diff options
| author | hathach <[email protected]> | 2013-07-02 17:20:25 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-07-02 17:20:25 +0700 |
| commit | e1ad7b62cf453735b3f8b9d97abe2b3e6579a099 (patch) | |
| tree | f90caee82c921b0b62c8ebaa19352eb28f72d245 /tinyusb | |
| parent | 6ce90e2bd8d1599df22af8dc670d4187a1ec6dc5 (diff) | |
add way to calculate the actual byte transferred with ehci
add come callback for cdch
add code for cdc serial demo
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/class/cdc_host.c | 21 | ||||
| -rw-r--r-- | tinyusb/host/ehci/ehci.c | 1 |
2 files changed, 19 insertions, 3 deletions
diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index 1520656fe..867dddeb8 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -76,7 +76,7 @@ bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr) tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool is_notify) { - ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); +// FIXME disable temp ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); ASSERT( p_data != NULL && length, TUSB_ERROR_INVALID_PARA); pipe_handle_t pipe_out = cdch_data[dev_addr-1].pipe_out; @@ -90,7 +90,7 @@ tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t leng tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify) { - ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); +// FIXME disable temp ASSERT( tusbh_cdc_is_mounted(dev_addr), TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED); ASSERT( p_buffer != NULL && length, TUSB_ERROR_INVALID_PARA); pipe_handle_t pipe_in = cdch_data[dev_addr-1].pipe_in; @@ -177,12 +177,21 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con } } + // FIXME mounted class flag is not set yet + if (tusbh_cdc_isr) + { + tusbh_cdc_isr(dev_addr, TUSB_EVENT_INTERFACE_OPEN); + } + return TUSB_ERROR_NONE; } void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event) { - + if (tusbh_cdc_isr) + { + tusbh_cdc_isr(pipe_hdl.dev_addr, event); + } } void cdch_close(uint8_t dev_addr) @@ -208,9 +217,15 @@ void cdch_close(uint8_t dev_addr) memclr_(p_cdc, sizeof(cdch_data_t)); + if (tusbh_cdc_isr) + { + tusbh_cdc_isr(dev_addr, TUSB_EVENT_INTERFACE_CLOSE); + } + ASSERT(err1 == TUSB_ERROR_NONE && err2 == TUSB_ERROR_NONE && err3 == TUSB_ERROR_NONE, (void) 0 ); + } #endif diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index 3e75c265a..c016a3a3c 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -938,6 +938,7 @@ static void qtd_init(ehci_qtd_t* p_qtd, uint32_t data_ptr, uint16_t total_bytes) p_qtd->cerr = 3; // TODO 3 consecutive errors tolerance p_qtd->data_toggle = 0; p_qtd->total_bytes = total_bytes; + p_qtd->expected_bytes = total_bytes; p_qtd->buffer[0] = data_ptr; for(uint8_t i=1; i<5; i++) |
