RKH
RKH_SMA_T Struct Reference

Describes the SMA (active object in UML). More...

#include <rkhsma.h>

Data Fields

RKH_SM_T sm
 State machine.
 
RKH_THREAD_TYPE thread
 Virtual pointer. More...
 
RKH_OSSIGNAL_TYPE os_signal
 OS-dependent object used to signal that an event has been queued. More...
 
RKH_EQ_TYPE equeue
 Event queue of the SMA (a.k.a Active Object).
 
rbool_t running
 The Boolean loop variable determining if the thread routine of the SMA is running.
 
RKH_SMAI_T sinfo
 Performance information. This member is optional, thus it could be declared as NULL or eliminated in compile-time with RKH_CFG_SMA_GET_INFO_EN = 0.
 

Detailed Description

Describes the SMA (active object in UML).

This structure resides in RAM because its members are dinamically updated by RKH (context of state machine). The RKH_SM_T::romrkh member points to RKH_ROM_T structure, allocated in ROM, to reduce the size of RAM consume. The key parameters of a state machine are allocated within. Therefore cannot be modified in runtime.

RKH_SMA_T is not intended to be instantiated directly, but rather serves as the base structure for derivation of active objects in the application code. The following example illustrates how to derive an active object from RKH_SMA_T. Please note that the RKH_SMA_T member ao is defined as the FIRST member of the derived struct.

Example:

// ...within state-machine's module
typedef struct
{
RKH_SMA_T ao; // base structure
rui8_t x; // private member
rui8_t y; // private member
} MYSM_T;
// static instance of SMA object
RKH_SMA_CREATE(MYSM_T, my, HCAL, &S1, my_iaction, &my_ievent);
@ HCAL
Definition: rkhsm.h:1611
#define RKH_SMA_CREATE(type, name, prio, ppty, initialState, initialAction, initialEvt)
Declare and allocate a SMA (active object) derived from RKH_SMA_T. Also, initializes and assigns a st...
Definition: rkhsma.h:348
Describes the SMA (active object in UML).
Definition: rkhsma.h:772
See also
RKH_SMA_T structure definition for more information. Also, single inheritance in C , and another example .

Definition at line 771 of file rkhsma.h.

Field Documentation

◆ thread

Virtual pointer.

OS-dependent thread of control of the active object.

Frequently, the active object has its own task processing loop that waits for the signal to be posted, and when it is, loops to remove and process all events that are currently queued. The RKH_SMA_POST_FIFO() macro enqueues an event and signals the OS that an event has arrived. In this case, os_signal holds the OS object used to signal that an event has been queued. This data might be used in various ways, depending on the RKH port. In some ports it's used to store the thread handler.

Note
This member is optional, thus it could be declared as NULL or eliminated in compile-time with RKH_CFGPORT_SMA_THREAD_EN = 0.

Definition at line 805 of file rkhsma.h.

◆ os_signal

RKH_OSSIGNAL_TYPE os_signal

OS-dependent object used to signal that an event has been queued.

Frequently, the active object has its own task processing loop that waits for the signal to be posted, and when it is, loops to remove and process all events that are currently queued. The RKH_SMA_POST_FIFO() macro enqueues an event and signals the OS that an event has arrived. In this case, os_signal holds the OS object used to signal that an event has been queued. This data might be used in various ways, depending on the RKH port. In some ports it's used to block the calling thread when the native RKH queue is empty. In other RKH ports the OS-dependent data object might be used differently.

Note
This member is optional, thus it could be eliminated in compile-time with RKH_CFGPORT_SMA_THREAD_DATA_EN = 0.

Definition at line 827 of file rkhsma.h.


The documentation for this struct was generated from the following file: