Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
21 uint32_t len; /* Length of data[] in bytes */
22 uint32_t start; /* Index of first valid byte in data[] */
23 uint32_t end; /* Index of next byte in data[] to write */
24 uint32_t seq; /* Mod-2^32 index of end since stream init */
26};
27
43static inline struct sys_winstream *sys_winstream_init(void *buf, int buflen)
44{
45 struct sys_winstream *ws = buf, tmp = { .len = buflen - sizeof(*ws) };
46
47 *ws = tmp;
48 return ws;
49}
50
65 const char *data, uint32_t len);
66
88 uint32_t *seq, char *buf, uint32_t buflen);
89
90#endif /* ZEPHYR_INCLUDE_SYS_WINSTREAM_H_ */
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Lockless shared memory byte stream IPC.
Definition: winstream.h:20
uint32_t start
Definition: winstream.h:22
uint32_t len
Definition: winstream.h:21
uint8_t data[]
Definition: winstream.h:25
uint32_t end
Definition: winstream.h:23
uint32_t seq
Definition: winstream.h:24
static fdata_t data[2]
Definition: test_fifo_contexts.c:15
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:43
void sys_winstream_write(struct sys_winstream *ws, const char *data, uint32_t len)
Write bytes to a sys_winstream.