qs.c File Reference

QS internal variables definitions and core QS functions implementations. More...

#include "qs_pkg.h"

Go to the source code of this file.

Functions

char const Q_ROM *Q_ROM_VAR QS_getVersion (void)
 Get the current version of QS.
void QS_initBuf (uint8_t sto[], uint32_t stoSize)
 Initialize the QS data buffer.
void QS_filterOn (uint8_t rec)
 Turn the global Filter on for a given record type rec.
void QS_filterOff (uint8_t rec)
 Turn the global Filter off for a given record type rec.
void QS_begin (uint8_t rec)
 Mark the begin of a QS record rec.
void QS_end (void)
 Mark the end of a QS record rec.
void QS_u8 (uint8_t format, uint8_t d)
 Output uint8_t data element with format information.
void QS_u16 (uint8_t format, uint16_t d)
 output uint16_t data element with format information
void QS_u32 (uint8_t format, uint32_t d)
 Output uint32_t data element with format information.

Variables

uint8_t QS_glbFilter_ [32]
uint8_tQS_ring_
QSCtr QS_end_
QSCtr QS_head_
QSCtr QS_tail_
QSCtr QS_used_
uint8_t QS_seq_
uint8_t QS_chksum_
uint8_t QS_full_

Detailed Description

QS internal variables definitions and core QS functions implementations.

Definition in file qs.c.


Function Documentation

void QS_begin ( uint8_t  rec  ) 

Mark the begin of a QS record rec.

This function must be called at the beginning of each QS record. This function should be called indirectly through the macro QS_BEGIN, or QS_BEGIN_NOLOCK, depending if it's called in a normal code or from a critical section.

Definition at line 94 of file qs.c.

References QS_chksum_, QS_INSERT_ESC_BYTE, and QS_seq_.

void QS_end ( void   ) 

Mark the end of a QS record rec.

This function must be called at the end of each QS record. This function should be called indirectly through the macro QS_END, or QS_END_NOLOCK, depending if it's called in a normal code or from a critical section.

Definition at line 101 of file qs.c.

References QS_end_, QS_FRAME, QS_head_, QS_INSERT_BYTE, QS_INSERT_CHKSUM_BYTE, QS_tail_, and QS_used_.

void QS_filterOff ( uint8_t  rec  ) 

Turn the global Filter off for a given record type rec.

This function sets up the QS filter to disable the record type rec. The argument QS_ALL_RECORDS specifies to suppress all records. This function should be called indirectly through the macro QS_FILTER_OFF.

Note:
Filtering records based on the record-type is only the first layer of filtering. The second layer is based on the object-type. Both filter layers must be enabled for the QS record to be inserted into the QS buffer.
See also:

Definition at line 82 of file qs.c.

References QS_ALL_RECORDS, and QS_glbFilter_.

void QS_filterOn ( uint8_t  rec  ) 

Turn the global Filter on for a given record type rec.

This function sets up the QS filter to enable the record type rec. The argument QS_ALL_RECORDS specifies to filter-in all records. This function should be called indirectly through the macro QS_FILTER_ON.

Note:
Filtering based on the record-type is only the first layer of filtering. The second layer is based on the object-type. Both filter layers must be enabled for the QS record to be inserted into the QS buffer.
See also:
QS_filterOff(), QS_FILTER_SM_OBJ, QS_FILTER_AO_OBJ, QS_FILTER_MP_OBJ, QS_FILTER_EQ_OBJ, and QS_FILTER_TE_OBJ.

Definition at line 70 of file qs.c.

References QS_ALL_RECORDS, and QS_glbFilter_.

char const Q_ROM* Q_ROM_VAR QS_getVersion ( void   ) 

Get the current version of QS.

Returns:
version of the QS as a constant 6-character string of the form x.y.zz, where x is a 1-digit major version number, y is a 1-digit minor version number, and zz is a 2-digit release number.

Definition at line 52 of file qs.c.

References QP_VERSION.

void QS_initBuf ( uint8_t  sto[],
uint32_t  stoSize 
)

Initialize the QS data buffer.

This function should be called from QS_onStartup() to provide QS with the data buffer. The first argument sto[] is the address of the memory block, and the second argument stoSize is the size of this block in bytes. Currently the size of the QS buffer cannot exceed 64KB.

QS can work with quite small data buffers, but you will start losing data if the buffer is too small for the bursts of logging activity. The right size of the buffer depends on the data production rate and the data output rate. QS offers flexible filtering to reduce the data production rate.

Note:
If the data output rate cannot keep up with the production rate, QS will start overwriting the older data with newer data. This is consistent with the "last-is-best" QS policy. The record sequence counters and checksums on each record allow to easily detect data loss.

Definition at line 65 of file qs.c.

References QS_end_, and QS_ring_.

void QS_u16 ( uint8_t  format,
uint16_t  d 
)

output uint16_t data element with format information

Note:
This function is only to be used through macros, never in the client code directly.

Definition at line 115 of file qs.c.

References QS_INSERT_ESC_BYTE.

void QS_u32 ( uint8_t  format,
uint32_t  d 
)

Output uint32_t data element with format information.

Note:
This function is only to be used through macros, never in the client code directly.

Definition at line 122 of file qs.c.

References QS_INSERT_ESC_BYTE.

void QS_u8 ( uint8_t  format,
uint8_t  d 
)

Output uint8_t data element with format information.

Note:
This function is only to be used through macros, never in the client code directly.

Definition at line 110 of file qs.c.

References QS_INSERT_ESC_BYTE.


Variable Documentation

the checksum of the current record

Definition at line 47 of file qs.c.

Referenced by QS_begin(), QS_mem(), QS_str(), QS_str_(), QS_str_ROM(), and QS_str_ROM_().

offset of the end of the ring buffer

Definition at line 42 of file qs.c.

Referenced by QS_end(), QS_getBlock(), QS_getByte(), and QS_initBuf().

the ring buffer is temporarily full

Definition at line 48 of file qs.c.

global on/off QS filter

Definition at line 38 of file qs.c.

Referenced by QS_filterOff(), and QS_filterOn().

offset to where next byte will be inserted

Definition at line 43 of file qs.c.

Referenced by QS_end().

pointer to the start of the ring buffer

Definition at line 41 of file qs.c.

Referenced by QS_getBlock(), QS_getByte(), and QS_initBuf().

the record sequence number

Definition at line 46 of file qs.c.

Referenced by QS_begin().

offset of where next event will be extracted

Definition at line 44 of file qs.c.

Referenced by QS_end(), QS_getBlock(), and QS_getByte().

number of bytes currently in the ring buffer

Definition at line 45 of file qs.c.

Referenced by QS_end(), QS_getBlock(), and QS_getByte().


Generated by  doxygen 1.6.2