QP/C  7.0.0
Real-Time Embedded Framework
qf_qmact.c
Go to the documentation of this file.
1/*============================================================================
2* QP/C Real-Time Embedded Framework (RTEF)
3* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
4*
5* SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
6*
7* This software is dual-licensed under the terms of the open source GNU
8* General Public License version 3 (or any later version), or alternatively,
9* under the terms of one of the closed source Quantum Leaps commercial
10* licenses.
11*
12* The terms of the open source GNU General Public License version 3
13* can be found at: <www.gnu.org/licenses/gpl-3.0>
14*
15* The terms of the closed source Quantum Leaps commercial licenses
16* can be found at: <www.state-machine.com/licensing>
17*
18* Redistributions in source code must retain this top-level comment block.
19* Plagiarizing this software to sidestep the license obligations is illegal.
20*
21* Contact information:
22* <www.state-machine.com>
23* <info@state-machine.com>
24============================================================================*/
39#define QP_IMPL /* this is QP implementation */
40#include "qf_port.h" /* QF port */
41#include "qf_pkg.h" /* QF package-scope interface */
42
43/*Q_DEFINE_THIS_MODULE("qf_qmact")*/
44
45/*
46* This internal macro encapsulates the violation of MISRA-C 2012
47* Rule 11.3(req) "A cast shall not be performed between a pointer to
48* object type and a poiner to a different object type".
49*/
50#define QMSM_CAST_(ptr_) ((QMsm *)(ptr_))
51
52/*==========================================================================*/
66void QMActive_ctor(QMActive * const me, QStateHandler initial) {
67 static QMActiveVtable const vtable = { /* QMActive virtual table */
68 { &QMsm_init_,
70#ifdef Q_SPY
72#endif
73 },
77 };
78
79 /* clear the whole QActive object, so that the framework can start
80 * correctly even if the startup code fails to clear the uninitialized
81 * data (as is required by the C Standard).
82 */
83 QF_bzero(me, sizeof(*me));
84
94 QMsm_ctor(QMSM_CAST_(&me->super.super), initial);
95
96 me->super.super.vptr = &vtable.super; /* hook vptr to QMActive vtable */
97}
QState(* QStateHandler)(void *const me, QEvt const *const e)
Definition: qep.h:176
Internal (package scope) QF/C interface.
#define QMSM_CAST_(ptr_)
Definition: qf_qmact.c:50
bool QActive_post_(QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender)
Definition: qf_actq.c:83
QHsm super
Definition: qf.h:108
void QActive_postLIFO_(QActive *const me, QEvt const *const e)
Definition: qf_actq.c:221
void QActive_start_(QActive *const me, uint_fast8_t prio, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
Definition: qutest.c:87
struct QHsmVtable super
Definition: qf.h:158
void QF_bzero(void *const start, uint_fast16_t len)
Definition: qf_act.c:129
struct QHsmVtable const * vptr
Definition: qep.h:254
Definition: qf.h:378
void QMActive_ctor(QMActive *const me, QStateHandler initial)
Definition: qf_qmact.c:66
QActive super
Definition: qf.h:379
QStateHandler QMsm_getStateHandler_(QHsm *const me)
Definition: qep_msm.c:397
void QMsm_init_(QHsm *const me, void const *const e, uint_fast8_t const qs_id)
Definition: qep_msm.c:142
void QMsm_dispatch_(QHsm *const me, QEvt const *const e, uint_fast8_t const qs_id)
Definition: qep_msm.c:206
void QMsm_ctor(QMsm *const me, QStateHandler initial)
Definition: qep_msm.c:114