Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
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
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 */
31};
32
48static 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
70 const char *data, uint32_t len);
71
93 uint32_t *seq, char *buf, uint32_t buflen);
94
95#endif /* ZEPHYR_INCLUDE_SYS_WINSTREAM_H_ */
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Lockless shared memory byte stream IPC.
Definition winstream.h:25
uint32_t start
Definition winstream.h:27
uint32_t len
Definition winstream.h:26
uint8_t data[]
Definition winstream.h:30
uint32_t end
Definition winstream.h:28
uint32_t seq
Definition winstream.h:29
uint32_t sys_winstream_read(struct sys_winstream *ws, uint32_t *seq, char *buf, uint32_t buflen)
Read bytes from a sys_winstream.
static struct sys_winstream * sys_winstream_init(void *buf, int buflen)
Construct a sys_winstream from a region of memory.
Definition winstream.h:48
void sys_winstream_write(struct sys_winstream *ws, const char *data, uint32_t len)
Write bytes to a sys_winstream.