more with clean up

This commit is contained in:
hathach 2021-05-27 18:04:28 +07:00
parent b36b211c26
commit f384d6f67e
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
2 changed files with 7 additions and 10 deletions

View File

@ -25,8 +25,6 @@
* This file is part of the TinyUSB stack.
*/
#include <string.h>
#include "osal/osal.h"
#include "tusb_fifo.h"

View File

@ -28,6 +28,10 @@
#ifndef _TUSB_FIFO_H_
#define _TUSB_FIFO_H_
#ifdef __cplusplus
extern "C" {
#endif
// Due to the use of unmasked pointers, this FIFO does not suffer from loosing
// one item slice. Furthermore, write and read operations are completely
// decoupled as write and read functions do not modify a common state. Henceforth,
@ -37,17 +41,12 @@
// read pointers can be updated from within a DMA ISR. Overflows are detectable
// within a certain number (see tu_fifo_overflow()).
#include "common/tusb_common.h"
// mutex is only needed for RTOS
// for OS None, we don't get preempted
#define CFG_FIFO_MUTEX (CFG_TUSB_OS != OPT_OS_NONE)
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#if CFG_FIFO_MUTEX
#include "osal/osal.h"
#define tu_fifo_mutex_t osal_mutex_t
@ -127,7 +126,7 @@ uint16_t tu_fifo_remaining (tu_fifo_t* f);
bool tu_fifo_overflowed (tu_fifo_t* f);
void tu_fifo_correct_read_pointer (tu_fifo_t* f);
static inline
TU_ATTR_ALWAYS_INLINE static inline
uint16_t tu_fifo_depth(tu_fifo_t* f)
{
return f->depth;