From 6fbca0ea8731b7f50a895ae5c62fc2bbedde2550 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 13 Mar 2014 18:25:20 +0700 Subject: [PATCH] remove legacy code of msc_device.c read10 & write10 clean up some warnings --- demos/host/src/cli.c | 18 +++++++----------- tinyusb/class/cdc_host.c | 7 +++---- tinyusb/class/msc_device.c | 8 ++++---- tinyusb/host/ehci/ehci.c | 12 +++++------- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/demos/host/src/cli.c b/demos/host/src/cli.c index b3bdb3967..1dd2aadd9 100644 --- a/demos/host/src/cli.c +++ b/demos/host/src/cli.c @@ -210,21 +210,16 @@ void cli_poll(char ch) char* p_para = (p_space == NULL) ? (cli_buffer+command_len) : (p_space+1); // point to NULL-character or after space //------------- Find entered command in lookup table & execute it -------------// - cli_cmdtype_t cmd_id; + uint32_t cmd_id; for(cmd_id = CLI_CMDTYPE_COUNT - 1; cmd_id > CLI_CMDTYPE_unknown; cmd_id--) { - if( 0 == strncmp(cli_buffer, cli_string_tbl[cmd_id], command_len) ) - { - break; - } + if( 0 == strncmp(cli_buffer, cli_string_tbl[cmd_id], command_len) ) break; } cli_error_t error = cli_command_tbl[cmd_id]( p_para ); // command execution, (unknown command if cannot find) if (CLI_ERROR_NONE != error) puts(cli_error_message[error]); // error message output if any - - //------------- print out current path -------------// - cli_command_prompt(); + cli_command_prompt(); // print out current path } else if (ch=='\t') // \t may be used for auto-complete later { @@ -247,7 +242,7 @@ cli_error_t cli_cmd_unknown(char * para) cli_error_t cli_cmd_help(char * para) { puts("current supported commands are:"); - for(cli_cmdtype_t cmd_id = CLI_CMDTYPE_help+1; cmd_id < CLI_CMDTYPE_COUNT; cmd_id++) + for(uint32_t cmd_id = CLI_CMDTYPE_help+1; cmd_id < CLI_CMDTYPE_COUNT; cmd_id++) { printf("%s\t%s\n", cli_string_tbl[cmd_id], cli_description_tbl[cmd_id]); } @@ -474,8 +469,9 @@ cli_error_t cli_cmd_remove(char *p_para) case FR_DENIED: printf("cannot remove readonly file/foler or non-empty folder\n"); - - default: return CLI_ERROR_FAILED; + break; + + default: break; } return CLI_ERROR_FAILED; diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index fc93fe565..7bfa30371 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -155,8 +155,6 @@ void cdch_init(void) tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) { - tusb_error_t error; - OSAL_SUBTASK_BEGIN if ( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL != p_interface_desc->bInterfaceSubClass) return TUSB_ERROR_CDC_UNSUPPORTED_SUBCLASS; @@ -226,6 +224,8 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con //------------- RNDIS -------------// if ( 0xff == cdch_data[dev_addr-1].interface_protocol && pipehandle_is_valid(cdch_data[dev_addr-1].pipe_notification) ) { + tusb_error_t error; + cdch_data[dev_addr-1].is_rndis = true; // set as true at first OSAL_SUBTASK_INVOKED_AND_WAIT( rndish_open_subtask(dev_addr, &cdch_data[dev_addr-1]), error ); @@ -248,9 +248,8 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) { - cdch_data_t *p_cdc = &cdch_data[pipe_hdl.dev_addr - 1]; - #if TUSB_CFG_HOST_CDC_RNDIS + cdch_data_t *p_cdc = &cdch_data[pipe_hdl.dev_addr - 1]; if ( p_cdc->is_rndis ) { rndish_xfer_isr(p_cdc, pipe_hdl, event, xferred_bytes); diff --git a/tinyusb/class/msc_device.c b/tinyusb/class/msc_device.c index 77ce2edc8..265051606 100644 --- a/tinyusb/class/msc_device.c +++ b/tinyusb/class/msc_device.c @@ -199,10 +199,10 @@ tusb_error_t mscd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32 //------------- Data Phase For READ10 & WRITE10 (can be executed several times) -------------// if ( (SCSI_CMD_READ_10 == p_cbw->command[0]) || (SCSI_CMD_WRITE_10 == p_cbw->command[0]) ) { - if (is_waiting_read10_write10) - { // continue with read10, write10 data transfer, interrupt must come from endpoint IN - ASSERT( endpointhandle_is_equal(p_msc->edpt_in, edpt_hdl) && event == TUSB_EVENT_XFER_COMPLETE, TUSB_ERROR_INVALID_PARA); - } +// if (is_waiting_read10_write10) +// { // continue with read10, write10 data transfer, interrupt must come from endpoint IN +// ASSERT( endpointhandle_is_equal(p_msc->edpt_in, edpt_hdl) && event == TUSB_EVENT_XFER_COMPLETE, TUSB_ERROR_INVALID_PARA); +// } is_waiting_read10_write10 = !read10_write10_data_xfer(p_msc); } diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index c20112d73..213876f3e 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -621,12 +621,11 @@ static void period_list_xfer_complete_isr(uint8_t hostid, uint8_t interval_ms) } break; - case EHCI_QUEUE_ELEMENT_ITD: + case EHCI_QUEUE_ELEMENT_ITD: // TODO support hs/fs ISO case EHCI_QUEUE_ELEMENT_SITD: case EHCI_QUEUE_ELEMENT_FSTN: - default: - ASSERT (false, VOID_RETURN); // TODO support hs/fs ISO - break; + + default: break; } next_item = *list_next(&next_item); @@ -717,12 +716,11 @@ static void xfer_error_isr(uint8_t hostid) } break; + // TODO support hs/fs ISO case EHCI_QUEUE_ELEMENT_ITD: case EHCI_QUEUE_ELEMENT_SITD: case EHCI_QUEUE_ELEMENT_FSTN: - default: - ASSERT (false, VOID_RETURN); // TODO support hs/fs ISO - break; + default: break; } next_item = *list_next(&next_item);