Skip to content

File syn_ao.c

FileList > sched > syn_ao.c

Go to the source code of this file

Active Object framework implementation.

  • #include "../port/syn_port_system.h"
  • #include "../sched/syn_sched.h"
  • #include "../util/syn_assert.h"
  • #include "syn_ao.h"

Public Functions

Type Name
void syn_ao_init (SYN_ActiveObject * ao, const char * name, const SYN_FSM_Transition * transitions, SYN_FSM_State initial_state, void * mailbox_buf, size_t mailbox_cap)
Initialize an Active Object.
bool syn_ao_post (SYN_ActiveObject * ao, uint16_t sig, void * data)
Post an event to the Active Object's mailbox.

Public Static Functions

Type Name
SYN_PT_Status syn_ao_pt_run (SYN_PT * pt, SYN_Task * task)
Protothread entry for active objects dispatches queued events.

Public Functions Documentation

function syn_ao_init

Initialize an Active Object.

void syn_ao_init (
    SYN_ActiveObject * ao,
    const char * name,
    const SYN_FSM_Transition * transitions,
    SYN_FSM_State initial_state,
    void * mailbox_buf,
    size_t mailbox_cap
) 

Parameters:

  • ao Active Object instance.
  • name Name of the active object (used for task/logging).
  • transitions Transition table for the internal state machine.
  • initial_state Initial state of the state machine.
  • mailbox_buf Buffer backing the mailbox event queue.
  • mailbox_cap Capacity (number of elements) of the buffer.

function syn_ao_post

Post an event to the Active Object's mailbox.

bool syn_ao_post (
    SYN_ActiveObject * ao,
    uint16_t sig,
    void * data
) 

Thread-safe and ISR-safe. Protects the mailbox write using critical sections.

Parameters:

  • ao Active Object instance.
  • sig Signal identifier.
  • data Optional payload.

Returns:

true if the event was successfully queued, false if queue is full.


Public Static Functions Documentation

function syn_ao_pt_run

Protothread entry for active objects dispatches queued events.

static SYN_PT_Status syn_ao_pt_run (
    SYN_PT * pt,
    SYN_Task * task
) 

Parameters:

  • pt Protothread state.
  • task Owning scheduler task.

Returns:

PT status.



The documentation for this class was generated from the following file src/syntropic/sched/syn_ao.c