305 #ifndef NZ_CIRCULARBUFFER_H
306 #define NZ_CIRCULARBUFFER_H
314 #if !defined(CIRBUF_USE_CIRCULAR_BUFFER_STD) && !defined(CIRBUF_USE_CIRCULAR_BUFFER_PWR2)
315 #define CIRBUF_USE_CIRCULAR_BUFFER_PWR2 //Use nz_circularBufferPwr2
320 #if !defined(CIRBUF_MIN_SIZE)
321 #define CIRBUF_MIN_SIZE 8
336 #if !defined(CIRBUF_ESC_CHAR)
337 #define CIRBUF_ESC_CHAR '^'
350 #define CIRBUF_TYPE_STREAMING 0x0000
362 #define CIRBUF_TYPE_PACKET 0x0001
379 #define CIRBUF_TYPE_LARGE_PACKET 0x0003
381 #define CIRBUF_FLAGS_POWER2 0x0020
390 #define CIRBUF_FORMAT_NONE 0x0000
391 #define BUFFORMAT_NONE 0
394 #define CIRBUF_FORMAT_ASCII 0x0004
395 #define BUFFORMAT_ASCII 1
402 #define CIRBUF_FORMAT_ASCII_ESC 0x0008
403 #define BUFFORMAT_ASCII_ESC 2
406 #define CIRBUF_FORMAT_BIN 0x000C
407 #define BUFFORMAT_BIN 3
417 #define CIRBUF_FORMAT_BIN_ESC 0x0010
418 #define BUFFORMAT_BIN_ESC 4
429 typedef struct __attribute__((__packed__))
_CIRBUF
439 unsigned int bPacket : 1;
440 unsigned int bPacketLarge : 1;
441 unsigned int format : 3;
442 unsigned int bSizePower2 : 1;
443 unsigned int fill6_7 : 2;
444 unsigned int fill8_15 : 8;
448 unsigned int type : 2;
449 unsigned int format : 3;
450 unsigned int fill : 11;
453 unsigned int val : 5;
454 unsigned int fill5_7 : 3;
455 unsigned int fill : 8;
503 void cbufInit(
CIRBUF* pBuf, BYTE* bufArray, WORD size, BYTE typeFormat);
578 #define cbufHasSpace(pBuf) (cbufIsFull(pBuf)==0)
656 #define cbufGetEscapeCharacter(pBuf) (CIRBUF_ESC_CHAR)
1187 #define ASCIIESC_ADD_S_AND_P 0x0001
1575 #if !defined(CIRBUF_USE_CIRCULAR_BUFFER_STD) && !defined(CIRBUF_USE_CIRCULAR_BUFFER_PWR2)
1577 #define CIRBUF_USE_CIRCULAR_BUFFER_STD
1580 #if defined(CIRBUF_USE_CIRCULAR_BUFFER_STD)
1581 #if defined(CIRBUF_USE_CIRCULAR_BUFFER_PWR2)
1582 #error "Configured to use multiple Circular Buffers! Only one can be used! Ensure only one CIRBUF_USE_XXX macro is defined (projdefs.h), and it matches circular buffer *.c file included with project!"
1587 #if defined(CIRBUF_USE_CIRCULAR_BUFFER_PWR2)
1588 #if defined(CIRBUF_USE_CIRCULAR_BUFFER_STD)
1589 #error "Configured to use multiple Circular Buffers! Only one can be used! Ensure only one CIRBUF_USE_XXX macro is defined (projdefs.h), and it matches circular buffer *.c file included with project!"