USBD ROM Stack  2.0
ROM based USB device stack
Data Fields
USBD_API_INIT_PARAM_T Struct Reference

USB device stack initialization parameter data structure. More...

#include <C:/Data/nxp/GIT/lpcopen_v3/lpcopen_version3/LPC43xx_18xx/lpc43xx_18xx/LPC_USBD_Lib/mw_usbd/mw_usbd_core.h>

Data Fields

uint32_t usb_reg_base
 
uint32_t mem_base
 
uint32_t mem_size
 
uint8_t max_num_ep
 
uint8_t high_speed_capable
 
uint8_t double_buffer
 
uint8_t pad0 [1]
 
USB_CB_T USB_Reset_Event
 
USB_CB_T USB_Suspend_Event
 
USB_CB_T USB_Resume_Event
 
USB_CB_T reserved_sbz
 
USB_CB_T USB_SOF_Event
 
USB_PARAM_CB_T USB_WakeUpCfg
 
USB_PARAM_CB_T USB_Power_Event
 
USB_PARAM_CB_T USB_Error_Event
 
USB_CB_T USB_Configure_Event
 
USB_CB_T USB_Interface_Event
 
USB_CB_T USB_Feature_Event
 
uint32_t(* virt_to_phys )(void *vaddr)
 
void(* cache_flush )(uint32_t *start_adr, uint32_t *end_adr)
 
uint32_t lpm_setting
 
ErrorCode_t(* USB_ReqGetStringDesc )(USBD_HANDLE_T hUsb, USB_SETUP_PACKET *setupPacket, uint8_t **pD)
 

Detailed Description

USB device stack initialization parameter data structure.

This data structure is used to pass initialization parameters to the USB device stack's init function.

Field Documentation

◆ usb_reg_base

uint32_t USBD_API_INIT_PARAM_T::usb_reg_base

USB device controller's base register address.

◆ mem_base

uint32_t USBD_API_INIT_PARAM_T::mem_base

Base memory location from where the stack can allocate data and buffers.

Note
The memory address set in this field should be accessible by USB DMA controller. Also this value should be aligned on 2048 byte boundary.

◆ mem_size

uint32_t USBD_API_INIT_PARAM_T::mem_size

The size of memory buffer which stack can use.

Note
The mem_size should be greater than the size returned by USBD_HW_API::GetMemSize() routine.

◆ max_num_ep

uint8_t USBD_API_INIT_PARAM_T::max_num_ep

max number of endpoints supported by the USB device controller instance (specified by usb_reg_base field) to which this instance of stack is attached.

◆ high_speed_capable

uint8_t USBD_API_INIT_PARAM_T::high_speed_capable

Specifies USB device controller's speed capability. 0 : Full-speed only; 1 : High speed capable

◆ double_buffer

uint8_t USBD_API_INIT_PARAM_T::double_buffer

Specifies whether low-level HW driver to use double buffering for EP transfers.

◆ USB_Reset_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_Reset_Event

Event for USB interface reset. This event fires when the USB host requests that the device reset its interface. This event fires after the control endpoint has been automatically configured by the library.

Note
This event is called from USB_ISR context and hence is time-critical. Having delays in this callback will prevent the device from enumerating correctly or operate properly.

◆ USB_Suspend_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_Suspend_Event

Event for USB suspend. This event fires when the USB host suspends the device by halting its transmission of Start Of Frame pulses to the device. This is generally hooked in order to move the device over to a low power state until the host wakes up the device.

Note
This event is called from USB_ISR context and hence is time-critical. Having delays in this callback will cause other system issues.

◆ USB_Resume_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_Resume_Event

Event for USB wake up or resume. This event fires when a the USB device interface is suspended and the host wakes up the device by supplying Start Of Frame pulses. This is generally hooked to pull the user application out of a low power state and back into normal operating mode.

Note
This event is called from USB_ISR context and hence is time-critical. Having delays in this callback will cause other system issues.

◆ reserved_sbz

USB_CB_T USBD_API_INIT_PARAM_T::reserved_sbz

Reserved parameter should be set to zero.

◆ USB_SOF_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_SOF_Event

Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB frame, once per millisecond in full-speed mode or once per 125 microseconds in high-speed mode, and is synchronized to the USB bus.

This event is time-critical; it is run once per millisecond (full-speed mode) and thus long handlers will significantly degrade device performance. This event should only be enabled when needed to reduce device wake-ups.

Note
This event is not normally active - it must be manually enabled and disabled via the USB interrupt register.

◆ USB_WakeUpCfg

USB_PARAM_CB_T USBD_API_INIT_PARAM_T::USB_WakeUpCfg

