![]() |
USB Component
Version 5.0
MDK-Professional Middleware for USB Device and Host
|
Internal USB functions not to be used in an user application. More...
Functions | |
usbStatus | USBH_SendSetup (uint8_t ctrl, uint8_t *ptr_data) |
Send Setup Packet on Control Endpoint 0. | |
usbStatus | USBH_SendData (uint8_t ctrl, uint8_t *ptr_data, uint32_t data_len) |
Send Data on Control Endpoint 0. | |
usbStatus | USBH_ReceiveData (uint8_t ctrl, uint8_t *ptr_data, uint32_t data_len) |
Receive Data on Control Endpoint 0. | |
usbStatus | USBH_Transfer (uint8_t ctrl, USBH_EP *ptr_ep, uint32_t timeout) |
Transfer URB on requested endpoint. | |
void | USBH_HID_DataReceived (int8_t instance, uint16_t len) |
Callback function called when data is received from the Human Interface Device. | |
usbStatus | USBH_GetStatus (uint8_t ctrl, uint8_t recipient, uint8_t index, uint8_t *ptr_stat_dat) |
Standard Device Request - GET_STATUS. | |
usbStatus | USBH_ClearFeature (uint8_t ctrl, uint8_t recipient, uint8_t index, uint8_t feature_selector) |
Standard Device Request - CLEAR_FEATURE. | |
usbStatus | USBH_SetFeature (uint8_t ctrl, uint8_t recipient, uint8_t index, uint8_t feature_selector) |
Standard Device Request - SET_FEATURE. | |
usbStatus | USBH_SetAddress (uint8_t ctrl, uint8_t device_address) |
Standard Device Request - SET_ADDRESS. | |
usbStatus | USBH_GetDescriptor (uint8_t ctrl, uint8_t recipient, uint8_t descriptor_type, uint8_t descriptor_index, uint8_t language_id, uint8_t *descriptor_data, uint16_t descriptor_length) |
Standard Device Request - GET_DESCRIPTOR. | |
usbStatus | USBH_SetDescriptor (uint8_t ctrl, uint8_t recipient, uint8_t descriptor_type, uint8_t descriptor_index, uint8_t language_id, uint8_t *descriptor_data, uint16_t descriptor_length) |
Standard Device Request - SET_DESCRIPTOR. | |
usbStatus | USBH_GetConfiguration (uint8_t ctrl, uint8_t *ptr_configuration) |
Standard Device Request - GET_CONFIGURATION. | |
usbStatus | USBH_SetConfiguration (uint8_t ctrl, uint8_t configuration) |
Standard Device Request - SET_CONFIGURATION. | |
usbStatus | USBH_GetInterface (uint8_t ctrl, uint8_t idx, uint8_t *ptr_alternate) |
Standard Device Request - GET_INTERFACE. | |
usbStatus | USBH_SetInterface (uint8_t ctrl, uint8_t index, uint8_t alternate) |
Standard Device Request - SET_INTERFACE. | |
usbStatus | USBH_SyncFrame (uint8_t ctrl, uint8_t index, uint8_t *ptr_frame_number) |
Standard Device Request - SYNC_FRAME. | |
usbStatus | USBH_MemoryAllocate (uint8_t ctrl, uint8_t **ptr, uint32_t size) |
Allocate a chunk of memory from the initialized pool to be used by USB Host controller. | |
usbStatus | USBH_MemoryFree (uint8_t ctrl, uint8_t *ptr) |
Release a piece of memory back to memory pool used by USB Host controller. | |
Internal USB functions not to be used in an user application.
The following functions are for internal use only. They should not be called from within an user application. They are part of the USB Component library and are defined in rl_usbh.h.
usbStatus USBH_ClearFeature | ( | uint8_t | ctrl, |
uint8_t | recipient, | ||
uint8_t | index, | ||
uint8_t | feature_selector | ||
) |
Standard Device Request - CLEAR_FEATURE.
[in] | ctrl | index of USB Host controller. |
[in] | recipient | recipient. |
[in] | index | interface or endpoint index. |
[in] | feature_selector | feature selector. |
The function USBH_ClearFeature implements the standard device request CLEAR_FEATURE
. This request is used to clear or disable a specific feature.
usbStatus USBH_GetConfiguration | ( | uint8_t | ctrl, |
uint8_t * | ptr_configuration | ||
) |
Standard Device Request - GET_CONFIGURATION.
[in] | ctrl | index of USB Host controller. |
[out] | ptr_configuration | pointer to where configuration will be read. |
The function USBH_GetConfiguration implements the standard device request GET_CONFIGURATION
. This request returns the current device configuration value.
usbStatus USBH_GetDescriptor | ( | uint8_t | ctrl, |
uint8_t | recipient, | ||
uint8_t | descriptor_type, | ||
uint8_t | descriptor_index, | ||
uint8_t | language_id, | ||
uint8_t * | descriptor_data, | ||
uint16_t | descriptor_length | ||
) |
Standard Device Request - GET_DESCRIPTOR.
[in] | ctrl | index of USB Host controller. |
[in] | recipient | recipient. |
[in] | descriptor_type | descriptor type. |
[in] | descriptor_index | descriptor index. |
[in] | language_id | language ID. |
[out] | descriptor_data | pointer to where descriptor data will be read. |
[in] | descriptor_length | descriptor length. |
The function USBH_GetDescriptor implements the standard device request GET_DESCRIPTOR
. This request returns the specified descriptor if the descriptor exists.
usbStatus USBH_GetInterface | ( | uint8_t | ctrl, |
uint8_t | index, | ||
uint8_t * | ptr_alternate | ||
) |
Standard Device Request - GET_INTERFACE.
[in] | ctrl | index of USB Host controller. |
[in] | index | interface index. |
[out] | ptr_alternate | pointer to where alternate setting data will be read. |
The function USBH_GetInterface implements the standard device request GET_INTERFACE
. This request returns the selected alternate setting for the specified interface.
usbStatus USBH_GetStatus | ( | uint8_t | ctrl, |
uint8_t | recipient, | ||
uint8_t | index, | ||
uint8_t * | ptr_stat_dat | ||
) |
Standard Device Request - GET_STATUS.
[in] | ctrl | index of USB Host controller. |
[in] | recipient | recipient. |
[in] | index | interface or endpoint index. |
[out] | ptr_stat_dat | pointer to where status data should be received. |
The function USBH_GetStatus implements the standard device request GET_STATUS
. This request returns the current device configuration value.
void USBH_HID_DataReceived | ( | int8_t | instance, |
uint16_t | len | ||
) |
Callback function called when data is received from the Human Interface Device.
[in] | instance | instance index. |
[in] | len | length of received data. |
The USBH_HID_DataReceived function enables programmers to analyse received data coming from an USB HID device. Implementing this function in user code overrides the library function that handles boot protocol device data reception. This is useful if the default HID functionality needs to be changed to support special HID devices.
usbStatus USBH_MemoryAllocate | ( | uint8_t | ctrl, |
uint8_t ** | ptr, | ||
uint32_t | size | ||
) |
Allocate a chunk of memory from the initialized pool to be used by USB Host controller.
[in] | ctrl | index of USB Host controller. |
[out] | ptr | pointer to pointer to allocated memory chunk. |
[in] | size | size of memory chunk to be allocated. |
The USBH_MemoryAllocate function allocates a block of memory from previously initialized memory pool.
usbStatus USBH_MemoryFree | ( | uint8_t | ctrl, |
uint8_t * | ptr | ||
) |
Release a piece of memory back to memory pool used by USB Host controller.
[in] | ctrl | index of USB Host controller. |
[in] | ptr | pointer to allocated memory chunk to be released. |
The USBH_MemoryFree function frees a block of memory that was previously allocated from the memory pool. The argument ctrl is the index of the controller (memory pool). The argument ptr is the pointer to the start of the memory block to be freed.
usbStatus USBH_ReceiveData | ( | uint8_t | ctrl, |
uint8_t * | ptr_data, | ||
uint32_t | data_len | ||
) |
Receive Data on Control Endpoint 0.
[in] | ctrl | index of USB Host controller. |
[out] | ptr_data | pointer to where data should be received. |
[in] | data_len | number of bytes to be received. |
The function USBH_ReceiveData receives data on control endpoint 0.
usbStatus USBH_SendData | ( | uint8_t | ctrl, |
uint8_t * | ptr_data, | ||
uint32_t | data_len | ||
) |
Send Data on Control Endpoint 0.
[in] | ctrl | index of USB Host controller. |
[in] | ptr_data | pointer to data to be sent. |
[in] | data_len | number of bytes to be sent. |
The function USBH_SendData sends actual data on control endpoint 0.
usbStatus USBH_SendSetup | ( | uint8_t | ctrl, |
uint8_t * | ptr_data | ||
) |
Send Setup Packet on Control Endpoint 0.
[in] | ctrl | index of USB Host controller. |
[in] | ptr_data | pointer to setup packet. |
The function USBH_SendSetup sends a setup packet on control endpoint 0.
usbStatus USBH_SetAddress | ( | uint8_t | ctrl, |
uint8_t | device_address | ||
) |
Standard Device Request - SET_ADDRESS.
[in] | ctrl | index of USB Host controller. |
[in] | device_address | device address. |
The function USBH_SetAddress implements the standard device request SET_ADDRESS
. This request sets the device address for all future device accesses.
usbStatus USBH_SetConfiguration | ( | uint8_t | ctrl, |
uint8_t | configuration | ||
) |
Standard Device Request - SET_CONFIGURATION.
[in] | ctrl | index of USB Host controller. |
[in] | configuration | configuration. |
The function USBH_SetConfiguration implements the standard device request SET_CONFIGURATION
. This request sets the device configuration.
usbStatus USBH_SetDescriptor | ( | uint8_t | ctrl, |
uint8_t | recipient, | ||
uint8_t | descriptor_type, | ||
uint8_t | descriptor_index, | ||
uint8_t | language_id, | ||
uint8_t * | descriptor_data, | ||
uint16_t | descriptor_length | ||
) |
Standard Device Request - SET_DESCRIPTOR.
[in] | ctrl | index of USB Host controller. |
[in] | recipient | recipient. |
[in] | descriptor_type | descriptor type. |
[in] | descriptor_index | descriptor index. |
[in] | language_id | language ID. |
[in] | descriptor_data | pointer to descriptor data to be written. |
[in] | descriptor_length | descriptor length. |
The function USBH_SetDescriptor implements the standard device request SET_DESCRIPTOR
. This request may be used to update existing or add new descriptors.
usbStatus USBH_SetFeature | ( | uint8_t | ctrl, |
uint8_t | recipient, | ||
uint8_t | index, | ||
uint8_t | feature_selector | ||
) |
Standard Device Request - SET_FEATURE.
[in] | ctrl | index of USB Host controller. |
[in] | recipient | recipient. |
[in] | index | interface or endpoint index. |
[in] | feature_selector | feature selector. |
The function USBH_SetFeature implements the standard device request SET_FEATURE
. This request is used to set or enable a specific feature.
usbStatus USBH_SetInterface | ( | uint8_t | ctrl, |
uint8_t | index, | ||
uint8_t | alternate | ||
) |
Standard Device Request - SET_INTERFACE.
[in] | ctrl | index of USB Host controller. |
[in] | index | interface index. |
[in] | alternate | alternate setting. |
The function USBH_SetInterface implements the standard device request SET_INTERFACE
. This request allows the host to select an alternate setting for the specified interface.
usbStatus USBH_SyncFrame | ( | uint8_t | ctrl, |
uint8_t | index, | ||
uint8_t * | ptr_frame_number | ||
) |
Standard Device Request - SYNC_FRAME.
[in] | ctrl | index of USB Host controller. |
[in] | index | interface or endpoint index. |
[out] | ptr_frame_number | pointer to where frame number data will be read. |
The function USBH_SyncFrame implements the standard device request SYNCH_FRAME
. This request is used to set and then report an endpoint’s synchronization frame. When an endpoint supports isochronous transfers, the endpoint may also require per-frame transfers to vary in size according to a specific pattern. The host and the endpoint must agree on which frame the repeating pattern begins. The number of the frame in which the pattern began is returned to the host.
Transfer URB on requested endpoint.
[in] | ctrl | index of USB Host controller. |
[in] | ptr_ep | pointer to endpoint used for transfer. |
[in] | timeout | timeout for transfer (in ms). |
The USBH_Transfer function is used if you need to write new USB Device Class drivers for Host other than those that are incorporated in the USB Component.