ChibiOS/HAL
6.1.0
|
This module define an abstract interface for generic data streams. Note that no code is present, just abstract interfaces-like structures, you should look at the system as to a set of abstract C++ classes (even if written in C). This system has then advantage to make the access to data 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.
Macros | |
#define | _base_sequential_stream_methods |
BaseSequentialStream specific methods. More... | |
#define | _base_sequential_stream_data _base_object_data |
BaseSequentialStream specific data. More... | |
Streams return codes | |
#define | STM_OK MSG_OK |
#define | STM_TIMEOUT MSG_TIMEOUT |
#define | STM_RESET MSG_RESET |
Macro Functions (BaseSequentialStream) | |
#define | streamWrite(ip, bp, n) ((ip)->vmt->write(ip, bp, n)) |
Sequential Stream write. More... | |
#define | streamRead(ip, bp, n) ((ip)->vmt->read(ip, bp, n)) |
Sequential Stream read. More... | |
#define | streamPut(ip, b) ((ip)->vmt->put(ip, b)) |
Sequential Stream blocking byte write. More... | |
#define | streamGet(ip) ((ip)->vmt->get(ip)) |
Sequential Stream blocking byte read. More... | |
Data Structures | |
struct | BaseSequentialStreamVMT |
BaseSequentialStream virtual methods table. More... | |
struct | BaseSequentialStream |
Base stream class. More... | |
#define _base_sequential_stream_methods |
BaseSequentialStream specific methods.
Definition at line 50 of file hal_streams.h.
#define _base_sequential_stream_data _base_object_data |
BaseSequentialStream
specific data.
BaseSequentialStream
is only an interface without implementation. Definition at line 66 of file hal_streams.h.
#define streamWrite | ( | ip, | |
bp, | |||
n | |||
) | ((ip)->vmt->write(ip, bp, n)) |
Sequential Stream write.
The function writes data from a buffer to a stream.
[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 |
Definition at line 106 of file hal_streams.h.
#define streamRead | ( | ip, | |
bp, | |||
n | |||
) | ((ip)->vmt->read(ip, bp, n)) |
Sequential Stream read.
The function reads data from a stream into a buffer.
[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 |
Definition at line 121 of file hal_streams.h.
#define streamPut | ( | ip, | |
b | |||
) | ((ip)->vmt->put(ip, b)) |
Sequential Stream blocking byte write.
This function writes a byte value to a channel. If the channel is not ready to accept data then the calling thread is suspended.
[in] | ip | pointer to a BaseChannel or derived class |
[in] | b | the byte value to be written to the channel |
STM_OK | if the operation succeeded. |
STM_RESET | if an end-of-file condition has been met. |
Definition at line 137 of file hal_streams.h.
#define streamGet | ( | ip | ) | ((ip)->vmt->get(ip)) |
Sequential Stream blocking byte read.
This function reads a byte value from a channel. If the data is not available then the calling thread is suspended.
[in] | ip | pointer to a BaseChannel or derived class |
STM_RESET | if an end-of-file condition has been met. |
Definition at line 151 of file hal_streams.h.