Event for remote wake-up configuration, when enabled. This event fires when the USB host request the device to configure itself for remote wake-up capability. The USB host sends this request to device which report remote wake-up capable in their device descriptors, before going to low-power state. The application layer should implement this callback if they have any special on board circuit to trigger remote wake up event. Also application can use this callback to differentiate the following SUSPEND event is caused by cable plug-out or host SUSPEND request. The device can wake-up host only after receiving this callback and remote wake-up feature is enabled by host. To signal remote wake-up the device has to generate resume signaling on bus by calling usapi.hw->WakeUp() routine.



Parameters
[in]hUsbHandle to the USB device stack.
[in]param1When 0 - Clear the wake-up configuration, 1 - Enable the wake-up configuration.
Returns
The call back should return ErrorCode_t type to indicate success or error condition.

◆ USB_Power_Event

USB_PARAM_CB_T USBD_API_INIT_PARAM_T::USB_Power_Event

Reserved parameter should be set to zero.

◆ USB_Error_Event

USB_PARAM_CB_T USBD_API_INIT_PARAM_T::USB_Error_Event

Event for error condition. This event fires when USB device controller detect an error condition in the system.



Parameters
[in]hUsbHandle to the USB device stack.
[in]param1USB device interrupt status register.
Returns
The call back should return ErrorCode_t type to indicate success or error condition.

◆ USB_Configure_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_Configure_Event

Event for USB configuration number changed. This event fires when a the USB host changes the selected configuration number. On receiving configuration change request from host, the stack enables/configures the endpoints needed by the new configuration before calling this callback function.

Note
This event is called from USB_ISR context and hence is time-critical. Having delays in this callback will prevent the device from enumerating correctly or operate properly.

◆ USB_Interface_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_Interface_Event

Event for USB interface setting changed. This event fires when a the USB host changes the interface setting to one of alternate interface settings. On receiving interface change request from host, the stack enables/configures the endpoints needed by the new alternate interface setting before calling this callback function.

Note
This event is called from USB_ISR context and hence is time-critical. Having delays in this callback will prevent the device from enumerating correctly or operate properly.

◆ USB_Feature_Event

USB_CB_T USBD_API_INIT_PARAM_T::USB_Feature_Event

Event for USB feature changed. This event fires when a the USB host send set/clear feature request. The stack handles this request for USB_FEATURE_REMOTE_WAKEUP, USB_FEATURE_TEST_MODE and USB_FEATURE_ENDPOINT_STALL features only. On receiving feature request from host, the stack handle the request appropriately and then calls this callback function.

Note
This event is called from USB_ISR context and hence is time-critical. Having delays in this callback will prevent the device from enumerating correctly or operate properly.

◆ virt_to_phys

uint32_t(* USBD_API_INIT_PARAM_T::virt_to_phys) (void *vaddr)

Reserved parameter for future use. should be set to zero.

◆ cache_flush

void(* USBD_API_INIT_PARAM_T::cache_flush) (uint32_t *start_adr, uint32_t *end_adr)

Reserved parameter for future use. should be set to zero.

◆ lpm_setting

uint32_t USBD_API_INIT_PARAM_T::lpm_setting

Configurable LPM setting

◆ USB_ReqGetStringDesc

ErrorCode_t(* USBD_API_INIT_PARAM_T::USB_ReqGetStringDesc) (USBD_HANDLE_T hUsb, USB_SETUP_PACKET *setupPacket, uint8_t **pD)

Call back function to handle get string descriptor request.

This callback is invoked by stack when get string descriptor request is received. If callback returns with pD pointing to NULL, then the stack uses string_desc descriptor array provided during initialization to find the string. This interface provides mechanism to override the stack handler for string desriptor and helps in handling dis-contiguous string index descriptor requests. For example Windows host request string descriptor at index 0xEE to see if the devie supports Microsoft defined OS descriptors. Also the interface could be used to support multi-language strings.

Parameters
[in]hUsbHandle to the USB device stack.
[in]setupPacketPointer to setup packet.
  • setupPacket->wIndex field specifies the Language ID for string descriptors.
  • SetupPacket.wValue.WB.L field specifies the index of the requested string descriptor.
[out]pDDouble Pointer to string descriptor which is updated in the function. The pointed data should persist for application scope. Set the pointer to NULL if you want stack to handle the request.
Returns
Returns ErrorCode_t type to indicate success or error condition.
Return values
LPC_OKOn success
ERR_USBD_INVALID_REQIf application thinks the request is invalid.

The documentation for this struct was generated from the following file: