NetBurner 3.5.6
PDF Version
ExtraFdCircBuffer.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5#include <iosys.h>
6#include <nbrtos.h>
7#include <iointernal.h>
8
9#ifndef _EXTRAFD_CIRC_BUFFER_H
10#define _EXTRAFD_CIRC_BUFFER_H
11
12// A circular buffer object, referred to as a "cbo"
13struct CircularBufferObject
14{
15 OS_CRIT criticalSection; // Critical section to make it task safe
16
17 uint32_t readIndex; // Buffer index of next char to get
18 uint32_t writeIndex; // Buffer index of next char to put
19
20 uint32_t dataBufferSize; // Size of data buffer
21 char *dataBuffer; // Data storage space
22
23 bool enableOverwrite; // Continuously overwrite buffer instead of setting full flag
24 char overwriteTermByte; // When in overwrite mode and buffer is full, bytes will be
25 // flushed up to the terminator instead of one at a time.
26 // Useful for lines/strings terminated with \r\n
27};
28
29// int CircularBufferInit(CircularBufferObject *pCbo, char *pBuffer, uint32_t bufferSize);
30int CircularBufferInit(CircularBufferObject *pCbo, char *pBuffer, uint32_t bufferSize, bool enableOverwrite, uint8_t overwriteTermByte);
31int CircularBufferRead(int fd, char *buf, int nbytes);
32int CircularBufferWrite(int fd, char *buf, int nbytes);
33void CircularBufferRawPrint(int fdCircBuffer, int fdDestination);
34
35#endif
Extra File Descriptors.
NetBurner I/O System Library API.
NetBurner Real-Time Operating System (NBRTOS) API.
An OS_CRIT object is used to establish critical sections of code that can only be run by one task at ...
Definition nbrtos.h:1110