diff options
| author | Ha Thach <[email protected]> | 2020-11-24 01:04:44 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-24 01:04:44 +0700 |
| commit | 2bfcd446a58d987d2275774c985471198cf43328 (patch) | |
| tree | cb6eee5f2dbb43258951f8aee102b93783c91e1b /src/common | |
| parent | b870d932e5e1c6ece4227a5d49cc71e53a744149 (diff) | |
| parent | 494e125432ca3eb6faa5de2896cfb8e2e7143ddb (diff) | |
Merge pull request #506 from duempel/cdc_without_dtr
CDC without DTR being set
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_fifo.c | 21 | ||||
| -rw-r--r-- | src/common/tusb_fifo.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index f41cf9f6c..608bfd081 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -599,6 +599,27 @@ bool tu_fifo_clear(tu_fifo_t *f) /******************************************************************************/ /*! + @brief Change the fifo mode to overwritable or not overwritable + + @param[in] f + Pointer to the FIFO buffer to manipulate + @param[in] overwritable + Overwritable mode the fifo is set to +*/ +/******************************************************************************/ +bool tu_fifo_set_overwritable(tu_fifo_t *f, bool overwritable) +{ + tu_fifo_lock(f); + + f->overwritable = overwritable; + + tu_fifo_unlock(f); + + return true; +} + +/******************************************************************************/ +/*! @brief Advance write pointer - intended to be used in combination with DMA. It is possible to fill the FIFO by use of a DMA in circular mode. Within DMA ISRs you may update the write pointer to be able to read from the FIFO. diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h index b87695743..b965386ab 100644 --- a/src/common/tusb_fifo.h +++ b/src/common/tusb_fifo.h @@ -89,6 +89,7 @@ typedef struct .non_used_index_space = 0xFFFF - 2*_depth-1, \ } +bool tu_fifo_set_overwritable(tu_fifo_t *f, bool overwritable); bool tu_fifo_clear(tu_fifo_t *f); bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_size, bool overwritable); |
