EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
em_usbxpress_internal.h File Reference

Detailed Description

Primary header file. Contains internal global declarations and definitions.

Version
5.1.2

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file em_usbxpress_internal.h.

#include <stdint.h>
#include <stdbool.h>
#include "em_usb.h"

Go to the source code of this file.

Macros

#define APIEA_GIE   0x01
 Enable. More...
 
#define APIEA_GIE_TEMP   0x02
 
#define SI_CP210X_GET_PART_NUMBER   0x370B
 Value.
 
#define SI_CP210X_REQUEST   0xFF
 Request.
 
#define SI_USBXPRESS_CLEAR_TO_SEND   0x0002
 Value.
 
#define SI_USBXPRESS_FLUSH_BUFFERS   0x0001
 Value.
 
#define SI_USBXPRESS_GET_VERSION   0x0008
 Value.
 
#define SI_USBXPRESS_NOT_CLEAR_TO_SEND   0x0004
 Value.
 
#define SI_USBXPRESS_PART_NUMBER_EFM32   0x81
 EFM32 USBXpress Part Number.
 
#define SI_USBXPRESS_PART_NUMBER_EFM8   0x80
 EFM8 USBXpress Part Number.
 
#define SI_USBXPRESS_REQUEST   0x02
 Request.
 
#define USBXCORE_MAXLEN   19
 
#define USBXPRESS_LIBRARY_VERSION   0x0500
 

Functions

void USBX_DeviceStateChangeCb (USBD_State_TypeDef oldState, USBD_State_TypeDef newState)
 USB device state change call-back. More...
 
int USBX_inXferCompleteCb (USB_Status_TypeDef, uint16_t, uint16_t remaining)
 USBXpress IN Endpoint Transfer Complete Callback. More...
 
void USBX_jumpCallback (void)
 Conditionally jumps to the user call-back routine. More...
 
int USBX_outXferCompleteCb (USB_Status_TypeDef, uint16_t, uint16_t remaining)
 USBXpress OUT Endpoint Transfer Complete Callback. More...
 
void USBX_ResetCb (void)
 USB Reset call-back. More...
 
int USBX_SetupCmdCb (const USB_Setup_TypeDef *setup)
 USB setup command call-back. More...
 
void USBXCORE_Read (uint8_t *, uint8_t *, uint8_t)
 
void USBXCORE_resetState (void)
 Resets internal USBXpress variables. More...
 
void USBXCORE_Write (uint8_t *, uint8_t *, uint8_t)
 

Variables

uint32_t USBXCORE_apiEa
 Enable or disable status of USB_API interrupts.
 
uint32_t USBXCORE_apiIntValue
 Byte holding the current USB_API interrupts.
 
uint32_t * USBXCORE_byteCountInPtr
 Pointer to variable holding number of bytes written.
 
uint32_t * USBXCORE_byteCountOutPtr
 Pointer to variable holding number of bytes read.
 
uint8_t USBXCORE_configDesc [32]
 Copy of configuration descriptor.
 
uint32_t USBXCORE_readSize
 Number of bytes sent to USBX_blockRead() as numBytes.
 
uint32_t USBXCORE_writeSize
 Number of bytes sent to USBX_blockWrite() as numBytes.
 

Macro Definition Documentation

#define APIEA_GIE   0x01
#define APIEA_GIE_TEMP   0x02

Temporary storage of API GIE bit when internally disabled

Definition at line 38 of file em_usbxpress_internal.h.

Referenced by USBX_SetupCmdCb().

#define USBXCORE_MAXLEN   19

Maximum length of array passed by USBXCORE_Read/Write

Definition at line 42 of file em_usbxpress_internal.h.

#define USBXPRESS_LIBRARY_VERSION   0x0500

USBXpress firmware library version Example: 0x0241 => v2.41

Definition at line 31 of file em_usbxpress_internal.h.

Referenced by USBX_getLibraryVersion().

Function Documentation

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 72 of file em_usbxpress_callback.c.

References APIEA_GIE, 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 268 of file em_usbxpress_callback.c.

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

Referenced by USBX_blockWrite().

void USBX_jumpCallback ( void  )

Conditionally jumps to the user call-back routine.

If the user call-back routine is already in progress, this function does nothing. Otherwise, this function jumps to the call-back defined via USBX_callbackEnable().

Definition at line 264 of file em_usbxpress.c.

Referenced by USBX_DeviceStateChangeCb(), USBX_inXferCompleteCb(), USBX_outXferCompleteCb(), USBX_ResetCb(), and USBX_SetupCmdCb().

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 314 of file em_usbxpress_callback.c.

References APIEA_GIE, 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 54 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)
void USBXCORE_resetState ( void  )

Resets internal USBXpress variables.

This function resets the internal USBXpress variables. It should be called after a cancel-type event (USBXpress Close, USB de-configure, FIFO flush, etc.).

Definition at line 276 of file em_usbxpress.c.

References USBXCORE_rxOverflowPacketAvailable, and USBXCORE_zlpActive.

Referenced by USBX_DeviceStateChangeCb(), USBX_ResetCb(), and USBX_SetupCmdCb().