QXK/C (preemptive dual-mode kernel) platform-independent public interface.
More...
Go to the source code of this file.
|
#define | QXTHREAD_NO_TIMEOUT ((QTimeEvtCtr)0) |
|
#define | QXTHREAD_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_) |
|
#define | QXTHREAD_POST_X(me_, e_, margin_, sender_) QACTIVE_POST_X(&(me_)->super, (e_), (margin_), (sender_)) |
|
#define | QF_SCHED_STAT_ QSchedStatus lockStat_; |
|
#define | QF_SCHED_LOCK_(ceil_) |
|
#define | QF_SCHED_UNLOCK_() |
|
#define | QACTIVE_EQUEUE_WAIT_(me_) Q_ASSERT_INCRIT(310, (me_)->eQueue.frontEvt != (QEvt *)0) |
|
#define | QACTIVE_EQUEUE_SIGNAL_(me_) |
|
#define | QXTHREAD_EQUEUE_SIGNAL_(me_) |
|
#define | QXK_PTR_CAST_(type_, ptr_) ((type_)(ptr_)) |
|
#define | QXTHREAD_CAST_(ptr_) ((QXThread *)(ptr_)) |
|
#define | QF_EPOOL_TYPE_ QMPool |
|
#define | QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) (QMPool_init(&(p_), (poolSto_), (poolSize_), (evtSize_))) |
|
#define | QF_EPOOL_EVENT_SIZE_(p_) ((uint_fast16_t)(p_).blockSize) |
|
#define | QF_EPOOL_GET_(p_, e_, m_, qs_id_) ((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qs_id_))) |
|
#define | QF_EPOOL_PUT_(p_, e_, qs_id_) (QMPool_put(&(p_), (e_), (qs_id_))) |
|
QXK/C (preemptive dual-mode kernel) platform-independent public interface.
- Traceability
-
Definition in file qxk.h.
◆ QXTHREAD_NO_TIMEOUT
No-timeout when blocking on semaphores, mutextes, and queues
Definition at line 66 of file qxk.h.
◆ QXTHREAD_START
#define QXTHREAD_START |
( |
|
me_, |
|
|
|
prioSpec_, |
|
|
|
qSto_, |
|
|
|
qLen_, |
|
|
|
stkSto_, |
|
|
|
stkSize_, |
|
|
|
par_ |
|
) |
| |
Value:
(stkSto_), (stkSize_), (par_))
#define QACTIVE_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_)
Start an extended thread
Starts execution of the thread and registers the AO with the framework.
- Parameters
-
[in,out] | me_ | current instance pointer (see oop) |
[in] | prioSpec_ | QF priority of the extended thread |
[in] | qSto_ | pointer to the storage for the ring buffer of the event queue (used only with the built-in QEQueue) |
[in] | qLen_ | length of the event queue (in events) |
[in] | stkSto_ | pointer to the stack storage (used only when per-AO stack is needed) |
[in] | stkSize_ | stack size (in bytes) |
[in] | par_ | pointer to the additional port-specific parameter(s) (might be NULL). |
- Traceability
-
- Usage
int main() {
BSP_init();
QActive_psInit(subscrSto,
Q_DIM(subscrSto));
QF_poolInit(smlPoolSto, sizeof(smlPoolSto), sizeof(smlPoolSto[0]));
Table_ctor();
n + 1U,
tableQueueSto,
tableStackSto,
sizeof(tableStackSto),
(void *)0);
. . .
Test_ctor();
10U,
testQueueSto,
testStackSto,
sizeof(testStackSto),
(void *)0);
}
QP/C interface including the backwards-compatibility layer.
#define QXTHREAD_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_)
Definition at line 273 of file qxk.h.
◆ QXTHREAD_POST_X
#define QXTHREAD_POST_X |
( |
|
me_, |
|
|
|
e_, |
|
|
|
margin_, |
|
|
|
sender_ |
|
) |
| QACTIVE_POST_X(&(me_)->super, (e_), (margin_), (sender_)) |
Asynchronous posting events to the event queue of an eXtended thread
This macro does not assert if the queue overflows and cannot accept the event with the specified margin of free slots remaining.
- Parameters
-
[in,out] | me_ | current instance pointer (see oop) |
[in] | e_ | pointer to the event to post |
[in] | margin_ | the minimum free slots in the queue, which must still be available after posting the event. The special value QF_NO_MARGIN causes asserting failure in case event allocation fails. |
[in] | sender_ | pointer to the sender object (used in QS tracing) |
- Returns
- 'true' if the posting succeeded, and 'false' if the posting failed due to insufficient margin of free slots available in the queue.
- Note
- The
sender_
parameter is actually only used when QS tracing is enabled (macro Q_SPY is defined). When QS software tracing is disabled, the QXTHREAD_POST_X() macro does not pass the sender_
parameter, so the overhead of passing this extra argument is entirely avoided.
-
The pointer to the sender object is not necessarily a pointer to an active object. In fact, if QXTHREAD_POST_X() is called from an interrupt or other context, you can create a unique object just to unambiguously identify the sender of the event.
- Traceability
-
- Usage
. . .
TableEvt *pe;
Q_NEW_X(pe, TableEvt, 5U, HUNGRY_SIG);
if (pe != (TableEvt *)0) {
pe->philNum = me->num;
}
. . .
#define Q_NEW_X(evtT_, margin_, sig_)
#define QXTHREAD_POST_X(me_, e_, margin_, sender_)
eXtended (blocking) thread of the QXK preemptive kernel
Definition at line 277 of file qxk.h.
◆ QF_SCHED_STAT_
◆ QF_SCHED_LOCK_
#define QF_SCHED_LOCK_ |
( |
|
ceil_ | ) |
|
Value: do { \
lockStat_ = 0xFFU; \
} else { \
lockStat_ = QXK_schedLock((ceil_)); \
} \
} while (false)
#define QXK_ISR_CONTEXT_()
Check if the code executes in the ISR context.
Definition at line 291 of file qxk.h.
◆ QF_SCHED_UNLOCK_
#define QF_SCHED_UNLOCK_ |
( |
| ) |
|
Value: do { \
if (lockStat_ != 0xFFU) { \
QXK_schedUnlock(lockStat_); \
} \
} while (false)
Definition at line 300 of file qxk.h.
◆ QACTIVE_EQUEUE_WAIT_
◆ QACTIVE_EQUEUE_SIGNAL_
#define QACTIVE_EQUEUE_SIGNAL_ |
( |
|
me_ | ) |
|
Value: do { \
QPSet_insert(&QXK_priv_.readySet, (uint_fast8_t)(me_)->prio); \
QPSet_update_(&QXK_priv_.readySet, &QXK_priv_.readySet_dis); \
if (QXK_sched_() != 0U) { \
QXK_activate_(); \
} \
} \
} while (false)
Definition at line 312 of file qxk.h.
◆ QXTHREAD_EQUEUE_SIGNAL_
#define QXTHREAD_EQUEUE_SIGNAL_ |
( |
|
me_ | ) |
|
Value: do { \
QPSet_insert(&QXK_priv_.readySet, (uint_fast8_t)me->prio); \
QPSet_update_(&QXK_priv_.readySet, &QXK_priv_.readySet_dis); \
(void)QXK_sched_(); \
} \
} \
} while (false)
#define QXTHREAD_CAST_(ptr_)
#define QXK_PTR_CAST_(type_, ptr_)
State object for the QMsm class (QM State Machine).
Definition at line 337 of file qxk.h.
◆ QXK_PTR_CAST_
#define QXK_PTR_CAST_ |
( |
|
type_, |
|
|
|
ptr_ |
|
) |
| ((type_)(ptr_)) |
Internal macro to encapsulate casting of pointers for MISRA deviations
This macro is specifically and exclusively used for casting pointers that are never de-referenced, but only used for internal bookkeeping and checking (via assertions) the correct operation of the QXK kernel. Such pointer casting is not compliant with MISRA-C:2023-Rule 11.3(R) as well as other messages (e.g., PC-Lint-Plus warning 826). Defining this specific macro for this purpose allows to selectively disable the warnings for this particular case.
- Traceability
-
Definition at line 363 of file qxk.h.
◆ QXTHREAD_CAST_
#define QXTHREAD_CAST_ |
( |
|
ptr_ | ) |
((QXThread *)(ptr_)) |
Internal macro to encapsulate casting of pointers for MISRA deviations
This macro is specifically and exclusively used for downcasting pointers to QActive to pointers to QXThread in situations when it is known that such downcasting is correct.However, such pointer casting is not compliant with MISRA-C:2023 Rule 11.3(R) as well as other messages (e.g., PC-Lint-Plus warning 826). Defining this specific macro for this purpose allows to selectively disable the warnings for this particular case.
- Traceability
-
Definition at line 366 of file qxk.h.
◆ QF_EPOOL_TYPE_
◆ QF_EPOOL_INIT_
#define QF_EPOOL_INIT_ |
( |
|
p_, |
|
|
|
poolSto_, |
|
|
|
poolSize_, |
|
|
|
evtSize_ |
|
) |
| (QMPool_init(&(p_), (poolSto_), (poolSize_), (evtSize_))) |
◆ QF_EPOOL_EVENT_SIZE_
#define QF_EPOOL_EVENT_SIZE_ |
( |
|
p_ | ) |
((uint_fast16_t)(p_).blockSize) |
◆ QF_EPOOL_GET_
#define QF_EPOOL_GET_ |
( |
|
p_, |
|
|
|
e_, |
|
|
|
m_, |
|
|
|
qs_id_ |
|
) |
| ((e_) = (QEvt *)QMPool_get(&(p_), (m_), (qs_id_))) |
◆ QF_EPOOL_PUT_
#define QF_EPOOL_PUT_ |
( |
|
p_, |
|
|
|
e_, |
|
|
|
qs_id_ |
|
) |
| (QMPool_put(&(p_), (e_), (qs_id_))) |
◆ QSchedStatus
Definition at line 60 of file qxk.h.
◆ QXK_TimeoutSigs
Enumerator |
---|
QXK_DELAY_SIG | |
QXK_TIMEOUT_SIG | |
Definition at line 390 of file qxk.h.