CANopenNode
CO_fifo.h File Reference

FIFO circular buffer. More...

#include "301/CO_driver.h"

Go to the source code of this file.

Data Structures

struct  CO_fifo_t
 Fifo object. More...
 

Enumerations

enum  CO_fifo_st {
  CO_fifo_st_closed = 0x01U, CO_fifo_st_partial = 0x02U, CO_fifo_st_errTok = 0x10U, CO_fifo_st_errVal = 0x20U,
  CO_fifo_st_errBuf = 0x40U, CO_fifo_st_errInt = 0x80U, CO_fifo_st_errMask = 0xF0U
}
 Bitfields for status argument from CO_fifo_cpyTok2U8 function and similar. More...
 

Functions

void CO_fifo_init (CO_fifo_t *fifo, char *buf, size_t bufSize)
 Initialize fifo object. More...
 
static void CO_fifo_reset (CO_fifo_t *fifo)
 Reset fifo object, make it empty. More...
 
static bool_t CO_fifo_purge (CO_fifo_t *fifo)
 Purge all data in fifo object, keep other properties. More...
 
static size_t CO_fifo_getSpace (CO_fifo_t *fifo)
 Get free buffer space in CO_fifo_t object. More...
 
static size_t CO_fifo_getOccupied (CO_fifo_t *fifo)
 Get size of data inside CO_fifo_t buffer object. More...
 
static bool_t CO_fifo_putc (CO_fifo_t *fifo, const char c)
 Put one character into CO_fifo_t buffer object. More...
 
static void CO_fifo_putc_ov (CO_fifo_t *fifo, const char c)
 Put one character into CO_fifo_t buffer object. More...
 
static bool_t CO_fifo_getc (CO_fifo_t *fifo, char *buf)
 Get one character from CO_fifo_t buffer object. More...
 
size_t CO_fifo_write (CO_fifo_t *fifo, const char *buf, size_t count, uint16_t *crc)
 Write data into CO_fifo_t object. More...
 
size_t CO_fifo_read (CO_fifo_t *fifo, char *buf, size_t count, bool_t *eof)
 Read data from CO_fifo_t object. More...
 
size_t CO_fifo_altBegin (CO_fifo_t *fifo, size_t offset)
 Initializes alternate read with CO_fifo_altRead. More...
 
void CO_fifo_altFinish (CO_fifo_t *fifo, uint16_t *crc)
 Ends alternate read with CO_fifo_altRead and calculate crc checksum. More...
 
static size_t CO_fifo_altGetOccupied (CO_fifo_t *fifo)
 Get alternate size of remaining data, see CO_fifo_altRead. More...
 
size_t CO_fifo_altRead (CO_fifo_t *fifo, char *buf, size_t count)
 Alternate read data from CO_fifo_t object. More...
 
bool_t CO_fifo_CommSearch (CO_fifo_t *fifo, bool_t clear)
 Search command inside FIFO. More...
 
bool_t CO_fifo_trimSpaces (CO_fifo_t *fifo, bool_t *insideComment)
 Trim spaces inside FIFO. More...
 
size_t CO_fifo_readToken (CO_fifo_t *fifo, char *buf, size_t count, char *closed, bool_t *err)
 Get token from FIFO buffer. More...
 
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. More...
 
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. More...
 
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. More...
 
size_t CO_fifo_cpyTok2U8 (CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status)
 Read ascii string from src fifo and copy as uint8_t variable to dest fifo. More...
 
size_t CO_fifo_cpyTok2U16 (CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *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, CO_fifo_st *status)
 Copy bytes written as two hex digits into to data. More...
 
size_t CO_fifo_cpyTok2Vs (CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status)
 Copy visible string to data. More...
 
size_t CO_fifo_cpyTok2B64 (CO_fifo_t *dest, CO_fifo_t *src, CO_fifo_st *status)
 Read ascii mime-base64 encoded string from src fifo and copy as binary data to dest fifo. More...
 

Detailed Description

FIFO circular buffer.

Author
Janez Paternoster

This file is part of CANopenNode, an opensource CANopen Stack. Project home page is https://github.com/CANopenNode/CANopenNode. For more information on CANopen see http://www.can-cia.org/.

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.