# 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
…
- 73
- 74
- 75
- 76
- 77
…
- 311
- 312

File
usb_device_cdc.h
Syntax
void CDCNotificationHandler();
Description
Checks for changes in DSR pin state and reports any changes to the USB host.
Remarks
This function is only implemented and needed when the USB_CDC_SUPPORT_DSR_REPORTING option has been
enabled. If the function is enabled, it should be called periodically to sample the DSR pin and feed the information to the
USB host. This can be done by calling CDCNotificationHandler() by itself, or, by calling CDCTxService() which also calls
CDCNotificationHandler() internally, when appropriate.
Preconditions
CDCInitEP() must have been called previously, prior to calling CDCNotificationHandler() for the first time.
Function
void CDCNotificationHandler(void)
1.4.1.3.2.3 CDCTxService Function
CDCTxService handles device-to-host transaction(s). This function should be called once per Main Program loop after the
device reaches the configured state.
File
usb_device_cdc.h
Syntax
void CDCTxService();
Description
CDCTxService handles device-to-host transaction(s). This function should be called once per Main Program loop after the
device reaches the configured state (after the CDCIniEP() function has already executed). This function is needed, in order
to advance the internal software state machine that takes care of sending multiple transactions worth of IN USB data to the
host, associated with CDC serial data. Failure to call CDCTxService() perioidcally will prevent data from being sent to the
USB host, over the CDC serial data interface.
Typical Usage:
void main(void)
{
USBDeviceInit();
while(1)
{
USBDeviceTasks();
if((USBGetDeviceState() < CONFIGURED_STATE) ||
(USBIsDeviceSuspended() == true))
{
//Either the device is not configured or we are suspended
// so we don't want to do execute any application code
continue; //go back to the top of the while loop
}
else
{
//Keep trying to send data to the PC as required
CDCTxService();
//Run application code.
UserApplication();
}
1.4 Library Interface MLA - USB Library Help Device/Peripheral
75

- 1
- 2
…
- 73
- 74
- 75
- 76
- 77
…
- 311
- 312