change desc_str_table to array of pointer of uint8_t* to be compatible with IAR (lack of support for VLA initialization)

IAR device os none works with ea4357
This commit is contained in:
hathach 2014-03-10 14:20:38 +07:00
parent ad72db5aea
commit b586fe632a
8 changed files with 3933 additions and 951 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\device_os_none.ewp</path>
</project>
<batchBuild/>
</workspace>

View File

@ -396,43 +396,40 @@ app_descriptor_configuration_t app_tusb_desc_configuration =
// STRING DESCRIPTORS // STRING DESCRIPTORS
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define STRING_LEN_UNICODE(n) (2 + (2*(n))) // also includes 2 byte header #define STRING_LEN_UNICODE(n) (2 + (2*(n))) // also includes 2 byte header
#define ENDIAN_BE16_FROM( high, low) ENDIAN_BE16(high << 8 | low)
ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
tusb_descriptor_string_t desc_str_language = uint16_t desc_str_language[] =
{ {
.bLength = STRING_LEN_UNICODE(1), ENDIAN_BE16_FROM( STRING_LEN_UNICODE(1), TUSB_DESC_TYPE_STRING ),
.bDescriptorType = TUSB_DESC_TYPE_STRING, 0x0409
.unicode_string = { 0x0409 }
}; };
ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
tusb_descriptor_string_t desc_str_manufacturer = uint16_t desc_str_manufacturer[] =
{ {
.bLength = STRING_LEN_UNICODE(11), ENDIAN_BE16_FROM( STRING_LEN_UNICODE(11), TUSB_DESC_TYPE_STRING),
.bDescriptorType = TUSB_DESC_TYPE_STRING, 't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g' // len = 11
.unicode_string = { 't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g' } // len = 11
}; };
ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
tusb_descriptor_string_t desc_str_product = uint16_t desc_str_product[] =
{ {
.bLength = STRING_LEN_UNICODE(14), ENDIAN_BE16_FROM( STRING_LEN_UNICODE(14), TUSB_DESC_TYPE_STRING),
.bDescriptorType = TUSB_DESC_TYPE_STRING, 't', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'D', 'e', 'v', 'i', 'c', 'e' // len = 14
.unicode_string = { 't', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'D', 'e', 'v', 'i', 'c', 'e' } // len = 14
}; };
ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
tusb_descriptor_string_t desc_str_serial = uint16_t desc_str_serial[] =
{ {
.bLength = STRING_LEN_UNICODE(4), ENDIAN_BE16_FROM( STRING_LEN_UNICODE(4), TUSB_DESC_TYPE_STRING),
.bDescriptorType = TUSB_DESC_TYPE_STRING, '1', '2', '3', '4' // len = 4
.unicode_string = { '1', '2', '3', '4' } // len = 4
}; };
tusb_descriptor_string_t * const desc_str_table [TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT] = uint8_t* const desc_str_table [TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT] =
{ {
&desc_str_language, (uint8_t*) desc_str_language,
&desc_str_manufacturer, (uint8_t*) desc_str_manufacturer,
&desc_str_product, (uint8_t*) desc_str_product,
&desc_str_serial (uint8_t*) desc_str_serial
}; };

View File

@ -179,7 +179,7 @@ typedef ATTR_PACKED_STRUCT(struct)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// STRINGS DESCRIPTOR // STRINGS DESCRIPTOR
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
extern tusb_descriptor_string_t * const desc_str_table[TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT]; extern uint8_t * const desc_str_table[TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT];
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Export descriptors // Export descriptors

View File

@ -351,7 +351,7 @@ void dcd_pipe_control_stall(uint8_t coreid)
} }
// control transfer does not need to use qtd find function // control transfer does not need to use qtd find function
tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, void * p_buffer, uint16_t length, bool int_on_complete) tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
{ {
LPC_USB0_Type* const lpc_usb = LPC_USB[coreid]; LPC_USB0_Type* const lpc_usb = LPC_USB[coreid];
dcd_data_t* const p_dcd = dcd_data_ptr[coreid]; dcd_data_t* const p_dcd = dcd_data_ptr[coreid];
@ -485,12 +485,12 @@ static tusb_error_t pipe_add_xfer(endpoint_handle_t edpt_hdl, void * buffer, uin
return TUSB_ERROR_NONE; return TUSB_ERROR_NONE;
} }
tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes) tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
{ {
return pipe_add_xfer( edpt_hdl, buffer, total_bytes, false); return pipe_add_xfer( edpt_hdl, buffer, total_bytes, false);
} }
tusb_error_t dcd_pipe_xfer(endpoint_handle_t edpt_hdl, void* buffer, uint16_t total_bytes, bool int_on_complete) tusb_error_t dcd_pipe_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete)
{ {
ASSERT_STATUS ( pipe_add_xfer(edpt_hdl, buffer, total_bytes, int_on_complete) ); ASSERT_STATUS ( pipe_add_xfer(edpt_hdl, buffer, total_bytes, int_on_complete) );
@ -602,7 +602,7 @@ void dcd_isr(uint8_t coreid)
.class_code = 0 .class_code = 0
}; };
dcd_qtd_t * const p_qtd = &p_dcd->qhd[ (edpt_complete & BIT_(0)) ? 0 : 1 ].qtd_overlay; dcd_qtd_t volatile * const p_qtd = &p_dcd->qhd[ (edpt_complete & BIT_(0)) ? 0 : 1 ].qtd_overlay;
tusb_event_t event = ( p_qtd->xact_err || p_qtd->halted || p_qtd->buffer_err ) ? TUSB_EVENT_XFER_ERROR : TUSB_EVENT_XFER_COMPLETE; tusb_event_t event = ( p_qtd->xact_err || p_qtd->halted || p_qtd->buffer_err ) ? TUSB_EVENT_XFER_ERROR : TUSB_EVENT_XFER_COMPLETE;
usbd_xfer_isr(edpt_hdl, event, 0); // TODO xferred bytes for control xfer is not needed yet !!!! usbd_xfer_isr(edpt_hdl, event, 0); // TODO xferred bytes for control xfer is not needed yet !!!!

View File

@ -344,7 +344,7 @@ static tusb_error_t get_descriptor(uint8_t coreid, tusb_control_request_t const
if ( ! (desc_index < TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT) ) return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT; if ( ! (desc_index < TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT) ) return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
(*pp_buffer) = (uint8_t *) desc_str_table[desc_index]; (*pp_buffer) = (uint8_t *) desc_str_table[desc_index];
(*p_length) = desc_str_table[desc_index]->bLength; (*p_length) = **pp_buffer;
}else }else
{ {
return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT; return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;