Buffers have two event functions associated. One of them is invoked when the buffer fills to a certain level and the second one is executed when the buffer contains unread data which is older that the specified timeout.
Defines | |
#define | BUF_CREATE(name, n, data_size) |
Create a cyclic fifo buffer. | |
Functions | |
STATUS | BUF_Put (HANDLE *ph, void *pdata) |
Put data into the buffer. | |
STATUS | BUF_Get (HANDLE *ph, void *pdata) |
Get data from buffer. | |
void | BUF_Flush (HANDLE *ph) |
Empty buffer. | |
uint16 | BUF_Querry (HANDLE *ph) |
Querry buffer. | |
void | BUF_AppendToutFxn (HANDLE *ph, uint16 timeout, STATUS(*pfxn)(uint8 evt, void *parg1, void *parg2)) |
Set buffer timeout. | |
void | BUF_AppendTrgFxn (HANDLE *ph, uint16 trigger, STATUS(*pfxn)(uint8 evt, void *parg1, void *parg2)) |
Set buffer trigger level. |
|
Create a cyclic fifo buffer. This macro creates a cyclic fifo buffer structure and allocates needed memory.
|
|
Set buffer timeout. By default the buffer structure has no timeout callback function associated. This function appends a timeout callback function that will be fired if the fifo contains data that is older that the timeout period. The handle to the buffer structure is passed thrue the parg1 argument of the callback function. Each read or write access on the buffer re-triggers the timer. Note that the callback funcion is executed from the uSMARTX_Tick() context.
|
|
Set buffer trigger level. By default the buffer structure has no trigger callback function associated. This function appends the trigger callback function with a defined trigger level. The function is executed only once and is re-triggered when the buffer is completely emptied out (also BUF_Flush()). The handle to the buffer structure is passed to the function via the parg1 argument.
|
|
Empty buffer.
|
|
Get data from buffer. If there is some data in the buffer this function retrieves it. Each read access on the buffer also reset the associated timeout callback function timeout.
|
|
Put data into the buffer. This function writes data into the buffer if there is enough free space. If there is a trigger function set and the function has reached the trigger level the trigger callback function is executed. Note the execution context is the same as BUF_Put. Each write access resets the timeout callback function timeout.
|
|
Querry buffer.
|