summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-06-24 19:45:49 +0700
committerhathach <[email protected]>2022-06-24 19:46:19 +0700
commit4f6e770eda9f8c605b238f35def1edaff93a8fb8 (patch)
tree65e8c12260d3b04fe01bf933886a05094a9cf81b /src/common
parent4639cac85cf959c3bfed091c02dce1345f067c7a (diff)
add more warning option, also fix -Wconversion with rp2040
-Wuninitialized, -Wunused, -Wredundant-decls
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_fifo.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index 183c9c6fc..895b9208b 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -79,7 +79,7 @@ bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_si
// Limit index space to 2*depth - this allows for a fast "modulo" calculation
// but limits the maximum depth to 2^16/2 = 2^15 and buffer overflows are detectable
// only if overflow happens once (important for unsupervised DMA applications)
- f->max_pointer_idx = 2*depth - 1;
+ f->max_pointer_idx = (uint16_t) (2*depth - 1);
f->non_used_index_space = UINT16_MAX - f->max_pointer_idx;
f->rd_idx = f->wr_idx = 0;
@@ -205,7 +205,7 @@ static void _ff_push_n(tu_fifo_t* f, void const * app_buf, uint16_t n, uint16_t
uint8_t rem = nLin_bytes & 0x03;
if (rem > 0)
{
- uint8_t remrem = tu_min16(nWrap_bytes, 4-rem);
+ uint8_t remrem = (uint8_t) tu_min16(nWrap_bytes, 4-rem);
nWrap_bytes -= remrem;
uint32_t tmp32 = *rx_fifo;
@@ -288,7 +288,7 @@ static void _ff_pull_n(tu_fifo_t* f, void* app_buf, uint16_t n, uint16_t rel, tu
uint8_t rem = nLin_bytes & 0x03;
if (rem > 0)
{
- uint8_t remrem = tu_min16(nWrap_bytes, 4-rem);
+ uint8_t remrem = (uint8_t) tu_min16(nWrap_bytes, 4-rem);
nWrap_bytes -= remrem;
uint32_t tmp32=0;
@@ -325,7 +325,7 @@ static uint16_t advance_pointer(tu_fifo_t* f, uint16_t p, uint16_t offset)
// We are exploiting the wrap around to the correct index
if ((p > (uint16_t)(p + offset)) || ((uint16_t)(p + offset) > f->max_pointer_idx))
{
- p = (p + offset) + f->non_used_index_space;
+ p = (uint16_t) ((p + offset) + f->non_used_index_space);
}
else
{
@@ -342,7 +342,7 @@ static uint16_t backward_pointer(tu_fifo_t* f, uint16_t p, uint16_t offset)
// We are exploiting the wrap around to the correct index
if ((p < (uint16_t)(p - offset)) || ((uint16_t)(p - offset) > f->max_pointer_idx))
{
- p = (p - offset) - f->non_used_index_space;
+ p = (uint16_t) ((p - offset) - f->non_used_index_space);
}
else
{
@@ -818,7 +818,7 @@ bool tu_fifo_clear(tu_fifo_t *f)
_ff_lock(f->mutex_rd);
f->rd_idx = f->wr_idx = 0;
- f->max_pointer_idx = 2*f->depth-1;
+ f->max_pointer_idx = (uint16_t) (2*f->depth-1);
f->non_used_index_space = UINT16_MAX - f->max_pointer_idx;
_ff_unlock(f->mutex_wr);