QP/C++  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QP Namespace Reference

QP/C++ framework. More...

Namespaces

namespace  QF
 QF Active Object Framework.
 
namespace  QK
 preemptive, non-blocking kernel
 
namespace  QS
 QP/Spy software tracing (target-resident components)
 
namespace  QV
 non-preemptive kernel
 
namespace  QXK
 preemptive, dual-mode (non-blocking / blocking) kernel
 

Classes

class  QActive
 Active object class (based on the QHsm implementation strategy) More...
 
class  QActiveDummy
 Dummy Active Object for testing. More...
 
class  QAsm
 Abstract State Machine class (state machine interface) More...
 
union  QAsmAttr
 Attribute of for the QP::QAsm class (Abstract State Machine). More...
 
class  QEQueue
 Native QP event queue. More...
 
class  QEvt
 Event class. More...
 
struct  QFreeBlock
 Structure representing a free block in QP::QMPool. More...
 
class  QHsm
 Hierarchical State Machine class (QHsm-style state machine implementation strategy) More...
 
class  QHsmDummy
 Dummy HSM class for testing. More...
 
class  QMActive
 Active object class (based on QMsm implementation strategy) More...
 
class  QMPool
 Native QF Memory Pool. More...
 
class  QMsm
 Hierarchical State Machine class (QMsm-style state machine implementation strategy) More...
 
struct  QMState
 State object for the QP::QMsm class (QM State Machine). More...
 
struct  QMTranActTable
 Transition-Action Table for the QP::QMsm State Machine. More...
 
class  QPSet
 Set of Active Objects of up to QF_MAX_ACTIVE elements. More...
 
struct  QSpyId
 QS ID type for applying local filtering. More...
 
class  QSubscrList
 Subscriber List (for publish-subscribe) More...
 
class  QTicker
 "Ticker" Active Object class More...
 
class  QTimeEvt
 Time Event class. More...
 
class  QXMutex
 Blocking Mutex of the QXK preemptive kernel. More...
 
class  QXSemaphore
 Counting Semaphore of the QXK preemptive kernel. More...
 
class  QXThread
 eXtended (blocking) thread of the QXK preemptive kernel More...
 

Typedefs

using QEQueueCtr = std::uint16_t
 
using QSchedStatus = std::uint_fast8_t
 
using QMPoolSize = std::uint16_t
 
using QMPoolCtr = std::uint16_t
 
using QSignal = std::uint16_t
 
using QState = std::uint_fast8_t
 
using QStateHandler = QState (*)(void * const me, QEvt const * const e)
 
using QActionHandler = QState (*)(void * const me)
 
using QXThreadHandler = void (*)(QXThread * const me)
 
using QPrioSpec = std::uint16_t
 
using QTimeEvtCtr = std::uint32_t
 
using QPSetBits = std::uint32_t
 
using QSpyFunPtr = void (*)()
 
using QSTimeCtr = std::uint32_t
 

Enumerations

