USBLibAPIGuide  1.00.00.01
Macros | Typedefs | Functions
Usblib_host_cdc

Macros

#define USBHCDC_DATA_SIZE   64
 
#define USBHCDC_DEVICE_PRESENT   0x00000001
 

Typedefs

typedef struct tUSBHCDCSerial tUSBHCDCSerial
 
typedef void(* tUSBHCDCSerialCallback) (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData)
 

Functions

tUSBHCDCSerialUSBHCDCSerialOpen (tUSBHCDCSerialCallback pfnCallback)
 
uint32_t USBHCDCSerialClose (tUSBHCDCSerial *psCdcSerialInstance)
 
uint32_t USBHCDCSerialInit (tUSBHCDCSerial *psCdcInstance)
 
uint32_t USBHCDCGetDataFromDevice (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Interface)
 
uint32_t USBHCDCSendDataToDevice (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Interface, uint8_t *ui8SendBuffer, uint8_t byteSize)
 
uint32_t USBHCDCProcessData (tUSBHCDCSerial *psCdcSerialInstance, uint8_t ui8ArrayIndex)
 

Detailed Description

Macro Definition Documentation

§ USBHCDC_DATA_SIZE

#define USBHCDC_DATA_SIZE   64

§ USBHCDC_DEVICE_PRESENT

#define USBHCDC_DEVICE_PRESENT   0x00000001

Typedef Documentation

§ tUSBHCDCSerial

typedef struct tUSBHCDCSerial tUSBHCDCSerial

§ tUSBHCDCSerialCallback

typedef void(* tUSBHCDCSerialCallback) (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData)

Function Documentation

§ USBHCDCSerialOpen()

tUSBHCDCSerial * USBHCDCSerialOpen ( tUSBHCDCSerialCallback  pfnCallback)

This function is used open an instance of a CDC device.

Parameters
pfnCallbackis the callback function to call when new events occur with the CDC device returned.

This function is used to open an instance of the CDC device. The value returned from this function should be used as the instance identifier for all other USBHCDCSerial calls.

Returns
&g_sUSBHCDCSerial is the pointer to the instance identifier for the device that is attached. If there is no device present this will return 0.

References eUSBHCDCClassDirectLineControl, and USBHCDCOpen().

§ USBHCDCSerialClose()

uint32_t USBHCDCSerialClose ( tUSBHCDCSerial psCdcSerialInstance)

This function is used close an instance of a CDC device.

Parameters
psCdcSerialInstanceis the instance value for this device.

This function is used to close an instance of the device that was opened with a call to USBHCDCSerialOpen(). The psCdcSerialInstance value is the value that was returned when the application called USBHCDCSerialOpen().

Returns
0 to indicate success of closing the device

References USBHCDCClose().

§ USBHCDCSerialInit()

uint32_t USBHCDCSerialInit ( tUSBHCDCSerial psCdcInstance)

This function is used to initialize a CDC interface after a CDC device is detected.

Parameters
psCdcInstanceis the instance value for this device.

This function should be called after receiving a STATE_CDC_DEVICE_INIT event in the callback function provided by USBHCDCOpen(), however this function should only be called outside the callback function. This will initialize the CDC interface. The psCdcInstance value is the value that was returned when the application called USBHCDCOpen(). This function only needs to be called once per connection event but it should be called every time a STATE_CDC_DEVICE_INIT event occurs.

Returns
This function returns 0 to indicate success any non-zero value indicates an error condition.

References CDC_DEACTIVATE_CARRIER, USB_GET_LINE_CODING_SIZE, USBHCDCGetLineCoding(), USBHCDCSetControlLineState(), and USBHCDCSetLineCoding().

§ USBHCDCGetDataFromDevice()

uint32_t USBHCDCGetDataFromDevice ( tUSBHCDCSerial psCdcSerialInstance,
uint32_t  ui32Interface 
)

This function calls the api that gets the data at the CDC bulk endpoint sent by the CDC device.

Parameters
psCdcSerialInstanceis the instance value for this device.
ui32Interfaceis the bulk endpoint interface

This function is called after receiving a USB_EVENT_CONNECTED event in the callback function provided by USBHCDCOpen().

Returns
This function returns 0 to indicate success any non-zero value indicates an error condition.

References USBH_EVENT_RX_CDC_DATA, USBHCDC_DATA_SIZE, and USBHCDCReadData().

§ USBHCDCSendDataToDevice()

uint32_t USBHCDCSendDataToDevice ( tUSBHCDCSerial psCdcSerialInstance,
uint32_t  ui32Interface,
uint8_t *  ui8SendBuffer,
uint8_t  byteSize 
)

This function calls the api that sends the bulk data to the CDC device

Parameters
psCdcSerialInstanceis the instance value for this device.
ui32Interfaceis the bulk endpoint interface
*ui8SendBufferis pointer of array
byteSizeis number of data bytes to be sent to device

This function is called after receiving a USB_EVENT_CONNECTED event in the callback function provided by USBHCDCOpen(). And it is called after receiving 74 bytes of data from the device

Returns
This function returns 0 to indicate success. Any non-zero value indicates an error condition.

References USBH_EVENT_TX_CDC_DATA, and USBHCDCWriteData().

§ USBHCDCProcessData()

uint32_t USBHCDCProcessData ( tUSBHCDCSerial psCdcSerialInstance,
uint8_t  ui8ArrayIndex 
)

This function processes the data contained in the USB buffer.

Parameters
psCdcSerialInstanceis the instance value for this device.
ui8ArrayIndexindex into the buffer array

This function is called after receiving a USB_EVENT_CONNECTED event in the callback function provided by USBHCDCOpen().

Returns
ui32Value The value pointed to by ui8ArrayIndex.
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale