|
ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
|
Generic structured event ring buffer for ICARUS OS. More...
#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | event_entry_t |
Macros | |
| #define | EVENT_MOD_MAX 16 |
| #define | EVENT_RING_SIZE 32 |
Enumerations | |
| enum | event_severity_t { EVENT_DEBUG = 0 , EVENT_INFO = 1 , EVENT_WARN = 2 , EVENT_CRITICAL = 3 } |
Functions | |
| void | event_init (void) |
| Initialize the event system. | |
| void | os_event (uint8_t module_id, event_severity_t severity, uint16_t event_id, const void *payload, uint8_t payload_len) |
| Emit a structured event into the ring buffer. | |
| void | event_set_squelch (uint8_t module_id, event_severity_t min_severity) |
| Set the minimum severity accepted for a given module. | |
| event_severity_t | event_get_squelch (uint8_t module_id) |
| Get the current squelch level for a given module. | |
| bool | event_drain (event_entry_t *out_buf, uint8_t max_entries, uint8_t *num_drained) |
| Drain queued events into a caller-provided buffer. | |
| uint32_t | event_get_count (void) |
| Number of events currently buffered. | |
| void | __event_init (void) |
| void | __os_event (uint8_t module_id, event_severity_t severity, uint16_t event_id, const void *payload, uint8_t payload_len) |
| void | __event_set_squelch (uint8_t module_id, event_severity_t min_severity) |
| event_severity_t | __event_get_squelch (uint8_t module_id) |
| bool | __event_drain (event_entry_t *out_buf, uint8_t max_entries, uint8_t *num_drained) |
| uint32_t | __event_get_count (void) |
Generic structured event ring buffer for ICARUS OS.
Lock-protected ring of fixed-size 16-byte event entries with per-module severity squelch filtering. Transport-agnostic: drains into a caller-provided buffer; downstream consumers decide how to ship the entries (e.g. CCSDS TM, file logging).
Definition in file event.h.
| enum event_severity_t |
| bool __event_drain | ( | event_entry_t * | out_buf, |
| uint8_t | max_entries, | ||
| uint8_t * | num_drained | ||
| ) |
Definition at line 88 of file event.c.
References EVENT_RING_SIZE, ring, ring_count, and ring_head.
Referenced by event_drain(), and SVC_Handler_C().
| uint32_t __event_get_count | ( | void | ) |
Definition at line 133 of file event.c.
References ring_count.
Referenced by event_get_count(), and SVC_Handler_C().
| event_severity_t __event_get_squelch | ( | uint8_t | module_id | ) |
Definition at line 81 of file event.c.
References EVENT_DEBUG, EVENT_MOD_MAX, and squelch.
Referenced by event_get_squelch(), and SVC_Handler_C().
| void __event_init | ( | void | ) |
Definition at line 34 of file event.c.
References EVENT_DEBUG, EVENT_MOD_MAX, ring, ring_count, ring_head, and squelch.
Referenced by event_init(), and SVC_Handler_C().
| void __event_set_squelch | ( | uint8_t | module_id, |
| event_severity_t | min_severity | ||
| ) |
Definition at line 73 of file event.c.
References EVENT_MOD_MAX, and squelch.
Referenced by event_set_squelch(), and SVC_Handler_C().
| void __os_event | ( | uint8_t | module_id, |
| event_severity_t | severity, | ||
| uint16_t | event_id, | ||
| const void * | payload, | ||
| uint8_t | payload_len | ||
| ) |
Definition at line 43 of file event.c.
References event_entry_t::event_id, EVENT_MOD_MAX, EVENT_RING_SIZE, event_entry_t::module_id, event_entry_t::payload, ring, ring_count, ring_head, event_entry_t::severity, and squelch.
Referenced by os_event(), and SVC_Handler_C().
| bool event_drain | ( | event_entry_t * | out_buf, |
| uint8_t | max_entries, | ||
| uint8_t * | num_drained | ||
| ) |
Drain queued events into a caller-provided buffer.
| out_buf | Destination array of event_entry_t. |
| max_entries | Maximum number of entries to copy. |
| num_drained | [out] Number of entries actually copied. |
Definition at line 1385 of file svc.c.
References __event_drain(), and SVC_EVENT_DRAIN.
| uint32_t event_get_count | ( | void | ) |
Number of events currently buffered.
Definition at line 1408 of file svc.c.
References __event_get_count(), and SVC_EVENT_GET_COUNT.
| event_severity_t event_get_squelch | ( | uint8_t | module_id | ) |
Get the current squelch level for a given module.
Definition at line 1368 of file svc.c.
References __event_get_squelch(), and SVC_EVENT_GET_SQUELCH.
| void event_init | ( | void | ) |
Initialize the event system.
Clears the ring buffer and resets every module's squelch level to EVENT_DEBUG (accept all).
Definition at line 1316 of file svc.c.
References __event_init(), and SVC_EVENT_INIT.
| void event_set_squelch | ( | uint8_t | module_id, |
| event_severity_t | min_severity | ||
| ) |
Set the minimum severity accepted for a given module.
Events below the threshold are silently dropped at emission time.
Definition at line 1352 of file svc.c.
References __event_set_squelch(), and SVC_EVENT_SET_SQUELCH.
| void os_event | ( | uint8_t | module_id, |
| event_severity_t | severity, | ||
| uint16_t | event_id, | ||
| const void * | payload, | ||
| uint8_t | payload_len | ||
| ) |
Emit a structured event into the ring buffer.
| module_id | Source module identifier (0..EVENT_MOD_MAX-1). |
| severity | Event severity level. |
| event_id | Application-defined event identifier. |
| payload | Optional payload bytes (may be NULL). |
| payload_len | Payload length in bytes (truncated to 12). |
Definition at line 1331 of file svc.c.
References __os_event(), and SVC_OS_EVENT.