diff options
| author | hathach <[email protected]> | 2021-01-22 11:17:10 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-01-22 11:17:10 +0700 |
| commit | 0cf2b02791bee41583f58b65c57bdac4ca1faf45 (patch) | |
| tree | 712d223dd102497b8d4764db50d9b3eaa7f82fef /src/common | |
| parent | 4cd8a95ef71fa351af1ec7144301b2736a80c75d (diff) | |
| parent | 388abe9d9cc0a7c360fd902e01461a53bb7b3f42 (diff) | |
Merge branch 'master' into group-boards-into-family
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_compiler.h | 1 | ||||
| -rw-r--r-- | src/common/tusb_fifo.c | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/common/tusb_compiler.h b/src/common/tusb_compiler.h index 505542078..22c8366ab 100644 --- a/src/common/tusb_compiler.h +++ b/src/common/tusb_compiler.h @@ -102,6 +102,7 @@ #define TU_BSWAP32(u32) (__builtin_bswap32(u32)) #elif defined(__ICCARM__) + #include <intrinsics.h> #define TU_ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) #define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name))) #define TU_ATTR_PACKED __attribute__ ((packed)) diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index 608bfd081..00f2434a7 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -30,6 +30,12 @@ #include "osal/osal.h" #include "tusb_fifo.h" +// Supress IAR warning +// Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement +#if defined(__ICCARM__) +#pragma diag_suppress = Pa082 +#endif + // implement mutex lock and unlock #if CFG_FIFO_MUTEX @@ -106,7 +112,7 @@ static void _ff_push_n(tu_fifo_t* f, void const * data, uint16_t n, uint16_t wRe memcpy(f->buffer + (wRel * f->item_size), data, nLin*f->item_size); // Write data wrapped around - memcpy(f->buffer, data + nLin*f->item_size, (n - nLin) * f->item_size); + memcpy(f->buffer, ((uint8_t const*) data) + nLin*f->item_size, (n - nLin) * f->item_size); } } @@ -131,7 +137,7 @@ static void _ff_pull_n(tu_fifo_t* f, void * p_buffer, uint16_t n, uint16_t rRel) memcpy(p_buffer, f->buffer + (rRel * f->item_size), nLin*f->item_size); // Read data wrapped part - memcpy(p_buffer + nLin*f->item_size, f->buffer, (n - nLin) * f->item_size); + memcpy((uint8_t*)p_buffer + nLin*f->item_size, f->buffer, (n - nLin) * f->item_size); } } |
