fix warning for device os none

This commit is contained in:
hathach 2014-03-14 17:18:05 +07:00
parent b545544c32
commit 4cdebe2e76
5 changed files with 34 additions and 27 deletions

View File

@ -8,7 +8,7 @@
<macros> <macros>
<stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/> <stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/>
<stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/> <stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/>
<stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked"/> <stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wnested-externs -Wredundant-decls -Winline"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>
@ -99,7 +99,7 @@
<macros> <macros>
<stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/> <stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/>
<stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/> <stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/>
<stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked"/> <stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wnested-externs -Wredundant-decls -Winline"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>
@ -190,7 +190,7 @@
<macros> <macros>
<stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/> <stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/>
<stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/> <stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/>
<stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked"/> <stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wnested-externs -Wredundant-decls -Winline"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>
@ -285,7 +285,7 @@
<macros> <macros>
<stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/> <stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/>
<stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/> <stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/>
<stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked"/> <stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wnested-externs -Wredundant-decls -Winline"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>
@ -376,7 +376,7 @@
<macros> <macros>
<stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/> <stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/>
<stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/> <stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/>
<stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked"/> <stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wnested-externs -Wredundant-decls -Winline"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>
@ -471,7 +471,7 @@
<macros> <macros>
<stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/> <stringMacro name="CFLAGS_OFF" type="VALUE_TEXT" value=""/>
<stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/> <stringMacro name="CFLAGS" type="VALUE_TEXT" value="${CFLAGS_OFF}"/>
<stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-pedantic -Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wpadded -Wnested-externs -Wredundant-decls -Winline -Wpacked"/> <stringMacro name="CFLAGS_ON" type="VALUE_TEXT" value="-Wextra -Wswitch-default -Wunsafe-loop-optimizations -Wcast-align -Wlogical-op -Wpacked-bitfield-compat -Wnested-externs -Wredundant-decls -Winline"/>
</macros> </macros>
<externalSettings/> <externalSettings/>
<extensions> <extensions>

View File

@ -108,8 +108,6 @@ int main(void)
#error need to start RTOS schduler #error need to start RTOS schduler
#endif #endif
while(1) { } // should not reach here
return 0; return 0;
} }
@ -133,7 +131,9 @@ OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para)
board_leds(led_on_mask, 1 - led_on_mask); board_leds(led_on_mask, 1 - led_on_mask);
led_on_mask = 1 - led_on_mask; // toggle led_on_mask = 1 - led_on_mask; // toggle
uint32_t btn_mask = board_buttons(); uint32_t btn_mask;
btn_mask = board_buttons();
for(uint8_t i=0; i<32; i++) for(uint8_t i=0; i<32; i++)
{ {
if ( BIT_TEST_(btn_mask, i) ) printf("button %d is pressed\n", i); if ( BIT_TEST_(btn_mask, i) ) printf("button %d is pressed\n", i);

View File

@ -87,7 +87,7 @@ void dcd_pipe_control_stall(uint8_t coreid);
endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT; endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT;
tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes) ATTR_WARN_UNUSED_RESULT; // only queue, not transferring yet tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, uint8_t * 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, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; tusb_error_t dcd_pipe_xfer(endpoint_handle_t edpt_hdl, uint8_t * 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_stall(endpoint_handle_t edpt_hdl);
bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl) ATTR_WARN_UNUSED_RESULT ; bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl) ATTR_WARN_UNUSED_RESULT ;
// TODO coreid + endpoint address are part of endpoint handle, not endpoint handle, data toggle also need to be reset // TODO coreid + endpoint address are part of endpoint handle, not endpoint handle, data toggle also need to be reset

View File

