Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
Loading...
Searching...
No Matches
winstream.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Intel Corporation
3
* SPDX-License-Identifier: Apache-2.0
4
*/
5
#ifndef ZEPHYR_INCLUDE_SYS_WINSTREAM_H_
6
#define ZEPHYR_INCLUDE_SYS_WINSTREAM_H_
7
8
#include <
stdint.h
>
9
25
struct
sys_winstream
{
26
uint32_t
len
;
/* Length of data[] in bytes */
27
uint32_t
start
;
/* Index of first valid byte in data[] */
28
uint32_t
end
;
/* Index of next byte in data[] to write */
29
uint32_t
seq
;
/* Mod-2^32 index of 'end' since stream init */
30
uint8_t
data
[];
31
};
32
48
static
inline
struct
sys_winstream
*
sys_winstream_init
(
void
*buf,
int
buflen)
49
{
50
struct
sys_winstream
*ws = buf, tmp = { .len = buflen -
sizeof
(*ws) };
51
52
*ws = tmp;
53
return
ws;
54
}
55
69
void
sys_winstream_write
(
struct
sys_winstream
*ws,
70
const
char
*
data
,
uint32_t
len
);
71
92
uint32_t
sys_winstream_read
(
struct
sys_winstream
*ws,
93
uint32_t
*
seq
,
char
*buf,
uint32_t
buflen);
94
95
#endif
/* ZEPHYR_INCLUDE_SYS_WINSTREAM_H_ */
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
sys_winstream
Lockless shared memory byte stream IPC.
Definition
winstream.h:25
sys_winstream::start
uint32_t start
Definition
winstream.h:27
sys_winstream::len
uint32_t len
Definition
winstream.h:26
sys_winstream::data
uint8_t data[]
Definition
winstream.h:30
sys_winstream::end
uint32_t end
Definition
winstream.h:28
sys_winstream::seq
uint32_t seq
Definition
winstream.h:29
sys_winstream_read
uint32_t sys_winstream_read(struct sys_winstream *ws, uint32_t *seq, char *buf, uint32_t buflen)
Read bytes from a sys_winstream.
sys_winstream_init
static struct sys_winstream * sys_winstream_init(void *buf, int buflen)
Construct a sys_winstream from a region of memory.
Definition
winstream.h:48
sys_winstream_write
void sys_winstream_write(struct sys_winstream *ws, const char *data, uint32_t len)
Write bytes to a sys_winstream.
zephyr
sys
winstream.h
Generated on
for Zephyr API by
1.17.0