USBLibAPIGuide
1.00.00.01
|
Macros | |
#define | MAX_CDC_DEVICES MAX_USB_DEVICES |
#define | CDC_EVENT_OPEN 1 |
#define | CDC_EVENT_CLOSE 2 |
#define | USBREQ_GET_LINE_CODING 0x21 |
#define | USBREQ_SET_LINE_CODING 0x20 |
#define | USBREQ_SET_CONTROL_LINE_STATE 0x22 |
#define | USB_GET_LINE_CODING_SIZE 0x07 |
#define | CDC_DEACTIVATE_CARRIER 0x00 |
#define | CDC_ACTIVATE_CARRIER 0x03 |
#define | USBH_EVENT_RX_CDC_DATA USBH_CDC_EVENT_BASE + 16 |
The CDC data detected. More... | |
#define | USBH_EVENT_TX_CDC_DATA USBH_CDC_EVENT_BASE + 17 |
Typedefs | |
typedef struct tCDCInstance | tCDCInstance |
Functions | |
tCDCInstance * | USBHCDCOpen (tCDCSubClassProtocol iDeviceType, tUSBCallback pfnCallback, void *pvCBData) |
void | USBHCDCClose (tCDCInstance *psCDCInstance) |
uint32_t | USBHCDCGetLineCoding (tCDCInstance *psCDCInstance, uint8_t *pui8Buffer, uint32_t ui32Size) |
uint32_t | USBHCDCSetLineCoding (tCDCInstance *psCDCInstance, uint8_t *pui8Data) |
uint32_t | USBHCDCSetControlLineState (tCDCInstance *psCDCInstance, uint16_t carrierValue) |
uint32_t | USBHCDCReadData (tCDCInstance *psCDCInstance, uint32_t ui32Interface, uint8_t *pui8Data, uint32_t ui32Size) |
uint32_t | USBHCDCWriteData (tCDCInstance *psCDCInstance, uint32_t ui32Interface, uint8_t *pui8Data, uint32_t ui32Size) |
Variables | |
const tUSBHostClassDriver | g_sUSBCDCClassDriver |
const tUSBHostClassDriver | g_sUSBCDCClassDriver |
#define MAX_CDC_DEVICES MAX_USB_DEVICES |
Referenced by USBHCDCOpen().
#define CDC_EVENT_OPEN 1 |
#define CDC_EVENT_CLOSE 2 |
#define USBREQ_GET_LINE_CODING 0x21 |
Referenced by USBHCDCGetLineCoding().
#define USBREQ_SET_LINE_CODING 0x20 |
Referenced by USBHCDCSetLineCoding().
#define USBREQ_SET_CONTROL_LINE_STATE 0x22 |
Referenced by USBHCDCSetControlLineState().
#define USB_GET_LINE_CODING_SIZE 0x07 |
Referenced by USBHCDCSerialInit().
#define CDC_DEACTIVATE_CARRIER 0x00 |
Referenced by USBHCDCSerialInit().
#define CDC_ACTIVATE_CARRIER 0x03 |
#define USBH_EVENT_RX_CDC_DATA USBH_CDC_EVENT_BASE + 16 |
The CDC data detected.
Referenced by USBHCDCGetDataFromDevice().
#define USBH_EVENT_TX_CDC_DATA USBH_CDC_EVENT_BASE + 17 |
Referenced by USBHCDCSendDataToDevice().
typedef struct tCDCInstance tCDCInstance |
enum tCDCSubClassProtocol |
The following values are used to register callbacks to the USB HOST CDC device class layer.
tCDCInstance * USBHCDCOpen | ( | tCDCSubClassProtocol | iDeviceType, |
tUSBCallback | pfnCallback, | ||
void * | pvCBData | ||
) |
This function is used to open an instance of a CDC device.
iDeviceType | is the type of device that should be loaded for this instance of the CDC device. |
pfnCallback | is the function that will be called whenever changes are detected for this device. |
pvCBData | is the data that will be returned in when the pfnCallback function is called. |
This function creates an instance of an specific type of CDC device. The iDeviceType parameter is one subclass/protocol values of the types specified in enumerated types tCDCSubClassProtocol. Only devices that enumerate with this type will be called back via the pfnCallback function. The pfnCallback parameter is the callback function for any events that occur for this device type. The pfnCallback function must point to a valid function of type tUSBCallback for this call to complete successfully. To release this device instance the caller of USBHCDCOpen() should call USBHCDCClose() and pass in the value returned from the USBHCDCOpen() call.
References eUSBHCDCClassNone, and MAX_CDC_DEVICES.
Referenced by USBHCDCSerialOpen().
void USBHCDCClose | ( | tCDCInstance * | psCDCInstance | ) |
This function is used to release an instance of a CDC device.
psCDCInstance | is the instance value for a CDC device to release. |
This function releases an instance of a CDC device that was created by a call to USBHCDCOpen(). This call is required to allow other CDC devices to be enumerated after another CDC device has been disconnected. The psCDCInstance parameter should hold the value that was returned from the previous call to USBHCDCOpen().
References eUSBHCDCClassNone.
Referenced by USBHCDCSerialClose().
uint32_t USBHCDCGetLineCoding | ( | tCDCInstance * | psCDCInstance, |
uint8_t * | pui8Buffer, | ||
uint32_t | ui32Size | ||
) |
This function is used to get line coding information for a CDC device.
psCDCInstance | is the instance value of a CDC device USBHCDCOpen(). |
pui8Buffer | is buffer that holds the CDC line coding parameter data |
ui32Size | is the line coding size |
This function is used to retrieve line parameter information from a device. The parameters retrieved are DTR rate, stop bit, partity and data bits This request is sent when a CDC device is connected to the host.
References USB_RTYPE_CLASS, USB_RTYPE_DIR_IN, USB_RTYPE_INTERFACE, USBHCDControlTransfer(), and USBREQ_GET_LINE_CODING.
Referenced by USBHCDCSerialInit().
uint32_t USBHCDCSetLineCoding | ( | tCDCInstance * | psCDCInstance, |
uint8_t * | pui8Data | ||
) |
This function is used to set the line coding information for a CDC device.
psCDCInstance | is the value that was returned from the call to USBHCDCOpen(). |
pui8Data | is the line parameter values |
This function is used to set the line parameter information from a device. The parameters are baud rate, stop bit, partiy and data bits This request is sent when a CDC device is connected to the host.
References USB_RTYPE_CLASS, USB_RTYPE_DIR_OUT, USB_RTYPE_INTERFACE, USBHCDControlTransfer(), and USBREQ_SET_LINE_CODING.
Referenced by USBHCDCSerialInit().
uint32_t USBHCDCSetControlLineState | ( | tCDCInstance * | psCDCInstance, |
uint16_t | carrierValue | ||
) |
This function is used to set the line state of a CDC device.
psCDCInstance | is the value that was returned from the call to USBHCDCOpen(). |
carrierValue | is the indicator that deactivates or activates the Control Line |
This function is used to set the line parameter information from a device. The parameters are baud rate, stop bit, partiy and data bits This request is sent when a CDC device is connected to the host.
References USB_RTYPE_CLASS, USB_RTYPE_DIR_OUT, USB_RTYPE_INTERFACE, USBHCDControlTransfer(), and USBREQ_SET_CONTROL_LINE_STATE.
Referenced by USBHCDCSerialInit().
uint32_t USBHCDCReadData | ( | tCDCInstance * | psCDCInstance, |
uint32_t | ui32Interface, | ||
uint8_t * | pui8Data, | ||
uint32_t | ui32Size | ||
) |
This function is used to read data from bulk IN endpoint.
psCDCInstance | is the value that was returned from the call to USBHCDCOpen(). |
ui32Interface | is the interface to retrieve the data from. |
pui8Data | is the memory buffer to use to store the data. |
ui32Size | is the size in bytes of the buffer pointed to by pui8Buffer. |
This function is used to read data sent from a connected device. The function specifically reads data from a USB Bulk IN pipe. The data is sent every time the main loop enters STATE_CDC_DEVICE_CONNECTED state.
References USBHCDPipeRead().
Referenced by USBHCDCGetDataFromDevice().
uint32_t USBHCDCWriteData | ( | tCDCInstance * | psCDCInstance, |
uint32_t | ui32Interface, | ||
uint8_t * | pui8Data, | ||
uint32_t | ui32Size | ||
) |
This function writes data to bulk OUT endpoint.
psCDCInstance | is the value that was returned from the call to USBHCDCOpen(). |
ui32Interface | is the interface to write the data to. |
pui8Data | is the memory buffer storing the data. |
ui32Size | is the size in bytes of the buffer pointed to by pui8Buffer. |
This function is used to send data to a connected device by writing the data stored in a memory buffer to a USB Bulk OUT pipe. The data is polled every time the main loop enters STATE_CDC_DEVICE_CONNECTED state.
References USBHCDPipeWrite().
Referenced by USBHCDCSendDataToDevice().
const tUSBHostClassDriver g_sUSBCDCClassDriver |
This constant global structure defines the CDC Class Driver that is provided with the USB library.
const tUSBHostClassDriver g_sUSBCDCClassDriver |
This constant global structure defines the CDC Class Driver that is provided with the USB library.