summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-12-12 11:54:33 +0700
committerhathach <[email protected]>2022-12-12 11:54:33 +0700
commit04a5c03ea8ea70510c332f0fafb44daf0ec7c7fb (patch)
treeec4f0b64733c7a40fa3a43b9d371c4bb274280a7
parentce064de6fd4416bb5368a2aaff4283f8e4b9fc36 (diff)
fix int conversion warnings
-rw-r--r--src/common/tusb_fifo.c4
-rw-r--r--src/common/tusb_fifo.h14
2 files changed, 9 insertions, 9 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index a3933416c..70f514df2 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -82,7 +82,7 @@ bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_si
// 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 = (uint16_t) (2*depth - 1);
- f->non_used_index_space = UINT16_MAX - (2*f->depth-1);
+ f->non_used_index_space = (uint16_t) (UINT16_MAX - (2*f->depth-1));
f->rd_idx = f->wr_idx = 0;
@@ -867,7 +867,7 @@ bool tu_fifo_clear(tu_fifo_t *f)
f->rd_idx = f->wr_idx = 0;
//f->max_pointer_idx = (uint16_t) (2*f->depth-1);
- f->non_used_index_space = UINT16_MAX - (2*f->depth-1);
+ f->non_used_index_space = (uint16_t) (UINT16_MAX - (2*f->depth-1));
_ff_unlock(f->mutex_wr);
_ff_unlock(f->mutex_rd);
diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h
index fd149b75c..932214c81 100644
--- a/src/common/tusb_fifo.h
+++ b/src/common/tusb_fifo.h
@@ -136,13 +136,13 @@ typedef struct
void * ptr_wrap ; ///< wrapped part start pointer
} tu_fifo_buffer_info_t;
-#define TU_FIFO_INIT(_buffer, _depth, _type, _overwritable) \
-{ \
- .buffer = _buffer, \
- .depth = _depth, \
- .item_size = sizeof(_type), \
- .overwritable = _overwritable, \
- .non_used_index_space = UINT16_MAX - (2*(_depth)-1), \
+#define TU_FIFO_INIT(_buffer, _depth, _type, _overwritable) \
+{ \
+ .buffer = _buffer, \
+ .depth = _depth, \
+ .item_size = sizeof(_type), \
+ .overwritable = _overwritable, \
+ .non_used_index_space = (uint16_t)(UINT16_MAX - (2*(_depth)-1)), \
}
#define TU_FIFO_DEF(_name, _depth, _type, _overwritable) \