Sample QP/C++ port. More...
Go to the source code of this file.
Macros | |
| #define | Q_NORETURN [[ noreturn ]] void |
| No-return specifier for the Q_onError() callback function. | |
| #define | QACTIVE_EQUEUE_TYPE QEQueue |
| Port-specific ::QActive event queue type. | |
| #define | QACTIVE_OS_OBJ_TYPE void* |
| Port-specific ::QActive "OS-object" type. | |
| #define | QACTIVE_THREAD_TYPE void const * |
| Port-specific ::QActive thread type. | |
| #define | QF_INT_DISABLE() |
| Port-specific interrupt disable. | |
| #define | QF_INT_ENABLE() |
| Port-specific interrupt enable. | |
| #define | QF_CRIT_STAT crit_stat_t crit_stat_; |
| Define the critical section status that was present before entering the critical section. | |
| #define | QF_CRIT_ENTRY() |
| Port-specific critical section entry. | |
| #define | QF_CRIT_EXIT() |
| Port-specific critical section exit. | |
| #define | QF_CRIT_EXIT_NOP() |
| No-operation for exiting a critical section. | |
| #define | QF_CRIT_EST() |
| Port-specific establishing a critical section (without saving the status). | |
| #define | QF_LOG2(bitmask_) |
| Port-specific integer log-base-2 of a 32-bit bitmask. | |
| #define | QV_CPU_SLEEP() |
| Port-specific method to put the CPU to sleep safely in the non-preemptive QV kernel (to be called from QV::QV_onIdle()). | |
| #define | QK_ISR_CONTEXT_() |
| Port-specific method to check if the QK kernel executes in the ISR context (used internally in QK only). | |
| #define | QK_ISR_ENTRY() |
| Port-specific method to inform QK kernel about the ISR entry. | |
| #define | QK_ISR_EXIT() |
| Port-specific method to inform QK kernel about the ISR exit. | |
| #define | QXK_ISR_CONTEXT_() |
| Port-specific method to check if the QXK kernel executes in the ISR context (used internally in QXK only). | |
| #define | QXK_CONTEXT_SWITCH_() |
| Port-specific method to trigger context switch (used internally in QXK only). | |
| #define | QXK_ISR_ENTRY() |
| Port-specific method to inform QXK kernel about the ISR entry. | |
| #define | QXK_ISR_EXIT() |
| Port-specific method to inform QXK kernel about the ISR exit. | |
| #define | QF_SCHED_STAT_ QSchedStatus lockStat_; |
| Port-specific type of the scheduler lock status (for internal use in QF only). | |
| #define | QF_SCHED_LOCK_(ceil_) |
| Port-specific method to lock the scheduler (for internal use in QF only). | |
| #define | QF_SCHED_UNLOCK_() |
| Port-specific method to unlock the scheduler (for internal use in QF only). | |
| #define | QACTIVE_EQUEUE_WAIT_(me_) |
| Port-specific method to wait on an empty Active Object event queue (for internal use only). | |
| #define | QACTIVE_EQUEUE_SIGNAL_(me_) |
| Port-specific method to signal Active Object event queue (for internal use only). | |
| #define | QXTHREAD_EQUEUE_SIGNAL_(me_) |
| Port-specific method to signal eXtended thread event queue (for internal use only). | |
| #define | QF_EPOOL_TYPE_ QMPool |
| Port-specific type of the event pool (for internal use in QF only). | |
| #define | QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) |
| Port-specific event pool initialization (for internal use in QF only). | |
| #define | QF_EPOOL_EVENT_SIZE_(p_) |
| Port-specific event pool block-size() operation (for internal use in QF only). | |
| #define | QF_EPOOL_GET_(p_, e_, m_, qsId_) |
| Port-specific event pool get() operation (for internal use in QF only). | |
| #define | QF_EPOOL_PUT_(p_, e_, qsId_) |
| Port-specific event pool put() operation (for internal use in QF only). | |
| #define | QF_EPOOL_USE_(ePool_) |
| Port-specific event pool # used events operation (for internal use in QF only). | |
| #define | QF_EPOOL_FREE_(ePool_) |
| Port-specific event pool # free events operation (for internal use in QF only). | |
| #define | QF_EPOOL_MIN_(ePool_) |
| Port-specific event pool minimum # events since initialization (for internal use in QF only). | |
Sample QP/C++ port.
Details
This is just an example of a QF port for a generic C11 compiler. Other specific QF ports will define the QF facilities differently.
Definition in file qp_port.hpp.
| #define Q_NORETURN [[ noreturn ]] void |
No-return specifier for the Q_onError() callback function.
Details
Per the Software Safety Requirement SSRS_QA_FDM_20, the Q_onError() handler should never return. Starting with the C99 Standard, the no-return specification can be provided at the language level, which may allow the compiler to apply optimizations (e.g., for impossible code paths downstream of Q_onError()). Also, the no-return specification is immensely valuable for static analysis tools.
Backward Traceability
Forward Traceability
Definition at line 26 of file qp_port.hpp.
| #define QACTIVE_EQUEUE_TYPE QEQueue |
Port-specific ::QActive event queue type.
Forward Traceability
Definition at line 34 of file qp_port.hpp.
| #define QACTIVE_OS_OBJ_TYPE void* |
Port-specific ::QActive "OS-object" type.
Forward Traceability
Definition at line 41 of file qp_port.hpp.
| #define QACTIVE_THREAD_TYPE void const * |
Port-specific ::QActive thread type.
Forward Traceability
Definition at line 48 of file qp_port.hpp.
| #define QF_INT_DISABLE | ( | ) |
Port-specific interrupt disable.
Forward Traceability
Definition at line 57 of file qp_port.hpp.
| #define QF_INT_ENABLE | ( | ) |
Port-specific interrupt enable.
Forward Traceability
Definition at line 65 of file qp_port.hpp.
| #define QF_CRIT_STAT crit_stat_t crit_stat_; |
Define the critical section status that was present before entering the critical section.
Details
For critical sections that are allowed to nest, the critical section status must be saved and restored at the end. This macro provides the storage for saving the status.
Forward Traceability
Definition at line 77 of file qp_port.hpp.
| #define QF_CRIT_ENTRY | ( | ) |
Port-specific critical section entry.
Details
If the critical section status is provided, the macro saves the critical section status from before entering the critical section. Otherwise, the macro just unconditionally enters the critical section without saving the status.
Forward Traceability
Definition at line 87 of file qp_port.hpp.
| #define QF_CRIT_EXIT | ( | ) |
Port-specific critical section exit.
Details
If the critical section status is provided, the macro restores the critical section status saved by QF_CRIT_ENTRY(). Otherwise, the macro just unconditionally exits the critical section.
Forward Traceability
Definition at line 97 of file qp_port.hpp.
| #define QF_CRIT_EXIT_NOP | ( | ) |
No-operation for exiting a critical section.
Details
In some QF ports, the critical section exit takes effect only on the next machine instruction. If this next instruction is another entry to a critical section, the critical section won't be exited, but rather the two adjacent critical sections would be merged. The QF_CRIT_EXIT_NOP() macro contains minimal code required to prevent such merging of critical sections in QF ports.
Forward Traceability
Definition at line 107 of file qp_port.hpp.
| #define QF_CRIT_EST | ( | ) |
Port-specific establishing a critical section (without saving the status).
Details
This port-specific macro only establishes a critical section (to later call Q_onError() error handler), but since Q_onError() never returns, there is no need to exit such established critical section.
Forward Traceability
Definition at line 117 of file qp_port.hpp.
| #define QF_LOG2 | ( | bitmask_ | ) |
Port-specific integer log-base-2 of a 32-bit bitmask.
Details
Calculate integer log-base-2 of a given bitmask (1-based) used to quickly determine the higest-number 1-bit in the bitmask. This operation is used frequently during task scheduling and publish-subscribe.
| [in] | bitmask_ | 32-bit bitmask |
Forward Traceability
Definition at line 141 of file qp_port.hpp.
| #define QV_CPU_SLEEP | ( | ) |
Port-specific method to put the CPU to sleep safely in the non-preemptive QV kernel (to be called from QV::QV_onIdle()).
Forward Traceability
Definition at line 185 of file qp_port.hpp.
| #define QK_ISR_CONTEXT_ | ( | ) |
Port-specific method to check if the QK kernel executes in the ISR context (used internally in QK only).
Forward Traceability
Definition at line 202 of file qp_port.hpp.
| #define QK_ISR_ENTRY | ( | ) |
Port-specific method to inform QK kernel about the ISR entry.
Forward Traceability
Definition at line 210 of file qp_port.hpp.
| #define QK_ISR_EXIT | ( | ) |
Port-specific method to inform QK kernel about the ISR exit.
Forward Traceability
Definition at line 224 of file qp_port.hpp.
| #define QXK_ISR_CONTEXT_ | ( | ) |
Port-specific method to check if the QXK kernel executes in the ISR context (used internally in QXK only).
Forward Traceability
Definition at line 244 of file qp_port.hpp.
| #define QXK_CONTEXT_SWITCH_ | ( | ) |
Port-specific method to trigger context switch (used internally in QXK only).
Forward Traceability
Definition at line 252 of file qp_port.hpp.
| #define QXK_ISR_ENTRY | ( | ) |
Port-specific method to inform QXK kernel about the ISR entry.
Forward Traceability
Definition at line 260 of file qp_port.hpp.
| #define QXK_ISR_EXIT | ( | ) |
Port-specific method to inform QXK kernel about the ISR exit.
Forward Traceability
Definition at line 268 of file qp_port.hpp.
| #define QF_SCHED_STAT_ QSchedStatus lockStat_; |
Port-specific type of the scheduler lock status (for internal use in QF only).
Forward Traceability
Definition at line 283 of file qp_port.hpp.
| #define QF_SCHED_LOCK_ | ( | ceil_ | ) |
Port-specific method to lock the scheduler (for internal use in QF only).
| [in] | ceil_ | priority-ceiling up to which the scheduler should be locked |
Forward Traceability
Definition at line 292 of file qp_port.hpp.
| #define QF_SCHED_UNLOCK_ | ( | ) |
Port-specific method to unlock the scheduler (for internal use in QF only).
Forward Traceability
Definition at line 306 of file qp_port.hpp.
| #define QACTIVE_EQUEUE_WAIT_ | ( | me_ | ) |
Port-specific method to wait on an empty Active Object event queue (for internal use only).
| [in,out] | me_ | current instance pointer |
Forward Traceability
Definition at line 321 of file qp_port.hpp.
| #define QACTIVE_EQUEUE_SIGNAL_ | ( | me_ | ) |
Port-specific method to signal Active Object event queue (for internal use only).
| [in,out] | me_ | current instance pointer |
Forward Traceability
Definition at line 330 of file qp_port.hpp.
| #define QXTHREAD_EQUEUE_SIGNAL_ | ( | me_ | ) |
Port-specific method to signal eXtended thread event queue (for internal use only).
| [in,out] | me_ | current instance pointer |
Forward Traceability
Definition at line 347 of file qp_port.hpp.
| #define QF_EPOOL_TYPE_ QMPool |
Port-specific type of the event pool (for internal use in QF only).
Forward Traceability
Definition at line 365 of file qp_port.hpp.
| #define QF_EPOOL_INIT_ | ( | p_, | |
| poolSto_, | |||
| poolSize_, | |||
| evtSize_ ) |
Port-specific event pool initialization (for internal use in QF only).
| [in,out] | p_ | event pool pointer |
| [in] | poolSto_ | storage for the pool (pointer to the pool buffer) |
| [in] | poolSize_ | size of the pool storage in [bytes] |
| [in] | evtSize_ | event size of this pool in [bytes] |
Forward Traceability
Definition at line 377 of file qp_port.hpp.
| #define QF_EPOOL_EVENT_SIZE_ | ( | p_ | ) |
Port-specific event pool block-size() operation (for internal use in QF only).
| [in,out] | p_ | event pool pointer |
Forward Traceability
Definition at line 387 of file qp_port.hpp.
| #define QF_EPOOL_GET_ | ( | p_, | |
| e_, | |||
| m_, | |||
| qsId_ ) |
Port-specific event pool get() operation (for internal use in QF only).
| [in,out] | p_ | event pool pointer |
| [out] | e_ | event pointer to be assigned the obtained event |
| [in] | m_ | marign (# free events that must still remain in the pool) |
| [in] | qsId_ | QS ID for the QS local filter |
Forward Traceability
Definition at line 399 of file qp_port.hpp.
| #define QF_EPOOL_PUT_ | ( | p_, | |
| e_, | |||
| qsId_ ) |
Port-specific event pool put() operation (for internal use in QF only).
| [in,out] | p_ | event pool pointer |
| [out] | e_ | event pointer to return to the pool |
| [in] | qsId_ | QS ID for the QS local filter |
Forward Traceability
Definition at line 412 of file qp_port.hpp.
| #define QF_EPOOL_USE_ | ( | ePool_ | ) |
Port-specific event pool # used events operation (for internal use in QF only).
| [in] | ePool_ | event pool pointer |
Forward Traceability
Definition at line 422 of file qp_port.hpp.
| #define QF_EPOOL_FREE_ | ( | ePool_ | ) |
Port-specific event pool # free events operation (for internal use in QF only).
| [in] | ePool_ | event pool pointer |
Forward Traceability
Definition at line 432 of file qp_port.hpp.
| #define QF_EPOOL_MIN_ | ( | ePool_ | ) |
Port-specific event pool minimum # events since initialization (for internal use in QF only).
| [in] | ePool_ | event pool pointer |
Forward Traceability
Definition at line 442 of file qp_port.hpp.