enum  QSpyPre : std::int8_t {
  QS_EMPTY , QS_QEP_STATE_ENTRY , QS_QEP_STATE_EXIT , QS_QEP_STATE_INIT ,
  QS_QEP_INIT_TRAN , QS_QEP_INTERN_TRAN , QS_QEP_TRAN , QS_QEP_IGNORED ,
  QS_QEP_DISPATCH , QS_QEP_UNHANDLED , QS_QF_ACTIVE_DEFER , QS_QF_ACTIVE_RECALL ,
  QS_QF_ACTIVE_SUBSCRIBE , QS_QF_ACTIVE_UNSUBSCRIBE , QS_QF_ACTIVE_POST , QS_QF_ACTIVE_POST_LIFO ,
  QS_QF_ACTIVE_GET , QS_QF_ACTIVE_GET_LAST , QS_QF_ACTIVE_RECALL_ATTEMPT , QS_QF_EQUEUE_POST ,
  QS_QF_EQUEUE_POST_LIFO , QS_QF_EQUEUE_GET , QS_QF_EQUEUE_GET_LAST , QS_QF_NEW_ATTEMPT ,
  QS_QF_MPOOL_GET , QS_QF_MPOOL_PUT , QS_QF_PUBLISH , QS_QF_NEW_REF ,
  QS_QF_NEW , QS_QF_GC_ATTEMPT , QS_QF_GC , QS_QF_TICK ,
  QS_QF_TIMEEVT_ARM , QS_QF_TIMEEVT_AUTO_DISARM , QS_QF_TIMEEVT_DISARM_ATTEMPT , QS_QF_TIMEEVT_DISARM ,
  QS_QF_TIMEEVT_REARM , QS_QF_TIMEEVT_POST , QS_QF_DELETE_REF , QS_QF_CRIT_ENTRY ,
  QS_QF_CRIT_EXIT , QS_QF_ISR_ENTRY , QS_QF_ISR_EXIT , QS_QF_INT_DISABLE ,
  QS_QF_INT_ENABLE , QS_QF_ACTIVE_POST_ATTEMPT , QS_QF_EQUEUE_POST_ATTEMPT , QS_QF_MPOOL_GET_ATTEMPT ,
  QS_SCHED_PREEMPT , QS_SCHED_RESTORE , QS_SCHED_LOCK , QS_SCHED_UNLOCK ,
  QS_SCHED_NEXT , QS_SCHED_IDLE , QS_ENUM_DICT , QS_QEP_TRAN_HIST ,
  QS_QEP_TRAN_EP , QS_QEP_TRAN_XP , QS_TEST_PAUSED , QS_TEST_PROBE_GET ,
  QS_SIG_DICT , QS_OBJ_DICT , QS_FUN_DICT , QS_USR_DICT ,
  QS_TARGET_INFO , QS_TARGET_DONE , QS_RX_STATUS , QS_QUERY_DATA ,
  QS_PEEK_DATA , QS_ASSERT_FAIL , QS_QF_RUN , QS_SEM_TAKE ,
  QS_SEM_BLOCK , QS_SEM_SIGNAL , QS_SEM_BLOCK_ATTEMPT , QS_MTX_LOCK ,
  QS_MTX_BLOCK , QS_MTX_UNLOCK , QS_MTX_LOCK_ATTEMPT , QS_MTX_BLOCK_ATTEMPT ,
  QS_MTX_UNLOCK_ATTEMPT , QS_PRE_MAX
}
 pre-defined QS record IDs More...
 
enum  QSpyGroups : std::int16_t {
  QS_ALL_RECORDS = 0xF0 , QS_SM_RECORDS , QS_AO_RECORDS , QS_EQ_RECORDS ,
  QS_MP_RECORDS , QS_TE_RECORDS , QS_QF_RECORDS , QS_SC_RECORDS ,
  QS_SEM_RECORDS , QS_MTX_RECORDS , QS_U0_RECORDS , QS_U1_RECORDS ,
  QS_U2_RECORDS , QS_U3_RECORDS , QS_U4_RECORDS , QS_UA_RECORDS
}
 QS-TX record groups for QS_GLB_FILTER() More...
 
enum  QSpyUserOffsets : std::int16_t {
  QS_USER = 100 , QS_USER0 = QS_USER , QS_USER1 = QS_USER0 + 5 , QS_USER2 = QS_USER1 + 5 ,
  QS_USER3 = QS_USER2 + 5 , QS_USER4 = QS_USER3 + 5
}
 QS user record group offsets for QS_GLB_FILTER() More...
 
enum  QSpyIdOffsets : std::int16_t { QS_AO_ID = 0 , QS_EP_ID = 64 , QS_EQ_ID = 80 , QS_AP_ID = 96 }
 QS ID offsets for QS_LOC_FILTER() More...
 
enum  QSpyIdGroups : std::int16_t {
  QS_ALL_IDS = 0xF0 , QS_AO_IDS = 0x80 + QS_AO_ID , QS_EP_IDS = 0x80 + QS_EP_ID , QS_EQ_IDS = 0x80 + QS_EQ_ID ,
  QS_AP_IDS = 0x80 + QS_AP_ID
}
 QS ID groups for QS_LOC_FILTER() More...
 

Functions

std::uint_fast8_t QF_LOG2 (QP::QPSetBits x) noexcept
 
void QEvt_refCtr_inc_ (QEvt const *const e) noexcept
 
void QEvt_refCtr_dec_ (QEvt const *const e) noexcept
 Decrement the refCtr of a const event (requires casting const away)
 

Variables

constexpr char const versionStr [] {QP_VERSION_STR}
 
constexpr enum_t Q_USER_SIG {4}
 
constexpr std::uint8_t TE_IS_LINKED = 1U << 7U
 
constexpr std::uint8_t TE_WAS_DISARMED = 1U << 6U
 
constexpr std::uint8_t TE_TICK_RATE = 0x0FU
 
char const BUILD_DATE [12] = __DATE__
 
char const BUILD_TIME [9] = __TIME__
 
constexpr QTimeEvtCtr QXTHREAD_NO_TIMEOUT {0U}
 

Detailed Description

QP/C++ framework.

Typedef Documentation

◆ QEQueueCtr

QP::QEQueueCtr = std::uint16_t

The data type to store the ring-buffer counters based on the macro QF_EQUEUE_CTR_SIZE.

The dynamic range of this data type determines the maximum length of the ring buffer managed by the native QF event queue.

Definition at line 55 of file qequeue.hpp.

◆ QSchedStatus

QP::QSchedStatus = std::uint_fast8_t

The scheduler lock status for QK::schedLock() and QK::schedUnlock()

The scheduler lock status for QP::QXK::schedLock() and QP::QXK::schedUnlock()

Definition at line 50 of file qk.hpp.

◆ QMPoolSize

QP::QMPoolSize = std::uint16_t

The data type to store the block-size based on the macro QF_MPOOL_SIZ_SIZE.

The dynamic range of this data type determines the maximum size of blocks that can be managed by the native QF event pool.

Definition at line 58 of file qmpool.hpp.

◆ QMPoolCtr

QP::QMPoolCtr = std::uint16_t

The data type to store the block-counter based on the macro QF_MPOOL_CTR_SIZE.

The dynamic range of this data type determines the maximum number of blocks that can be stored in the pool.

Definition at line 68 of file qmpool.hpp.

◆ QSignal

QP::QSignal = std::uint16_t

The signal of event QP::QEvt

Description
The relationship between an event and a signal is as follows. A signal in UML is the specification of an asynchronous stimulus that triggers reactions, and as such is an essential part of an event. (The signal conveys the type of the occurrence–what happened?) However, an event can also contain additional quantitative information about the occurrence in form of event parameters.

Definition at line 130 of file qp.hpp.

◆ QState

QP::QState = std::uint_fast8_t

Type returned from state-handler functions.

Definition at line 173 of file qp.hpp.

◆ QStateHandler

QP::QStateHandler = QState (*)(void * const me, QEvt const * const e)

Pointer to a state-handler function.

Definition at line 176 of file qp.hpp.

◆ QActionHandler

QP::QActionHandler = QState (*)(void * const me)

Pointer to an action-handler function.

Definition at line 179 of file qp.hpp.

◆ QXThreadHandler

QP::QXThreadHandler = void (*)(QXThread * const me)

Pointer to an extended-thread handler function

Definition at line 186 of file qp.hpp.

◆ QPrioSpec

QP::QPrioSpec = std::uint16_t

Priority specification for Active Objects in QP.

Description
Active Object priorities in QP are integer numbers in the range [1..QF_MAX_ACTIVE], whereas the special priority number 0 is reserved for the lowest-priority idle thread. The QP framework uses the direct priority numbering, in which higher numerical values denote higher urgency. For example, an AO with priority 32 has higher urgency than an AO with priority 23.

QP::QPrioSpec allows an application developer to assign two priorities to a given AO (see also Q_PRIO()):

  1. The "QF-priority", which resides in the least-significant byte of the QP::QPrioSpec data type. The "QF-priority" must be unique for each thread in the system and higher numerical values represent higher urgency (direct priority numbering).
  2. The "preemption-threshold" priority, which resides in the most-significant byte of the QP::QPrioSpec data type. The second priority cannot be lower than the "QF-priority", but does NOT need to be unique.

