1.5 KiB
1.5 KiB
title | date | summary |
---|---|---|
stream.h | 2023-04-20T22:15:05+02:00 | Streams are cycled buffers, that have __one__ input and __one__ output. |
Streams are cycled buffers, that have one input and one output.
stream_T
- struct
Name | Type | Description |
---|---|---|
buffer | uint8_t* | The buffer where all the streams data is stored in. |
size | uint32_t | The size of buffer in bytes. |
pos_sender | uint32_t | The senders (input) position in the buffer. |
pos_receiver | uint32_t | The receivers (output) position in the buffer. This is always behind the sender. |
stream_alloc(size)
- function (stream_T*)
Allocates and returns a new stream, with a buffer of size size.
stream_destruct(stream)
- function (void)
Frees the resources of a stream.
stream_write(stream, buffer_in, n)
- function (uint32_t)
Writes at most n bytes from buffer_in into stream. Returns the amount of bytes, that where actually written into the stream.
stream_read(stream, buffer_out, n)
- function (uint32_t)
Reads at most n bytes from stream into buffer_out. Returns the amount of bytes, that where actually read from the stream.