Firmware SDK
twr_fifo

FIFO buffer implementation. More...

Data Structures

struct  twr_fifo_t
 Structure of FIFO instance. More...
 

Functions

void twr_fifo_init (twr_fifo_t *fifo, void *buffer, size_t size)
 Initialize FIFO buffer. More...
 
void twr_fifo_purge (twr_fifo_t *fifo)
 Purge FIFO buffer. More...
 
size_t twr_fifo_write (twr_fifo_t *fifo, const void *buffer, size_t length)
 Write data to FIFO. More...
 
size_t twr_fifo_read (twr_fifo_t *fifo, void *buffer, size_t length)
 Read data from FIFO. More...
 
size_t twr_fifo_irq_write (twr_fifo_t *fifo, const void *buffer, size_t length)
 Write data to FIFO from interrupt. More...
 
size_t twr_fifo_irq_read (twr_fifo_t *fifo, void *buffer, size_t length)
 Read data from FIFO from interrupt. More...
 
bool twr_fifo_is_empty (twr_fifo_t *fifo)
 Is empty. More...
 

Detailed Description

FIFO buffer implementation.

Function Documentation

◆ twr_fifo_init()

void twr_fifo_init ( twr_fifo_t fifo,
void *  buffer,
size_t  size 
)

Initialize FIFO buffer.

Parameters
[in]fifoFIFO instance
[in]bufferPointer to buffer where FIFO holds data
[in]sizeSize of buffer where FIFO holds data

Definition at line 4 of file twr_fifo.c.

Referenced by twr_atci_init(), twr_cmwx1zzabz_init(), twr_dma_init(), twr_td1207r_init(), twr_usb_cdc_init(), and twr_wssfm10r1at_init().

Here is the caller graph for this function:

◆ twr_fifo_irq_read()

size_t twr_fifo_irq_read ( twr_fifo_t fifo,
void *  buffer,
size_t  length 
)

Read data from FIFO from interrupt.

Parameters
[in]fifoFIFO instance
[out]bufferPointer to buffer where data will be read
[in]lengthNumber of requested bytes to be read
Returns
Number of bytes read

Definition at line 133 of file twr_fifo.c.

◆ twr_fifo_irq_write()

size_t twr_fifo_irq_write ( twr_fifo_t fifo,
const void *  buffer,
size_t  length 
)

Write data to FIFO from interrupt.

Parameters
[in]fifoFIFO instance
[in]bufferPointer to buffer from which data will be written
[in]lengthNumber of requested bytes to be written
Returns
Number of bytes written

Definition at line 101 of file twr_fifo.c.

◆ twr_fifo_is_empty()

bool twr_fifo_is_empty ( twr_fifo_t fifo)

Is empty.

Parameters
[in]fifoFIFO instance
Returns
true When is empty
false When is not empty

Definition at line 161 of file twr_fifo.c.

Here is the call graph for this function:

◆ twr_fifo_purge()

void twr_fifo_purge ( twr_fifo_t fifo)

Purge FIFO buffer.

Parameters
[in]fifoFIFO instance

Definition at line 12 of file twr_fifo.c.

◆ twr_fifo_read()

size_t twr_fifo_read ( twr_fifo_t fifo,
void *  buffer,
size_t  length 
)

Read data from FIFO.

Parameters
[in]fifoFIFO instance
[out]bufferPointer to buffer where data will be read
[in]lengthNumber of requested bytes to be read
Returns
Number of bytes read

Definition at line 63 of file twr_fifo.c.

Referenced by twr_module_rs485_async_read(), twr_uart_async_read(), and twr_usb_cdc_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ twr_fifo_write()

size_t twr_fifo_write ( twr_fifo_t fifo,
const void *  buffer,
size_t  length 
)

Write data to FIFO.

Parameters
[in]fifoFIFO instance
[in]bufferPointer to buffer from which data will be written
[in]lengthNumber of requested bytes to be written
Returns
Number of bytes written

Definition at line 18 of file twr_fifo.c.

Referenced by twr_module_rs485_async_write(), and twr_uart_async_write().

Here is the call graph for this function:
Here is the caller graph for this function: