QP/C  8.0.3
Real-Time Event Framework
Loading...
Searching...
No Matches
qp_pkg.h
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#ifndef QP_PKG_H_
30#define QP_PKG_H_
31
32//============================================================================
33#define QACTIVE_CAST_(ptr_) ((QActive *)(ptr_))
34#define Q_PTR2UINT_CAST_(ptr_) ((uintptr_t)(ptr_))
35
36//============================================================================
37typedef struct {
38#if (QF_MAX_EPOOL > 0U)
39 QF_EPOOL_TYPE_ ePool_[QF_MAX_EPOOL]; //!< @private @memberof QF_Attr
40 uint_fast8_t maxPool_; //!< @private @memberof QF_Attr
41#else
42 uint8_t dummy; //!< @private @memberof QF_Attr
43#endif // (QF_MAX_EPOOL == 0U)
44} QF_Attr;
45
46extern QF_Attr QF_priv_; //!< @static @private @memberof QF
47
48//! @static @private @memberof QF
49void QF_bzero_(
50 void * const start,
51 uint_fast16_t const len);
52
53//============================================================================
54// Bitmasks are for the QTimeEvt::flags attribute
55#define QTE_FLAG_IS_LINKED (1U << 7U)
56#define QTE_FLAG_WAS_DISARMED (1U << 6U)
57
58//============================================================================
59//! @private @memberof QEvt
60static inline void QEvt_refCtr_inc_(QEvt const * const me) {
61 // NOTE: this function must be called inside a critical section
62 uint8_t const rc = me->refCtr_ + 1U;
63 ((QEvt *)me)->refCtr_ = rc; // cast away 'const'
64}
65
66//! @private @memberof QEvt
67static inline void QEvt_refCtr_dec_(QEvt const * const me) {
68 // NOTE: this function must be called inside a critical section
69 uint8_t const rc = me->refCtr_ - 1U;
70 ((QEvt *)me)->refCtr_ = rc; // cast away 'const'
71}
72
73#endif // QP_PKG_H_
void QF_bzero_(void *const start, uint_fast16_t const len)
Definition qf_act.c:52
QF_Attr QF_priv_
Definition qp_pkg.h:46
#define QF_EPOOL_TYPE_
Definition qk.h:108
#define QF_MAX_EPOOL
Maximum # event pools in the system (0..15)
Definition qp_config.h:133
Event class.
Definition qp.h:112
static void QEvt_refCtr_dec_(QEvt const *const me)
Definition qp_pkg.h:67
uint8_t volatile refCtr_
Event reference counter.
Definition qp.h:115
static void QEvt_refCtr_inc_(QEvt const *const me)
Definition qp_pkg.h:60
Private attributes of the QF framework.
Definition qp_pkg.h:37
uint_fast8_t maxPool_
Definition qp_pkg.h:40
QF_EPOOL_TYPE_ ePool_[QF_MAX_EPOOL]
Definition qp_pkg.h:39