Zephyr Project API 4.4.99
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_DUMP)
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
88#define MPIPE_STATE_GET_NEXT(cur, target) \
89 ((enum mpipe_state)((int)cur + SYS_SIGN((int)target - (int)cur)))
90
98#define MPIPE_STATE_TRANSITION(cur, next) (((cur) << 2) | (next))
99
109#define MPIPE_STATE_TRANSITION_CURRENT(trans) ((enum mpipe_state)((trans) >> 2))
110
120#define MPIPE_STATE_TRANSITION_NEXT(trans) ((enum mpipe_state)((trans) & 0x3))
121
135
155
156struct mpipe_element;
157
168
169#if defined(CONFIG_MPIPE_DUMP) || defined(__DOXYGEN__)
176 const char *name;
177#endif
178
183
186
188 int (*set_state)(struct mpipe_element *element, enum mpipe_state state);
190 int (*change_state)(struct mpipe_element *element, enum mpipe_state_change transition);
191};
192
204
224static inline void mpipe_element_set_name(struct mpipe_element *self, const char *name)
225{
226 ARG_UNUSED(self);
227 ARG_UNUSED(name);
228
229 MPIPE_ELEMENT_SET_NAME(self, name);
230}
231
232struct mpipe_pad;
233
245
257void mpipe_element_add_pad(struct mpipe_element *element, struct mpipe_pad *pad);
258
272int mpipe_element_link(struct mpipe_element *element_1, struct mpipe_element *element_2, ...);
273
288
301
303
304#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
enum mpipe_state_change
Definition mpipe_element.h:141
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:127
static void mpipe_element_set_name(struct mpipe_element *self, const char *name)
Name an element for the pipeline dump.
Definition mpipe_element.h:224
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:98
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:152
@ MPIPE_STATE_CHANGE_PLAYING_TO_PAUSED
State change from PLAYING to PAUSED.
Definition mpipe_element.h:149
@ MPIPE_STATE_CHANGE_READY_TO_PAUSED
State change from READY to PAUSED.
Definition mpipe_element.h:143
@ MPIPE_STATE_CHANGE_PAUSED_TO_PLAYING
State change from PAUSED to PLAYING.
Definition mpipe_element.h:146
@ MPIPE_STATE_PLAYING
The element is PLAYING, data is flowing through the element.
Definition mpipe_element.h:133
@ MPIPE_STATE_PAUSED
The element is PAUSED and ready to receive, process or transfer data.
Definition mpipe_element.h:131
@ MPIPE_STATE_READY
The element is initialized READY to go to PAUSED.
Definition mpipe_element.h:129
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:77
Element base class.
Definition mpipe_element.h:165
int(* set_state)(struct mpipe_element *element, enum mpipe_state state)
Set state function, 0 on success, negative errno otherwise.
Definition mpipe_element.h:188
struct mpipe_object object
Base object.
Definition mpipe_element.h:167
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:176
sys_dlist_t sink_pads
List of sink pads.
Definition mpipe_element.h:182
enum mpipe_state current_state
Current state of the element.
Definition mpipe_element.h:185
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:190
sys_dlist_t src_pads
List of source pads.
Definition mpipe_element.h:180
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.