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

}
}
Remarks
None
Preconditions
CDCIniEP() function should have already exectuted/the device should be in the CONFIGURED_STATE.
Function
void CDCTxService(void)
1.4.1.3.2.4 getsUSBUSART Function
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.
File
usb_device_cdc.h
Syntax
uint8_t getsUSBUSART(uint8_t * buffer, uint8_t len);
Returns
uint8_t - Returns a byte indicating the total number of bytes that were actually received and copied into the specified buffer.
The returned value can be anything from 0 up to the len input value. A return value of 0 indicates that no new CDC bulk OUT
endpoint data was available.
Description
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.
Typical Usage:
uint8_t numBytes;
uint8_t buffer[64]
numBytes = getsUSBUSART(buffer,
sizeof(buffer)); //until the buffer is free.
if(numBytes > 0)
{
//we received numBytes bytes of data and they are copied into
// the "buffer" variable. We can do something with the data
// here.
}
Preconditions
Value of input argument 'len' should be smaller than the maximum endpoint size responsible for receiving bulk data from
USB host for CDC class. Input argument 'buffer' should point to a buffer area that is bigger or equal to the size specified by
'len'.
Parameters
Parameters Description
buffer Pointer to where received BYTEs are to be stored
len The number of BYTEs expected.
Function
uint8_t getsUSBUSART(char *buffer, uint8_t len)
1.4 Library Interface MLA - USB Library Help Device/Peripheral
76

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