ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
event.c File Reference

Generic event ring buffer implementation. More...

#include "icarus/icarus.h"
#include <string.h>

Go to the source code of this file.

Functions

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)
 

Variables

static event_entry_t ring [32]
 
static uint32_t ring_head
 
static uint32_t ring_count
 
static event_severity_t squelch [16]
 

Detailed Description

Generic event ring buffer implementation.

Lock-protected (enter_critical / exit_critical) circular ring of fixed-size event entries with per-module severity squelch. Transport-agnostic: drains into a caller-provided buffer.

The ring, head/count cursors, and squelch table all live in DTCM_DATA_PRIV (privileged-only TCM). Public access goes through SVC gates so unprivileged thread-mode tasks can use the API once the MPU is locked.

Author
Souham Biswas
Date
2026

Definition in file event.c.

Function Documentation

◆ __event_drain()

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().

◆ __event_get_count()

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_get_squelch()

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().

◆ __event_init()

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().

◆ __event_set_squelch()

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().

◆ __os_event()

void __os_event ( uint8_t  module_id,
event_severity_t  severity,
uint16_t  event_id,
const void *  payload,
uint8_t  payload_len 
)

Variable Documentation

◆ ring

event_entry_t ring[32]
static

Definition at line 27 of file event.c.

Referenced by __event_drain(), __event_init(), and __os_event().

◆ ring_count

uint32_t ring_count
static

Definition at line 29 of file event.c.

Referenced by __event_drain(), __event_get_count(), __event_init(), and __os_event().

◆ ring_head

uint32_t ring_head
static

Definition at line 28 of file event.c.

Referenced by __event_drain(), __event_init(), and __os_event().

◆ squelch

event_severity_t squelch[16]
static

Definition at line 30 of file event.c.

Referenced by __event_get_squelch(), __event_init(), __event_set_squelch(), and __os_event().