Public QEP/C interface. More...
Go to the source code of this file.
Data Structures | |
struct | QEvt |
union | QHsmAttr |
struct | QHsm |
struct | QHsmVtable |
struct | QMsm |
struct | QMState |
struct | QMTranActTable |
Macros | |
#define | QP_VERSION 700U |
#define | QP_VERSION_STR "7.0.0" |
#define | QP_RELEASE 0x7CCAAA13U |
#define | Q_SIGNAL_SIZE 2U |
#define | Q_EVT_CAST(class_) ((class_ const *)e) |
#define | Q_UINT2PTR_CAST(type_, uintptr_) ((type_ *)(uintptr_)) |
#define | Q_STATE_CAST(handler_) ((QStateHandler)(handler_)) |
#define | Q_ACTION_CAST(action_) ((QActionHandler)(action_)) |
#define | QHSM_INIT(me_, par_, qs_id_) |
#define | QHSM_DISPATCH(me_, e_, qs_id_) ((*(me_)->vptr->dispatch)((me_), (e_), (qs_id_))) |
#define | Q_HSM_UPCAST(ptr_) ((QHsm *)(ptr_)) |
#define | Q_TRAN(target_) ((Q_HSM_UPCAST(me))->temp.fun = Q_STATE_CAST(target_), (QState)Q_RET_TRAN) |
#define | Q_TRAN_HIST(hist_) ((Q_HSM_UPCAST(me))->temp.fun = (hist_), (QState)Q_RET_TRAN_HIST) |
#define | Q_SUPER(super_) ((Q_HSM_UPCAST(me))->temp.fun = Q_STATE_CAST(super_), (QState)Q_RET_SUPER) |
#define | Q_HANDLED() ((QState)Q_RET_HANDLED) |
#define | Q_UNHANDLED() ((QState)Q_RET_UNHANDLED) |
#define | Q_ACTION_NULL ((QActionHandler)0) |
#define | QM_ENTRY(state_) ((Q_HSM_UPCAST(me))->temp.obj = (state_), (QState)Q_RET_ENTRY) |
#define | QM_EXIT(state_) ((Q_HSM_UPCAST(me))->temp.obj = (state_), (QState)Q_RET_EXIT) |
#define | QM_SM_EXIT(state_) ((Q_HSM_UPCAST(me))->temp.obj = (state_), (QState)Q_RET_EXIT) |
#define | QM_TRAN(tatbl_) |
#define | QM_TRAN_INIT(tatbl_) |
#define | QM_TRAN_HIST(history_, tatbl_) |
#define | QM_TRAN_EP(tatbl_) |
#define | QM_TRAN_XP(xp_, tatbl_) |
#define | QM_HANDLED() ((QState)Q_RET_HANDLED) |
#define | QM_UNHANDLED() ((QState)Q_RET_UNHANDLED) |
#define | QM_SUPER() ((QState)Q_RET_SUPER) |
#define | QM_SUPER_SUB(host_) ((Q_HSM_UPCAST(me))->temp.obj = (host_), (QState)Q_RET_SUPER_SUB) |
#define | QM_STATE_NULL ((QMState *)0) |
Typedefs | |
typedef signed int | int_t |
typedef signed int | enum_t |
typedef float | float32_t |
typedef double | float64_t |
typedef uint16_t | QSignal |
typedef uint_fast8_t | QState |
typedef QState(* | QStateHandler) (void *const me, QEvt const *const e) |
typedef QState(* | QActionHandler) (void *const me) |
typedef void(* | QXThreadHandler) (QXThread *const me) |
Enumerations | |
enum | { Q_RET_SUPER , Q_RET_SUPER_SUB , Q_RET_UNHANDLED , Q_RET_HANDLED , Q_RET_IGNORED , Q_RET_ENTRY , Q_RET_EXIT , Q_RET_NULL , Q_RET_TRAN , Q_RET_TRAN_INIT , Q_RET_TRAN_EP , Q_RET_TRAN_HIST , Q_RET_TRAN_XP } |
enum | { Q_ENTRY_SIG = 1 , Q_EXIT_SIG , Q_INIT_SIG , Q_USER_SIG } |
Variables | |
char const | QP_versionStr [7] |
traces to: RQP001
traces to: RQP101
Definition in file qep.h.
#define QP_VERSION 700U |
#define QP_VERSION_STR "7.0.0" |
#define QP_RELEASE 0x7CCAAA13U |
#define Q_EVT_CAST | ( | class_ | ) | ((class_ const *)e) |
Perform downcast of an event onto a subclass of QEvt class_
QEvt represents events without parameters and serves as the base class This macro encapsulates the downcast of QEvt pointers, which violates MISRA-C 2012 Rule 11.3(R) "A cast shall not be performed between a pointer to object type and a pointer to a different object type". This macro helps to localize this deviation.
traces to: RQP003
traces to: PQA11_3
#define Q_UINT2PTR_CAST | ( | type_, | |
uintptr_ | |||
) | ((type_ *)(uintptr_)) |
#define Q_STATE_CAST | ( | handler_ | ) | ((QStateHandler)(handler_)) |
Perform cast to QStateHandler.
This macro encapsulates the cast of a specific state handler function pointer to QStateHandler, which violates MISRA:C-2012 Rule 11.1(req) "Conversions shall not be performed between a pointer to function and any other type". This macro helps to localize this deviation.
traces to: PQP11_1
traces to: PQA11_1
#define Q_ACTION_CAST | ( | action_ | ) | ((QActionHandler)(action_)) |
Perform cast to QActionHandler.
This macro encapsulates the cast of a specific action handler function pointer to QActionHandler, which violates MISRA:C-2012 Rule 11.1(R) "Conversions shall not be performed between a pointer to function and any other type". This macro helps to localize this deviation.
traces to: PQP11_1
traces to: PQA11_1
#define QHSM_INIT | ( | me_, | |
par_, | |||
qs_id_ | |||
) |
Polymorphically executes the top-most initial transition in a HSM
[in,out] | me_ | pointer (see oop) |
[in] | e_ | constant pointer the QEvt or a class derived from QEvt (see oop) |
[in] | qs_id_ | QS local filter ID |
#define QHSM_DISPATCH | ( | me_, | |
e_, | |||
qs_id_ | |||
) | ((*(me_)->vptr->dispatch)((me_), (e_), (qs_id_))) |
Polymorphically dispatches an event to a HSM
Processes one event at a time in Run-to-Completion fashion.
[in,out] | me_ | pointer (see oop) |
[in] | e_ | constant pointer the QEvt or a class derived from QEvt (see oop) |
#define Q_HSM_UPCAST | ( | ptr_ | ) | ((QHsm *)(ptr_)) |
Perform upcast from a subclass of QHsm to the base class QHsm
Upcasting from a subclass to superclass is a very frequent and safe operation in object-oriented programming and object-oriented languages (such as C++) perform such upcasting automatically. However, OOP is implemented in C just as a set of coding conventions (see oop), and the C compiler does not "know" that certain types are related by inheritance. Therefore for C, the upcast must be performed explicitly. Unfortunately, pointer casting violates the advisory MISRA-C 2012 Rule 11.3(req) "A cast shall not be performed between a pointer to object type and a pointer to a different object type". This macro encapsulates this deviation and provides a descriptive name for the reason of this cast.
#define Q_TRAN | ( | target_ | ) | ((Q_HSM_UPCAST(me))->temp.fun = Q_STATE_CAST(target_), (QState)Q_RET_TRAN) |
Macro to call in a state-handler when it executes a regular or and initial transition. Applicable only to QHsm subclasses.
traces to: RQP103
traces to: RQP120E
#define Q_TRAN_HIST | ( | hist_ | ) | ((Q_HSM_UPCAST(me))->temp.fun = (hist_), (QState)Q_RET_TRAN_HIST) |
Macro to call in a state-handler when it executes a transition to history. Applicable only to HSMs.
traces to: RQP103
traces to: RQP120H
#define Q_SUPER | ( | super_ | ) | ((Q_HSM_UPCAST(me))->temp.fun = Q_STATE_CAST(super_), (QState)Q_RET_SUPER) |
Macro to call in a state-handler when it designates the superstate of a given state. Applicable only to QHsm subclasses.
#define Q_HANDLED | ( | ) | ((QState)Q_RET_HANDLED) |
Macro to call in a state-handler when it handles an event.
traces to: RQP103
traces to: RQP120B
traces to: RQP120C
#define Q_UNHANDLED | ( | ) | ((QState)Q_RET_UNHANDLED) |
#define Q_ACTION_NULL ((QActionHandler)0) |
#define QM_ENTRY | ( | state_ | ) | ((Q_HSM_UPCAST(me))->temp.obj = (state_), (QState)Q_RET_ENTRY) |
#define QM_EXIT | ( | state_ | ) | ((Q_HSM_UPCAST(me))->temp.obj = (state_), (QState)Q_RET_EXIT) |
#define QM_SM_EXIT | ( | state_ | ) | ((Q_HSM_UPCAST(me))->temp.obj = (state_), (QState)Q_RET_EXIT) |
#define QM_TRAN | ( | tatbl_ | ) |
Macro to call in a QM state-handler when it executes a regular transition. Applicable only to QMsm subclasses.
#define QM_TRAN_INIT | ( | tatbl_ | ) |
Macro to call in a QM state-handler when it executes an initial transition. Applicable only to QMsm subclasses.
#define QM_TRAN_HIST | ( | history_, | |
tatbl_ | |||
) |
Macro to call in a QM state-handler when it executes a transition to history. Applicable only to QMsm subclasses.
#define QM_TRAN_EP | ( | tatbl_ | ) |
Macro to call in a QM state-handler when it executes a transition to the submachine via an entry point.
#define QM_TRAN_XP | ( | xp_, | |
tatbl_ | |||
) |
Macro to call in a QM state-handler when it executes a transition to exit point. Applicable only to QMsm subclasses.
#define QM_HANDLED | ( | ) | ((QState)Q_RET_HANDLED) |
#define QM_UNHANDLED | ( | ) | ((QState)Q_RET_UNHANDLED) |
#define QM_SUPER | ( | ) | ((QState)Q_RET_SUPER) |
#define QM_SUPER_SUB | ( | host_ | ) | ((Q_HSM_UPCAST(me))->temp.obj = (host_), (QState)Q_RET_SUPER_SUB) |
#define QM_STATE_NULL ((QMState *)0) |
typedef signed int int_t |
typedef signed int enum_t |
typedef float float32_t |
IEEE 754 32-bit floating point number, MISRA-C 2012 Dir 4.6(A)
typedef double float64_t |
IEEE 754 64-bit floating point number, MISRA-C 2012 Dir 4.6(A)
typedef uint16_t QSignal |
The size (in bytes) of the signal of an event. Valid values: 1U, 2U, or 4U; default 2U
This macro can be defined in the QEP port file (qep_port.h) to configure the QSignal type. When the macro is not defined, the default of 2 bytes is applied.
typedef uint_fast8_t QState |
typedef QState(* QActionHandler) (void *const me) |
typedef void(* QXThreadHandler) (QXThread *const me) |
anonymous enum |
All possible values returned from state/action handlers
anonymous enum |
|
extern |
the current QP version number string in ROM, based on QP_VERSION_STR