Open CDC-ACM device The driver first looks for CDC compliant descriptor, if it is not found the driver checks if the interface has 2 Bulk endpoints that can be used for data Use CDC_HOST_ANY_* macros to signal that you don't care about the device's VID and PID. In this case, first USB device will be opened. It is recommended to use this feature if only one device can ever be in the system (there is no USB HUB connected).
Install CDC-ACM driver - USB Host Library must already be installed before calling this function (via usb_host_install()) - This function should be called before calling any other CDC driver functions
Send command to CTRL endpoint Sends Control transfer as described in USB specification chapter 9. This function can be used by device drivers that use custom/vendor specific commands. These commands can either extend or replace commands defined in USB CDC-PSTN specification rev. 1.2.
GetLineCoding function @see Chapter 6.3.11, USB CDC-PSTN specification rev. 1.2
Send CDC specific request Helper function that will send CDC specific request to default endpoint. Both IN and OUT requests are sent through this API, depending on the in_transfer parameter. @see Chapter 6.2, USB CDC specification rev. 1.2
Transmit data - blocking mode
SetControlLineState function @see Chapter 6.3.12, USB CDC-PSTN specification rev. 1.2
SetLineCoding function @see Chapter 6.3.10, USB CDC-PSTN specification rev. 1.2
Close CDC device and release its resources
SendBreak function This function will block until the duration_ms has passed. @see Chapter 6.3.13, USB CDC-PSTN specification rev. 1.2
Print device's descriptors Device and full Configuration descriptors are printed in human readable format to stdout.
Free USB transfers used by this device
Reset IN transfer In in_xfer_cb() we can modify IN transfer parameters, this function resets the transfer to its defaults
VCP factory with VID and PID Use this function if you know VID and PID of the device. The VCP service will look for correct (already registered) driver and load it. @attention USB Host Library must be installed before calling this function!
Register new USB device callback The callback will be called for every new USB device, not just CDC-ACM class.
Uninstall CDC-ACM driver - Users must ensure that all CDC devices must be closed via cdc_acm_host_close() before calling this function
Get protocols defined in USB-CDC interface descriptors
Get CDC functional descriptor
Parse CDC interface descriptor #. Check if the required interface exists #. Parse the interface descriptor #. Check if the device is CDC compliant #. For CDC compliant devices also parse second interface descriptor and functional descriptors
Print CDC specific descriptor in human readable form This is a callback function that is called from USB Host library, when it wants to print full configuration descriptor to stdout.
Helper function that releases resources claimed by CDC device Close underlying USB device, free device driver memory
Cancel transfer and reset endpoint This function will cancel ongoing transfer a reset its endpoint to ready state.
FT23x's RX data handler First two bytes are status bytes, the RX data start at data[2]. Coding of status bytes: Byte 0: Bit 0: Full Speed packet Bit 1: High Speed packet Bit 4: CTS Bit 5: DSR Bit 6: RI Bit 7: DCD Byte 1: Bit 1: RX overflow Bit 2: Parity error Bit 3: Framing error Bit 4: Break received Bit 5: Transmitter holding register empty Bit 6: Transmitter empty @todo When CTS is asserted, this driver should stop sending data.
Construct a new calculate baudrate object A Baud rate for the FT232R, FT2232 (UART mode) or FT232B is generated using the chips internal 48MHz clock. This is input to Baud rate generator circuitry where it is then divided by 16 and fed into a prescaler as a 3MHz reference clock. This 3MHz reference clock is then divided down to provide the required Baud rate for the device's on chip UART. The value of the Baud rate divisor is an integer plus a sub-integer prescaler. Allowed values for the Baud rate divisor are: Divisor = n + 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875; where n is an integer between 2 and 16384 (214). Note: Divisor = 1 and Divisor = 0 are special cases. A divisor of 0 will give 3 MBaud, and a divisor of 1 will give 2 MBaud. Sub-integer divisors between 0 and 2 are not allowed. Therefore the value of the divisor needed for a given Baud rate is found by dividing 3000000 by the required Baud rate. @see FTDI AN232B-05 Configuring FT232R, FT2232 and FT232B Baud Rates
Data received callback Just pass received data to stdout
Device event callback Apart from handling device disconnection it doesn't do anything useful
USB Host library handling task
Start CDC device After this call, USB host peripheral will continuously poll IN endpoints.
Open USB device with requested VID/PID This function has two regular return paths: 1. USB device with matching VID/PID is already opened by this driver: allocate new CDC device on top of the already opened USB device. 2. USB device with matching VID/PID is NOT opened by this driver yet: poll USB connected devices until it is found.
CDC-ACM driver handling task USB host client registration and deregistration is handled here.
Notification received callback Notification (interrupt) IN transfer is submitted at the end of this function to ensure periodic poll of IN endpoint.
Data received callback Data (bulk) IN transfer is submitted at the end of this function to ensure continuous poll of IN endpoint.
USB Host Client event callback Handling of USB device connection/disconnection to/from root HUB.
Data send callback Reused for bulk OUT and CTRL transfers
Constructor for this CH34x driver
Set Control Line State method
Constructor for this CP210x driver
Get Line Coding method @see AN571: CP210x Virtual COM Port Interface chapters 5.6 and 5.8
Set Line Coding method @see AN571: CP210x Virtual COM Port Interface chapters 5.5 and 5.7
Set Control Line State method @see AN571: CP210x Virtual COM Port Interface chapter 5.9
Send Break method @see AN571: CP210x Virtual COM Port Interface chapter 5.20
Constructor for this FTDI driver
Set Control Line State method
Check finished transfer status Return to on transfer completed OK. Cancel the transfer and issue user's callback in case of an error.
Parse CDC functional descriptors @attention The driver must take care of memory freeing
Searches interface by index and verifies its CDC-compliance