![]() |
NUC472_NUC442_BSP V3.03.005
The Board Support Package for NUC472/NUC442
|
Functions | |
int32_t | USBH_Open (void) |
Open USB Host controller function. More... | |
int | USBH_ProcessHubEvents () |
Processed USB hub device events. User application must invoke this routine in the main while loop. Device enumeration is done in this routine. More... | |
URB_T * | USBH_AllocUrb () |
Allocate an URB from USB Core driver internal URB pool. More... | |
void | USBH_FreeUrb (URB_T *urb) |
Free the URB allocated from USBH_AllocUrb() More... | |
int32_t | USBH_SubmitUrb (URB_T *urb) |
Submit an URB to USB core for transfer data. More... | |
int32_t | USBH_UnlinkUrb (URB_T *urb) |
Cancel an URB which has been submit to USB core. More... | |
int32_t | USBH_SendCtrlMsg (USB_DEV_T *dev, uint32_t pipe, uint8_t request, uint8_t requesttype, uint16_t value, uint16_t index, void *data, uint16_t size, int timeout) |
Execute a control transfer. More... | |
int32_t | USBH_SendBulkMsg (USB_DEV_T *usb_dev, uint32_t pipe, void *data, int len, int *actual_length, int timeout) |
Execute a bulk transfer. More... | |
int32_t | USBH_RegisterDriver (USB_DRIVER_T *new_driver) |
Register a device driver to USB Host Core driver. More... | |
int32_t | USBH_GetDescriptor (USB_DEV_T *dev, uint8_t type, uint8_t index, void *buf, int size) |
Get a descriptor from device. More... | |
int32_t | USBH_SetConfiguration (USB_DEV_T *dev, int configuration) |
Select USB device configuration. More... | |
int32_t | USBH_SetInterface (USB_DEV_T *dev, char interface, char alternate) |
Set USB device interface. More... | |
int32_t | USBH_ClearHalt (USB_DEV_T *dev, int pipe) |
Clear the halt state of an endpoint. More... | |
int32_t | USBH_Suspend (void) |
Suspend USB Host Controller and devices. More... | |
int32_t | USBH_Resume (void) |
Resume USB Host controller and devices. More... | |
int32_t | USBH_Close (void) |
Disable USB Host controller function. More... | |
USB device structure
HIDDEN_SYMBOLS URB_T * USBH_AllocUrb | ( | void | ) |
Allocate an URB from USB Core driver internal URB pool.
NULL | Out of URB. |
Otherwise | The pointer refer to the newly allocated URB. |
Definition at line 90 of file usbh_support.c.
HIDDEN_SYMBOLS int32_t USBH_ClearHalt | ( | USB_DEV_T * | dev, |
int | pipe | ||
) |
Clear the halt state of an endpoint.
[in] | dev | The USB device. |
[in] | pipe | Pipe description of the endpoint. |
0 | Success |
Otherwise | Failed |
Definition at line 900 of file usbh_core.c.
int32_t USBH_Close | ( | void | ) |
Disable USB Host controller function.
0 | Success |
Otherwise | Failed |
Definition at line 1319 of file usbh_core.c.
void USBH_FreeUrb | ( | URB_T * | urb | ) |
Free the URB allocated from USBH_AllocUrb()
[in] | urb | The URB to be freed. |
Definition at line 113 of file usbh_support.c.
HIDDEN_SYMBOLS int32_t USBH_GetDescriptor | ( | USB_DEV_T * | dev, |
uint8_t | type, | ||
uint8_t | index, | ||
void * | buf, | ||
int | size | ||
) |
Get a descriptor from device.
[in] | dev | The USB devise. |
[in] | type | Descriptor type. |
[in] | index | Index of the descriptor. |
[out] | buf | Buffer to store the descriptor. |
[in] | size | Available size of buf. |
>=0 | Length of the descriptor. |
Otherwise | Failed |
Definition at line 822 of file usbh_core.c.
HIDDEN_SYMBOLS int32_t USBH_Open | ( | void | ) |
Open USB Host controller function.
0 | Success |
Otherwise | Failed |
Definition at line 1270 of file usbh_core.c.
HIDDEN_SYMBOLS int USBH_ProcessHubEvents | ( | void | ) |
Processed USB hub device events. User application must invoke this routine in the main while loop. Device enumeration is done in this routine.
0 | No hub events |
1 | Have hub events |
Definition at line 113 of file usbh_hub.c.
int32_t USBH_RegisterDriver | ( | USB_DRIVER_T * | new_driver | ) |
Register a device driver to USB Host Core driver.
[in] | new_driver | The USB device driver. |
0 | Success |
otherwise | Failed |
Definition at line 78 of file usbh_core.c.
int32_t USBH_Resume | ( | void | ) |
Resume USB Host controller and devices.
0 | Success |
Otherwise | Failed |
Definition at line 1378 of file usbh_core.c.
int32_t USBH_SendBulkMsg | ( | USB_DEV_T * | usb_dev, |
uint32_t | pipe, | ||
void * | data, | ||
int | len, | ||
int * | actual_length, | ||
int | timeout | ||
) |
Execute a bulk transfer.
[in] | usb_dev | Pointer to the usb device to send the message to. |
[in] | pipe | Endpoint pipe to send the message to. |
[in,out] | data | Pointer to the data to send or to receive. |
[in] | len | Length in bytes of the data to send or receive. |
[out] | actual_length | Actual length of data transferred. |
[in] | timeout | Time in millisecond to wait for the message to complete before timing out (if 0 the wait is forever). |
>=0 | The actual bytes of data be transferred. |
Otherwise | Failed |
This function sends a simple bulk message to a specified endpoint and waits for the message to complete, or timeout.
If successful, it returns 0, otherwise a negative error number. The number of actual bytes transferred will be placed in the actual_timeout parameter.
Don't use this function from within an interrupt context, like a bottom half handler. If you need a asynchronous message, or need to send a message from within interrupt context, use USBH_SubmitUrb()
Definition at line 416 of file usbh_core.c.
HIDDEN_SYMBOLS int32_t USBH_SendCtrlMsg | ( | USB_DEV_T * | dev, |
uint32_t | pipe, | ||
uint8_t | request, | ||
uint8_t | requesttype, | ||
uint16_t | value, | ||
uint16_t | index, | ||
void * | data, | ||
uint16_t | size, | ||
int | timeout | ||
) |
Execute a control transfer.
[in] | dev | Pointer to the usb device to send the message to. |
[in] | pipe | Endpoint pipe to send the message to. |
[in] | request | USB message request value |
[in] | requesttype | USB message request type value |
[in] | value | USB message value |
[in] | index | USB message index value |
[in,out] | data | Memory buffer of the data to be send with this transfer or to hold the data received from this transfer. |
[in] | size | Length in bytes of the data to send. |
[in] | timeout | Time in millisecond to wait for the message to complete before timing out (if 0 the wait is forever). |
>=0 | The actual bytes of data be transferred. |
Otherwise | Failed |
This function sends a simple control message to a specified endpoint and waits for the message to complete, or timeout.
If successful, it returns 0, otherwise a negative error number.
Don't use this function from within an interrupt context, like a bottom half handler. If you need a asynchronous message, or need to send a message from within interrupt context, use USBH_SubmitUrb()
Definition at line 378 of file usbh_core.c.
int32_t USBH_SetConfiguration | ( | USB_DEV_T * | dev, |
int | configuration | ||
) |
Select USB device configuration.
[in] | dev | The USB device. |
[in] | configuration | Configuration number. |
0 | Success |
Otherwise | Failed |
Definition at line 973 of file usbh_core.c.
int32_t USBH_SetInterface | ( | USB_DEV_T * | dev, |
char | interface, | ||
char | alternate | ||
) |
Set USB device interface.
[in] | dev | The USB device. |
[in] | interface | Interface number. |
[in] | alternate | Interface alternate setting number. |
0 | Success |
Otherwise | Failed |
Definition at line 948 of file usbh_core.c.
HIDDEN_SYMBOLS int32_t USBH_SubmitUrb | ( | URB_T * | urb | ) |
Submit an URB to USB core for transfer data.
[in] | urb | The USB transfer request to be processed. |
0 | Success |
otherwise | Failed |
Definition at line 218 of file usbh_core.c.
int32_t USBH_Suspend | ( | void | ) |
Suspend USB Host Controller and devices.
0 | Success |
Otherwise | Failed |
Definition at line 1336 of file usbh_core.c.
int32_t USBH_UnlinkUrb | ( | URB_T * | urb | ) |
Cancel an URB which has been submit to USB core.
[in] | urb | The USB to be canceled. |
0 | Success |
otherwise | Failed |
Definition at line 236 of file usbh_core.c.
signed char usb_device::act_config |
Active configuration number
Definition at line 681 of file usbh_core.h.
char usb_device::act_iface |
Active interface number
Definition at line 682 of file usbh_core.h.
uint32_t iso_pkt_t::actual_length |
Actual transfer length
Definition at line 529 of file usbh_core.h.
int urb_t::actual_length |
actual data buffer length
Definition at line 547 of file usbh_core.h.
USB_BUS_T* usb_device::bus |
Bus we're part of
Definition at line 679 of file usbh_core.h.
struct usb_device* usb_device::children[USB_MAXCHILDREN] |
Child device list
Definition at line 702 of file usbh_core.h.
void(* urb_t::complete) (struct urb_t *) |
USB transfer complete callback function
Definition at line 555 of file usbh_core.h.
void* urb_t::context |
USB Driver internal used
Definition at line 554 of file usbh_core.h.
USB_DEV_DESC_T usb_device::descriptor |
Device descriptor.
Definition at line 667 of file usbh_core.h.
struct usb_device* urb_t::dev |
pointer to associated USB device
Definition at line 541 of file usbh_core.h.
int usb_device::devnum |
Device number on USB bus
Definition at line 669 of file usbh_core.h.
USB_DRIVER_T* usb_device::driver[MAX_DRIVER_PER_DEV] |
Driver list
Definition at line 704 of file usbh_core.h.
int usb_device::driver_cnt |
Total number of driver list
Definition at line 705 of file usbh_core.h.
EP_INFO_T usb_device::ep_list[MAX_ENDPOINTS] |
Endpoint list
Definition at line 685 of file usbh_core.h.
int usb_device::ep_list_cnt |
Total number of ep_list[]
Definition at line 686 of file usbh_core.h.
int urb_t::error_count |
number of errors in this transfer (iso only)
Definition at line 552 of file usbh_core.h.
uint32_t usb_device::halted[2] |
endpoint halts; one bit per endpoint # & direction; [0] = IN, [1] = OUT
Definition at line 674 of file usbh_core.h.
int usb_device::have_langid |
whether string_langid is valid yet
Definition at line 688 of file usbh_core.h.
void* usb_device::hcpriv |
Host Controller private data
Definition at line 691 of file usbh_core.h.
int usb_device::hub_port |
The hub port that this device connected on
Definition at line 678 of file usbh_core.h.
char usb_device::iface_alternate |
Active interface alternate setting
Definition at line 683 of file usbh_core.h.
int urb_t::interval |
polling interval (irq only)
Definition at line 551 of file usbh_core.h.
ISO_PACKET_DESCRIPTOR_T urb_t::iso_frame_desc[8] |
isochronous transfer descriptor
Definition at line 556 of file usbh_core.h.
uint32_t iso_pkt_t::length |
Length in transfer buffer
Definition at line 528 of file usbh_core.h.
int usb_device::maxchild |
Number of ports if hub
Definition at line 701 of file usbh_core.h.
struct urb_t* urb_t::next |
pointer to next URB
Definition at line 540 of file usbh_core.h.
int urb_t::number_of_packets |
number of packets in this request (iso)
Definition at line 550 of file usbh_core.h.
uint32_t iso_pkt_t::offset |
Start offset in transfer buffer
Definition at line 527 of file usbh_core.h.
struct usb_device* usb_device::parent |
parent device
Definition at line 677 of file usbh_core.h.
uint32_t urb_t::pipe |
pipe information
Definition at line 542 of file usbh_core.h.
uint8_t* urb_t::setup_packet |
setup packet (control only)
Definition at line 548 of file usbh_core.h.
int usb_device::slow |
Is slow device.
Definition at line 670 of file usbh_core.h.
int usb_device::speed |
Device speed.
Definition at line 671 of file usbh_core.h.
int urb_t::start_frame |
start frame (iso/irq only)
Definition at line 549 of file usbh_core.h.
int iso_pkt_t::status |
Transfer status
Definition at line 530 of file usbh_core.h.
int urb_t::status |
returned status
Definition at line 543 of file usbh_core.h.
int usb_device::string_langid |
language ID for strings
Definition at line 689 of file usbh_core.h.
int urb_t::timeout |
timeout (in jiffies)
Definition at line 553 of file usbh_core.h.
uint32_t usb_device::toggle[2] |
toggle bit ([0] = IN, [1] = OUT)
Definition at line 673 of file usbh_core.h.
void* urb_t::transfer_buffer |
associated data buffer
Definition at line 545 of file usbh_core.h.
int urb_t::transfer_buffer_length |
data buffer length
Definition at line 546 of file usbh_core.h.
uint32_t urb_t::transfer_flags |
USB_DISABLE_SPD | USB_ISO_ASAP | etc.
Definition at line 544 of file usbh_core.h.
URB_PRIV_T urb_t::urb_hcpriv |
private data for host controller
Definition at line 538 of file usbh_core.h.
USB_LIST_T urb_t::urb_list |
list pointer to all active urbs
Definition at line 539 of file usbh_core.h.