In the QP native preemptive kernels, like QK, the "preemption-threshold" priority is used as to implement the "preemption-threshold scheduling" (PTS). It determines the conditions under which a given thread can be preempted by other threads. Specifically, a given thread can be preempted only by another thread with a higher priority than the "preemption-threshold" of the original thread.

QF-priority and preemption-threshold relations
Note
For backwards-compatibility, QP::QPrioSpec data type might contain only the "QF-priority" component (and the "preemption-threshold" component left at zero). In that case, the "preemption-threshold" will be assumed to be the same as the "QF-priority". This corresponds exactly to the previous semantics of AO priority.
Remarks
When QP runs on top of 3rd-party kernels/RTOSes or general-purpose operating systems, the second priority can have different meaning, depending on the specific RTOS/GPOS used. Priority threshold is supported in QP ports to ThreadX.

Definition at line 574 of file qp.hpp.

◆ QTimeEvtCtr

QP::QTimeEvtCtr = std::uint32_t

Data type to store the block-size defined based on the macro QF_TIMEEVT_CTR_SIZE.

Description
The dynamic range of this data type determines the maximum block size that can be managed by the pool.

Definition at line 588 of file qp.hpp.

◆ QPSetBits

QP::QPSetBits = std::uint32_t

Bitmask for the internal representation of QPSet elements

Definition at line 603 of file qp.hpp.

◆ QSpyFunPtr

using QP::QSpyFunPtr = void (*)()

Definition at line 283 of file qs.hpp.

◆ QSTimeCtr

using QP::QSTimeCtr = std::uint32_t

Definition at line 302 of file qs.hpp.

Enumeration Type Documentation

◆ QSpyPre

enum QP::QSpyPre : std::int8_t

pre-defined QS record IDs

Enumerator
QS_EMPTY 

QS record for cleanly starting a session.

QS_QEP_STATE_ENTRY 

a state was entered

QS_QEP_STATE_EXIT 

a state was exited

QS_QEP_STATE_INIT 

an initial transition was taken in a state

QS_QEP_INIT_TRAN 

the top-most initial transition was taken

QS_QEP_INTERN_TRAN 

an internal transition was taken

QS_QEP_TRAN 

a regular transition was taken

QS_QEP_IGNORED 

an event was ignored (silently discarded)

QS_QEP_DISPATCH 

an event was dispatched (begin of RTC step)

QS_QEP_UNHANDLED 

an event was un-handled due to a guard

QS_QF_ACTIVE_DEFER 

AO deferred an event.

QS_QF_ACTIVE_RECALL 

AO recalled an event.

QS_QF_ACTIVE_SUBSCRIBE 

an AO subscribed to an event

QS_QF_ACTIVE_UNSUBSCRIBE 

an AO unsubscribed to an event

QS_QF_ACTIVE_POST 

an event was posted (FIFO) directly to AO

QS_QF_ACTIVE_POST_LIFO 

an event was posted (LIFO) directly to AO

QS_QF_ACTIVE_GET 

AO got an event and its queue is not empty.

QS_QF_ACTIVE_GET_LAST 

AO got an event and its queue is empty.

QS_QF_ACTIVE_RECALL_ATTEMPT 

AO attempted to recall an event.

QS_QF_EQUEUE_POST 

an event was posted (FIFO) to a raw queue

QS_QF_EQUEUE_POST_LIFO 

an event was posted (LIFO) to a raw queue

QS_QF_EQUEUE_GET 

get an event and queue still not empty

QS_QF_EQUEUE_GET_LAST 

get the last event from the queue

QS_QF_NEW_ATTEMPT 

an attempt to allocate an event failed

QS_QF_MPOOL_GET 

a memory block was removed from memory pool

QS_QF_MPOOL_PUT 

a memory block was returned to memory pool

QS_QF_PUBLISH 

an event was published to active objects

QS_QF_NEW_REF 

new event reference was created

QS_QF_NEW 

new event was created

QS_QF_GC_ATTEMPT 

