QXK/C++ preemptive extended (blocking) kernel, 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_OS_OBJECT_TYPE void* |
|
#define | QF_THREAD_TYPE void* |
|
#define | QXK_TLS(type_) (static_cast<type_>(QXK_current()->m_thread)) |
| Access Thread-Local Storage (TLS) and cast it on the given type_ . More...
|
|
#define | QXK_ISR_CONTEXT_() (QXK_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 qxk.hpp.
◆ QXK_Attr
Definition at line 66 of file qxk.hpp.
Data Fields |
QActive *volatile |
curr |
currently executing thread |
QActive *volatile |
next |
next thread to execute |
uint8_t volatile |
actPrio |
prio of the active basic thread |
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. |
QActive * |
idleThread |
pointer to the idle thread |
QPSet |
readySet |
ready-set of all threads |
◆ QF_EQUEUE_TYPE
#define QF_EQUEUE_TYPE QEQueue |
◆ QF_OS_OBJECT_TYPE
#define QF_OS_OBJECT_TYPE void* |
◆ QF_THREAD_TYPE
#define QF_THREAD_TYPE void* |
◆ QXK_TLS
#define QXK_TLS |
( |
|
type_ | ) |
(static_cast<type_>(QXK_current()->m_thread)) |
◆ QXK_ISR_CONTEXT_
#define QXK_ISR_CONTEXT_ |
( |
| ) |
(QXK_attr_.intNest != 0U) |
- Returns
- true if the code executes in the ISR context and false otherwise
Definition at line 170 of file qxk.hpp.
◆ QF_SCHED_STAT_
#define QF_SCHED_STAT_ QSchedStatus lockStat_; |
◆ QF_SCHED_LOCK_
#define QF_SCHED_LOCK_ |
( |
|
prio_ | ) |
|
Value: do { \
lockStat_ = 0xFFU; \
} else { \
lockStat_ = QXK::schedLock((prio_)); \
} \
} while (false)
#define QXK_ISR_CONTEXT_()
Internal port-specific macro that reports the execution context.
Definition at line 181 of file qxk.hpp.
◆ QF_SCHED_UNLOCK_
#define QF_SCHED_UNLOCK_ |
( |
| ) |
|
Value: do { \
if (lockStat_ != 0xFFU) { \
QXK::schedUnlock(lockStat_); \
} \
} while (false)
Definition at line 190 of file qxk.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 { \
QXK_attr_.readySet.insert( \
static_cast<std::uint_fast8_t>((me_)->m_dynPrio)); \
QXK_activate_(); \
} \
} \
} while (false)
std::uint_fast8_t QXK_sched_(void) noexcept
QXK scheduler finds the highest-priority thread ready to run.
Definition at line 200 of file qxk.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_))) |
◆ QXK_sched_()
std::uint_fast8_t QXK_sched_ |
( |
void |
| ) |
|
|
noexcept |
- Description
- The QXK scheduler finds the priority of the highest-priority thread that is ready to run.
- Returns
- the 1-based priority of the the active object to run next, or zero if no eligible active object is found.
- Attention
- QXK_sched_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 340 of file qxk.cpp.
◆ QXK_activate_()
void QXK_activate_ |
( |
void |
| ) |
|
- Attention
- QXK_activate_() must be always called with interrupts disabled and returns with interrupts disabled.
- Note
- The activate function might enable interrupts internally, but it always returns with interrupts disabled.
- Precondition
- QXK_attr_.next must be valid
Definition at line 417 of file qxk.cpp.
◆ QXK_current()
- Precondition
- the QXK kernel must be running
- Postcondition
- the current thread must be valid
Definition at line 549 of file qxk.cpp.
◆ QXK_onContextSw()
- Description
- This callback function provides a mechanism to perform additional custom operations when QXK switches context from one thread to another.
- Parameters
-
[in] | prev | pointer to the previous thread (active object) (prev==0 means that prev was the QXK idle thread) |
[in] | next | pointer to the next thread (active object) (next==0) means that next is the QXK idle thread) |
- Attention
- QXK_onContextSw() is invoked with interrupts disabled and must also return with interrupts disabled.
- Note
- This callback is enabled by defining the macro #QXK_ON_CONTEXT_SW.
extern "C" {
#ifdef QXK_ON_CONTEXT_SW
(void)prev;
if (next != (QActive *)0) {
_impure_ptr = next->thread;
}
}
#endif
}
#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.
void QXK_onContextSw(QP::QActive *prev, QP::QActive *next)
QXK context switch callback (customized in BSPs for QXK)
◆ QXK_attr_