EFR32 Blue Gecko 13 Software Documentation  efr32bg13-doc-5.1.2
em_usbxpress_internal.h
Go to the documentation of this file.
1 /***************************************************************************/
17 #ifndef EM_USBXPRESS_INTERNAL_H
18 #define EM_USBXPRESS_INTERNAL_H
19 
20 #include <stdint.h>
21 #include <stdbool.h>
22 #include "em_usb.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 // -----------------------------------------------------------------------------
29 // Macro Definitions
30 
31 #define USBXPRESS_LIBRARY_VERSION 0x0500
32 
35 // Define USBXCORE_apiEa bit masks
36 #define APIEA_GIE 0x01
37 #define APIEA_GIE_TEMP 0x02
39 
42 #define USBXCORE_MAXLEN 19
43 
46 // Control command requests and values
47 #define SI_USBXPRESS_REQUEST 0x02
48 #define SI_USBXPRESS_FLUSH_BUFFERS 0x0001
49 #define SI_USBXPRESS_CLEAR_TO_SEND 0x0002
50 #define SI_USBXPRESS_NOT_CLEAR_TO_SEND 0x0004
51 #define SI_USBXPRESS_GET_VERSION 0x0008
52 
53 #define SI_CP210X_REQUEST 0xFF
54 #define SI_CP210X_GET_PART_NUMBER 0x370B
55 
56 // USBXpress Part Numbers
57 #define SI_USBXPRESS_PART_NUMBER_EFM8 0x80
58 #define SI_USBXPRESS_PART_NUMBER_EFM32 0x81
59 
60 // -----------------------------------------------------------------------------
61 // Global Variable Declarations
62 
63 extern uint32_t USBXCORE_apiIntValue;
64 extern uint8_t USBXCORE_configDesc[32];
65 extern uint32_t USBXCORE_apiEa;
66 extern uint32_t* USBXCORE_byteCountInPtr;
67 extern uint32_t* USBXCORE_byteCountOutPtr;
68 extern uint32_t USBXCORE_readSize;
69 extern uint32_t USBXCORE_writeSize;
70 
72 // Doxygen can't handle function pointers
73 extern void (*USBXCORE_apiCallback)(void);
75 
76 // -----------------------------------------------------------------------------
77 // Global Function Declarations
78 
79 // Internal USBXpress Functions
80 void USBX_jumpCallback(void);
81 void USBXCORE_Read(uint8_t *, uint8_t *, uint8_t);
82 void USBXCORE_Write(uint8_t *, uint8_t *, uint8_t);
83 void USBXCORE_resetState(void);
84 
85 // EFM32 USB Library Call-back Functions
86 void USBX_ResetCb(void);
87 void USBX_DeviceStateChangeCb(USBD_State_TypeDef oldState,
88  USBD_State_TypeDef newState);
89 int USBX_SetupCmdCb(const USB_Setup_TypeDef *setup);
90 int USBX_inXferCompleteCb(USB_Status_TypeDef, uint16_t, uint16_t remaining);
91 int USBX_outXferCompleteCb(USB_Status_TypeDef, uint16_t, uint16_t remaining);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif // EM_USBXPRESS_INTERNAL_H
uint32_t USBXCORE_apiEa
Enable or disable status of USB_API interrupts.
Definition: em_usbxpress.c:41
void USBX_jumpCallback(void)
Conditionally jumps to the user call-back routine.
Definition: em_usbxpress.c:264
void USBXCORE_resetState(void)
Resets internal USBXpress variables.
Definition: em_usbxpress.c:276
uint32_t USBXCORE_apiIntValue
Byte holding the current USB_API interrupts.
Definition: em_usbxpress.c:38
int USBX_SetupCmdCb(const USB_Setup_TypeDef *setup)
USB setup command call-back.
uint32_t * USBXCORE_byteCountOutPtr
Pointer to variable holding number of bytes read.
Definition: em_usbxpress.c:64
uint32_t USBXCORE_readSize
Number of bytes sent to USBX_blockRead() as numBytes.
Definition: em_usbxpress.c:67
uint32_t * USBXCORE_byteCountInPtr
Pointer to variable holding number of bytes written.
Definition: em_usbxpress.c:61
void USBX_ResetCb(void)
USB Reset call-back.
int USBX_inXferCompleteCb(USB_Status_TypeDef, uint16_t, uint16_t remaining)
USBXpress IN Endpoint Transfer Complete Callback.
uint32_t USBXCORE_writeSize
Number of bytes sent to USBX_blockWrite() as numBytes.
Definition: em_usbxpress.c:70
void USBX_DeviceStateChangeCb(USBD_State_TypeDef oldState, USBD_State_TypeDef newState)
USB device state change call-back.
int USBX_outXferCompleteCb(USB_Status_TypeDef, uint16_t, uint16_t remaining)
USBXpress OUT Endpoint Transfer Complete Callback.
uint8_t USBXCORE_configDesc[32]
Copy of configuration descriptor.