RKH
|
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. | |
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:
RKH_THREAD_TYPE 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.
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.