From d02ef073376d3f57cbaf9e494ffd27ee113f1cf6 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 1 Nov 2013 22:00:39 +0700 Subject: added support for - sense data scsi_sense_fixed_data_t - read format capacity scsi_read_format_capacity_data_t change msc device callback to support actual response fix dcd_pipe_clear_stall also reset toggle --- tinyusb/device/dcd.h | 4 +++- tinyusb/device/dcd_lpc43xx.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'tinyusb/device') diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 744c77bb7..b4205d542 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -93,7 +93,9 @@ endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes) ATTR_WARN_UNUSED_RESULT; // only queue, not transferring yet tusb_error_t dcd_pipe_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; tusb_error_t dcd_pipe_stall(endpoint_handle_t edpt_hdl) ATTR_WARN_UNUSED_RESULT; -tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr); // TODO coreid + endpoint address are part of endpoint handle, not endpoint handle + +// TODO coreid + endpoint address are part of endpoint handle, not endpoint handle, data toggle also need to be reset +tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr); #ifdef __cplusplus } diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c index f7a219ad8..c6231b1c0 100644 --- a/tinyusb/device/dcd_lpc43xx.c +++ b/tinyusb/device/dcd_lpc43xx.c @@ -360,6 +360,8 @@ tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) { volatile uint32_t * reg_control = (&LPC_USB0->ENDPTCTRL0) + edpt_phy2log( edpt_addr2phy(edpt_addr) ); + // data toggle also need to be reset + (*reg_control) |= ENDPTCTRL_MASK_TOGGLE_RESET << ((edpt_addr & TUSB_DIR_DEV_TO_HOST_MASK) ? 16 : 0); (*reg_control) &= ~(ENDPTCTRL_MASK_STALL << ((edpt_addr & TUSB_DIR_DEV_TO_HOST_MASK) ? 16 : 0)); return TUSB_ERROR_NONE; @@ -482,6 +484,7 @@ void xfer_complete_isr(uint8_t coreid, uint32_t reg_complete) //------------- Free QTD and shift array list -------------// p_qtd->used = 0; // free QTD memmove(p_qhd->list_qtd_idx, p_qhd->list_qtd_idx+1, DCD_QTD_PER_QHD_MAX-1); + p_qhd->list_qtd_idx[DCD_QTD_PER_QHD_MAX-1]=0; if (p_qtd->int_on_complete) { -- cgit v1.3.1