garbage collection attempt

QS_QF_GC 

garbage collection

QS_QF_TICK 

QTimeEvt tick was called.

QS_QF_TIMEEVT_ARM 

a time event was armed

QS_QF_TIMEEVT_AUTO_DISARM 

a time event expired and was disarmed

QS_QF_TIMEEVT_DISARM_ATTEMPT 

attempt to disarm a disarmed QTimeEvt

QS_QF_TIMEEVT_DISARM 

true disarming of an armed time event

QS_QF_TIMEEVT_REARM 

rearming of a time event

QS_QF_TIMEEVT_POST 

a time event posted itself directly to an AO

QS_QF_DELETE_REF 

an event reference is about to be deleted

QS_QF_CRIT_ENTRY 

critical section was entered

QS_QF_CRIT_EXIT 

critical section was exited

QS_QF_ISR_ENTRY 

an ISR was entered

QS_QF_ISR_EXIT 

an ISR was exited

QS_QF_INT_DISABLE 

interrupts were disabled

QS_QF_INT_ENABLE 

interrupts were enabled

QS_QF_ACTIVE_POST_ATTEMPT 

attempt to post an evt to AO failed

QS_QF_EQUEUE_POST_ATTEMPT 

attempt to post evt to QEQueue failed

QS_QF_MPOOL_GET_ATTEMPT 

attempt to get a memory block failed

QS_SCHED_PREEMPT 

scheduler asynchronously preempted a task

QS_SCHED_RESTORE 

scheduler restored preempted task

QS_SCHED_LOCK 

scheduler was locked

QS_SCHED_UNLOCK 

scheduler was unlocked

QS_SCHED_NEXT 

scheduler started next task

QS_SCHED_IDLE 

scheduler restored the idle task

QS_ENUM_DICT 

enumeration dictionary entry

QS_QEP_TRAN_HIST 

a tran to history was taken

QS_QEP_TRAN_EP 

a tran to entry point into a submachine

QS_QEP_TRAN_XP 

a tran to exit point out of a submachine

QS_TEST_PAUSED 

test has been paused

QS_TEST_PROBE_GET 

reports that Test-Probe has been used

QS_SIG_DICT 

signal dictionary entry

QS_OBJ_DICT 

object dictionary entry

QS_FUN_DICT 

function dictionary entry

QS_USR_DICT 

user QS record dictionary entry

QS_TARGET_INFO 

reports the Target information

QS_TARGET_DONE 

reports completion of a user callback

QS_RX_STATUS 

reports QS data receive status

QS_QUERY_DATA 

reports the data from "current object" query

QS_PEEK_DATA 

reports the data from the PEEK query

QS_ASSERT_FAIL 

assertion failed in the code

QS_QF_RUN 

QF_run() was entered.

QS_SEM_TAKE 

a semaphore was taken by a thread

QS_SEM_BLOCK 

a semaphore blocked a thread

QS_SEM_SIGNAL 

a semaphore was signaled

QS_SEM_BLOCK_ATTEMPT 

a semaphore blocked was attempted

QS_MTX_LOCK 

a mutex was locked

QS_MTX_BLOCK 

a mutex blocked a thread

QS_MTX_UNLOCK 

a mutex was unlocked

QS_MTX_LOCK_ATTEMPT 

a mutex lock was attempted

QS_MTX_BLOCK_ATTEMPT 

a mutex blocking was attempted

QS_MTX_UNLOCK_ATTEMPT 

a mutex unlock was attempted

QS_PRE_MAX 

the # predefined signals

Definition at line 69 of file qs.hpp.

◆ QSpyGroups

enum QP::QSpyGroups : std::int16_t

QS-TX record groups for QS_GLB_FILTER()

Enumerator
QS_ALL_RECORDS 

all maskable QS records

QS_SM_RECORDS 

State Machine QS records.

QS_AO_RECORDS 

Active Object QS records.

QS_EQ_RECORDS 

Event Queues QS records.

QS_MP_RECORDS 

Memory Pools QS records.

QS_TE_RECORDS 

Time Events QS records.

QS_QF_RECORDS 

