em_usbxpress_callback.c File Reference

Contains call-back functions from the EFM32 USB Library.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

Definition in file em_usbxpress_callback.c.

#include <stddef.h>
#include "em_usbxpress_internal.h"
#include "em_usbxpress_descriptors.h"
#include "em_usbxpress.h"

Functions

static uint8_t usbxpressPartNumber SL_ATTRIBUTE_ALIGN (4)
 USBXpress Part Number.
 
void USBX_DeviceStateChangeCb (USBD_State_TypeDef oldState, USBD_State_TypeDef newState)
 USB device state change call-back.
 
int USBX_inXferCompleteCb (USB_Status_TypeDef status, uint16_t xferred, uint16_t remaining)
 USBXpress IN Endpoint Transfer Complete Callback.
 
int USBX_outXferCompleteCb (USB_Status_TypeDef status, uint16_t xferred, uint16_t remaining)
 USBXpress OUT Endpoint Transfer Complete Callback.
 
void USBX_ResetCb (void)
 USB Reset call-back.
 
int USBX_SetupCmdCb (const USB_Setup_TypeDef *setup)
 USB setup command call-back.
 

Variables

uint8_t USBXCORE_overflowBuffer []
 
bool USBXCORE_rxOverflowPacketAvailable
 Boolean indicating if data was received while expecting a ZLP.
 
uint32_t USBXCORE_rxOverflowPacketSize
 Size of Rx Overflow Packet.
 
bool USBXCORE_zlpActive
 Boolean indicating whether a ZLP read is active.
 

Function Documentation

static uint8_t usbxpressPartNumber SL_ATTRIBUTE_ALIGN ( )
static

USBXpress Part Number.

USBXpress Library Version.

void USBX_DeviceStateChangeCb ( USBD_State_TypeDef  oldState,
USBD_State_TypeDef  newState 
)

USB device state change call-back.

Set new state and jump to user API call-back.

Definition at line 73 of file em_usbxpress_callback.c.

References APIEA_GIE, USBD_STATE_CONFIGURED, USBD_STATE_SUSPENDED, USBX_DEV_CONFIGURED, USBX_DEV_SUSPEND, USBX_jumpCallback(), USBXCORE_apiEa, USBXCORE_apiIntValue, and USBXCORE_resetState().

Referenced by USBX_init().

int USBX_inXferCompleteCb ( USB_Status_TypeDef  status,
uint16_t  xferred,
uint16_t  remaining 
)

USBXpress IN Endpoint Transfer Complete Callback.

Gets the number of IN bytes transferred and passes them to the user API call-back.

Definition at line 244 of file em_usbxpress_callback.c.

References APIEA_GIE, USB_FS_BULK_EP_MAXSIZE, USB_STATUS_OK, USBD_Write(), USBX_jumpCallback(), USBX_TX_COMPLETE, USBXCORE_apiEa, USBXCORE_apiIntValue, USBXCORE_byteCountInPtr, and USBXCORE_writeSize.

Referenced by USBX_blockWrite().

int USBX_outXferCompleteCb ( USB_Status_TypeDef  status,
uint16_t  xferred,
uint16_t  remaining 
)

USBXpress OUT Endpoint Transfer Complete Callback.

Gets the number of OUT bytes transferred and passes them to the user API call-back.

Definition at line 284 of file em_usbxpress_callback.c.

References APIEA_GIE, USB_STATUS_OK, USBD_Read(), USBX_jumpCallback(), USBX_RX_COMPLETE, USBX_RX_OVERRUN, USBXCORE_apiEa, USBXCORE_apiIntValue, USBXCORE_byteCountOutPtr, and USBXCORE_readSize.

Referenced by USBX_blockRead().

void USBX_ResetCb ( void  )

USB Reset call-back.

Jump to user API RESET call-back.

Definition at line 56 of file em_usbxpress_callback.c.

References APIEA_GIE, USBX_jumpCallback(), USBX_RESET, USBXCORE_apiEa, USBXCORE_apiIntValue, and USBXCORE_resetState().

Referenced by USBX_init().

int USBX_SetupCmdCb ( const USB_Setup_TypeDef setup)

USB setup command call-back.

If the setup command is a vendor request, pass to the USB command request parsing routine and acknowledge. Otherwise ignore the request.

Definition at line 103 of file em_usbxpress_callback.c.

References APIEA_GIE, APIEA_GIE_TEMP, USB_Setup_TypeDef::bmRequestType, USB_Setup_TypeDef::bRequest, EXT_COMP_DESC_SIZE, EXT_COMP_VENDOR_CODE, FEATURE_EXTENDED_COMPATIBILITY_ID, FEATURE_EXTENDED_PROPERTIES_ID, GET_DESCRIPTOR, PROPERTIES_DESCRIPTOR_SIZE, SI_CP210X_GET_PART_NUMBER, SI_CP210X_REQUEST, SI_USBXPRESS_CLEAR_TO_SEND, SI_USBXPRESS_FLUSH_BUFFERS, SI_USBXPRESS_GET_VERSION, SI_USBXPRESS_NOT_CLEAR_TO_SEND, SI_USBXPRESS_REQUEST, USB_Setup_TypeDef::Type, USB_SETUP_DIR_D2H, USB_SETUP_RECIPIENT_DEVICE, USB_SETUP_RECIPIENT_INTERFACE, USB_SETUP_TYPE_STANDARD, USB_SETUP_TYPE_VENDOR, USB_SETUP_TYPE_VENDOR_MASK, USB_STATUS_OK, USB_STATUS_REQ_UNHANDLED, USB_STRING_DESCRIPTOR, USBD_AbortTransfer(), USBD_Write(), USBX_DEV_CLOSE, USBX_DEV_OPEN, USBX_FIFO_PURGE, USBX_jumpCallback(), USBXCORE_apiEa, USBXCORE_apiIntValue, USBXCORE_resetState(), USB_Setup_TypeDef::wIndex, USB_Setup_TypeDef::wLength, and USB_Setup_TypeDef::wValue.

Referenced by USBX_init().