# 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
…
- 61
- 62
- 63
- 64
- 65
…
- 311
- 312

Preconditions
None
Parameters
Parameters Description
ep the endpoint number you want to send the data out of
data pointer to a user buffer that contains the data that you wish to
send to the host. Note This RAM buffer must be accessible by the USB module.
len the number of bytes of data that you wish to send to the host,
in the next transaction on this endpoint. Note this value should always be less than or equal to the
endpoint size, as specified in the USB endpoint descriptor.
Return Values
Return Values Description
USB_HANDLE Returns a pointer to the BDT entry associated with the
transaction. The firmware can check for completion of the
transaction by using the USBHandleBusy() function, using
the returned USB_HANDLE value.
Function
USB_HANDLE USBTxOnePacket(uint8_t ep, uint8_t* data, uint16_t len)
1.4.1.1.2 Data Types and Constants
Macros
Name Description
DESC_CONFIG_uint32_t The DESC_CONFIG_uint32_t() macro is implemented for convinence.
Since the configuration descriptor array is a uint8_t array, each entry
needs to be a uint8_t in LSB format. The DESC_CONFIG_uint32_t()
macro breaks up a uint32_t into the appropriate uint8_t entries in LSB.
DESC_CONFIG_uint8_t The DESC_CONFIG_uint8_t() macro is implemented for convinence. The
DESC_CONFIG_uint8_t() macro provides a consistant macro for use
with a byte when generating a configuratin descriptor when using either
the DESC_CONFIG_WORD() or DESC_CONFIG_uint32_t() macros.
DESC_CONFIG_WORD The DESC_CONFIG_WORD() macro is implemented for convinence.
Since the configuration descriptor array is a uint8_t array, each entry
needs to be a uint8_t in LSB format. The DESC_CONFIG_WORD()
macro breaks up a uint16_t into the appropriate uint8_t entries in LSB.
Typical Usage:
USB_EP0_BUSY The PIPE is busy
USB_EP0_INCLUDE_ZERO include a trailing zero packet
USB_EP0_NO_DATA no data to send
USB_EP0_NO_OPTIONS no options set
USB_EP0_RAM Data comes from const
USB_EP0_ROM Data comes from RAM
USB_HANDLE USB_HANDLE is a pointer to an entry in the BDT. This pointer can be
used to read the length of the last transfer, the status of the last transfer,
and various other information. Insure to initialize USB_HANDLE objects
to NULL so that they are in a known state during their first usage.
Module
Device Stack
1.4 Library Interface MLA - USB Library Help Device/Peripheral
63

- 1
- 2
…
- 61
- 62
- 63
- 64
- 65
…
- 311
- 312