QF QS records.

QS_SC_RECORDS 

Scheduler QS records.

QS_SEM_RECORDS 

Semaphore QS records.

QS_MTX_RECORDS 

Mutex QS records.

QS_U0_RECORDS 

User Group 100-104 records.

QS_U1_RECORDS 

User Group 105-109 records.

QS_U2_RECORDS 

User Group 110-114 records.

QS_U3_RECORDS 

User Group 115-119 records.

QS_U4_RECORDS 

User Group 120-124 records.

QS_UA_RECORDS 

All User records.

Definition at line 193 of file qs.hpp.

◆ QSpyUserOffsets

enum QP::QSpyUserOffsets : std::int16_t

QS user record group offsets for QS_GLB_FILTER()

Enumerator
QS_USER 

the first record available to QS users

QS_USER0 

offset for User Group 0

QS_USER1 

offset for User Group 1

QS_USER2 

offset for User Group 2

QS_USER3 

offset for User Group 3

QS_USER4 

offset for User Group 4

Definition at line 214 of file qs.hpp.

◆ QSpyIdOffsets

enum QP::QSpyIdOffsets : std::int16_t

QS ID offsets for QS_LOC_FILTER()

Enumerator
QS_AO_ID 

offset for AO priorities

QS_EP_ID 

offset for event-pool IDs

QS_EQ_ID 

offset for event-queue IDs

QS_AP_ID 

offset for Application-specific IDs

Definition at line 225 of file qs.hpp.

◆ QSpyIdGroups

enum QP::QSpyIdGroups : std::int16_t

QS ID groups for QS_LOC_FILTER()

Enumerator
QS_ALL_IDS 

all QS IDs

QS_AO_IDS 

AO IDs (priorities)

QS_EP_IDS 

event-pool IDs

QS_EQ_IDS 

event-queue IDs

QS_AP_IDS 

Application-specific IDs.

Definition at line 234 of file qs.hpp.

Function Documentation

◆ QF_LOG2()

std::uint_fast8_t QP::QF_LOG2 ( QP::QPSetBits x)
noexcept

Definition at line 101 of file qf_act.cpp.

◆ QEvt_refCtr_inc_()

QP::QEvt_refCtr_inc_ ( QEvt const *const e)
inlinenoexcept

Increment the refCtr of a const event (requires casting const away)

Traceability

Definition at line 92 of file qp_pkg.hpp.

◆ QEvt_refCtr_dec_()

QP::QEvt_refCtr_dec_ ( QEvt const *const e)
inlinenoexcept

Decrement the refCtr of a const event (requires casting const away)

Traceability
  • DVR-QP-MC4-R11_08

Definition at line 96 of file qp_pkg.hpp.

Variable Documentation

◆ versionStr

constexpr char const QP::versionStr[] {QP_VERSION_STR}
constexpr

Definition at line 121 of file qp.hpp.

◆ Q_USER_SIG

constexpr enum_t QP::Q_USER_SIG {4}
constexpr

Definition at line 217 of file qp.hpp.

◆ TE_IS_LINKED

constexpr std::uint8_t QP::TE_IS_LINKED = 1U << 7U
constexpr

Definition at line 88 of file qp_pkg.hpp.

◆ TE_WAS_DISARMED

constexpr std::uint8_t QP::TE_WAS_DISARMED = 1U << 6U
constexpr

Definition at line 89 of file qp_pkg.hpp.

◆ TE_TICK_RATE

constexpr std::uint8_t QP::TE_TICK_RATE = 0x0FU
constexpr

Definition at line 90 of file qp_pkg.hpp.

◆ BUILD_DATE

char const QP::BUILD_DATE = __DATE__

Definition at line 46 of file qstamp.cpp.

◆ BUILD_TIME

char const QP::BUILD_TIME = __TIME__

Definition at line 47 of file qstamp.cpp.

◆ QXTHREAD_NO_TIMEOUT

QP::QXTHREAD_NO_TIMEOUT {0U}
constexpr

No-timeout when blocking on semaphores, mutextes, and queues

Definition at line 59 of file qxk.hpp.