2025-11-27 09:38:35 +01:00
|
|
|
/* AVB support */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2025 Alexandre Malki <alexandre.malki@kebag-logic.com> */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
|
|
#ifndef AVB_AECP_AEM_STATE_H
|
|
|
|
|
#define AVB_AECP_AEM_STATE_H
|
|
|
|
|
|
2025-12-07 09:14:17 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2025-11-27 09:38:35 +01:00
|
|
|
#include "aecp-aem-descriptors.h"
|
2025-11-30 09:20:24 +01:00
|
|
|
#include "aecp-aem-milan.h"
|
2025-12-07 09:14:17 +01:00
|
|
|
#include "stream.h"
|
2025-11-27 09:38:35 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The way structure are organised in a "derived" manner.
|
|
|
|
|
* Each of the state structure must directly "castable" into the descriptor
|
|
|
|
|
* that the state variable relies upon.
|
|
|
|
|
*
|
|
|
|
|
* For instance, if a stream_input descriptor is created, the state structure
|
|
|
|
|
* stream_input_state needs to be created as follow:
|
|
|
|
|
*
|
|
|
|
|
* struct stream_input_state {
|
|
|
|
|
* struct stream_input_desc ...
|
|
|
|
|
* ...
|
|
|
|
|
* This way it's possible to get directly from the AEM command the descriptor
|
|
|
|
|
* and the state without having to create a mechanism for this.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief The base information would be required
|
|
|
|
|
* for descriptor that needs to udpate for unsollictied
|
|
|
|
|
* notificaction.
|
|
|
|
|
*/
|
|
|
|
|
struct aecp_aem_state_base {
|
2026-01-19 09:39:49 +01:00
|
|
|
uint64_t controller_entity_id;
|
2025-11-27 09:38:35 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
int64_t last_update;
|
2025-11-27 09:38:35 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
/** timeout absolute time*/
|
|
|
|
|
int64_t expire_timeout;
|
2025-11-27 09:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
2025-11-30 09:20:24 +01:00
|
|
|
/**
|
|
|
|
|
* \brief the structure keeps track of the registered controller entities
|
|
|
|
|
*/
|
|
|
|
|
struct aecp_aem_unsol_notification_state {
|
2026-01-19 09:39:49 +01:00
|
|
|
uint64_t ctrler_entity_id;
|
2025-11-30 09:20:24 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
uint8_t ctrler_mac_addr[6];
|
2025-11-30 09:20:24 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
uint8_t port_id;
|
2025-11-30 09:20:24 +01:00
|
|
|
|
|
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
uint16_t next_seq_id;
|
|
|
|
|
bool is_registered;
|
2025-11-30 09:20:24 +01:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-30 12:11:56 +01:00
|
|
|
struct aecp_aem_base_info {
|
2026-01-19 09:39:49 +01:00
|
|
|
uint64_t controller_entity_id;
|
2025-11-30 12:11:56 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
int64_t last_update;
|
2025-11-30 12:11:56 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
/** timeout absolute time*/
|
|
|
|
|
int64_t expire_timeout;
|
2025-11-30 12:11:56 +01:00
|
|
|
};
|
|
|
|
|
|
2025-11-30 09:20:24 +01:00
|
|
|
struct aecp_aem_lock_state {
|
2025-11-30 12:11:56 +01:00
|
|
|
struct aecp_aem_base_info base_info;
|
2025-11-30 09:20:24 +01:00
|
|
|
/**
|
|
|
|
|
* the entity id that is locking this system
|
|
|
|
|
*/
|
|
|
|
|
uint64_t locked_id;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* actual value of the lock
|
|
|
|
|
*/
|
|
|
|
|
bool is_locked;
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-15 08:48:49 +01:00
|
|
|
struct aecp_aem_avb_interface_state {
|
|
|
|
|
struct avb_aem_desc_avb_interface desc;
|
|
|
|
|
struct avb_msrp_attribute *domain_attr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2025-11-30 09:20:24 +01:00
|
|
|
/**
|
|
|
|
|
* \brief the generic entity state common for all flavor of AVB
|
|
|
|
|
*/
|
|
|
|
|
struct aecp_aem_entity_state {
|
|
|
|
|
struct avb_aem_desc_entity desc;
|
2025-12-03 09:11:17 +01:00
|
|
|
struct aecp_aem_lock_state lock_state;
|
2025-11-30 09:20:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Milan implementation of the entity
|
|
|
|
|
*/
|
|
|
|
|
struct aecp_aem_entity_milan_state {
|
|
|
|
|
struct aecp_aem_entity_state state;
|
|
|
|
|
struct aecp_aem_unsol_notification_state unsol_notif_state[AECP_AEM_MILAN_MAX_CONTROLLER];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Legacy AVB implementation of the entity
|
|
|
|
|
*/
|
|
|
|
|
struct aecp_aem_entity_legacy_avb_state {
|
|
|
|
|
struct aecp_aem_entity_state state;
|
|
|
|
|
};
|
2025-11-27 09:38:35 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief The stream inputs are specified as in the IEEE-1722.1-2021
|
|
|
|
|
* Table 7-156
|
|
|
|
|
*/
|
|
|
|
|
struct aecp_aem_stream_input_counters {
|
2026-01-19 09:39:49 +01:00
|
|
|
struct aecp_aem_state_base base_state;
|
2025-11-27 09:38:35 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
uint32_t media_locked;
|
|
|
|
|
uint32_t media_unlocked;
|
|
|
|
|
uint32_t stream_interrupted;
|
|
|
|
|
uint32_t seq_mistmatch;
|
|
|
|
|
uint32_t media_reset;
|
|
|
|
|
/** Timestamp Uncertain */
|
|
|
|
|
uint32_t tu;
|
|
|
|
|
uint32_t unsupported_format;
|
|
|
|
|
uint32_t late_timestamp;
|
|
|
|
|
uint32_t early_timestamp;
|
|
|
|
|
uint32_t frame_rx;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct stream_common {
|
|
|
|
|
struct stream stream;
|
2026-03-15 10:20:17 +01:00
|
|
|
struct avb_msrp_attribute *stream_attr;
|
2025-11-27 09:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aecp_aem_stream_input_state {
|
2026-01-19 09:39:49 +01:00
|
|
|
struct avb_aem_desc_stream desc;
|
2025-11-27 09:38:35 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
struct aecp_aem_stream_input_counters counters;
|
|
|
|
|
struct stream_common common;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct stream_input_saved_binding_param {
|
|
|
|
|
uint64_t controller_guid;
|
|
|
|
|
uint64_t talker_guid;
|
|
|
|
|
uint64_t listener_guid;
|
|
|
|
|
uint16_t talker_unique_id;
|
|
|
|
|
uint16_t listener_unique_id;
|
|
|
|
|
/** 1722.1-2021 Table 7.145 use the same as in the aecp packet*/
|
|
|
|
|
uint32_t aem_flags;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct acmp_stream_status_common {
|
|
|
|
|
struct stream_input_saved_binding_param saved_bindings;
|
|
|
|
|
uint8_t probing_status;
|
|
|
|
|
uint8_t acmp_status;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct acmp_stream_status_milan_v12 {
|
|
|
|
|
struct acmp_stream_status_common common;
|
|
|
|
|
uint32_t fsm_acmp_state;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief The Milan v1.2 stream structure needs more information
|
|
|
|
|
* about the different protocol*/
|
|
|
|
|
struct aecp_aem_stream_input_state_milan_v12 {
|
|
|
|
|
struct aecp_aem_stream_input_state stream_in_sta;
|
|
|
|
|
struct acmp_stream_status_milan_v12 acmp_status;
|
2025-11-27 09:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aecp_aem_stream_output_counters {
|
2026-01-19 09:39:49 +01:00
|
|
|
struct aecp_aem_state_base base_state;
|
2025-11-27 09:38:35 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
uint32_t stream_start;
|
|
|
|
|
uint32_t stream_stop;
|
|
|
|
|
uint32_t media_reset;
|
|
|
|
|
uint32_t tu;
|
|
|
|
|
uint32_t frame_tx;
|
2025-11-27 09:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aecp_aem_stream_output_state {
|
2026-01-19 09:39:49 +01:00
|
|
|
struct avb_aem_desc_stream desc;
|
2025-11-27 09:38:35 +01:00
|
|
|
|
2026-01-19 09:39:49 +01:00
|
|
|
struct aecp_aem_stream_output_counters counters;
|
|
|
|
|
struct stream_common common;
|
2025-11-27 09:38:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // AVB_AECP_AEM_STATE_H
|