Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
File
usb_device.h
Syntax
void USBStallEndpoint(uint8_t ep, uint8_t dir);
Remarks
None
Preconditions
None
Parameters
Parameters Description
uint8_t ep The endpoint number that should be configured to send
STALL.
uint8_t dir The direction of the endpoint to STALL, either IN_TO_HOST
or OUT_FROM_HOST.
Function
void USBStallEndpoint(uint8_t ep, uint8_t dir)
1.4.1.1.1.31 USBTransferOnePacket Function
Transfers a single packet (one transaction) of data on the USB bus.
File
usb_device.h
Syntax
USB_HANDLE USBTransferOnePacket(uint8_t ep, uint8_t dir, uint8_t* data, uint8_t len);
Description
The USBTransferOnePacket() function prepares a USB endpoint so that it may send data to the host (an IN transaction), or
receive data from the host (an OUT transaction). The USBTransferOnePacket() function can be used both to receive and
send data to the host. This function is the primary API function provided by the USB stack firmware for sending or receiving
application data over the USB port.
The USBTransferOnePacket() is intended for use with all application endpoints. It is not used for sending or receiving
applicaiton data through endpoint 0 by using control transfers. Separate API functions, such as USBEP0Receive(),
USBEP0SendRAMPtr(), and USBEP0SendROMPtr() are provided for this purpose.
The USBTransferOnePacket() writes to the Buffer Descriptor Table (BDT) entry associated with an endpoint buffer, and sets
the UOWN bit, which prepares the USB hardware to allow the transaction to complete. The application firmware can use the
USBHandleBusy() macro to check the status of the transaction, to see if the data has been successfully transmitted yet.
Typical Usage
//make sure that the we are in the configured state
if(USBGetDeviceState() == CONFIGURED_STATE)
{
//make sure that the last transaction isn't busy by checking the handle
if(!USBHandleBusy(USBInHandle))
{
//Write the new data that we wish to send to the host to the INPacket[] array
INPacket[0] = USEFUL_APPLICATION_VALUE1;
INPacket[1] = USEFUL_APPLICATION_VALUE2;
//INPacket[2] = ... (fill in the rest of the packet data)
//Send the data contained in the INPacket[] array through endpoint "EP_NUM"
1.4 Library Interface MLA - USB Library Help Device/Peripheral
61
Protego_Release_01_05-Related-OEM-Documentation-MLA_v2013_12_20-help_mla_usb.pdf