# 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
…
- 71
- 72
- 73
- 74
- 75
…
- 311
- 312

CDCTxService CDCTxService handles device-to-host transaction(s). This function
should be called once per Main Program loop after the device reaches
the configured state.
getsUSBUSART getsUSBUSART copies a string of BYTEs received through USB CDC
Bulk OUT endpoint to a user's specified location. It is a non-blocking
function. It does not wait for data if there is no data available. Instead it
returns '0' to notify the caller that there is no data available.
putrsUSBUSART putrsUSBUSART writes a string of data to the USB including the null
character. Use this version, 'putrs', to transfer data literals and data
located in program memory.
putsUSBUSART putsUSBUSART writes a string of data to the USB including the null
character. Use this version, 'puts', to transfer data from a RAM buffer.
putUSBUSART putUSBUSART writes an array of data to the USB. Use this version, is
capable of transfering 0x00 (what is typically a NULL character in any of
the string transfer functions).
USBCDCEventHandler Handles events from the USB stack, which may have an effect on the
CDC endpoint(s).
USBCheckCDCRequest This routine checks the most recently received SETUP data packet to
see if the request is specific to the CDC class. If the request was a CDC
specific request, this function will take care of handling the request and
responding appropriately.
Macros
Name Description
CDCSetBaudRate This macro is used set the baud rate reported back to the host during a
get line coding request. (optional)
CDCSetCharacterFormat This macro is used manually set the character format reported back to
the host during a get line coding request. (optional)
CDCSetDataSize This function is used manually set the number of data bits reported back
to the host during a get line coding request. (optional)
CDCSetLineCoding This function is used to manually set the data reported back to the host
during a get line coding request. (optional)
CDCSetParity This function is used manually set the parity format reported back to the
host during a get line coding request. (optional)
mUSBUSARTIsTxTrfReady Depricated in MCHPFSUSB v2.3. This macro has been replaced by
USBUSARTIsTxTrfReady().
mUSBUSARTTxRam Use this macro to transfer data located in data memory. Use this macro
when:
1. Data stream is not null-terminated
2. Transfer length is known
Remember: cdc_trf_state must == CDC_TX_READY Unlike
putsUSBUSART, there is not code double checking the transfer state.
Unexpected behavior will occur if this function is called when
cdc_trf_state != CDC_TX_READY
Typical Usage:
1.4 Library Interface MLA - USB Library Help Device/Peripheral
73

- 1
- 2
…
- 71
- 72
- 73
- 74
- 75
…
- 311
- 312