libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
libopencm3 LM4F Universal Serial Bus controller More...
Macros | |
#define | MAX_FIFO_RAM (4 * 1024) |
Functions | |
void | usb_enable_interrupts (enum usb_interrupt ints, enum usb_ep_interrupt rx_ints, enum usb_ep_interrupt tx_ints) |
Enable Specific USB Interrupts. More... | |
void | usb_disable_interrupts (enum usb_interrupt ints, enum usb_ep_interrupt rx_ints, enum usb_ep_interrupt tx_ints) |
Disable Specific USB Interrupts. More... | |
Variables | |
const struct _usbd_driver | lm4f_usb_driver |
libopencm3 LM4F Universal Serial Bus controller
The LM4F USB driver is integrated with the libopencm3 USB stack. You should use the generic stack.
To use this driver, tell the linker to look for it:
And pass this driver as an argument when initializing the USB stack:
Polling or interrupt-driven?
The LM4F USB driver will work fine regardless of whether it is called from an interrupt service routine, or from the main program loop.
Polling USB from the main loop requires calling usbd_poll() from the main program loop. For example:
Running usbd_poll() from an interrupt has the advantage that it is only called when needed, saving CPU cycles for the main program.
RESET, DISCON, RESUME, and SUSPEND interrupts must be enabled, along with the interrupts for any endpoint that is used. The EP0_TX interrupt must be enabled for the control endpoint to function correctly. For example, if EP1IN and EP2OUT are used, then the EP0_TX, EP1_TX, and EP2_RX interrupts should be enabled:
The USB ISR only has to call usbd_poll().
#define MAX_FIFO_RAM (4 * 1024) |
Definition at line 111 of file usb_lm4f.c.
void usb_disable_interrupts | ( | enum usb_interrupt | ints, |
enum usb_ep_interrupt | rx_ints, | ||
enum usb_ep_interrupt | tx_ints | ||
) |
Disable Specific USB Interrupts.
Disable any combination of interrupts. Interrupts may be OR'ed together to enable them with one call. For example, to disable both the RESUME and RESET interrupts, pass (USB_INT_RESUME | USB_INT_RESET)
Note that the NVIC must be enabled and properly configured for the interrupt to be routed to the CPU.
[in] | ints | Interrupts which to disable. Any combination of interrupts may be specified by OR'ing then together |
[in] | rx_ints | Endpoints for which to stop generating an interrupt when a packet packet is received. |
[in] | tx_ints | Endpoints for which to stop generating an interrupt when a packet packet is finished transmitting. |
Definition at line 158 of file usb_lm4f.c.
void usb_enable_interrupts | ( | enum usb_interrupt | ints, |
enum usb_ep_interrupt | rx_ints, | ||
enum usb_ep_interrupt | tx_ints | ||
) |
Enable Specific USB Interrupts.
Enable any combination of interrupts. Interrupts may be OR'ed together to enable them with one call. For example, to enable both the RESUME and RESET interrupts, pass (USB_INT_RESUME | USB_INT_RESET)
Note that the NVIC must be enabled and properly configured for the interrupt to be routed to the CPU.
[in] | ints | Interrupts which to enable. Any combination of interrupts may be specified by OR'ing then together |
[in] | rx_ints | Endpoints for which to generate an interrupt when a packet packet is received. |
[in] | tx_ints | Endpoints for which to generate an interrupt when a packet packet is finished transmitting. |
Definition at line 132 of file usb_lm4f.c.
const struct _usbd_driver lm4f_usb_driver |
Definition at line 113 of file usb_lm4f.c.