Buffered log stream (definitions)
This file contains the implementations of weAutSys' non blocking buffered stream, mainly meant for logging. Any (standard) output stream may be decorated with this buffered stream.
According to embedded or real time requirements non-blocking has the highest priority. Hence older buffered and not yet forwarded output is allowed to be overwritten. Hence this is for logging and debugging purposes only, when un-spoiled un-blocked operation is favored over non loosing output and newer logs are more valued than older ones.
With regard the main logging or debugging purpose of this buffered stream there are some extra convenience functions for combined constant flash string output and formatting. The rationale is to reduce the temptation to use the fprint sort of output functions — usually a deadly sin in embedded real time systems.
This file is part of weAutSys <weinert-automation.de>
Copyright © 2012 Albrecht Weinert, Bochum
The buffered log streams | |
#define | BUF_STREAMS_CAP 2047 |
The buffered log streams capacity. | |
#define | bufLogConsIsUART |
The UART is the consumer of buffered log streams output (text) data. | |
#define | bufLogSetConsumer(tD) |
Set the consumer of buffered log streams output (text) data. | |
#define | bufLogSetUART() |
Set the UART as consumer of buffered log streams output. | |
#define | BufLogInBufferd |
The number of characters buffered in buffered log streams for input. | |
FILE | bufLogStreams |
The stream "device" being a buffer for logging. | |
struct thr_data_t * | bufLogCons |
The consumer of buffered log streams output (text) data. | |
void | bufLogStreamsInit (void) |
Initialise the buffered log streams. | |
void | bufLogStreamsOpen (void) |
Open the buffered log streams. | |
uint16_t | bufLogInBufferd (FILE *streams) |
The number of characters buffered in buffered log streams for input. | |
int | bufLogGetC (void) |
Get one byte from buffered stream input. | |
uint16_t | bufLogGetChars (char *dst, uint16_t n) |
Get a number of bytes from buffered stream input. | |
uint8_t | uartPutLogBuf (void) |
Put characters from buffered log streams to serial output. | |
uint16_t | bufLogStreamsOutSpace (FILE *streams) __attribute__((pure)) |
The buffer space available for buffered log streams output. | |
uint8_t | bufLogCheckOutSpace (uint16_t const reqSpace, FILE *const streams) |
Check the space available buffered log streams output. | |
void | bufLogPutC (char const c) |
Put one byte to buffered stream output. | |
void | bufLogPut2C (char const c1, char const c2) |
Put two bytes to buffered stream output. | |
int | bufLogGetChar (FILE *const stream) |
Get one byte from buffered stream input. | |
int | bufLogPutChar (char c, FILE *const stream) |
Put one byte to buffered stream output. | |
int | bufLogPutSt (char *src, FILE const *const stream) |
Put a RAM string (some characters) to buffered stream output. | |
int | bufLogPutSt_P (char *src, FILE const *const stream) |
Put some characters from program space to buffered stream output. | |
Functions | |
void | bufLog2Dec_P (char const *src, uint16_t info1, uint16_t info2) |
Log a program space string + two 3 digit decimal numbers to buffered log output. | |
void | bufLog4HexBE (uint16_t const info) |
Log a four digit big endian hex number to buffered log output. | |
void | bufLog8HexBE (uint32_t const info) |
Log an eight digit big endian hex number + one space to buffered log output. | |
void | bufLogDec (uint16_t const info) |
Log a 4 digit decimal number to buffered log output. | |
void | bufLogDec3 (uint8_t const info) |
Log a three decimal digit number with leading zeroes to buffered log output. | |
void | bufLogDec_P (char const *src, uint16_t info) |
Log a string from program space + a 4 digit decimal number to buffered log output. | |
void | bufLogDecB (uint8_t const info) |
Log a two decimal digit number with leading zeroes to buffered log output. | |
void | bufLogDecHex_P (char const *src, uint16_t info1, uint32_t info2) |
Log a program space string + a 3 digit decimal + an 8 digit hex number to buffered log output. | |
void | bufLogHex (uint8_t const info) |
Log a two digit hex number to buffered log output. | |
void | bufLogHex_P (char const *src, uint8_t info) |
Log a string from program space + a two digit hex number to buffered log output. | |
void | bufLogHexHex_P (char const *src, uint8_t info1, uint32_t info2) |
Log a program space string + a 2 digit and an 8 digit hex number to buffered log output. | |
void | bufLogLF (uint8_t n) |
Log space and linefeed to buffered log output. | |
void | bufLogMark (char *info, uint8_t const len) |
Output a (debug) marker text. | |
void | bufLogTThex_P (char const *tx1, char const *tx2, uint8_t info) |
Log two flash strings + a two digit hex number to buffered log output. | |
void | bufLogTxt (char *src, uint8_t n) |
Log some characters from RAM to buffered log output. | |
void | bufLogTxt_P (char const *src) |
Log some characters from program space to buffered log output. |