@@ -331,17 +331,6 @@ uint16_t _ff_count(uint16_t depth, uint16_t wr_idx, uint16_t rd_idx)
331
331
}
332
332
}
333
333
334
- // BE AWARE - THIS FUNCTION MIGHT NOT GIVE A CORRECT ANSWERE IN CASE WRITE POINTER "OVERFLOWS"
335
- // Only one overflow is allowed for this function to work e.g. if depth = 100, you must not
336
- // write more than 2*depth-1 items in one rush without updating write pointer. Otherwise
337
- // write pointer wraps and you pointer states are messed up. This can only happen if you
338
- // use DMAs, write functions do not allow such an error.
339
- TU_ATTR_ALWAYS_INLINE static inline
340
- bool _ff_overflowed (uint16_t depth , uint16_t wr_idx , uint16_t rd_idx )
341
- {
342
- return _ff_count (depth , wr_idx , rd_idx ) > depth ;
343
- }
344
-
345
334
// return remaining slot in fifo
346
335
TU_ATTR_ALWAYS_INLINE static inline
347
336
uint16_t _ff_remaining (uint16_t depth , uint16_t wr_idx , uint16_t rd_idx )
@@ -672,7 +661,7 @@ uint16_t tu_fifo_remaining(tu_fifo_t* f)
672
661
/******************************************************************************/
673
662
bool tu_fifo_overflowed (tu_fifo_t * f )
674
663
{
675
- return _ff_overflowed (f -> depth , f -> wr_idx , f -> rd_idx );
664
+ return _ff_count (f -> depth , f -> wr_idx , f -> rd_idx ) > f -> depth ;
676
665
}
677
666
678
667
// Only use in case tu_fifo_overflow() returned true!
0 commit comments