Class internal implementation.
Data Structures | |
struct | uhi_cdc_buf_t |
Internal buffer information. More... | |
struct | uhi_cdc_dev_t |
USB CDC device information. More... | |
struct | uhi_cdc_line_t |
Communication line information. More... | |
struct | uhi_cdc_port_t |
Communication port information. More... | |
Internal defines and variables to manage CDC device | |
static uhi_cdc_dev_t | uhi_cdc_dev |
Information about the enumerated USB CDC device. More... | |
Internal routines | |
static void | uhi_cdc_free_device (void) |
Free all CDC device structures. More... | |
static uhi_cdc_port_t * | uhi_cdc_get_port (uint8_t port_num) |
Returns a port structure information. More... | |
static bool | uhi_cdc_set_conf (uint8_t port, usb_cdc_line_coding_t *configuration) |
Changes the port configuration. More... | |
static bool | uhi_cdc_set_ctrl_line (uint8_t port, le16_t wValue) |
Sends a control line command on the port. More... | |
static bool | uhi_cdc_rx_update (uhi_cdc_line_t *line) |
Update the transfer endpoint IN (RX) Valid the reception of the previous transfer. More... | |
static void | uhi_cdc_rx_received (usb_add_t add, usb_ep_t ep, uhd_trans_status_t status, iram_size_t nb_transferred) |
Manage the end of RX transfer. More... | |
static bool | uhi_cdc_tx_update (uhi_cdc_line_t *line) |
Update the transfer endpoint OUT (TX) Start a new transfer on endpoint OUT, if a data must be send and a new USB frame is occurred since last transfer. More... | |
static void | uhi_cdc_tx_send (usb_add_t add, usb_ep_t ep, uhd_trans_status_t status, iram_size_t nb_transferred) |
Manage the end of TX transfer. More... | |
|
static |
Free all CDC device structures.
References uhi_cdc_line_t::buffer, uhi_cdc_port_t::line_rx, uhi_cdc_port_t::line_tx, uhi_cdc_dev_t::nb_port, NULL, uhi_cdc_dev_t::port, and uhi_cdc_buf_t::ptr.
Referenced by uhi_cdc_install(), and uhi_cdc_uninstall().
|
static |
Returns a port structure information.
port_num | Number of port |
References uhi_cdc_dev_t::dev, uhi_cdc_dev_t::nb_port, NULL, and uhi_cdc_dev_t::port.
Referenced by uhi_cdc_get_nb_received(), uhi_cdc_getc(), uhi_cdc_is_tx_ready(), uhi_cdc_putc(), uhi_cdc_read_buf(), uhi_cdc_rx_received(), uhi_cdc_set_conf(), uhi_cdc_set_ctrl_line(), uhi_cdc_sof(), uhi_cdc_tx_send(), and uhi_cdc_write_buf().
|
static |
Manage the end of RX transfer.
Registered by uhd_ep_run() Callback called by USB interrupt after data transfer or abort (reset,...).
add | USB address used by the transfer |
status | Transfer status |
nb_transferred | Number of data transfered |
References uhi_cdc_line_t::b_trans_ongoing, uhi_cdc_line_t::buf_sel, uhi_cdc_line_t::buffer, uhi_cdc_line_t::buffer_size, uhi_cdc_dev_t::dev, uhi_cdc_line_t::ep_data, uhi_cdc_port_t::line_rx, uhi_cdc_buf_t::nb, NULL, uhi_cdc_buf_t::pos, uhi_cdc_line_t::sof, uhc_device_t::speed, uhd_get_frame_number(), uhd_get_microframe_number(), UHD_SPEED_HIGH, UHD_TRANS_NOERROR, UHD_TRANS_TIMEOUT, uhi_cdc_get_port(), uhi_cdc_rx_update(), and UNUSED.
Referenced by uhi_cdc_rx_update().
|
static |
Update the transfer endpoint IN (RX) Valid the reception of the previous transfer.
Start a new transfer on endpoint IN, if a RX buffer is free and a new USB frame is occurred since last transfer.
line | RX communication line to manage |
References uhc_device_t::address, uhi_cdc_line_t::b_trans_ongoing, uhi_cdc_line_t::buf_sel, uhi_cdc_line_t::buffer, uhi_cdc_line_t::buffer_size, cpu_irq_restore(), cpu_irq_save(), uhi_cdc_dev_t::dev, uhi_cdc_line_t::ep_data, uhi_cdc_buf_t::nb, uhi_cdc_buf_t::pos, uhi_cdc_buf_t::ptr, uhi_cdc_line_t::sof, uhc_device_t::speed, uhd_ep_run(), uhd_get_frame_number(), uhd_get_microframe_number(), UHD_SPEED_HIGH, UHI_CDC_RX_NOTIFY, and uhi_cdc_rx_received().
Referenced by uhi_cdc_getc(), uhi_cdc_read_buf(), uhi_cdc_rx_received(), and uhi_cdc_sof().
|
static |
Changes the port configuration.
port_num | Number of port |
configuration | Pointer on new configuration |
References uhc_device_t::address, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhi_cdc_port_t::conf, uhi_cdc_dev_t::dev, uhi_cdc_port_t::iface_comm, NULL, uhd_setup_request(), uhi_cdc_get_port(), USB_REQ_CDC_SET_LINE_CODING, USB_REQ_DIR_OUT, USB_REQ_RECIP_INTERFACE, USB_REQ_TYPE_CLASS, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhi_cdc_open().
Sends a control line command on the port.
port_num | Number of port |
wValue | USB CDC control line word |
References uhc_device_t::address, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhi_cdc_dev_t::dev, uhi_cdc_port_t::iface_comm, NULL, uhd_setup_request(), uhi_cdc_get_port(), USB_REQ_CDC_SET_CONTROL_LINE_STATE, USB_REQ_DIR_OUT, USB_REQ_RECIP_INTERFACE, USB_REQ_TYPE_CLASS, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.
Referenced by uhi_cdc_close(), and uhi_cdc_open().
|
static |
Manage the end of TX transfer.
Registered by uhd_ep_run() Callback called by USB interrupt after data transfer or abort (reset,...).
add | USB address used by the transfer |
status | Transfer status |
nb_transferred | Number of data transfered |
References uhi_cdc_line_t::b_trans_ongoing, uhi_cdc_line_t::buf_sel, uhi_cdc_line_t::buffer, uhi_cdc_line_t::buffer_size, cpu_irq_restore(), cpu_irq_save(), uhi_cdc_dev_t::dev, uhi_cdc_line_t::ep_data, uhi_cdc_port_t::line_tx, uhi_cdc_buf_t::nb, NULL, uhi_cdc_line_t::sof, uhc_device_t::speed, uhd_get_frame_number(), uhd_get_microframe_number(), UHD_SPEED_HIGH, UHD_TRANS_NOERROR, uhi_cdc_get_port(), uhi_cdc_tx_update(), and UNUSED.
Referenced by uhi_cdc_tx_update().
|
static |
Update the transfer endpoint OUT (TX) Start a new transfer on endpoint OUT, if a data must be send and a new USB frame is occurred since last transfer.
line | TX communication line to manage |
References uhc_device_t::address, uhi_cdc_line_t::b_trans_ongoing, uhi_cdc_line_t::buf_sel, uhi_cdc_line_t::buffer, cpu_irq_restore(), cpu_irq_save(), uhi_cdc_dev_t::dev, uhi_cdc_line_t::ep_data, uhi_cdc_buf_t::nb, uhi_cdc_buf_t::ptr, uhi_cdc_line_t::sof, uhc_device_t::speed, uhd_ep_run(), uhd_get_frame_number(), uhd_get_microframe_number(), UHD_SPEED_HIGH, and uhi_cdc_tx_send().
Referenced by uhi_cdc_sof(), and uhi_cdc_tx_send().
|
static |