RKH
Active objects

Files

file  rkh.h
 RKH framwwork platform - independent interface.
 
file  rkhsm.h
 Specifies the interface of the state-machine manager.
 
file  rkhsma.h
 Specifies the interface of the acive object (SMA state machine applications) manager.
 

Data Structures

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

Macros

#define RKH_UPCAST(BaseType_, me_)   ((BaseType_ *)me_)
 Convert a pointer to a base-class. More...
 
#define RKH_DOWNCAST(DerivedType_, me_)   ((DerivedType_ *)me_)
 Converts a base-class pointer to a derived-class pointer.
 
#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_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...
 

Functions

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

Detailed Description

Macro Definition Documentation

◆ RKH_UPCAST

#define RKH_UPCAST (   BaseType_,
  me_ 
)    ((BaseType_ *)me_)

Convert a pointer to a base-class.

In other words, upcasting allows us to treat a derived type as though it were its base type.

Definition at line 74 of file rkhfwk_cast.h.

◆ RKH_SMA_ACTIVATE

#define RKH_SMA_ACTIVATE (   me_,
  qSto_,
  qStoSize,
  stkSto_,
  stkSize_ 
)
Value:
(const RKH_EVT_T **)qSto_, \
qStoSize, \
(void *)stkSto_, \
(rui32_t)stkSize_)
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 obj...
Represents events without parameters.
Definition: rkhevt.h:170

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.

This macro is the recommended way of invoke the rkh_sma_activate() function to active an active object, because it allows to completely hides the platform-specific code.

Parameters
[in]me_pointer to previously created state machine application.
[in]qSto_base address of the event storage area. A message storage area is declared as an array of pointers to RKH events.
[in]qStoSizesize of the storage event area [in number of entries].
[in]stkSto_starting address of the stack's memory area.
[in]stkSize_size of stack memory area [in bytes].
Note
In the next releases this macro will be improved, calling a function instead of using its own vptr.
See also
rkh_sma_activate().
Usage
int
main( int argc, char *argv[] )
{
...
RKH_SMA_ACTIVATE( blinky, qsto, QSTO_SIZE, 0, 0 );
...
return 0;
}
#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_...
Definition: rkhsma.h:250

Definition at line 250 of file rkhsma.h.

◆ RKH_SMA_POST_FIFO

#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.

This macro is the recommended way of posting events, because it provides the vital information for software tracing and avoids any overhead when the tracing is disabled.

Parameters
[in]me_pointer to previously created state machine application.
[in]e_actual event sent to the state machine application.
[in]sender_pointer to the sender object. It is not necessarily a pointer to an active object. In fact, if RKH_SMA_POST_FIFO() is called from an interrupt or other context, it can create a unique object just to unambiguously identify the publisher of the event.
Note
In the next releases this macro will be improved, calling a function instead of using its own vptr.
See also
rkh_sma_post_fifo().

Definition at line 450 of file rkhsma.h.

◆ RKH_SMA_POST_LIFO

#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.

This macro is the recommended way of posting events, because it provides the vital information for software tracing and avoids any overhead when the tracing is disabled.

Parameters
[in]me_pointer to previously created state machine application.
[in]e_actual event sent to the state machine application.
[in]sender_pointer to the sender object. It is not necessarily a pointer to an active object. In fact, if RKH_SMA_POST_LIFO() is called from an interrupt or other context, it can create a unique object just to unambiguously identify the publisher of the event.
Note
In the next releases this macro will be improved, calling a function instead of using its own vptr.
See also
rkh_sma_post_lifo().

Definition at line 498 of file rkhsma.h.

◆ RKH_SMA_DISPATCH

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

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.

Parameters
[in]me_pointer to previously created state machine application.
[in]arg_optional and general purpose argument.

Definition at line 526 of file rkhsma.h.

Function Documentation

◆ rkh_sma_dispatch()

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

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.

Parameters
[in]mepointer to previously created state machine application.
[in]argoptional and general purpose argument.