CANopenNode
CANopen protocol stack
Loading...
Searching...
No Matches

FIFO circular buffer. More...

#include "301/CO_driver.h"
+ Include dependency graph for CO_fifo.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CO_fifo_t
 Fifo object. More...
 

Macros

#define CO_fifo_st_closed   0x01U
 Bit is set, if command delimiter is reached in src.
 
#define CO_fifo_st_partial    0x02U
 Bit is set, if copy was partial and more data are available.
 
#define CO_fifo_st_errTok   0x10U
 Bit is set, if no valid token found.
 
#define CO_fifo_st_errVal   0x20U
 Bit is set, if value is not valid or out of limits.
 
#define CO_fifo_st_errBuf   0x40U
 Bit is set, if destination buffer is to small.
 
#define CO_fifo_st_errInt   0x80U
 Bit is set, if internal error.
 
#define CO_fifo_st_errMask   0xF0U
 Bitmask for error bits.
 

Functions

void CO_fifo_init (CO_fifo_t *fifo, uint8_t *buf, size_t bufSize)
 Initialize fifo object.
 
static void CO_fifo_reset (CO_fifo_t *fifo)
 Reset fifo object, make it empty.
 
static bool_t CO_fifo_purge (CO_fifo_t *fifo)
 Purge all data in fifo object, keep other properties.
 
static size_t CO_fifo_getSpace (CO_fifo_t *fifo)
 Get free buffer space in CO_fifo_t object.
 
static size_t CO_fifo_getOccupied (CO_fifo_t *fifo)
 Get size of data inside CO_fifo_t buffer object.
 
static bool_t CO_fifo_putc (CO_fifo_t *fifo, const uint8_t c)
 Put one character into CO_fifo_t buffer object.
 
static void CO_fifo_putc_ov (CO_fifo_t *fifo, const uint8_t c)
 Put one character into CO_fifo_t buffer object.
 
static bool_t CO_fifo_getc (CO_fifo_t *fifo, uint8_t *buf)
 Get one character from CO_fifo_t buffer object.
 
size_t CO_fifo_write (CO_fifo_t *fifo, const uint8_t *buf, size_t count, uint16_t *crc)
 Write data into CO_fifo_t object.
 
size_t CO_fifo_read (CO_fifo_t *fifo, uint8_t *buf, size_t count, bool_t *eof)
 Read data from CO_fifo_t object.
 
size_t CO_fifo_altBegin (CO_fifo_t *fifo, size_t offset)
 Initializes alternate read with CO_fifo_altRead.
 
void CO_fifo_altFinish (CO_fifo_t *fifo, uint16_t *crc)
 Ends alternate read with CO_fifo_altRead and calculate crc checksum.
 
static size_t CO_fifo_altGetOccupied (CO_fifo_t *fifo)
 Get alternate size of remaining data, see CO_fifo_altRead.
 
size_t CO_fifo_altRead (CO_fifo_t *fifo, uint8_t *buf, size_t count)
 Alternate read data from CO_fifo_t object.
 
bool_t CO_fifo_CommSearch (CO_fifo_t *fifo, bool_t clear)
 Search command inside FIFO.
 
bool_t CO_fifo_trimSpaces (CO_fifo_t *fifo, bool_t *insideComment)
 Trim spaces inside FIFO.
 
size_t CO_fifo_readToken (CO_fifo_t *fifo, char *buf, size_t count, uint8_t *closed, bool_t *err)
 Get token from FIFO buffer.
 
size_t CO_fifo_readU82a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint8_t variable from fifo and output as ascii string.
 
size_t CO_fifo_readU162a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint16_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readU322a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint32_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readU642a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint64_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readX82a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint8_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readX162a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint16_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readX322a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint32_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readX642a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read uint64_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readI82a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read int8_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readI162a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read int16_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readI322a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read int32_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readI642a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read int64_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readR322a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read float32_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readR642a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read float64_t variable from fifo as ascii string, see CO_fifo_readU82a.
 
size_t CO_fifo_readHex2a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read data from fifo and output as space separated two digit ascii string, see also CO_fifo_readU82a.
 
size_t CO_fifo_readVs2a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read data from fifo and output as visible string.
 
size_t CO_fifo_readB642a (CO_fifo_t *fifo, char *buf, size_t count, bool_t end)
 Read data from fifo and output as mime-base64 encoded string.
 
size_t CO_fifo_cpyTok2U8 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Read ascii string from src fifo and copy as uint8_t variable to dest fifo.
 
size_t CO_fifo_cpyTok2U16 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to uint16_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2U32 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to uint32_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2U64 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to uint64_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2I8 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to int8_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2I16 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to int16_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2I32 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to int32_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2I64 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to int64_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2R32 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to float32_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2R64 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy ascii string to float64_t variable, see CO_fifo_cpyTok2U8.
 
size_t CO_fifo_cpyTok2Hex (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy bytes written as two hex digits into to data.
 
size_t CO_fifo_cpyTok2Vs (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Copy visible string to data.
 
size_t CO_fifo_cpyTok2B64 (CO_fifo_t *dest, CO_fifo_t *src, uint8_t *status)
 Read ascii mime-base64 encoded string from src fifo and copy as binary data to dest fifo.
 

Detailed Description

FIFO circular buffer.

Author
Janez Paternoster

This file is part of https://github.com/CANopenNode/CANopenNode, a CANopen Stack.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.