RA Flexible Software Package Documentation
Release v5.7.0
|
|
Functions | |
fsp_err_t | R_USB_HCDC_ControlDataRead (usb_ctrl_t *const p_api_ctrl, uint8_t *p_buf, uint32_t size, uint8_t device_address) |
Read Control Data.(CDC Interrupt IN data) More... | |
fsp_err_t | R_USB_HCDC_SpecificDeviceRegister (usb_ctrl_t *const p_api_ctrl, uint16_t vendor_id, uint16_t product_id) |
Register the specified vendor class device in the device table. More... | |
fsp_err_t | R_USB_HCDC_DeviceInfoGet (usb_ctrl_t *const p_api_ctrl, usb_hcdc_device_info_t *p_info, uint8_t device_address) |
Get the VID, PID and subclass code of the connected device. More... | |
This module provides a USB Host Communications Device Class (HCDC) driver. It implements the USB HCDC Interface.
Refer to USB (r_usb_basic) for the common API (r_usb_basic) to be called from the application.
The r_usb_hcdc module, when used in combination with the r_usb_basic module, operates as a USB Host Communications Device Class (HCDC) driver. The HCDC conforms to the PSTN device subclass abstract control model of the USB Communications Device Class (CDC) specification and enables communication with a CDC peripheral device.
The r_usb_hcdc module has the following key features:
Configuration | Options | Default | Description |
---|---|---|---|
Target Peripheral Device Class ID |
| CDC class supported device | Specify the device class ID of the CDC device to be connected. |
Bulk Input Transfer Pipe |
| USB PIPE4 | Select the USB pipe to use for bulk input transfers. |
Bulk Output Transfer Pipe |
| USB PIPE5 | Select the USB pipe to use for bulk output transfers. |
Interrupt In Pipe |
| USB PIPE6 | Select the USB pipe to use for interrupts. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_hcdc0 | Module name. |
Refer to the USB (r_usb_basic) module.
Refer to the USB (r_usb_basic) module.
This software conforms to the Abstract Control Model (ACM) subclass of the Communications Device Class specification as defined in the "USB Communications Class Subclass Specification for PSTN Devices", Revision 1.2. The Abstract Control Model subclass is a technology that bridges the gap between USB devices and earlier modems (employing RS-232C connections) enabling use of application programs designed for older modems.
Basic Functions
The main functions of HCDC are the following:
This driver supports the following class requests:
Request | Code | Description |
---|---|---|
SendEncapsulatedCommand | 0x00 | Transmits an AT command as defined by the protocol used by the device (normally 0 for USB). |
GetEncapsulatedResponse | 0x01 | Requests a response to a command transmitted by SendEncapsulatedCommand. |
SetCommFeature | 0x02 | Enables or disables features such as device-specific 2-byte code and country setting. |
GetCommFeature | 0x03 | Acquires the enabled/disabled state of features such as device-specific 2-byte code and country setting. |
ClearCommFeature | 0x04 | Restores the default enabled/disabled settings of features such as device-specific 2-byte code and country setting. |
SetLineCoding | 0x20 | Makes communication line settings (communication speed, data length, parity bit, and stop bit length). |
GetLineCoding | 0x21 | Acquires the communication line setting state. |
SetControlLineState | 0x22 | Makes communication line control signal (RTS, DTR) settings. |
SendBreak | 0x23 | Transmits a break signal. |
The expected data format for each command is shown below followed by dependent structures.
bmRequestType | bRequest | wValue | wIndex | wLength | Data |
---|---|---|---|---|---|
0x21 | SEND_ENCAPSULATED_COMMAND (0x00) | 0x0000 | 0x0000 | Data length | usb_hcdc_encapsulated_t |
0x21 | GET_ENCAPSULATED_RESPONSE (0x01) | 0x0000 | 0x0000 | Data length | usb_hcdc_encapsulated_t |
0x21 | SET_COMM_FEATURE (0x02) | usb_hcdc_feature_selector_t | 0x0000 | Data length | usb_hcdc_commfeature_t |
0x21 | GET_COMM_FEATURE (0x03) | usb_hcdc_feature_selector_t | 0x0000 | Data length | usb_hcdc_commfeature_t |
0x21 | CLEAR_COMM_FEATURE (0x04) | usb_hcdc_feature_selector_t | 0x0000 | Data length | None |
0x21 | SET_LINE_CODING (0x20) | 0x0000 | 0x0000 | 0x0000 | usb_hcdc_linecoding_t |
0xA1 | GET_LINE_CODING (0x21) | 0x0000 | 0x0000 | 0x0007 | usb_hcdc_linecoding_t |
0x21 | SET_CONTROL_LINE_STATE (0x22) | usb_hcdc_controllinestate_t | 0x0000 | 0x0000 | None |
0x21 | SEND_BREAK (0x23) | usb_hcdc_breakduration_t | 0x0000 | 0x0000 | None |
The following class notifications are supported:
Notification | Code | Description |
---|---|---|
RESPONSE_AVAILABLE | 0x01 | Response to GET_ENCAPSULATED_RESPONSE |
SERIAL_STATE | 0x20 | Notification of serial line state |
The data types returned are as follows:
bmRequestType | bRequest | wValue | wIndex | wLength | Data |
---|---|---|---|---|---|
0xA1 | RESPONSE_AVAILABLE (0x01) | 0x0000 | 0x0000 | 0x0000 | None |
0xA1 | SERIAL_STATE (0x20) | 0x0000 | 0x0000 | 0x0002 | usb_hcdc_serialstate_t |
This driver is subject to the following limitations:
The main functions of the HCDC loopback example are as follows:
The main loop performs loopback processing in which data received from a CDC peripheral device is transmitted unaltered back to the peripheral.
fsp_err_t R_USB_HCDC_ControlDataRead | ( | usb_ctrl_t *const | p_api_ctrl, |
uint8_t * | p_buf, | ||
uint32_t | size, | ||
uint8_t | device_address | ||
) |
Read Control Data.(CDC Interrupt IN data)
FSP_SUCCESS | Successfully completed (Data read request completed). |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_BUSY | Data receive request already in process for USB device with same device address. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
fsp_err_t R_USB_HCDC_SpecificDeviceRegister | ( | usb_ctrl_t *const | p_api_ctrl, |
uint16_t | vendor_id, | ||
uint16_t | product_id | ||
) |
Register the specified vendor class device in the device table.
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter Null pointer error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
fsp_err_t R_USB_HCDC_DeviceInfoGet | ( | usb_ctrl_t *const | p_api_ctrl, |
usb_hcdc_device_info_t * | p_info, | ||
uint8_t | device_address | ||
) |
Get the VID, PID and subclass code of the connected device.
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter Null pointer error. |
FSP_ERR_USB_PARAMETER | Parameter error. |