Zephyr Project API 4.5.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mpipe_element.h
Go to the documentation of this file.
1/*
2 * Copyright 2025-2026 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_MPIPE_MPIPE_ELEMENT_H_
14#define ZEPHYR_INCLUDE_MPIPE_MPIPE_ELEMENT_H_
15
58
59#include <stdbool.h>
60#include <stdint.h>
61
62#include <zephyr/sys/dlist.h>
63#include <zephyr/sys/util.h>
64
66
67struct mpipe_dispatch;
68struct zbus_channel;
69
71#if defined(CONFIG_MPIPE_ELEMENT_NAME)
72#define MPIPE_ELEMENT_SET_NAME(e, n) ((e)->name = (n))
73#else
74#define MPIPE_ELEMENT_SET_NAME(e, n) ((void)0)
75#endif
77
89#define MPIPE_STATE_GET_NEXT(cur, target) \
90 ((enum mpipe_state)((int)cur + SYS_SIGN((int)target - (int)cur)))
91
100#define MPIPE_STATE_TRANSITION(cur, next) (((cur) << 2) | (next))
101
112#define MPIPE_STATE_TRANSITION_CURRENT(trans) ((enum mpipe_state)((trans) >> 2))
113
124#define MPIPE_STATE_TRANSITION_NEXT(trans) ((enum mpipe_state)((trans) & 0x3))
125
139
157
158struct mpipe_element;
159
170
171#if defined(CONFIG_MPIPE_ELEMENT_NAME) || defined(__DOXYGEN__)
178 const char *name;
179#endif
180
185
188
190 int (*set_state)(struct mpipe_element *element, enum mpipe_state state);
192 int (*change_state)(struct mpipe_element *element, enum mpipe_state_change transition);
193};
194
206
226static inline void mpipe_element_set_name(struct mpipe_element *self, const char *name)
227{
228 ARG_UNUSED(self);
229 ARG_UNUSED(name);
230
231 MPIPE_ELEMENT_SET_NAME(self, name);
232}
233
234struct mpipe_pad;
235
247
259void mpipe_element_add_pad(struct mpipe_element *element, struct mpipe_pad *pad);
260
275int mpipe_element_link(struct mpipe_element *element_1, struct mpipe_element *element_2, ...);
276
292
305
307
308#endif /* ZEPHYR_INCLUDE_MPIPE_MPIPE_ELEMENT_H_ */
Header file for the doubly-linked list API.
struct _dnode sys_dlist_t
Doubly-linked list structure.
Definition dlist.h:55
mpipe_state_change
Transition between two adjacent states.
Definition mpipe_element.h:143
void mpipe_element_reset_pad_caps(struct mpipe_element *element)
Reset every pad of an element to constraining nothing.
int mpipe_element_link(struct mpipe_element *element_1, struct mpipe_element *element_2,...)
Link elements together.
mpipe_state
States of an element.
Definition mpipe_element.h:131
static void mpipe_element_set_name(struct mpipe_element *self, const char *name)
Name an element for the pipeline dump.
Definition mpipe_element.h:226
int mpipe_element_init(struct mpipe_element *self, uint8_t id)
Initialize an element.
void mpipe_element_add_pad(struct mpipe_element *element, struct mpipe_pad *pad)
Attach a pad to an element.
#define MPIPE_STATE_TRANSITION(cur, next)
Create state transition value.
Definition mpipe_element.h:100
struct zbus_channel * mpipe_element_get_bus_chan(struct mpipe_element *element)
Get the bus channel of an element.
int mpipe_element_set_state(struct mpipe_element *element, enum mpipe_state state)
Set the state of an element.
@ MPIPE_STATE_CHANGE_PAUSED_TO_READY
State change from PAUSED to READY.
Definition mpipe_element.h:154
@ MPIPE_STATE_CHANGE_PLAYING_TO_PAUSED
State change from PLAYING to PAUSED.
Definition mpipe_element.h:151
@ MPIPE_STATE_CHANGE_READY_TO_PAUSED
State change from READY to PAUSED.
Definition mpipe_element.h:145
@ MPIPE_STATE_CHANGE_PAUSED_TO_PLAYING
State change from PAUSED to PLAYING.
Definition mpipe_element.h:148
@ MPIPE_STATE_PLAYING
The element is PLAYING, data is flowing through the element.
Definition mpipe_element.h:137
@ MPIPE_STATE_PAUSED
The element is PAUSED and ready to receive, process or transfer data.
Definition mpipe_element.h:135
@ MPIPE_STATE_READY
The element is initialized READY to go to PAUSED.
Definition mpipe_element.h:133
Object: the base that every mpipe type embeds.
state
Definition parser_state.h:29
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
A query or an event traveling a pad link.
Definition mpipe_dispatch.h:75
Element base class.
Definition mpipe_element.h:167
int(* set_state)(struct mpipe_element *element, enum mpipe_state state)
Set state function, 0 on success, negative errno otherwise.
Definition mpipe_element.h:190
struct mpipe_object object
Base object.
Definition mpipe_element.h:169
const char * name
Name of the element, set to its type by the element's init function and overridable per instance with...
Definition mpipe_element.h:178
sys_dlist_t sink_pads
List of sink pads.
Definition mpipe_element.h:184
enum mpipe_state current_state
Current state of the element.
Definition mpipe_element.h:187
int(* change_state)(struct mpipe_element *element, enum mpipe_state_change transition)
Change state function, 0 on success, negative errno otherwise.
Definition mpipe_element.h:192
sys_dlist_t src_pads
List of source pads.
Definition mpipe_element.h:182
Base object structure.
Definition mpipe_object.h:65
Pad structure.
Definition mpipe_pad.h:128
Type used to represent a channel.
Definition zbus.h:99
Misc utilities.