summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-01-20 20:14:23 +0100
committerReinhard Panhuber <[email protected]>2021-01-20 20:14:23 +0100
commitf1551d7a5fe5faccad9c1ef3f5d374869a1874e6 (patch)
tree3195be0e263e38dcaf43eeda2e7c001aed977b4e /src
parent93ec6f3735b30193f368458cf10d1af6c833c230 (diff)
Add __restrict keyword and memore alignment to src/dst pointer of
_tu_fifo_read_from_const_src_ptr() _tu_fifo_write_to_const_dst_ptr()
Diffstat (limited to 'src')
-rw-r--r--src/common/tusb_fifo.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index ca03864eb..ff2e2c6fd 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -95,9 +95,9 @@ static inline uint16_t _ff_mod(uint16_t idx, uint16_t depth)
// Intended to be used to read from hardware USB FIFO in e.g. STM32 where all data is read from a constant address
// Code adapted from dcd_synopsis.c
-static void _tu_fifo_read_from_const_src_ptr(void * dst, const void * src, uint16_t len)
+static void _tu_fifo_read_from_const_src_ptr(void * __restrict dst, const void * __restrict src, uint16_t len)
{
- uint8_t * dst_u8 = (uint8_t *)dst;
+ uint8_t CFG_TUSB_MEM_ALIGN * dst_u8 = (uint8_t *)dst;
volatile uint32_t * rx_fifo = (volatile uint32_t *) src;
// Reading full available 32 bit words from FIFO
@@ -127,10 +127,10 @@ static void _tu_fifo_read_from_const_src_ptr(void * dst, const void * src, uint1
// Intended to be used to write to hardware USB FIFO in e.g. STM32 where all data is written to a constant address
// Code adapted from dcd_synopsis.c
-static void _tu_fifo_write_to_const_dst_ptr(void * dst, const void * src, uint16_t len)
+static void _tu_fifo_write_to_const_dst_ptr(void * __restrict dst, const void * __restrict src, uint16_t len)
{
volatile uint32_t * tx_fifo = (volatile uint32_t *) dst;
- uint8_t * src_u8 = (uint8_t *)src;
+ uint8_t CFG_TUSB_MEM_ALIGN * src_u8 = (uint8_t *)src;
// Pushing full available 32 bit words to FIFO
uint16_t full_words = len >> 2;