mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-18 20:42:24 +00:00
clean up compiler
This commit is contained in:
parent
8cd23489d5
commit
15112fdbba
@ -245,7 +245,7 @@ typedef struct TU_ATTR_PACKED
|
|||||||
uint8_t bDescriptorSubType ;\
|
uint8_t bDescriptorSubType ;\
|
||||||
uint8_t bControlInterface ;\
|
uint8_t bControlInterface ;\
|
||||||
uint8_t bSubordinateInterface[no_slave] ;\
|
uint8_t bSubordinateInterface[no_slave] ;\
|
||||||
} \
|
}
|
||||||
|
|
||||||
/// Country Selection Functional Descriptor (Communication Interface)
|
/// Country Selection Functional Descriptor (Communication Interface)
|
||||||
typedef struct TU_ATTR_PACKED
|
typedef struct TU_ATTR_PACKED
|
||||||
@ -264,7 +264,7 @@ typedef struct TU_ATTR_PACKED
|
|||||||
uint8_t bDescriptorSubType ;\
|
uint8_t bDescriptorSubType ;\
|
||||||
uint8_t iCountryCodeRelDate ;\
|
uint8_t iCountryCodeRelDate ;\
|
||||||
uint16_t wCountryCode[no_country] ;\
|
uint16_t wCountryCode[no_country] ;\
|
||||||
} \
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// PUBLIC SWITCHED TELEPHONE NETWORK (PSTN) SUBCLASS
|
// PUBLIC SWITCHED TELEPHONE NETWORK (PSTN) SUBCLASS
|
||||||
|
@ -81,7 +81,6 @@
|
|||||||
|
|
||||||
#define TU_ATTR_PACKED_BEGIN
|
#define TU_ATTR_PACKED_BEGIN
|
||||||
#define TU_ATTR_PACKED_END
|
#define TU_ATTR_PACKED_END
|
||||||
|
|
||||||
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||||
#define TU_ATTR_BIT_FIELD_ORDER_END
|
#define TU_ATTR_BIT_FIELD_ORDER_END
|
||||||
|
|
||||||
@ -109,6 +108,11 @@
|
|||||||
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
||||||
#define TU_ATTR_USED __attribute__ ((used))
|
#define TU_ATTR_USED __attribute__ ((used))
|
||||||
|
|
||||||
|
#define TU_ATTR_PACKED_BEGIN
|
||||||
|
#define TU_ATTR_PACKED_END
|
||||||
|
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||||
|
#define TU_ATTR_BIT_FIELD_ORDER_END
|
||||||
|
|
||||||
// __BYTE_ORDER is defined in the TI ARM compiler, but not MSP430 (which is little endian)
|
// __BYTE_ORDER is defined in the TI ARM compiler, but not MSP430 (which is little endian)
|
||||||
#if ((__BYTE_ORDER__) == (__ORDER_LITTLE_ENDIAN__)) || defined(__MSP430__)
|
#if ((__BYTE_ORDER__) == (__ORDER_LITTLE_ENDIAN__)) || defined(__MSP430__)
|
||||||
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
|
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
|
||||||
@ -130,6 +134,11 @@
|
|||||||
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
||||||
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
|
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
|
||||||
|
|
||||||
|
#define TU_ATTR_PACKED_BEGIN
|
||||||
|
#define TU_ATTR_PACKED_END
|
||||||
|
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||||
|
#define TU_ATTR_BIT_FIELD_ORDER_END
|
||||||
|
|
||||||
// Endian conversion use well-known host to network (big endian) naming
|
// Endian conversion use well-known host to network (big endian) naming
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
|
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
|
||||||
@ -152,7 +161,6 @@
|
|||||||
|
|
||||||
#define TU_ATTR_PACKED_BEGIN _Pragma("pack")
|
#define TU_ATTR_PACKED_BEGIN _Pragma("pack")
|
||||||
#define TU_ATTR_PACKED_END _Pragma("packoption")
|
#define TU_ATTR_PACKED_END _Pragma("packoption")
|
||||||
|
|
||||||
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN _Pragma("bit_order right")
|
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN _Pragma("bit_order right")
|
||||||
#define TU_ATTR_BIT_FIELD_ORDER_END _Pragma("bit_order")
|
#define TU_ATTR_BIT_FIELD_ORDER_END _Pragma("bit_order")
|
||||||
|
|
||||||
|
@ -334,11 +334,7 @@ static bool process_edpt0_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer,
|
|||||||
pipe_state_t *pipe = &_dcd.pipe[0];
|
pipe_state_t *pipe = &_dcd.pipe[0];
|
||||||
/* configure fifo direction and access unit settings */
|
/* configure fifo direction and access unit settings */
|
||||||
if (ep_addr) { /* IN, 2 bytes */
|
if (ep_addr) { /* IN, 2 bytes */
|
||||||
#if TU_BYTE_ORDER == TU_BIG_ENDIAN
|
USB0.CFIFOSEL.WORD = USB_FIFOSEL_TX | USB_FIFOSEL_MBW_16 | (TU_BYTE_ORDER == TU_BIG_ENDIAN ? USB_FIFOSEL_BIGEND : 0);
|
||||||
USB0.CFIFOSEL.WORD = USB_FIFOSEL_TX | USB_FIFOSEL_MBW_16 | USB_FIFOSEL_BIGEND;
|
|
||||||
#else
|
|
||||||
USB0.CFIFOSEL.WORD = USB_FIFOSEL_TX | USB_FIFOSEL_MBW_16;
|
|
||||||
#endif
|
|
||||||
while (!(USB0.CFIFOSEL.WORD & USB_FIFOSEL_TX)) ;
|
while (!(USB0.CFIFOSEL.WORD & USB_FIFOSEL_TX)) ;
|
||||||
} else { /* OUT, a byte */
|
} else { /* OUT, a byte */
|
||||||
USB0.CFIFOSEL.WORD = USB_FIFOSEL_MBW_8;
|
USB0.CFIFOSEL.WORD = USB_FIFOSEL_MBW_8;
|
||||||
@ -413,11 +409,7 @@ static bool process_pipe_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer,
|
|||||||
USB0.PIPESEL.WORD = num;
|
USB0.PIPESEL.WORD = num;
|
||||||
const unsigned mps = USB0.PIPEMAXP.WORD;
|
const unsigned mps = USB0.PIPEMAXP.WORD;
|
||||||
if (dir) { /* IN */
|
if (dir) { /* IN */
|
||||||
#if TU_BYTE_ORDER == TU_BIG_ENDIAN
|
USB0.D0FIFOSEL.WORD = num | USB_FIFOSEL_MBW_16 | (TU_BYTE_ORDER == TU_BIG_ENDIAN ? USB_FIFOSEL_BIGEND : 0);
|
||||||
USB0.D0FIFOSEL.WORD = num | USB_FIFOSEL_MBW_16 | USB_FIFOSEL_BIGEND;
|
|
||||||
#else
|
|
||||||
USB0.D0FIFOSEL.WORD = num | USB_FIFOSEL_MBW_16;
|
|
||||||
#endif
|
|
||||||
while (USB0.D0FIFOSEL.BIT.CURPIPE != num) ;
|
while (USB0.D0FIFOSEL.BIT.CURPIPE != num) ;
|
||||||
int r = fifo_write((void*)&USB0.D0FIFO.WORD, pipe, mps);
|
int r = fifo_write((void*)&USB0.D0FIFO.WORD, pipe, mps);
|
||||||
if (r) USB0.D0FIFOCTR.WORD = USB_FIFOCTR_BVAL;
|
if (r) USB0.D0FIFOCTR.WORD = USB_FIFOCTR_BVAL;
|
||||||
@ -442,11 +434,7 @@ static void process_pipe_brdy(uint8_t rhport, unsigned num)
|
|||||||
{
|
{
|
||||||
pipe_state_t *pipe = &_dcd.pipe[num];
|
pipe_state_t *pipe = &_dcd.pipe[num];
|
||||||
if (tu_edpt_dir(pipe->ep)) { /* IN */
|
if (tu_edpt_dir(pipe->ep)) { /* IN */
|
||||||
#if TU_BYTE_ORDER == TU_BIG_ENDIAN
|
select_pipe(num, USB_FIFOSEL_MBW_16 | (TU_BYTE_ORDER == TU_BIG_ENDIAN ? USB_FIFOSEL_BIGEND : 0));
|
||||||
select_pipe(num, USB_FIFOSEL_MBW_16 | USB_FIFOSEL_BIGEND);
|
|
||||||
#else
|
|
||||||
select_pipe(num, USB_FIFOSEL_MBW_16);
|
|
||||||
#endif
|
|
||||||
const unsigned mps = USB0.PIPEMAXP.WORD;
|
const unsigned mps = USB0.PIPEMAXP.WORD;
|
||||||
unsigned rem = pipe->remaining;
|
unsigned rem = pipe->remaining;
|
||||||
rem -= TU_MIN(rem, mps);
|
rem -= TU_MIN(rem, mps);
|
||||||
@ -527,7 +515,7 @@ static void process_set_address(uint8_t rhport)
|
|||||||
#else
|
#else
|
||||||
.bmRequestType = 0,
|
.bmRequestType = 0,
|
||||||
#endif
|
#endif
|
||||||
.bRequest = 5,
|
.bRequest = TUSB_REQ_SET_ADDRESS,
|
||||||
.wValue = addr,
|
.wValue = addr,
|
||||||
.wIndex = 0,
|
.wIndex = 0,
|
||||||
.wLength = 0,
|
.wLength = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user