Specifies the interface of the acive object (SMA state machine applications) manager.
More...
|
#define | RKH_SMA_ACCESS_STATE(me_) ((RKH_SM_T *)me_)->state |
| Macro for accessing to state member of state machine structure. More...
|
|
#define | RKH_SMA_ACCESS_CONST(me_, member_) ((RKH_SM_T *)me_)->romrkh->member_ |
| Macro for accessing to members of state machine structure. More...
|
|
#define | RKH_SMA_DCLR(me_) RKH_DCLR_PTR_TYPE(RKH_SMA_T, me_) |
| This macro declares a opaque pointer to previously created state machine application (SMA aka active object) to be used as a global object. More...
|
|
#define | RKH_SMA_DCLR_TYPE(type_, me_) RKH_DCLR_PTR_TYPE(type_, me_) |
| This macro declares a typed pointer to previously created state machine application (SMA aka active object) to be used as a global and public object. More...
|
|
#define | RKH_SMA_ACTIVATE(me_, qSto_, qStoSize, stkSto_, stkSize_) |
| Invoke the active object activation function rkh_sma_activate(). If RKH_CFG_SMA_VFUNCT_EN is set RKH_ENABLED, this operation is polymorphic, where its implementation is defined by the virtual table of the active object to activate. More...
|
|
#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 state machine to previously declared SMA. More...
|
|
#define | RKH_SMA_DEF_PTR(me_) RKH_SMA_T *const me_ = (RKH_SMA_T *)&RKH_SMA_NAME(me_) |
| Declare a opaque pointer pointing to an previously created active object. More...
|
|
#define | RKH_SMA_DEF_PTR_TYPE(type, me_) type *const me_ = (type *)&RKH_SMA_NAME(me_) |
| Declare a pointer of specified type pointing to an previously created active object. More...
|
|
#define | RKH_SMA_POST_FIFO(me_, e_, sender_) rkh_sma_post_fifo((me_), (e_), (sender_)) |
| Invoke the direct event posting facility rkh_sma_post_fifo(). If RKH_CFG_SMA_VFUNCT_EN is set RKH_ENABLED, this operation is polymorphic, where its implementation is defined by the virtual table of the target active object. More...
|
|
#define | RKH_SMA_POST_LIFO(me_, e_, sender_) rkh_sma_post_lifo((me_), (e_), (sender_)) |
| Invoke the direct event posting facility rkh_sma_post_lifo(). If RKH_CFG_SMA_VFUNCT_EN is set RKH_ENABLED, this operation is polymorphic, where its implementation is defined by the virtual table of the target active object. More...
|
|
#define | RKH_SMA_DISPATCH(me_, arg_) rkh_sma_dispatch((me_), (arg_)) |
| For cooperative scheduling policy, this function is used to dispatch the event to the active object behavior (single or multiple state machines). More...
|
|
#define | RKH_ARRAY_SMA_DCLR(_arr, _num) extern RKH_SMA_T * const *_arr[_num] |
| Declares a opaque pointer to previously created array of state machine applications SMA (a.k.a Active Object) to be used as a global object. More...
|
|
#define | RKH_ARRAY_SMA_DCLR_TYPE(type_, array_, num_) extern type_ * const * array_[num_] |
| Declares a typed pointer to previously created array of state machine applications SMA (a.k.a Active Object) to be used as a global object. More...
|
|
#define | RKH_ARRAY_SMA_CREATE(_arr, _num) RKH_SMA_T * const *_arr[_num] = |
| Declare and allocate an array of SMAs (a.k.a active objects) derived from RKH_SMA_T. More...
|
|
#define | RKH_ARRAY_SMA_CREATE_TYPE(type_, array_, num_) type_ * const * array_[num_] = |
| Declare and allocate an array of SMAs (a.k.a active objects) derived from RKH_SMA_T. More...
|
|
#define | RKH_ARRAY_SMA(_arr, _ix) *_arr[_ix] |
| Retrieves the pointer to active object from a SMA's array. More...
|
|
#define | RKH_GET_AO_NAME(ao) RKH_SMA_ACCESS_CONST(ao, name) |
| This macro retrieves the name of an registered active object. More...
|
|
#define | RKH_GET_SMA(_prio) rkh_sptbl[(rui8_t)(_prio)] |
| Retrieves the address of an registered active object (SMA) according to its priority. More...
|
|
#define | RKH_GET_PRIO(_ao) (rui8_t)(RKH_SMA_ACCESS_CONST(_ao, prio)) |
| Retrieves the priority number of an registered active object (SMA). More...
|
|
|
void | rkh_sma_register (RKH_SMA_T *me) |
| Registers a state machine application (SMA) as known as active object into the framework, which implies to store a pointer to the SMA in the priority table. More...
|
|
void | rkh_sma_unregister (RKH_SMA_T *me) |
| Removes the SMA as known as active object from the priority table, and thus from the framework, by simply replacing the link to the SMA being deleted with a NULL pointer. More...
|
|
void | rkh_sma_ctor (RKH_SMA_T *me, const RKHSmaVtbl *vtbl) |
| Initializes the virtual table of the active object instance and calls the constructor operation of its base class. More...
|
|
void | rkh_sma_activate (RKH_SMA_T *me, const RKH_EVT_T **qSto, RKH_QUENE_T qSize, void *stkSto, rui32_t stkSize) |
| Initializes and activates a previously created state machine application (SMA) as known as active object. More...
|
|
void | rkh_sma_terminate (RKH_SMA_T *me) |
| Terminate a state machine application (SMA) as known as active object. More...
|
|
void | rkh_sma_post_fifo (RKH_SMA_T *me, const RKH_EVT_T *e, const void *const sender) |
| Send an event to a state machine application (SMA) as known as active object through a queue using the FIFO policy. A message is a pointer size variable and its use is application specific. More...
|
|
void | rkh_sma_post_lifo (RKH_SMA_T *me, const RKH_EVT_T *e, const void *const sender) |
| Send an event to a state machine application (SMA) as known as active object through a queue using the LIFO policy. A message is a pointer size variable and its use is application specific. More...
|
|
RKH_EVT_T * | rkh_sma_get (RKH_SMA_T *me) |
| Get an event from the event queue of an state machine application (SMA) as known as active object. The events received are pointer size variables and their use is application specific. More...
|
|
void | rkh_sma_dispatch (RKH_SMA_T *me, void *arg) |
| For cooperative scheduling policy, this function is used to dispatch the event to the active object behavior (single or multiple state machines). More...
|
|
void | rkh_sma_defer (RKH_QUEUE_T *q, const RKH_EVT_T *e) |
| Defer an event to a given separate event queue. More...
|
|
RKH_EVT_T * | rkh_sma_recall (RKH_SMA_T *me, RKH_QUEUE_T *q) |
| Recall a deferred event from a given event queue. More...
|
|
void | rkh_sma_clear_info (RKH_SMA_T *me) |
| Clear performance information for a particular state machine application (SMA) as known as active object. More...
|
|
void | rkh_sma_get_info (RKH_SMA_T *me, RKH_SMAI_T *psi) |
| Retrieves performance information for a particular state machine application (SMA) as known as active object. More...
|
|
Specifies the interface of the acive object (SMA state machine applications) manager.
Definition in file rkhsma.h.
#define RKH_SMA_CREATE |
( |
|
type, |
|
|
|
name, |
|
|
|
prio, |
|
|
|
ppty, |
|
|
|
initialState, |
|
|
|
initialAction, |
|
|
|
initialEvt |
|
) |
| |
Value:
initialAction, initialEvt); \
static type RKH_SMA_NAME(name) = MKSMA(&RKH_SM_CONST_NAME(name), \
initialState)
#define RKH_SM_CONST_CREATE(name, prio, ppty, initialState, initialAction, initialEvt)
Allocates and then initializes the constant part (in ROM) of the state machine.
Declare and allocate a SMA (active object) derived from RKH_SMA_T. Also, initializes and assigns a state machine to previously declared SMA.
In the UML specification, every state machine has a top state (the abstract root of every state machine hierarchy), which contains all the other elements of the entire state machine. RKH provides the top state using the macro RKH_SMA_CREATE(). Frequently, RKH_SMA_CREATE() is used within state-machine's module (.c file), thus the structure definition is in fact entirely encapsulated in its module and is inaccessible to the rest of the application. However, use RKH_SMA_DEF_PTR() or RKH_SMA_DEF_PTR_TYPE() macros to define a opaque pointer or typed pointer to that state machine application structure, respectively. Also, use the RKH_SMA_DCLR() macro to declare it to be for the rest of application code. RKH_SMA_T is not intended to be instantiated directly, but rather serves as the base structure for derivation of state machines in the application code. The following example illustrates how to derive an state machine from RKH_SMA_T. Please note that the RKH_SMA_T member sm is defined as the FIRST member of the derived structure.
- Parameters
-
[in] | type | Data type of the SMA. Could be derived from RKH_SMA_T. |
[in] | name | Name of state machine application. Also, it represents the top state of state diagram. |
[in] | prio | State machine application priority. A unique priority number must be assigned to each SMA from 0 to RKH_LOWEST_PRIO. The lower the number, the higher the priority. |
[in] | ppty | State machine properties. The available properties are enumerated in RKH_HPPTY_T enumeration in the rkh.h file. |
[in] | initialState | Pointer to initial state. This state could be defined either composite or basic (not pseudo-state). |
[in] | initialAction | Pointer to initialization action (optional). The function prototype is defined as RKH_TRN_ACT_T. This argument is optional, thus it could be declared as NULL. |
[in] | initialEvt | This parameter is now deprecated and not recommended for new designs. It remains supported for backwards compatibility. |
- See also
- RKH_SM_CONST_CREATE(), RKH_SM_GET_CONST(), RKH_SM_GET_CONST(), RKH_SMA_DEF_PTR(), RKH_SMA_DEF_PTR_TYPE()
- Usage
...within state-machine application'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, 0, HCAL, &S1, my_iaction, &my_ievent);
Definition at line 348 of file rkhsma.h.
typedef void(* RKHTask) (RKH_SMA_T *me, void *arg) |
Frequently, the active object has its own task processing loop, also as known as thread of control, that waits for the signal to be posted, and when it is, loops to remove and process all events that are currently queued.
For cooperative scheduling policy, this function is used to dispatch the event to the active object behavior (single or multiple state machines).
Definition at line 861 of file rkhsma.h.