Zephyr Project API 4.5.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mpipe_structure.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_STRUCTURE_H_
14#define ZEPHYR_INCLUDE_MPIPE_MPIPE_STRUCTURE_H_
15
16#include <zephyr/sys/clock.h>
17#include <zephyr/sys/util.h>
19#include <zephyr/toolchain.h>
20
22
64
78
132
139#define MPIPE_STRUCTURE_FLAG_ANY BIT(0)
140
153#define MPIPE_FRAME_INTERVAL_FROM_FPS(fps) DIV_ROUND_CLOSEST(USEC_PER_SEC, (fps))
154
173 uint8_t ids[CONFIG_MPIPE_STRUCTURE_MAX_FIELDS];
175 struct mpipe_value values[CONFIG_MPIPE_STRUCTURE_MAX_FIELDS];
176};
177
179#define MPIPE_STRUCTURE_FIELD_COUNT(field_id, value) 1 +
180#define MPIPE_STRUCTURE_FIELD_ID(field_id, value) (field_id),
181#define MPIPE_STRUCTURE_FIELD_VALUE(field_id, value) value,
183
206#define MPIPE_STRUCTURE_DEFINE(name, media, fields) \
207 BUILD_ASSERT((fields(MPIPE_STRUCTURE_FIELD_COUNT) 0) <= CONFIG_MPIPE_STRUCTURE_MAX_FIELDS, \
208 #name " has more fields than CONFIG_MPIPE_STRUCTURE_MAX_FIELDS"); \
209 static const struct mpipe_structure name = { \
210 .media_type_id = (media), \
211 .flags = 0, \
212 .num_fields = fields(MPIPE_STRUCTURE_FIELD_COUNT) 0, \
213 .ids = {fields(MPIPE_STRUCTURE_FIELD_ID)}, \
214 .values = {fields(MPIPE_STRUCTURE_FIELD_VALUE)}, \
215 }
216
228int mpipe_structure_init(struct mpipe_structure *structure, uint8_t media_type_id);
229
250int mpipe_structure_init_fields(struct mpipe_structure *structure, uint8_t media_type_id, ...);
251
263
272bool mpipe_structure_is_any(const struct mpipe_structure *structure);
273
286bool mpipe_structure_is_empty(const struct mpipe_structure *structure);
287
304 const struct mpipe_value *value);
305
325 uint8_t field_id);
326
342
354bool mpipe_structure_is_fixed(const struct mpipe_structure *structure);
355
367const struct mpipe_value *mpipe_structure_get_value(const struct mpipe_structure *structure,
368 uint8_t field_id);
369
381int mpipe_structure_remove_field(struct mpipe_structure *structure, uint8_t field_id);
382
408 const struct mpipe_structure *struct2, struct mpipe_structure *out);
409
423int mpipe_structure_fixate(const struct mpipe_structure *src, struct mpipe_structure *out);
424
432void mpipe_structure_print(const struct mpipe_structure *structure);
433
435
436#endif /*ZEPHYR_INCLUDE_MPIPE_MPIPE_STRUCTURE_H_*/
System clock APIs.
mpipe_caps_field
Caps field identifiers.
Definition mpipe_structure.h:101
const struct mpipe_value * mpipe_structure_get_value(const struct mpipe_structure *structure, uint8_t field_id)
Get the value of a field in an Capability Structure.
int mpipe_structure_init(struct mpipe_structure *structure, uint8_t media_type_id)
Initialize an Capability Structure.
int mpipe_structure_copy_field(const struct mpipe_structure *src, struct mpipe_structure *dst, uint8_t field_id)
Copy a field from one Capability Structure to another.
int mpipe_structure_clear(struct mpipe_structure *structure)
Empty an Capability Structure, dropping every field it carries.
int mpipe_structure_remove_field(struct mpipe_structure *structure, uint8_t field_id)
Remove a field from an Capability Structure.
bool mpipe_structure_is_fixed(const struct mpipe_structure *structure)
Check if an Capability Structure is fixed.
mpipe_media_type
Media type a capability describes.
Definition mpipe_structure.h:68
int mpipe_structure_append_value(struct mpipe_structure *structure, uint8_t field_id, const struct mpipe_value *value)
Append a field to an Capability Structure from caller-owned storage.
int mpipe_structure_init_any(struct mpipe_structure *structure)
Initialize a structure that constrains nothing.
int mpipe_structure_fixate(const struct mpipe_structure *src, struct mpipe_structure *out)
Fixate a structure into caller-provided storage.
bool mpipe_structure_is_any(const struct mpipe_structure *structure)
Check whether a structure is ANY, constraining nothing.
int mpipe_structure_init_fields(struct mpipe_structure *structure, uint8_t media_type_id,...)
Initialize an Capability Structure with a media type and a list of fields.
int mpipe_structure_intersect(const struct mpipe_structure *struct1, const struct mpipe_structure *struct2, struct mpipe_structure *out)
Intersect two structures into caller-provided storage.
bool mpipe_structure_is_empty(const struct mpipe_structure *structure)
Check whether an Capability Structure matches nothing.
void mpipe_structure_print(const struct mpipe_structure *structure)
Print an Capability Structure.
@ MPIPE_CAPS_NUM_CHANNELS
Number of channels (audio), MPIPE_TYPE_UINT.
Definition mpipe_structure.h:113
@ MPIPE_CAPS_FRAME_INTERVAL
Time covered by one frame, in microseconds, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:124
@ MPIPE_CAPS_END
One past the last field identifier.
Definition mpipe_structure.h:130
@ MPIPE_CAPS_BIT_WIDTH
Sample size in bits (audio), MPIPE_TYPE_UINT.
Definition mpipe_structure.h:111
@ MPIPE_CAPS_INTERLEAVED
Layout of the channels within a buffer (audio), MPIPE_TYPE_BOOLEAN: true for interleaved (LRLRLRLR),...
Definition mpipe_structure.h:118
@ MPIPE_CAPS_IMAGE_HEIGHT
Image height in pixels, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:107
@ MPIPE_CAPS_SAMPLE_RATE
Sampling frequency in Hz (audio), MPIPE_TYPE_UINT.
Definition mpipe_structure.h:109
@ MPIPE_CAPS_IMAGE_WIDTH
Image width in pixels, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:105
@ MPIPE_CAPS_PIXEL_FORMAT
Pixel format, as a VIDEO_PIX_FMT_* fourcc, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:103
@ MPIPE_MEDIA_END
One past the last media type; not itself a usable media type.
Definition mpipe_structure.h:76
@ MPIPE_MEDIA_UNKNOWN
Unknown media type, what an ANY structure carries.
Definition mpipe_structure.h:70
@ MPIPE_MEDIA_AUDIO_PCM
Audio in PCM format.
Definition mpipe_structure.h:72
@ MPIPE_MEDIA_VIDEO
Video, including raw, bayer and compressed formats.
Definition mpipe_structure.h:74
Value: one typed scalar or range inside a capability.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Fixed-size container holding the fields of one capability.
Definition mpipe_structure.h:165
uint8_t media_type_id
Media type of the structure, see mpipe_media_type.
Definition mpipe_structure.h:167
uint8_t num_fields
Number of slots in use at the front of ids and values.
Definition mpipe_structure.h:171
uint8_t ids[CONFIG_MPIPE_STRUCTURE_MAX_FIELDS]
Field identifier held by each slot, see mpipe_caps_field.
Definition mpipe_structure.h:173
struct mpipe_value values[CONFIG_MPIPE_STRUCTURE_MAX_FIELDS]
Value held by each slot.
Definition mpipe_structure.h:175
uint8_t flags
Structure flags, see MPIPE_STRUCTURE_FLAG_ANY.
Definition mpipe_structure.h:169
Value structure.
Definition mpipe_value.h:78
Misc utilities.
Macros to abstract toolchain specific capabilities.
Macro utilities.