diff options
| author | IngHK <[email protected]> | 2024-04-04 14:07:32 +0200 |
|---|---|---|
| committer | IngHK <[email protected]> | 2024-04-04 14:07:32 +0200 |
| commit | e2a56308110c1b3948441bec7ea71e397dfc1b49 (patch) | |
| tree | 904e3c19c3c5e0027f243e8aa3d247b72051e886 /src/class/cdc | |
| parent | 1bbd658352f5ecbfea13343df20cd02597dc31fd (diff) | |
| parent | 66cdf6d097d76f8d21ed4314651ac730d4023f99 (diff) | |
Merge remote-tracking branch 'remotes/hathach/master' into cdch_upgrade
Diffstat (limited to 'src/class/cdc')
| -rw-r--r-- | src/class/cdc/cdc_host.c | 18 | ||||
| -rw-r--r-- | src/class/cdc/cdc_host.h | 3 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index 6121e59f0..e6579ad82 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -717,12 +717,11 @@ bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const * line_coding, // CLASS-USBH API //--------------------------------------------------------------------+ -void cdch_init(void) { +bool cdch_init(void) { + TU_LOG_DRV("sizeof(cdch_interface_t) = %u\r\n", sizeof(cdch_interface_t)); tu_memclr(cdch_data, sizeof(cdch_data)); - for (size_t i = 0; i < CFG_TUH_CDC; i++) { - cdch_interface_t * p_cdc = &cdch_data[i]; - + cdch_interface_t* p_cdc = &cdch_data[i]; tu_edpt_stream_init(&p_cdc->stream.tx, true, true, false, p_cdc->stream.tx_ff_buf, CFG_TUH_CDC_TX_BUFSIZE, p_cdc->stream.tx_ep_buf, CFG_TUH_CDC_TX_EPSIZE); @@ -731,6 +730,17 @@ void cdch_init(void) { p_cdc->stream.rx_ff_buf, CFG_TUH_CDC_RX_BUFSIZE, p_cdc->stream.rx_ep_buf, CFG_TUH_CDC_RX_EPSIZE); } + + return true; +} + +bool cdch_deinit(void) { + for (size_t i = 0; i < CFG_TUH_CDC; i++) { + cdch_interface_t* p_cdc = &cdch_data[i]; + tu_edpt_stream_deinit(&p_cdc->stream.tx); + tu_edpt_stream_deinit(&p_cdc->stream.rx); + } + return true; } void cdch_close(uint8_t daddr) { diff --git a/src/class/cdc/cdc_host.h b/src/class/cdc/cdc_host.h index 77081d3b0..27f9170a8 100644 --- a/src/class/cdc/cdc_host.h +++ b/src/class/cdc/cdc_host.h @@ -188,7 +188,8 @@ TU_ATTR_WEAK extern void tuh_cdc_tx_complete_cb(uint8_t idx); //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ -void cdch_init (void); +bool cdch_init (void); +bool cdch_deinit (void); bool cdch_open (uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *itf_desc, uint16_t max_len); bool cdch_set_config (uint8_t dev_addr, uint8_t itf_num); bool cdch_xfer_cb (uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); |
