Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
Description
This function initializes the device stack it in the default state. The USB module will be completely reset including all of the
internal variables, registers, and interrupt flags.
Remarks
None
Preconditions
This function must be called before any of the other USB Device functions can be called, including USBDeviceTasks().
Function
void USBDeviceInit(void)
1.4.1.1.1.11 USBDeviceTasks Function
This function is the main state machine/transaction handler of the USB device side stack. When the USB stack is operated in
"USB_POLLING" mode (usb_config.h user option) the USBDeviceTasks() function should be called periodically to receive
and transmit packets through the stack. This function also takes care of control transfers associated with the USB
enumeration process, and detecting various USB events (such as suspend). This function should be called at least once
every 1.8ms during the USB enumeration process. After the enumeration process is complete (which can be determined
when USBGetDeviceState() returns CONFIGURED_STATE), the USBDeviceTasks() handler may be called the faster of:
either once every 9.8ms, or as often as needed to make sure that the hardware USTAT FIFO never gets full. A good rule of
thumb is to call USBDeviceTasks() at a minimum rate of either the frequency that USBTransferOnePacket() gets called, or,
once/1.8ms, whichever is faster. See the inline code comments near the top of usb_device.c for more details about minimum
timing requirements when calling USBDeviceTasks().
When the USB stack is operated in "USB_INTERRUPT" mode, it is not necessary to call USBDeviceTasks() from the main
loop context. In the USB_INTERRUPT mode, the USBDeviceTasks() handler only needs to execute when a USB interrupt
occurs, and therefore only needs to be called from the interrupt context.
File
usb_device.h
Syntax
void USBDeviceTasks();
Description
This function is the main state machine/transaction handler of the USB device side stack. When the USB stack is operated in
"USB_POLLING" mode (usb_config.h user option) the USBDeviceTasks() function should be called periodically to receive
and transmit packets through the stack. This function also takes care of control transfers associated with the USB
enumeration process, and detecting various USB events (such as suspend). This function should be called at least once
every 1.8ms during the USB enumeration process. After the enumeration process is complete (which can be determined
when USBGetDeviceState() returns CONFIGURED_STATE), the USBDeviceTasks() handler may be called the faster of:
either once every 9.8ms, or as often as needed to make sure that the hardware USTAT FIFO never gets full. A good rule of
thumb is to call USBDeviceTasks() at a minimum rate of either the frequency that USBTransferOnePacket() gets called, or,
once/1.8ms, whichever is faster. See the inline code comments near the top of usb_device.c for more details about minimum
timing requirements when calling USBDeviceTasks().
When the USB stack is operated in "USB_INTERRUPT" mode, it is not necessary to call USBDeviceTasks() from the main
loop context. In the USB_INTERRUPT mode, the USBDeviceTasks() handler only needs to execute when a USB interrupt
occurs, and therefore only needs to be called from the interrupt context.
Typical usage:
void main(void)
{
USBDeviceInit();
1.4 Library Interface MLA - USB Library Help Device/Peripheral
46
Protego_Release_01_05-Related-OEM-Documentation-MLA_v2013_12_20-help_mla_usb.pdf