Functions#

Functions.

Functions#

void
USBX_init(USBX_Init_t *p)

User API USB initialization function.

int
USBX_blockWrite(uint8_t *block, uint32_t numBytes, uint32_t *countPtr)

User API function to send data to host.

int
USBX_blockRead(uint8_t *block, uint32_t numBytes, uint32_t *countPtr)

User API function to get data from host.

uint32_t

User API function to get the call-back source.

void
USBX_apiCallbackEnable(USBX_apiCallback_t f)

Enables user API call-backs.

void

Inhibits user API call-backs and does NOT disable the USB interrupt.

void

Disables the USB interface.

uint_least16_t

Returns the USBXpress library version.

Function Documentation#

USBX_init#

void USBX_init (USBX_Init_t * p)

User API USB initialization function.

Parameters
N/Ap

Pointer to USBX_Init_t structure. Not modified by this routine.

To minimize user XRAM use, the user should pass initialization parameters from code memory to the USBX_init() function.


Definition at line 316 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_blockWrite#

int USBX_blockWrite (uint8_t * block, uint32_t numBytes, uint32_t * countPtr)

User API function to send data to host.

Parameters
N/Ablock

Pointer to user's array where data to be transmitted is stored.

N/AnumBytes

Number of bytes to send to host

[out]countPtr

Pointer to user's storage for number of bytes actually transmitted to the host. This will be valid upon the subsequent USBX_TX_COMPLETE call-back.

Returns

  • This function returns a status word. 0 indicates that the write was successfully started. Any other value indicates that the request was ignored. The most common reason is USBX_STATUS_EP_BUSY meaning that a write is already in progress.

Valid return codes are fond in Status Flags

A USBX_TX_COMPLETE call-back will occur when the entire transfer has completed. For example if the user writes a block of 100 bytes, two packets will be sent (one 64 byte packet and one 36 byte packet), but the USBX_TX_COMPLETE call-back will only occur after the final packet has been sent.

This function utilizes the EFM32 USB Library's USBD_Write() function, which only prepares for a write. The actual write will occur over time as the host transmits data.


Definition at line 349 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_blockRead#

int USBX_blockRead (uint8_t * block, uint32_t numBytes, uint32_t * countPtr)

User API function to get data from host.

Parameters
N/Ablock

Pointer to user's array where received data will be stored.

N/AnumBytes

Number of bytes to receive from host

[out]countPtr

Pointer to user's storage for number of bytes actually received from the host. This will be valid upon the subsequent USBX_RX_COMPLETE call-back.

Returns

  • This function returns a status word. 0 indicates that the read was successfully started. Any other value indicates that the request was ignored. The most common reason is USBX_STATUS_EP_BUSY meaning that a read is already in progress.

Valid return codes are fond in Status Flags

A USBX_RX_COMPLETE call-back will occur when the read transfer has completed. For example if the user reads a block of 100 bytes, two packets will be received (one 64 byte packet and one 36 byte packet), but the USBX_RX_COMPLETE call-back will only occur after the final packet has been received.

If the device receives more data than the value specified by numBytes, the USBX_RX_COMPLETE call-back will occur when numBytes number of bytes has been received. At this point, the USBX_RX_OVERRUN status flag will also be set, indicating that more data was received than is available to write to the buffer at block. At this point, the application may call USBX_blockRead() again to receive the remaining data from the transfer.

This function utilizes the EFM32 USB Library's USBD_Read() function, which only prepares for a read. The actual read will occur over time as the host transmits data.


Definition at line 391 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_getCallbackSource#

uint32_t USBX_getCallbackSource (void )

User API function to get the call-back source.

Parameters
N/A

Returns an 32-bit value indicating the reason(s) for the API call-back, and clears the USBXpress API call-back pending flag(s). This function should be called at the beginning of the user's call-back service routine to determine which event(s) has/have occurred.

Returns

  • An unsigned 32-bit code indicating the reason(s) for the API interrupt. The code can indicate more than one type of interrupt at the same time. Valid flags are found in Status Flags


Definition at line 410 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_apiCallbackEnable#

void USBX_apiCallbackEnable (USBX_apiCallback_t f)

Enables user API call-backs.

Parameters
N/Af

Pointer to user-defined call-back function.

Enables USB interrupts and sets the API call-back function pointer to the passed function.


Definition at line 423 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_apiCallbackDisable#

void USBX_apiCallbackDisable (void )

Inhibits user API call-backs and does NOT disable the USB interrupt.

Parameters
N/A

Definition at line 430 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_disable#

void USBX_disable (void )

Disables the USB interface.

Parameters
N/A

Definition at line 437 of file platform/middleware/usbxpress/inc/em_usbxpress.h

USBX_getLibraryVersion#

uint_least16_t USBX_getLibraryVersion (void )

Returns the USBXpress library version.

Parameters
N/A

Returns

  • Library version

Library version is returned in binary-coded decimal format.


Definition at line 448 of file platform/middleware/usbxpress/inc/em_usbxpress.h