@ -55,7 +55,7 @@
usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER]; usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
// TODO fix/compress number of class driver // TODO fix/compress number of class driver
static usbd_class_driver_t const usbd_class_drivers[TUSB_CLASS_MAPPED_INDEX_START] = static usbd_class_driver_t const usbd_class_drivers[] =
{ {
#if DEVICE_CLASS_HID #if DEVICE_CLASS_HID
[TUSB_CLASS_HID] = [TUSB_CLASS_HID] =
@ -92,6 +92,10 @@ static usbd_class_driver_t const usbd_class_drivers[TUSB_CLASS_MAPPED_INDEX_STAR
}; };
enum {
USBD_CLASS_DRIVER_COUNT = sizeof(usbd_class_drivers) / sizeof(usbd_class_driver_t)
};
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION // INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@ -150,7 +154,8 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
{ {
OSAL_SUBTASK_BEGIN OSAL_SUBTASK_BEGIN
tusb_error_t error = TUSB_ERROR_NONE; tusb_error_t error;
error = TUSB_ERROR_NONE;
//------------- Standard Control such as those in enumeration -------------// //------------- Standard Control such as those in enumeration -------------//
if( TUSB_REQUEST_RECIPIENT_DEVICE == p_request->bmRequestType_bit.recipient && if( TUSB_REQUEST_RECIPIENT_DEVICE == p_request->bmRequestType_bit.recipient &&
@ -165,7 +170,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
if ( TUSB_ERROR_NONE == error ) if ( TUSB_ERROR_NONE == error )
{ {
dcd_pipe_control_xfer(coreid, p_request->bmRequestType_bit.direction, p_buffer, length, false); dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, p_buffer, length, false);
} }
} }
else if ( TUSB_REQUEST_SET_ADDRESS == p_request->bRequest ) else if ( TUSB_REQUEST_SET_ADDRESS == p_request->bRequest )
@ -185,11 +190,12 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
//------------- Class/Interface Specific Request -------------// //------------- Class/Interface Specific Request -------------//
else if ( TUSB_REQUEST_RECIPIENT_INTERFACE == p_request->bmRequestType_bit.recipient) else if ( TUSB_REQUEST_RECIPIENT_INTERFACE == p_request->bmRequestType_bit.recipient)
{ {
OSAL_VAR tusb_std_class_code_t class_code; OSAL_VAR uint8_t class_code;
class_code = usbd_devices[coreid].interface2class[ u16_low_u8(p_request->wIndex) ]; class_code = usbd_devices[coreid].interface2class[ u16_low_u8(p_request->wIndex) ];
if ( (TUSB_CLASS_AUDIO <= class_code) && (class_code <= TUSB_CLASS_AUDIO_VIDEO) && // TODO [Custom] TUSB_CLASS_DIAGNOSTIC, vendor etc ...
if ( (class_code > 0) && (class_code < USBD_CLASS_DRIVER_COUNT) &&
usbd_class_drivers[class_code].control_request_subtask ) usbd_class_drivers[class_code].control_request_subtask )
{ {
OSAL_SUBTASK_INVOKED_AND_WAIT( usbd_class_drivers[class_code].control_request_subtask(coreid, p_request), error ); OSAL_SUBTASK_INVOKED_AND_WAIT( usbd_class_drivers[class_code].control_request_subtask(coreid, p_request), error );
@ -216,7 +222,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
// ASSERT(error == TUSB_ERROR_NONE, VOID_RETURN); // ASSERT(error == TUSB_ERROR_NONE, VOID_RETURN);
}else if (p_request->wLength == 0) }else if (p_request->wLength == 0)
{ {
dcd_pipe_control_xfer(coreid, p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
} }
OSAL_SUBTASK_END OSAL_SUBTASK_END
@ -230,7 +236,8 @@ OSAL_TASK_FUNCTION(usbd_task) (void* p_task_para)
OSAL_TASK_LOOP_BEGIN OSAL_TASK_LOOP_BEGIN
OSAL_VAR usbd_task_event_t event; OSAL_VAR usbd_task_event_t event;
tusb_error_t error = TUSB_ERROR_NONE; tusb_error_t error;
error = TUSB_ERROR_NONE;
osal_queue_receive(usbd_queue_hdl, &event, OSAL_TIMEOUT_WAIT_FOREVER, &error); osal_queue_receive(usbd_queue_hdl, &event, OSAL_TIMEOUT_WAIT_FOREVER, &error);
SUBTASK_ASSERT_STATUS(error); SUBTASK_ASSERT_STATUS(error);
@ -245,7 +252,7 @@ OSAL_TASK_FUNCTION(usbd_task) (void* p_task_para)
if (usbd_class_drivers[class_index].xfer_cb) if (usbd_class_drivers[class_index].xfer_cb)
{ {
usbd_class_drivers[class_index].xfer_cb( event.xfer_done.edpt_hdl, event.sub_event_id, event.xfer_done.xferred_byte); usbd_class_drivers[class_index].xfer_cb( event.xfer_done.edpt_hdl, (tusb_event_t) event.sub_event_id, event.xfer_done.xferred_byte);
}else }else
{ {
hal_debugger_breakpoint(); // something wrong, no one claims the isr's source hal_debugger_breakpoint(); // something wrong, no one claims the isr's source
@ -326,7 +333,7 @@ static tusb_error_t usbd_set_configure_received(uint8_t coreid, uint8_t config_n
static tusb_error_t get_descriptor(uint8_t coreid, tusb_control_request_t const * const p_request, uint8_t ** pp_buffer, uint16_t * p_length) static tusb_error_t get_descriptor(uint8_t coreid, tusb_control_request_t const * const p_request, uint8_t ** pp_buffer, uint16_t * p_length)
{ {
tusb_std_descriptor_type_t const desc_type = u16_high_u8(p_request->wValue); tusb_std_descriptor_type_t const desc_type = (tusb_std_descriptor_type_t) u16_high_u8(p_request->wValue);
uint8_t const desc_index = u16_low_u8( p_request->wValue ); uint8_t const desc_index = u16_low_u8( p_request->wValue );
if ( TUSB_DESC_TYPE_DEVICE == desc_type ) if ( TUSB_DESC_TYPE_DEVICE == desc_type )