ChibiOS/RT Logo ChibiOS/RT

Architecture - Reference Manual - Guides

Data Streams
[I/O Support]

Collaboration diagram for Data Streams:


Description

This module define an abstract interface for generic data streams. Note that no code is present, streams are just abstract interfaces like structures, you should look at the systems as to a set of abstract C++ classes (even if written in C). This system has the advantage to make the access to streams independent from the implementation logic.
The stream interface can be used as base class for high level object types such as files, sockets, serial ports, pipes etc.

Data Structures

struct  BaseSequentialStreamVMT
 BaseSequentialStream virtual methods table. More...
struct  BaseSequentialStream
 Base stream class. More...

Defines

#define _base_sequental_stream_methods
 BaseSequentialStream specific methods.
#define _base_sequental_stream_data
 BaseSequentialStream specific data.
#define chSequentialStreamWrite(ip, bp, n)   ((ip)->vmt->write(ip, bp, n))
 Sequential Stream write.
#define chSequentialStreamRead(ip, bp, n)   ((ip)->vmt->read(ip, bp, n))
 Sequential Stream read.

Define Documentation

#define _base_sequental_stream_methods
Value:
/* Stream write buffer method.*/                                          \
  size_t (*write)(void *instance, const uint8_t *bp, size_t n);             \
  /* Stream read buffer method.*/                                           \
  size_t (*read)(void *instance, uint8_t *bp, size_t n);

BaseSequentialStream specific methods.

Definition at line 51 of file chstreams.h.

#define _base_sequental_stream_data

BaseSequentialStream specific data.

Note:
It is empty because BaseSequentialStream is only an interface without implementation.

Definition at line 62 of file chstreams.h.

#define chSequentialStreamWrite ( ip,
bp,
 )     ((ip)->vmt->write(ip, bp, n))

Sequential Stream write.

The function writes data from a buffer to a stream.

Parameters:
[in] ip pointer to a BaseSequentialStream or derived class
[in] bp pointer to the data buffer
[in] n the maximum amount of data to be transferred
Returns:
The number of bytes transferred. The return value can be less than the specified number of bytes if the stream reaches a physical end of file and cannot be extended.

Definition at line 94 of file chstreams.h.

#define chSequentialStreamRead ( ip,
bp,
 )     ((ip)->vmt->read(ip, bp, n))

Sequential Stream read.

The function reads data from a stream into a buffer.

Parameters:
[in] ip pointer to a BaseSequentialStream or derived class
[out] bp pointer to the data buffer
[in] n the maximum amount of data to be transferred
Returns:
The number of bytes transferred. The return value can be less than the specified number of bytes if the stream reaches the end of the available data.

Definition at line 107 of file chstreams.h.


Generated on Sun Jul 11 13:13:16 2010 for ChibiOS/RT by doxygen 1.6.3