Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ump_stream_responder.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Titouan Christophe
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef ZEPHYR_LIB_MIDI2_UMP_STREAM_RESPONDER_H_
7#define ZEPHYR_LIB_MIDI2_UMP_STREAM_RESPONDER_H_
8
18
19#include <zephyr/kernel.h>
20#include <zephyr/audio/midi.h>
21
45
51 const char *name;
53 size_t n_blocks;
56};
57
63 void *dev;
65 void (*send)(void *dev, const struct midi_ump ump);
68};
69
75#define UMP_BLOCK_DT_SPEC_GET(_node) \
76{ \
77 .name = DT_PROP_OR(_node, label, NULL), \
78 .first_group = DT_REG_ADDR(_node), \
79 .groups_spanned = DT_REG_SIZE(_node), \
80 .is_input = !DT_ENUM_HAS_VALUE(_node, terminal_type, output_only), \
81 .is_output = !DT_ENUM_HAS_VALUE(_node, terminal_type, input_only), \
82 .is_midi1 = !DT_ENUM_HAS_VALUE(_node, protocol, midi2), \
83 .is_31250bps = DT_PROP(_node, serial_31250bps), \
84}
85
86#define UMP_BLOCK_SEP_IF_OKAY(_node) \
87 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(_node), \
88 (UMP_BLOCK_DT_SPEC_GET(_node),), \
89 ())
90
96#define UMP_ENDPOINT_DT_SPEC_GET(_node) \
97{ \
98 .name = DT_PROP_OR(_node, label, NULL), \
99 .n_blocks = DT_FOREACH_CHILD_SEP(_node, DT_NODE_HAS_STATUS_OKAY, (+)), \
100 .blocks = {DT_FOREACH_CHILD(_node, UMP_BLOCK_SEP_IF_OKAY)}, \
101}
102
110int ump_stream_respond(const struct ump_stream_responder_cfg *cfg,
111 const struct midi_ump pkt);
112
117const char *ump_product_instance_id(void);
118
120
121#endif
const char * ump_product_instance_id(void)
Definition ump_stream_responder.c:235
int ump_stream_respond(const struct ump_stream_responder_cfg *cfg, const struct midi_ump pkt)
Respond to an UMP Stream message.
Definition ump_stream_responder.c:265
Public kernel APIs.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Universal MIDI Packet container.
Definition midi.h:41
UMP Function Block specification.
Definition ump_stream_responder.h:26
const char * name
Name of this function block, or NULL if unnamed.
Definition ump_stream_responder.h:28
bool is_midi1
True if this function block carries MIDI1 data only.
Definition ump_stream_responder.h:38
bool is_input
True if this function block is an input.
Definition ump_stream_responder.h:34
uint8_t first_group
Number of the first UMP group in this block.
Definition ump_stream_responder.h:30
bool is_output
True if this function block is an output.
Definition ump_stream_responder.h:36
bool is_31250bps
True if this function block is physically wired to a (MIDI1) serial interface, where data is transmit...
Definition ump_stream_responder.h:43
uint8_t groups_spanned
Number of (contiguous) UMP groups spanned by this block.
Definition ump_stream_responder.h:32
UMP endpoint specification.
Definition ump_stream_responder.h:49
size_t n_blocks
Number of function blocks in this endpoint.
Definition ump_stream_responder.h:53
struct ump_block_dt_spec blocks[]
Function blocks in this endpoint.
Definition ump_stream_responder.h:55
const char * name
Name of this endpoint, or NULL if unnamed.
Definition ump_stream_responder.h:51
Configuration for the UMP Stream responder.
Definition ump_stream_responder.h:61
void(* send)(void *dev, const struct midi_ump ump)
The function to call to send a reply packet.
Definition ump_stream_responder.h:65
void * dev
The device to send reply packets.
Definition ump_stream_responder.h:63
const struct ump_endpoint_dt_spec * ep_spec
The UMP endpoint specification.
Definition ump_stream_responder.h:67