house keeping, clean up warnings

This commit is contained in:
hathach
2013-09-21 14:28:59 +07:00
parent d15ba08fdc
commit 5708863859
13 changed files with 121 additions and 69 deletions

View File

@@ -224,10 +224,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
#endif
{
// FIXME mounted class flag is not set yet
if (tusbh_cdc_mounted_cb)
{
tusbh_cdc_mounted_cb(dev_addr);
}
tusbh_cdc_mounted_cb(dev_addr);
}
OSAL_SUBTASK_END
@@ -243,15 +240,12 @@ void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
rndish_xfer_isr(p_cdc, pipe_hdl, event, xferred_bytes);
} else
#endif
if (tusbh_cdc_xfer_isr)
{
tusbh_cdc_xfer_isr( pipe_hdl.dev_addr, event, get_app_pipeid(pipe_hdl), xferred_bytes );
}
tusbh_cdc_xfer_isr( pipe_hdl.dev_addr, event, get_app_pipeid(pipe_hdl), xferred_bytes );
}
void cdch_close(uint8_t dev_addr)
{
tusb_error_t err1, err2, err3;
cdch_data_t * p_cdc = &cdch_data[dev_addr-1];
#if TUSB_CFG_HOST_CDC_RNDIS
@@ -261,20 +255,9 @@ void cdch_close(uint8_t dev_addr)
}
#endif
if ( pipehandle_is_valid(p_cdc->pipe_notification) )
{
err1 = hcd_pipe_close(p_cdc->pipe_notification);
}
if ( pipehandle_is_valid(p_cdc->pipe_in) )
{
err2 = hcd_pipe_close(p_cdc->pipe_in);
}
if ( pipehandle_is_valid(p_cdc->pipe_out) )
{
err3 = hcd_pipe_close(p_cdc->pipe_out);
}
(void) hcd_pipe_close(p_cdc->pipe_notification);
(void) hcd_pipe_close(p_cdc->pipe_in);
(void) hcd_pipe_close(p_cdc->pipe_out);
#if TUSB_CFG_HOST_CDC_RNDIS
@@ -282,14 +265,7 @@ void cdch_close(uint8_t dev_addr)
memclr_(p_cdc, sizeof(cdch_data_t));
if (tusbh_cdc_unmounted_isr)
{
tusbh_cdc_unmounted_isr(dev_addr);
}
ASSERT(err1 == TUSB_ERROR_NONE &&
err2 == TUSB_ERROR_NONE &&
err3 == TUSB_ERROR_NONE, VOID_RETURN );
tusbh_cdc_unmounted_isr(dev_addr);
}

View File

@@ -244,10 +244,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
if ( HID_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
{
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &keyboardh_data[dev_addr-1]) );
if ( tusbh_hid_keyboard_mounted_cb )
{
tusbh_hid_keyboard_mounted_cb(dev_addr);
}
tusbh_hid_keyboard_mounted_cb(dev_addr);
} else
#endif
@@ -255,10 +252,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
if ( HID_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
{
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &mouseh_data[dev_addr-1]) );
if (tusbh_hid_mouse_mounted_cb)
{
tusbh_hid_mouse_mounted_cb(dev_addr);
}
tusbh_hid_mouse_mounted_cb(dev_addr);
} else
#endif
@@ -281,10 +275,7 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
if ( pipehandle_is_equal(pipe_hdl, keyboardh_data[pipe_hdl.dev_addr-1].pipe_hdl) )
{
keyboardh_data[pipe_hdl.dev_addr-1].status = (event == TUSB_EVENT_XFER_COMPLETE) ? TUSB_INTERFACE_STATUS_COMPLETE : TUSB_INTERFACE_STATUS_ERROR;
if (tusbh_hid_keyboard_isr)
{
tusbh_hid_keyboard_isr(pipe_hdl.dev_addr, event);
}
tusbh_hid_keyboard_isr(pipe_hdl.dev_addr, event);
return;
}
#endif
@@ -293,11 +284,7 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
if ( pipehandle_is_equal(pipe_hdl, mouseh_data[pipe_hdl.dev_addr-1].pipe_hdl) )
{
mouseh_data[pipe_hdl.dev_addr-1].status = (event == TUSB_EVENT_XFER_COMPLETE) ? TUSB_INTERFACE_STATUS_COMPLETE : TUSB_INTERFACE_STATUS_ERROR;
if (tusbh_hid_mouse_isr)
{
tusbh_hid_mouse_isr(pipe_hdl.dev_addr, event);
}
tusbh_hid_mouse_isr(pipe_hdl.dev_addr, event);
return;
}
#endif

View File

@@ -94,7 +94,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
}
//------------- Open Data Pipe -------------//
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( p_interface_desc );
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_interface_desc );
for(uint32_t i=0; i<2; i++)
{
ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED);
@@ -105,7 +105,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
(*p_pipe_hdl) = hcd_pipe_open(dev_addr, p_endpoint, TUSB_CLASS_MSC);
ASSERT ( pipehandle_is_valid(*p_pipe_hdl), TUSB_ERROR_HCD_OPEN_PIPE_FAILED );
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( p_endpoint );
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( (uint8_t const*) p_endpoint );
}
msch_data[dev_addr-1].interface_number = p_interface_desc->bInterfaceNumber;
@@ -119,8 +119,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
error
);
SUBTASK_ASSERT( TUSB_ERROR_NONE != error /* && TODO STALL means zero */);
SUBTASK_ASSERT( TUSB_ERROR_NONE == error /* && TODO STALL means zero */);
msch_data[dev_addr-1].max_lun = msch_buffer[0];
//------------- SCSI Inquiry -------------//
@@ -133,7 +132,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
return TUSB_ERROR_NONE;
}
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event)
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes)
{
}

View File

@@ -77,7 +77,7 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr);
void msch_init(void);
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event);
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
void msch_close(uint8_t dev_addr);
#endif