QP/C++  8.0.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qp_port.hpp File Reference

Sample QP/C++ port. More...

#include <cstdint>
#include "qequeue.hpp"
#include "qmpool.hpp"
#include "qp.hpp"
#include "qk.hpp"

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
 QP::QActive event queue type used in various QP/C++ ports.
 
#define QACTIVE_OS_OBJ_TYPE   void*
 QP::QActive "OS-object" type used in various QP/C++ ports.
 
#define QACTIVE_THREAD_TYPE   void const *
 QP::QActive "thread" type used in various QP/C++ ports.
 
#define QF_INT_DISABLE()   intDisable()
 Disable interrupts.
 
#define QF_INT_ENABLE()   intEnable()
 Enable interrupts.
 
#define QF_CRIT_STAT   std::uint32_t crit_stat_;
 
#define QF_CRIT_ENTRY()   (crit_stat_ = critEntry())
 
#define QF_CRIT_EXIT()   critExit(crit_stat_)
 
#define QV_CPU_SLEEP()
 ! def QF_MEM_ISOLATE
 
#define QK_ISR_CONTEXT_()   (QK_priv_.intNest != 0U)
 
#define QK_ISR_ENTRY()
 Define the ISR entry sequence.
 
#define QK_ISR_EXIT()
 
#define QXK_ISR_CONTEXT_()   (QXK_get_IPSR() != 0U)
 Check if the code executes in the ISR context.
 
#define QXK_CONTEXT_SWITCH_()   (trigPendSV())
 Trigger context switch (used internally in QXK only)
 
#define QXK_ISR_ENTRY()   ((void)0)
 Define the ISR entry sequence.
 
#define QXK_ISR_EXIT()
 Define the ISR exit sequence.
 

Functions

void intDisable (void)
 
void intEnable (void)
 
std::uint32_t critEntry (void)
 
void critExit (std::uint32_t stat)
 
std::uint32_t QK_get_IPSR (void)
 

Detailed Description

Sample QP/C++ port.

This is just an example of a QF port for a generic C99 compiler. Other specific QF ports will define the QF facilities differently.

Definition in file qp_port.hpp.

Macro Definition Documentation

◆ Q_NORETURN

#define Q_NORETURN   [[ noreturn ]] void

No-return specifier for the Q_onError() callback function.

If the Q_NORETURN macro is undefined, the default definition uses the C++11 specifier [[ noreturn ]].

Note
The Q_NORETURN macro can be defined in the QP port (typically in qep_port.hpp). If such definition is provided the default won't be used.

Definition at line 22 of file qp_port.hpp.

◆ QACTIVE_EQUEUE_TYPE

#define QACTIVE_EQUEUE_TYPE   QEQueue

QP::QActive event queue type used in various QP/C++ ports.

Definition at line 26 of file qp_port.hpp.

◆ QACTIVE_OS_OBJ_TYPE

#define QACTIVE_OS_OBJ_TYPE   void*

QP::QActive "OS-object" type used in various QP/C++ ports.

Definition at line 29 of file qp_port.hpp.

◆ QACTIVE_THREAD_TYPE

#define QACTIVE_THREAD_TYPE   void const *

QP::QActive "thread" type used in various QP/C++ ports.

Definition at line 32 of file qp_port.hpp.

◆ QF_INT_DISABLE

#define QF_INT_DISABLE ( )    intDisable()

Disable interrupts.

Definition at line 36 of file qp_port.hpp.

◆ QF_INT_ENABLE

#define QF_INT_ENABLE ( )    intEnable()

Enable interrupts.

Definition at line 39 of file qp_port.hpp.

◆ QF_CRIT_STAT

#define QF_CRIT_STAT   std::uint32_t crit_stat_;

Define the critical section status that was present before entering the critical section.

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.

Note
This macro might be empty, in which case the critical section status is not saved or restored. Such critical sections won't be able to nest. Also, note that the macro should be invoked without the closing semicolon.

Definition at line 54 of file qp_port.hpp.

◆ QF_CRIT_ENTRY

#define QF_CRIT_ENTRY ( )    (crit_stat_ = critEntry())

Enter the critical section

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.

Definition at line 63 of file qp_port.hpp.

◆ QF_CRIT_EXIT

#define QF_CRIT_EXIT ( )    critExit(crit_stat_)

Exit the critical section

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.

Definition at line 71 of file qp_port.hpp.

◆ QV_CPU_SLEEP

#define QV_CPU_SLEEP ( )
Value:
do { \
__disable_interrupt(); \
QF_INT_ENABLE(); \
__WFI(); \
__enable_interrupt(); \
} while (false)

! def QF_MEM_ISOLATE

Macro to put the CPU to sleep safely in the non-preemptive QV kernel (to be called from QV::onIdle()).

Definition at line 100 of file qp_port.hpp.

◆ QK_ISR_CONTEXT_

#define QK_ISR_CONTEXT_ ( )    (QK_priv_.intNest != 0U)

Check if the code executes in the ISR context

Definition at line 111 of file qp_port.hpp.

◆ QK_ISR_ENTRY

#define QK_ISR_ENTRY ( )
Value:
do { \
QF_INT_DISABLE(); \
QF_QS_ISR_ENTRY(QK_priv_.intNest, QK_currPrio_); \
QF_INT_ENABLE(); \
} while (false)
std::uint_fast8_t intNest
Definition qk.hpp:75
QK_Attr QK_priv_
Definition qk.cpp:149

Define the ISR entry sequence.

Definition at line 114 of file qp_port.hpp.

◆ QK_ISR_EXIT

#define QK_ISR_EXIT ( )
Value:
do { \
QF_INT_DISABLE(); \
if (QK_priv_.intNest == 0U) { \
if (QK_sched_() != 0U) { \
QK_activate_(); \
} \
} \
QF_INT_ENABLE(); \
} while (false)
std::uint_fast8_t QK_sched_() noexcept
Definition qk.cpp:152

Define the ISR exit sequence

Definition at line 123 of file qp_port.hpp.

◆ QXK_ISR_CONTEXT_

#define QXK_ISR_CONTEXT_ ( )    (QXK_get_IPSR() != 0U)

Check if the code executes in the ISR context.

Definition at line 137 of file qp_port.hpp.

◆ QXK_CONTEXT_SWITCH_

#define QXK_CONTEXT_SWITCH_ ( )    (trigPendSV())

Trigger context switch (used internally in QXK only)

Definition at line 140 of file qp_port.hpp.

◆ QXK_ISR_ENTRY

#define QXK_ISR_ENTRY ( )    ((void)0)

Define the ISR entry sequence.

Definition at line 143 of file qp_port.hpp.

◆ QXK_ISR_EXIT

#define QXK_ISR_EXIT ( )
Value:
do { \
QF_INT_DISABLE(); \
if (QXK_sched_() != 0U) { \
*Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (1U << 28U);\
} \
QF_INT_ENABLE(); \
QXK_ARM_ERRATUM_838869(); \
} while (false)
#define Q_UINT2PTR_CAST(type_, uint_)
Perform cast from unsigned integer uint_ to pointer of type type_
Definition qp.hpp:504

Define the ISR exit sequence.

Definition at line 146 of file qp_port.hpp.

Function Documentation

◆ intDisable()

void intDisable ( void )

◆ intEnable()

void intEnable ( void )

◆ critEntry()

std::uint32_t critEntry ( void )

◆ critExit()

void critExit ( std::uint32_t stat)

◆ QK_get_IPSR()

std::uint32_t QK_get_IPSR ( void )