# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- USB Library

20 December, 2013

- 1
- 2
…
- 122
- 123
- 124
- 125
- 126
…
- 311
- 312

Syntax
typedef bool (* USB_CLIENT_EVENT_HANDLER)(uint8_t address, USB_EVENT event, void *data,
uint32_t size);
Description
This data type defines a pointer to a call-back function that must be implemented by a client driver if it needs to be aware of
events on the USB. When an event occurs, the Host layer will call the client driver via this pointer to handle the event.
Events are identified by the "event" parameter and may have associated data. If the client driver was able to handle the
event, it should return true. If not (or if additional processing is required), it should return false.
Remarks
The application may also implement an event handling routine if it requires knowledge of events. To do so, it must implement
a routine that matches this function signature and define the USB_HOST_APP_EVENT_HANDLER macro as the name of
that function.
Preconditions
The client must have been initialized.
Parameters
Parameters Description
uint8_t address Address of device where event occurred
USB_EVENT event Identifies the event that occured
void *data Pointer to event-specific data
uint32_t size Size of the event-specific data
Return Values
Return Values Description
true The event was handled
false The event was not handled
Function
bool (*USB_CLIENT_EVENT_HANDLER) ( uint8_t address, USB_EVENT event,
void *data, uint32_t size )
1.4.2.1.2.5 USB_CLIENT_INIT Type
This is a typedef to use when defining a client driver initialization handler.
File
usb_host.h
Syntax
typedef bool (* USB_CLIENT_INIT)(uint8_t address, uint32_t flags, uint8_t clientDriverID);
Description
This routine is a call out from the host layer to a USB client driver. It is called when the system has been configured as a
USB host and a new device has been attached to the bus. Its purpose is to initialize and activate the client driver.
Remarks
There may be multiple client drivers. If so, the USB host layer will call the initialize routine for each of the clients that are in
the selected configuration.
Preconditions
The device has been configured.
1.4 Library Interface MLA - USB Library Help Embedded Host API
124

- 1
- 2
…
- 122
- 123
- 124
- 125
- 126
…
- 311
- 312