eXtended (blocking) thread of the QXK preemptive kernel More...
#include "qxk.h"
Public Member Functions | |
void | QXThread_ctor (QXThread *const me, QXThreadHandler const handler, uint_fast8_t const tickRate) |
bool | QXThread_delayCancel (QXThread *const me) |
![]() | |
void | QActive_subscribe (QActive const *const me, enum_t const sig) |
void | QActive_unsubscribe (QActive const *const me, enum_t const sig) |
void | QActive_unsubscribeAll (QActive const *const me) |
void | QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2) |
![]() | |
bool | QHsm_isIn (QHsm *const me, QStateHandler const state) |
QStateHandler | QHsm_childState (QHsm *const me, QStateHandler const parent) |
Static Public Member Functions | |
bool | QXThread_delay (uint_fast16_t const nTicks) |
QEvt const * | QXThread_queueGet (uint_fast16_t const nTicks) |
![]() | |
void | QActive_psInit (QSubscrList *const subscrSto, enum_t const maxSignal) |
![]() | |
static QStateHandler | QHsm_state (QHsm *const me) |
Public Attributes | |
QActive | super |
QTimeEvt | timeEvt |
![]() | |
QHsm | super |
Private Member Functions | |
void | QXThread_init_ (QHsm *const me, void const *const par, uint_fast8_t const qs_id) |
void | QXThread_dispatch_ (QHsm *const me, QEvt const *const e, uint_fast8_t const qs_id) |
void | QXThread_start_ (QActive *const me, QPrioSpec const prioSpec, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par) |
bool | QXThread_post_ (QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender) |
void | QXThread_postLIFO_ (QActive *const me, QEvt const *const e) |
void | QXThread_block_ (QXThread const *const me) |
void | QXThread_unblock_ (QXThread const *const me) |
void | QXThread_teArm_ (QXThread *const me, enum_t const sig, uint_fast16_t const nTicks) |
bool | QXThread_teDisarm_ (QXThread *const me) |
void | QXK_threadExit_ (void) |
Additional Inherited Members | |
![]() | |
void | QActive_ctor (QActive *const me, QStateHandler const initial) |
void | QActive_stop (QActive *const me) |
bool | QActive_defer (QActive const *const me, QEQueue *const eq, QEvt const *const e) |
bool | QActive_recall (QActive *const me, QEQueue *const eq) |
uint_fast16_t | QActive_flushDeferred (QActive const *const me, QEQueue *const eq) |
void | QActive_register_ (QActive *const me) |
void | QActive_unregister_ (QActive *const me) |
![]() | |
void | QHsm_ctor (QHsm *const me, QStateHandler const initial) |
QState | QHsm_top (QHsm const *const me, QEvt const *const e) |
void | QHsm_init_ (QHsm *const me, void const *const e, uint_fast8_t const qs_id) |
void | QHsm_dispatch_ (QHsm *const me, QEvt const *const e, uint_fast8_t const qs_id) |
QXThread represents the eXtended (blocking) thread of the QXK kernel. Each extended thread in the application must be represented by the corresponding QXThread instance
void QXThread_ctor | ( | QXThread *const | me, |
QXThreadHandler const | handler, | ||
uint_fast8_t const | tickRate | ||
) |
constructor of an extended-thread
Performs the first step of QXThread initialization by assigning the thread-handler function and the tick rate at which it will handle the timeouts.
[in,out] | me | current instance pointer (see oop) |
[in] | handler | the thread-handler function |
[in] | tickRate | the ticking rate for timeouts in this thread (see QXThread_delay() and QTIMEEVT_TICK_X()) |
|
static |
delay (block) the current extended thread for a specified # ticks
Blocking delay for the number of clock tick at the associated tick rate.
[in] | nTicks | number of clock ticks (at the associated rate) to wait for the event to arrive. |
qxk_xthr:800
qxk_xthr:801
Definition at line 104 of file qxk_xthr.c.
bool QXThread_delayCancel | ( | QXThread *const | me | ) |
cancel the delay
Cancel the blocking delay and cause return from the QXThread_delay() function.
Definition at line 138 of file qxk_xthr.c.
|
static |
obtain a message from the private message queue (block if no messages)
The QXThread_queueGet() operation allows the calling extended thread to receive QP events directly into its own built-in event queue from an ISR, basic thread (AO), or another extended thread.
If QXThread_queueGet() is called when no events are present in the thread's private event queue, the operation blocks the current extended thread until either an event is received, or a user-specified timeout expires.
[in] | nTicks | number of clock ticks (at the associated rate) to wait for the event to arrive. The value of QXTHREAD_NO_TIMEOUT indicates that no timeout will occur and the queue will block indefinitely. |
qxk_xthr:500
qxk_xthr:501
Definition at line 157 of file qxk_xthr.c.
|
private |
Overrides QHsm_init_()
Definition at line 238 of file qxk_xthr.c.
Overrides QHsm_dispatch_()
Definition at line 252 of file qxk_xthr.c.
|
private |
start QXThread private implementation
Starts execution of an extended thread and registers it with the framework. The extended thread becomes ready-to-run immediately and is scheduled if the QXK is already running.
[in,out] | me | current instance pointer (see oop) |
[in] | prio | QF-priority of the thread, but no preemption- threshold. See also QPrioSpec. |
[in] | qSto | pointer to the storage for the ring buffer of the event queue. This cold be NULL, if this extended thread does not use the built-in event queue. |
[in] | qLen | length of the event queue [in events], or zero if queue not used |
[in] | stkSto | pointer to the stack storage (must be provided) |
[in] | stkSize | stack size [in bytes] (must not be zero) |
[in] | par | pointer to an extra parameter (might be NULL). |
qxk_xthr:200
prio
must NOT provide preemption-threshold and this function will assert it in the precondition.Definition at line 266 of file qxk_xthr.c.
|
private |
post to the QXThread event queue private implementation
Direct event posting is the simplest asynchronous communication method available in QF. The following example illustrates how the Philo active object posts directly the HUNGRY event to the Table active object.
The parameter margin
specifies the minimum number of free slots in the queue that must be available for posting to succeed. The function returns 1 (success) if the posting succeeded (with the provided margin) and 0 (failure) when the posting fails.
[in,out] | me | current instance pointer (see oop) |
[in] | e | pointer to the event to be posted |
[in] | margin | number of required free slots in the queue after posting the event. The special value QF_NO_MARGIN means that this function will assert if posting fails. |
[in] | sender | pointer to a sender object (used only for QS tracing). |
margin
parameter is special and denotes situation when the post() operation is assumed to succeed (event delivery guarantee). An assertion fires, when the event cannot be delivered in this case.me
pointer here actually points to the QXThread subclass. Therefore the downcast (QXThread *)me is always correct. Definition at line 314 of file qxk_xthr.c.
post to the QXThread event queue (LIFO) private implementation
Last-In-First-Out (LIFO) policy is not supported for extened threads.
[in] | me | current instance pointer (see oop) |
[in] | e | pointer to the event to post to the queue |
Definition at line 457 of file qxk_xthr.c.
|
private |
block QXThread private implementation
Internal implementation of blocking the given extended thread.
qxk_xthr:600
Definition at line 469 of file qxk_xthr.c.
|
private |
unblock QXThread private implementation
Internal implementation of un-blocking the given extended thread.
Definition at line 478 of file qxk_xthr.c.
arm internal time event private implementation
Internal implementation of arming the private time event for a given timeout at a given system tick rate.
qxk_xthr:700
Definition at line 489 of file qxk_xthr.c.
|
private |
disarm internal time event private implementation
Internal implementation of disarming the private time event.
Definition at line 530 of file qxk_xthr.c.
|
private |
called when QXThread exits
Called when the extended-thread handler function returns.
qxk:900
qxk:901
QTimeEvt QXThread::timeEvt |