ISR -> userspace pipe.
More...
ISR -> userspace pipe.
|
void | isrpipe_init (isrpipe_t *isrpipe, char *buf, size_t bufsize) |
| Initialisation function for isrpipe. More...
|
|
int | isrpipe_write_one (isrpipe_t *isrpipe, char c) |
| Put one character into the isrpipe's buffer. More...
|
|
int | isrpipe_read (isrpipe_t *isrpipe, char *buf, size_t count) |
| Read data from isrpipe (blocking) More...
|
|
int | isrpipe_read_timeout (isrpipe_t *isrpipe, char *buf, size_t count, uint32_t timeout) |
| Read data from isrpipe (with timeout, blocking) More...
|
|
int | isrpipe_read_all_timeout (isrpipe_t *isrpipe, char *buf, size_t count, uint32_t timeout) |
| Read data from isrpipe (with timeout, blocking, wait until all read) More...
|
|
◆ isrpipe_init()
Initialisation function for isrpipe.
- Parameters
-
[in] | isrpipe | isrpipe object to initialize |
[in] | buf | buffer to use as ringbuffer (must be power of two sized!) |
[in] | bufsize | size of buf |
◆ isrpipe_read()
Read data from isrpipe (blocking)
- Parameters
-
[in] | isrpipe | isrpipe object to operate on |
[in] | buf | buffer to write to |
[in] | count | number of bytes to read |
- Returns
- number of bytes read
◆ isrpipe_read_all_timeout()
int isrpipe_read_all_timeout |
( |
isrpipe_t * |
isrpipe, |
|
|
char * |
buf, |
|
|
size_t |
count, |
|
|
uint32_t |
timeout |
|
) |
| |
Read data from isrpipe (with timeout, blocking, wait until all read)
This function is like isrpipe_read_timeout, but will only return on timeout or when count
bytes have been received.
- Parameters
-
[in] | isrpipe | isrpipe object to operate on |
[in] | buf | buffer to write to |
[in] | count | number of bytes to read |
[in] | timeout | timeout in microseconds |
- Returns
- number of bytes read
-
-ETIMEDOUT on timeout
◆ isrpipe_read_timeout()
int isrpipe_read_timeout |
( |
isrpipe_t * |
isrpipe, |
|
|
char * |
buf, |
|
|
size_t |
count, |
|
|
uint32_t |
timeout |
|
) |
| |
Read data from isrpipe (with timeout, blocking)
Currently, the timeout parameter is applied on every underlying read, which might be per single byte.
- Note
- This function might return less than
count
bytes
- Parameters
-
[in] | isrpipe | isrpipe object to operate on |
[in] | buf | buffer to write to |
[in] | count | number of bytes to read |
[in] | timeout | timeout in microseconds |
- Returns
- number of bytes read
-
-ETIMEDOUT on timeout
◆ isrpipe_write_one()
int isrpipe_write_one |
( |
isrpipe_t * |
isrpipe, |
|
|
char |
c |
|
) |
| |
Put one character into the isrpipe's buffer.
- Parameters
-
[in] | isrpipe | isrpipe object to initialize |
[in] | c | character to add to isrpipe buffer |
- Returns
- 0 if character could be added
-
-1 if buffer was full