|
XBee Firmware Library
1.6.0
|
Files | |
| file | cbuf.h |
| file | xbee_cbuf.c |
Data Structures | |
| struct | xbee_cbuf_t |
Typedefs | |
| typedef XBEE_BEGIN_DECLS struct xbee_cbuf_t | xbee_cbuf_t |
Functions | |
| void | xbee_cbuf_flush (xbee_cbuf_t FAR *cbuf) |
| Flush the contents of the circular buffer. More... | |
| uint_fast8_t | xbee_cbuf_free (xbee_cbuf_t FAR *cbuf) |
| Returns the number of additional bytes that can be stored in the circular buffer. More... | |
| uint_fast8_t | xbee_cbuf_get (xbee_cbuf_t *cbuf, void FAR *buffer, uint_fast8_t length) |
| Read (and remove) multiple bytes from circular buffer. More... | |
| int | xbee_cbuf_getch (xbee_cbuf_t FAR *cbuf) |
| Remove and return the first byte of the circular buffer. More... | |
| int | xbee_cbuf_init (xbee_cbuf_t FAR *cbuf, uint_fast8_t datasize) |
| Initialize the fields of the circular buffer. More... | |
| uint_fast8_t | xbee_cbuf_put (xbee_cbuf_t FAR *cbuf, const void FAR *buffer, uint_fast8_t length) |
| Append multiple bytes to the end of a circular buffer. More... | |
| int | xbee_cbuf_putch (xbee_cbuf_t FAR *cbuf, uint_fast8_t ch) |
| Append a single byte to the circular buffer (if not full). More... | |
| uint_fast8_t | xbee_cbuf_used (xbee_cbuf_t FAR *cbuf) |
| Returns the number of bytes stored in the circular buffer. More... | |
Variables | |
| uint8_t | data [1] |
| uint8_t | head |
| uint8_t | lock |
| uint8_t | mask |
| uint8_t | tail |
| typedef XBEE_BEGIN_DECLS struct xbee_cbuf_t xbee_cbuf_t |
Circular buffer used by transparent serial cluster handler. Buffer is empty when head == tail and full when head == (tail - 1).
| void xbee_cbuf_flush | ( | xbee_cbuf_t FAR * | cbuf | ) |
Flush the contents of the circular buffer.
| [in,out] | cbuf | Pointer to circular buffer. |
| uint_fast8_t xbee_cbuf_free | ( | xbee_cbuf_t FAR * | cbuf | ) |
Returns the number of additional bytes that can be stored in the circular buffer.
| [in] | cbuf | Pointer to circular buffer. |
| 0-255 | Number of unused bytes in the circular buffer. |
| uint_fast8_t xbee_cbuf_get | ( | xbee_cbuf_t * | cbuf, |
| void FAR * | buffer, | ||
| uint_fast8_t | length | ||
| ) |
Read (and remove) multiple bytes from circular buffer.
| [in,out] | cbuf | circular buffer |
| [out] | buffer | destination to copy data from circular buffer |
| [in] | length | number of bytes to copy |
| 0-255 | number of bytes copied (may be less than length if buffer is empty) |
| int xbee_cbuf_getch | ( | xbee_cbuf_t FAR * | cbuf | ) |
Remove and return the first byte of the circular buffer.
| [in] | cbuf | Pointer to circular buffer. |
| -1 | buffer is empty |
| 0-255 | byte removed from the head of the buffer |
| int xbee_cbuf_init | ( | xbee_cbuf_t FAR * | cbuf, |
| uint_fast8_t | datasize | ||
| ) |
Initialize the fields of the circular buffer.
| [in,out] | cbuf | Address of buffer to use for the circular buffer. This buffer must be (datasize + CBUF_OVEREAD) bytes long to hold the locks, head, tail, size and buffered bytes. |
| [in] | datasize | Maximum number of bytes to store in the circular buffer. This size must be at least 3, no more than 255, and a power of 2 minus 1 (2^n - 1). |
| 0 | success |
| -EINVAL | invalid parameter |
| uint_fast8_t xbee_cbuf_put | ( | xbee_cbuf_t FAR * | cbuf, |
| const void FAR * | buffer, | ||
| uint_fast8_t | length | ||
| ) |
Append multiple bytes to the end of a circular buffer.
| [in,out] | cbuf | circular buffer |
| [in] | buffer | data to copy into circular buffer |
| [in] | length | number of bytes to copy |
| 0-255 | number of bytes copied (may be less than length if buffer is full) |
| int xbee_cbuf_putch | ( | xbee_cbuf_t FAR * | cbuf, |
| uint_fast8_t | ch | ||
| ) |
Append a single byte to the circular buffer (if not full).
| [in,out] | cbuf | Pointer to circular buffer. |
| [in] | ch | Byte to append. |
| 0 | buffer is full |
| 1 | the byte was appended |
| uint_fast8_t xbee_cbuf_used | ( | xbee_cbuf_t FAR * | cbuf | ) |
Returns the number of bytes stored in the circular buffer.
| [in] | cbuf | Pointer to circular buffer. |
| 0-255 | Number of bytes stored in the circular buffer. |
| uint8_t data[1] |
| uint8_t head |
| uint8_t lock |
| uint8_t mask |
| uint8_t tail |
1.8.10