QP/C 8.1.2
Real-Time Event Framework
Loading...
Searching...
No Matches
qf_act.c
Go to the documentation of this file.
1//============================================================================
2// QP/C Real-Time Event Framework (RTEF)
3//
4// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
5//
6// Q u a n t u m L e a P s
7// ------------------------
8// Modern Embedded Software
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
11//
12// This software is dual-licensed under the terms of the open-source GNU
13// General Public License (GPL) or under the terms of one of the closed-
14// source Quantum Leaps commercial licenses.
15//
16// Redistributions in source code must retain this top-level comment block.
17// Plagiarizing this software to sidestep the license obligations is illegal.
18//
19// NOTE:
20// The GPL does NOT permit the incorporation of this code into proprietary
21// programs. Please contact Quantum Leaps for commercial licensing options,
22// which expressly supersede the GPL and are designed explicitly for
23// closed-source distribution.
24//
25// Quantum Leaps contact information:
26// <www.state-machine.com/licensing>
27// <info@state-machine.com>
28//============================================================================
29#define QP_IMPL // this is QP implementation
30#include "qp_port.h" // QP port
31#include "qp_pkg.h" // QP package-scope interface
32#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
33#ifdef Q_SPY // QS software tracing enabled?
34 #include "qs_port.h" // QS port
35 #include "qs_pkg.h" // QS facilities for pre-defined trace records
36#else
37 #include "qs_dummy.h" // disable the QS software tracing
38#endif // Q_SPY
39
40Q_DEFINE_THIS_MODULE("qf_act")
41
42// QP version string embedded in the binary image
43char const QP_versionStr[24] = "QP/C " QP_VERSION_STR;
44
45//----------------------------------------------------------------------------
46//! @public @memberof QEvt
47void QEvt_ctor(QEvt * const me, enum_t const sig) {
48 me->sig = (QSignal)sig;
49 me->poolNum_ = 0x00U; // not a pool event
50 me->refCtr_ = 0xE0U; // use as an "event marker"
51}
52//............................................................................
53//! @public @memberof QEvt
54QEvt *QEvt_init(QEvt * const me, uint8_t const dummy) {
55 // initialize a dynamic event without parameters
56 Q_UNUSED_PAR(dummy);
57 return me;
58}
59//............................................................................
60//! @private @memberof QEvt
61void QEvt_refCtr_inc_(QEvt const * const me) {
62 // NOTE: this function must be called *inside* a critical section
63
64 // the event reference count must not exceed the number of AOs
65 // in the system plus each AO possibly holding one event reference
67
68 QEvt * const mut_me = (QEvt*)me; // cast 'const' away
69 ++mut_me->refCtr_;
70}
71//............................................................................
72//! @private @memberof QEvt
73void QEvt_refCtr_dec_(QEvt const * const me) {
74 // NOTE: this function must be called inside a critical section
75 QEvt * const mut_me = (QEvt*)me; // cast 'const' away
76 --mut_me->refCtr_;
77}
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
Definition qp.h:90
#define QP_VERSION_STR
Version string complying with Software Versioning specification.
Definition qp.h:33
int enum_t
Definition qp.h:88
char const QP_versionStr[24]
Definition qf_act.c:43
uint16_t QSignal
The signal of event QEvt.
Definition qp.h:97
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64).
Definition qp_config.h:100
QP/C Framework in C internal (package-scope) interface.
Sample QP/C port.
QS (QP/Spy software tracing) internal (package-scope) interface.
Sample QS/C port.
QP Functional Safety (FuSa) Subsystem.
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section).
Definition qsafe.h:98
Event class.
Definition qp.h:100
void QEvt_ctor(QEvt *const me, enum_t const sig)
QEvt constructor
Definition qf_act.c:47
void QEvt_refCtr_dec_(QEvt const *const me)
Internal function to decrement the refCtr of a const event.
Definition qf_act.c:73
uint32_t refCtr_
Event reference counter.
Definition qp.h:103
QEvt * QEvt_init(QEvt *const me, uint8_t const dummy)
Event without parameters initialization.
Definition qf_act.c:54
uint32_t sig
Event signal (see Event Signal).
Definition qp.h:101
void QEvt_refCtr_inc_(QEvt const *const me)
Internal function to increment the refCtr of a const event.
Definition qf_act.c:61