diff options
| author | Ha Thach <[email protected]> | 2021-10-24 00:19:19 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-24 00:19:19 +0700 |
| commit | ffde3bd33d1fcd66c1ebc6019cde8e82ff43db3b (patch) | |
| tree | 4119b44658bc6d66947ba0e4605fea16ea4ea678 /src/common | |
| parent | b541c0f5e07696ead205666e43c726b14277e0d9 (diff) | |
| parent | 311c05b401591507cbc4977926bcc878d3f119aa (diff) | |
Merge pull request #1159 from hathach/fix-warnings
Increase compiler warnings flags
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_common.h | 5 | ||||
| -rw-r--r-- | src/common/tusb_fifo.c | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index fc4d3bc62..8dd1dbd49 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -161,7 +161,6 @@ static inline uint8_t tu_log2(uint32_t value) #if TUP_ARCH_STRICT_ALIGN // Rely on compiler to generate correct code for unaligned access - typedef struct { uint16_t val; } TU_ATTR_PACKED tu_unaligned_uint16_t; typedef struct { uint32_t val; } TU_ATTR_PACKED tu_unaligned_uint32_t; @@ -227,8 +226,8 @@ TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16(void* mem, uint16_ #else // MCU that could access unaligned memory natively -TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32 (const void* mem ) { return *((uint32_t*) mem); } -TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16 (const void* mem ) { return *((uint16_t*) mem); } +TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32 (const void* mem) { return *((uint32_t const *) mem); } +TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16 (const void* mem) { return *((uint16_t const *) mem); } TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write32 (void* mem, uint32_t value ) { *((uint32_t*) mem) = value; } TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16 (void* mem, uint16_t value ) { *((uint16_t*) mem) = value; } diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index 11b8fc5f3..564687e02 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -102,7 +102,7 @@ static inline uint16_t _ff_mod(uint16_t idx, uint16_t depth) // TODO generalize with configurable 1 byte or 4 byte each read static void _ff_push_const_addr(uint8_t * ff_buf, const void * app_buf, uint16_t len) { - volatile uint32_t * rx_fifo = (volatile uint32_t *) app_buf; + volatile const uint32_t * rx_fifo = (volatile const uint32_t *) app_buf; // Reading full available 32 bit words from const app address uint16_t full_words = len >> 2; @@ -201,7 +201,7 @@ static void _ff_push_n(tu_fifo_t* f, void const * app_buf, uint16_t n, uint16_t ff_buf += nLin_4n_bytes; // There could be odd 1-3 bytes before the wrap-around boundary - volatile uint32_t * rx_fifo = (volatile uint32_t *) app_buf; + volatile const uint32_t * rx_fifo = (volatile const uint32_t *) app_buf; uint8_t rem = nLin_bytes & 0x03; if (rem > 0) { |
