em_usbxpress.c File Reference

USBXpress global variable declaration, initialization, and call-back.

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.c .

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

Functions

USB_DeviceDescriptor_TypeDef USBXCORE_deviceDesc SL_ATTRIBUTE_ALIGN (4)
Copy of device descriptor, so it can be edited.
void USBX_apiCallbackDisable (void)
Inhibits user API call-backs and does NOT disable the USB interrupt.
void USBX_apiCallbackEnable ( USBX_apiCallback_t f)
Enables user API call-backs.
int USBX_blockRead (uint8_t *block, uint32_t numBytes, uint32_t *countPtr)
User API function to get data from host.
int USBX_blockWrite (uint8_t *block, uint32_t numBytes, uint32_t *countPtr)
User API function to send data to host.
USBX_BUF (USBXCORE_overflowBuffer, USB_FS_BULK_EP_MAXSIZE )
Buffer to hold overflow rx data if a ZLP read returns more than zero bytes.
void USBX_disable (void)
Disables the USB interface.
uint32_t USBX_getCallbackSource (void)
User API function to get the call-back source.
uint_least16_t USBX_getLibraryVersion (void)
Returns the USBXpress library version.
void USBX_init ( USBX_Init_t *p)
User API USB initialization function.
void USBX_jumpCallback (void)
Conditionally jumps to the user call-back routine.
void USBXCORE_resetState (void)
Resets internal USBXpress variables.

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.
uint32_t USBXCORE_readSize
Number of bytes sent to USBX_blockRead() as numBytes.
bool USBXCORE_rxOverflowPacketAvailable = false
Boolean indicating if data was received while expecting a ZLP.
uint32_t USBXCORE_rxOverflowPacketSize = 0
Size of Rx Overflow Packet.
USB_StringDescriptor_TypeDef const * USBXCORE_stringDescTable [4]
Table of pointers to various string descriptors.
uint32_t USBXCORE_writeSize
Number of bytes sent to USBX_blockWrite() as numBytes.
bool USBXCORE_zlpActive = false
Boolean indicating whether a ZLP read is active.

Function Documentation

const USB_ExtendedPropertiesDescriptor_t USBXCORE_extendedPropertiesDesc SL_ATTRIBUTE_ALIGN ( 4 )
Initial value:
=
{
EXT_COMP_DESC_SIZE ,
0x0100,
FEATURE_EXTENDED_COMPATIBILITY_ID ,
NUM_IFCS_WITH_EXT_COMPAT ,
{ 0, 0, 0, 0, 0, 0, 0 },
{
{
0,
1,
"WINUSB\0" ,
{ 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
},
}
}
FEATURE_EXTENDED_COMPATIBILITY_ID
#define FEATURE_EXTENDED_COMPATIBILITY_ID
Extended Compatibility ID Descriptor.
Definition: em_usbxpress_descriptors.h:47
NUM_IFCS_WITH_EXT_COMPAT
#define NUM_IFCS_WITH_EXT_COMPAT
Number of interfaces with extended compatibility descriptors.
Definition: em_usbxpress_descriptors.h:56
EXT_COMP_DESC_SIZE
#define EXT_COMP_DESC_SIZE
Size of Extended Compatibility Descriptor.
Definition: em_usbxpress_descriptors.h:51

Copy of device descriptor, so it can be edited.

Extended Properties Descriptor.

Compatible ID Feature Descriptor.

Copy of configuration descriptor.

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 255 of file em_usbxpress.c .

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

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 267 of file em_usbxpress.c .

References USBXCORE_rxOverflowPacketAvailable , and USBXCORE_zlpActive .

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