USB

The HWPL USB module provides an API for accessing the devices USB hardware. The full USB device stack is part of the Hardware Device Library (HWDL). The HWPL API is used for low level initialization, and the HWDL is used for application level functionality such as implementing USB Device Classes.

More information about accessing peripheral IO is in the Device Interface section.

Details

define USB_VERSION

define USB_IOC_IDENT_CHAR

define USB_PIN_ASSIGNMENT_COUNT

define USB_TX_FIFO_WORD_SIZE_COUNT

define I_USB_GETVERSION

define I_USB_GETINFO

define I_USB_SETATTR

define I_USB_SETACTION

define I_USB_ISCONNECTED

This request checks to see if the USB is connected to an upstream port. It is connected, once is has been reset and disconnected when suspended.

  • Example: cpp void my_handler(usb_spec_event_t event); if ( ioctl(usb_fd, I_USB_ISCONNECTED) ){ //The USB is connected } else { //The USB is not connected } ———————————– ##### define I_USB_CONNECTED ———————————– ##### define I_USB_TOTAL ———————————– ##### enum usb_flag_t - USB_FLAG_SET_UNCONFIGURED unconfigured mode - USB_FLAG_SET_DEVICE device mode - USB_FLAG_SET_HOST host mode - USB_FLAG_SET_OTG on-the-go mode - USB_FLAG_RESET Rest the USB - USB_FLAG_ATTACH Attach USB device - USB_FLAG_DETACH Detach USB device - USB_FLAG_CONFIGURE Configure USB device - USB_FLAG_UNCONFIGURE Unconfigure USB device - USB_FLAG_SET_ADDRESS - USB_FLAG_RESET_ENDPOINT - USB_FLAG_ENABLE_ENDPOINT - USB_FLAG_DISABLE_ENDPOINT - USB_FLAG_STALL_ENDPOINT - USB_FLAG_UNSTALL_ENDPOINT - USB_FLAG_CONFIGURE_ENDPOINT - USB_FLAG_IS_SOF_ENABLED - USB_FLAG_IS_LOW_POWER_MODE_ENABLED - USB_FLAG_IS_VBUS_SENSING_ENABLED - USB_FLAG_IS_HIGH_SPEED - USB_FLAG_IS_BATTERY_CHARGING_ENABLED - USB_FLAG_FLUSH_ENDPOINT This lists the valid USB modes. ———————————– #### struct::usb_info_t ##### u32 o_flags ##### u32 o_events ##### u32 resd ——————– #### struct::usb_pin_assignment_t ##### mcu_pin_t dp ##### mcu_pin_t dm ##### mcu_pin_t id ##### mcu_pin_t vbus ——————– #### struct::usb_attr_t This defines the USB IOCTL data structure. ##### u32 o_flags Configuration flags ##### usb_pin_assignment_t pin_assignment Pin assignments ##### u32 freq The crystal oscillator frequency ##### u32 address USB endpoint address or device address (USB_FLAG_SET_ADDRESS) ##### u16 max_packet_size USB endpoing max packet size ##### u16 type USB endpoint type as bmAttributes ##### u16 rx_fifo_word_size RX FIFO word size for all endpoints (STM32) ##### u8 tx_fifo_word_size TX FIFO word size (used on STM32) ##### u32 resd ——————–
X

Thanks for Coming!

Subscribe to news and updates