mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
update endian
This commit is contained in:
parent
c4da1abb1e
commit
8cd23489d5
@ -953,11 +953,10 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
|
||||
|
||||
tusb_desc_bos_t const* desc_bos = (tusb_desc_bos_t const*) tud_descriptor_bos_cb();
|
||||
|
||||
uint16_t total_len;
|
||||
// Use offsetof to avoid pointer to the odd/misaligned address
|
||||
memcpy(&total_len, (uint8_t*) desc_bos + offsetof(tusb_desc_bos_t, wTotalLength), 2);
|
||||
uint16_t const total_len = tu_le16toh( tu_unaligned_read16((uint8_t*) desc_bos + offsetof(tusb_desc_bos_t, wTotalLength)) );
|
||||
|
||||
return tud_control_xfer(rhport, p_request, (void*) desc_bos, tu_le16toh(total_len));
|
||||
return tud_control_xfer(rhport, p_request, (void*) desc_bos, total_len);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -968,11 +967,10 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
|
||||
tusb_desc_configuration_t const* desc_config = (tusb_desc_configuration_t const*) tud_descriptor_configuration_cb(desc_index);
|
||||
TU_ASSERT(desc_config);
|
||||
|
||||
uint16_t total_len;
|
||||
// Use offsetof to avoid pointer to the odd/misaligned address
|
||||
memcpy(&total_len, (uint8_t*) desc_config + offsetof(tusb_desc_configuration_t, wTotalLength), 2);
|
||||
uint16_t const total_len = tu_le16toh( tu_unaligned_read16((uint8_t*) desc_config + offsetof(tusb_desc_configuration_t, wTotalLength)) );
|
||||
|
||||
return tud_control_xfer(rhport, p_request, (void*) desc_config, tu_le16toh(total_len));
|
||||
return tud_control_xfer(rhport, p_request, (void*) desc_config, total_len);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -58,7 +58,6 @@ static usbd_control_xfer_t _ctrl_xfer;
|
||||
CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN
|
||||
static uint8_t _usbd_ctrl_buf[CFG_TUD_ENDPOINT0_SIZE];
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Application API
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -95,7 +95,10 @@
|
||||
#define FIFO_REQ_CLR (1u)
|
||||
#define FIFO_COMPLETE (1u<<1)
|
||||
|
||||
// Start of definition of packed structs (used by the CCRX toolchain)
|
||||
TU_ATTR_PACKED_BEGIN
|
||||
TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
@ -108,9 +111,7 @@ typedef struct {
|
||||
};
|
||||
uint16_t TRN;
|
||||
} reg_pipetre_t;
|
||||
TU_ATTR_BIT_FIELD_ORDER_END
|
||||
|
||||
TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||
typedef union {
|
||||
struct {
|
||||
volatile uint16_t u8: 8;
|
||||
@ -118,11 +119,7 @@ typedef union {
|
||||
};
|
||||
volatile uint16_t u16;
|
||||
} hw_fifo_t;
|
||||
TU_ATTR_BIT_FIELD_ORDER_END
|
||||
|
||||
TU_ATTR_PACKED_BEGIN // Start of definition of packed structs (used by the CCRX toolchain)
|
||||
|
||||
TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||
typedef struct TU_ATTR_PACKED
|
||||
{
|
||||
uintptr_t addr; /* the start address of a transfer data buffer */
|
||||
@ -133,9 +130,9 @@ typedef struct TU_ATTR_PACKED
|
||||
uint32_t : 0;
|
||||
};
|
||||
} pipe_state_t;
|
||||
TU_ATTR_BIT_FIELD_ORDER_END
|
||||
|
||||
TU_ATTR_PACKED_END // End of definition of packed structs (used by the CCRX toolchain)
|
||||
TU_ATTR_BIT_FIELD_ORDER_END
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -147,7 +144,7 @@ typedef struct
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
CFG_TUSB_MEM_SECTION static dcd_data_t _dcd;
|
||||
static dcd_data_t _dcd;
|
||||
|
||||
static uint32_t disable_interrupt(void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user