weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Data Structures | Defines | Functions
include/we-aut_sys/streams.h File Reference

Overview

Streams (definitions)

This file contains the definitions for weAutSys' I/O via (standard i.e. stdio like) streams. It is system software and must not be modified for user or application programs.

This file is part of weAutSys   <weinert-automation.de>

  Copyright © 2012 Albrecht Weinert, Bochum

Author:
Albrecht Weinert   <a-weinert.de>
Revision:
2
Date:
2017-01-25 17:49:03 +0100 (Mi, 25 Jan 2017)

Data Structures

struct  streamClassDescript_t
 Extra stream (type) specific data. More...

Defines

#define AVAILABLE_UNKNOWN   0xFFFF
 Available input unknown.
#define LAN_IS_STDOUT
 stdout is the LAN stream output (Ethernet, uIP)
#define SER_IS_STDOUT
 stdout is the serial output (UART)
#define USE_AVR_GCC_FILE   1
 use AVR FILE type internals

Common stream handling definitions

#define PT_YIELD_OUT_SPACE(pt, requSpace, streams)
 Set standard I/O and exit or yield for requested output space.
#define PT_WAIT_OUT_SPACE(pt, requSpace, streams)
 Set standard I/O and exit or wait for requested output space.
typedef uint16_t(* str2InBufferd )(const FILE *stream)
 Function pointer / type: number of characters buffered for input.
typedef uint16_t(* str2OutSpace )(const FILE *stream)
 Function pointer / type: buffer space available for output.
typedef uint8_t(* str2CheckOutSpace )(uint16_t reqSpace, const FILE *stream)
 Function pointer / type: checking the space available for output.
typedef int(* str2PutS )(char *src, const FILE *stream)
 Function pointer / type: writing a RAM string to output.
typedef int(* str2PutS_P )(prog_char *src, const FILE *stream)
 Function pointer / type: writing a flash memory string to output.
typedef struct
streamClassDescript_t 
streamClassDescript_s
 Extra stream (type) specific data (structure)
uint16_t inBufferd (const FILE *stream)
 Number of characters buffered for input.
uint16_t outSpace (const FILE *stream)
 Buffer space available for output.
uint8_t checkOutSpace (uint16_t reqSpace, const FILE *stream)
 Checking the space available for output.
int putSt (char *src, const FILE *stream)
 Write a RAM string to output.
int putSt_P (char const *src, const FILE *stream)
 Write a flash memory string to output.

The serial streams

FILE serStreams
 The stream "device" connected to the serial IO / UART(0)
void serStreamsOpen (void)
 Open the serial (UART) streams.
uint16_t serStreamsOutSpace (FILE *streams)
 The buffer space available for serial output.
uint8_t serCheckOutSpace (uint16_t reqSpace, FILE *streams)
 Check the space available for serial output.
int serPutChar (char c, FILE *stream)
 Put one byte to serial output.

Recommended standard I/O functions

#define stdPutS(src)
 Write a RAM string to stdout.
#define stdPutS_P(src)
 Write a flash memory string to stdout.
void stdPutC (char c)
 Write a character to stdout.
void logStackS (uint8_t maxBytes)
 Log the stack frame to stdout.

The Ethernet / LAN streams

FILE lanStreams
 The stream "device" connected to the Ethernet (uIP)
void lanStreamsInit (void)
 Initialise the Ethernet / LAN streams.
void lanStreamsEcho (void)
 Set the Ethernet / LAN streams to echo input.
void lanStreamsOpen (void)
 Open the Ethernet / LAN streams.
void lanStreamSend (void)
 Sends the LAN streams data (over the Ethernet)
uint16_t lanStreamsOutSpace (FILE *streams)
 The buffer space available for Ethernet / LAN streams output.
uint8_t lanCheckOutSpace (uint16_t reqSpace, FILE *streams)
 Check the space available Ethernet / LAN streams output.
uint16_t lanInBufferd (FILE *streams)
 The number of characters buffered from LAN (stream) input.
int lanGetC (void)
 Get one byte from LAN stream input.
void lanPutC (char c)
 Put one byte to LAN stream output.
int lanGetChar (FILE *stream)
 Get one byte from LAN stream input.
int lanPutChar (char c, FILE *stream)
 Put one byte to LAN stream output.
int lanPutChars (char *src, uint16_t n)
 Put some characters to LAN stream output.
int lanPutSt (char *src, const FILE *stream)
 Put a RAM string (some characters) to LAN stream output.
int lanPutSt_P (char *src, const FILE *stream)
 Put some characters from program space to LAN stream output.

The nul device

FILE nulStreams
 The stream "device" connected to the nul device.
void nulStreamsOpen (void)
 Open the nul streams.
uint16_t nulStreamsOutSpace (FILE *streams)
 The buffer space available for nul output.
uint8_t nulCheckOutSpace (uint16_t reqSpace, FILE *streams)
 Check the space available for nul streams output.
uint16_t nulInBufferd (FILE *streams)
 The number of characters buffered from nul input.
int nulGetC (void)
 Get one byte from nul stream input.
void nulPutC (char c)
 Put one byte to nul stream output.
int nulPutChar (char c, FILE *stream)
 Put one byte to nul stream output.
int nulGetChar (FILE *stream)
 Get one byte from nul stream input.
int nulPutSt (char *const src, const FILE *stream)
 Put a string (some characters) to nul stream output.

Functions

void initStdStreams (FILE *initStream)
 Initialise the standard streams.
void streamsClose (void)
 Close other standard streams.
uint8_t switchStdStreams (FILE *toStream)
 Switch the standard streams to another stream.