QK/C++ platform-independent public interface.
More...
#include "qequeue.hpp"
#include "qmpool.hpp"
#include "qpset.hpp"
Go to the source code of this file.
|
namespace | QP |
| namespace associated with the QP/C++ framework
|
|
|
#define | QF_EQUEUE_TYPE QEQueue |
|
#define | QF_THREAD_TYPE void* |
|
#define | QK_ISR_CONTEXT_() (QK_attr_.intNest != 0U) |
| Internal port-specific macro that reports the execution context. More...
|
|
#define | QF_SCHED_STAT_ QSchedStatus lockStat_; |
| Internal macro to represent the scheduler lock status. More...
|
|
#define | QF_SCHED_LOCK_(prio_) |
| Internal macro for selective scheduler locking. More...
|
|
#define | QF_SCHED_UNLOCK_() |
| Internal macro for selective scheduler unlocking. More...
|
|
#define | QACTIVE_EQUEUE_WAIT_(me_) Q_ASSERT_ID(110, (me_)->m_eQueue.m_frontEvt != nullptr) |
|
#define | QACTIVE_EQUEUE_SIGNAL_(me_) |
|
#define | QF_EPOOL_TYPE_ QMPool |
|
#define | QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) (p_).init((poolSto_), (poolSize_), (evtSize_)) |
|
#define | QF_EPOOL_EVENT_SIZE_(p_) ((p_).m_blockSize) |
|
#define | QF_EPOOL_GET_(p_, e_, m_, qs_id_) ((e_) = static_cast<QEvt *>((p_).get((m_), (qs_id_)))) |
|
#define | QF_EPOOL_PUT_(p_, e_, qs_id_) ((p_).put((e_), (qs_id_))) |
|
- Date
- Last updated on: 2021-12-23
- Version
- Last updated for: Version 7.0.0, 2022-04-30
Definition in file qk.hpp.
◆ QK_Attr
Definition at line 59 of file qk.hpp.
Data Fields |
uint8_t volatile |
actPrio |
prio of the active AO |
uint8_t volatile |
nextPrio |
prio of the next AO to execute |
uint8_t volatile |
lockPrio |
lock prio (0 == no-lock) |
uint8_t volatile |
lockHolder |
prio of the lock holder |
uint8_t volatile |
intNest |
ISR nesting level. |
QPSet |
readySet |
QK ready-set of AOs and "naked" threads. |
◆ QF_EQUEUE_TYPE
#define QF_EQUEUE_TYPE QEQueue |
◆ QF_THREAD_TYPE
#define QF_THREAD_TYPE void* |
◆ QK_ISR_CONTEXT_
#define QK_ISR_CONTEXT_ |
( |
| ) |
(QK_attr_.intNest != 0U) |
- Returns
- true if the code executes in the ISR context and false otherwise
Definition at line 163 of file qk.hpp.
◆ QF_SCHED_STAT_
#define QF_SCHED_STAT_ QSchedStatus lockStat_; |
◆ QF_SCHED_LOCK_
#define QF_SCHED_LOCK_ |
( |
|
prio_ | ) |
|
Value: do { \
lockStat_ = 0xFFU; \
} else { \
lockStat_ = QK::schedLock((prio_)); \
} \
} while (false)
#define QK_ISR_CONTEXT_()
Internal port-specific macro that reports the execution context.
Definition at line 173 of file qk.hpp.
◆ QF_SCHED_UNLOCK_
#define QF_SCHED_UNLOCK_ |
( |
| ) |
|
Value: do { \
if (lockStat_ != 0xFFU) { \
QK::schedUnlock(lockStat_); \
} \
} while (false)
Definition at line 182 of file qk.hpp.
◆ QACTIVE_EQUEUE_WAIT_
#define QACTIVE_EQUEUE_WAIT_ |
( |
|
me_ | ) |
Q_ASSERT_ID(110, (me_)->m_eQueue.m_frontEvt != nullptr) |
◆ QACTIVE_EQUEUE_SIGNAL_
#define QACTIVE_EQUEUE_SIGNAL_ |
( |
|
me_ | ) |
|
Value: do { \
QK_attr_.readySet.insert( \
static_cast<std::uint_fast8_t>((me_)->m_prio)); \
QK_activate_(); \
} \
} \
} while (false)
std::uint_fast8_t QK_sched_(void) noexcept
QK scheduler finds the highest-priority thread ready to run.
Definition at line 192 of file qk.hpp.
◆ QF_EPOOL_TYPE_
#define QF_EPOOL_TYPE_ QMPool |
◆ QF_EPOOL_INIT_
#define QF_EPOOL_INIT_ |
( |
|
p_, |
|
|
|
poolSto_, |
|
|
|
poolSize_, |
|
|
|
evtSize_ |
|
) |
| (p_).init((poolSto_), (poolSize_), (evtSize_)) |
◆ QF_EPOOL_EVENT_SIZE_
#define QF_EPOOL_EVENT_SIZE_ |
( |
|
p_ | ) |
((p_).m_blockSize) |
◆ QF_EPOOL_GET_
#define QF_EPOOL_GET_ |
( |
|
p_, |
|
|
|
e_, |
|
|
|
m_, |
|
|
|
qs_id_ |
|
) |
| ((e_) = static_cast<QEvt *>((p_).get((m_), (qs_id_)))) |
◆ QF_EPOOL_PUT_
#define QF_EPOOL_PUT_ |
( |
|
p_, |
|
|
|
e_, |
|
|
|
qs_id_ |
|
) |
| ((p_).put((e_), (qs_id_))) |
◆ QK_sched_()
std::uint_fast8_t QK_sched_ |
( |
void |
| ) |
|
|
noexcept |
- Description
- The QK scheduler finds out the priority of the highest-priority AO that (1) has events to process and (2) has priority that is above the current priority.
- Returns
- the 1-based priority of the the active object, or zero if no eligible active object is ready to run.
- Attention
- QK_sched_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 321 of file qk.cpp.
◆ QK_activate_()
void QK_activate_ |
( |
void |
| ) |
|
|
noexcept |
- Description
- QK_activate_() activates ready-to run AOs that are above the initial active priority (QK_attr_.actPrio).
- Note
- The activator might enable interrupts internally, but always returns with interrupts disabled.
Definition at line 348 of file qk.cpp.
◆ QK_onContextSw()
- Description
- This callback function provides a mechanism to perform additional custom operations when QK switches context from one thread to another.
- Parameters
-
[in] | prev | pointer to the previous thread (active object) (prev==0 means that prev was the QK idle loop) |
[in] | next | pointer to the next thread (active object) (next==0) means that next is the QK idle loop) |
- Attention
- QK_onContextSw() is invoked with interrupts disabled and must also return with interrupts disabled.
- Note
- This callback is enabled by defining the macro #QK_ON_CONTEXT_SW.
extern "C" {
#ifdef QK_ON_CONTEXT_SW
(void)prev;
if (next != (QActive *)0) {
_impure_ptr = next->thread;
}
}
#endif
}
void QK_onContextSw(QP::QActive *prev, QP::QActive *next)
QK context switch callback (customized in BSPs for QK)
#define QS_OBJ(obj_)
Output formatted object pointer to the QS record.
#define QS_END_NOCRIT()
End a QS user record without exiting critical section.
#define QS_BEGIN_NOCRIT(rec_, qs_id_)
Begin a QS user record without entering critical section.
◆ QK_attr_