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_delay (QTimeEvtCtr const nTicks) |
bool | QXThread_delayCancel (QXThread *const me) |
Public Member Functions inherited from QActive | |
void | QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2) |
Static Public Member Functions | |
QEvt const * | QXThread_queueGet (QTimeEvtCtr const nTicks) |
Static Public Member Functions inherited from QActive | |
void | QActive_psInit (QSubscrList *const subscrSto, enum_t const maxSignal) |
Publish event to all subscribers of a given signal e->sig | |
Public Attributes | |
QActive | super |
Public Attributes inherited from QActive | |
QAsm | super |
Private Member Functions | |
void | QXThread_block_ (QXThread const *const me) |
void | QXThread_unblock_ (QXThread const *const me) |
void | QXThread_timeout_ (QActive *const act) |
void | QXThread_teArm_ (QXThread *const me, enum_t const sig, QTimeEvtCtr const nTicks) |
bool | QXThread_teDisarm_ (QXThread *const me) |
void | QXThread_stackInit_ (QActive *const me, QXThreadHandler const handler, void *const stkSto, uint_fast16_t const stkSize) |
Private Attributes | |
QTimeEvt | timeEvt |
QXThread const * | QXThread_dummy |
Additional Inherited Members | |
Protected Member Functions inherited from QActive | |
void | QActive_ctor (QActive *const me, QStateHandler const initial) |
QActive constructor (abstract base class) | |
void | QActive_stop (QActive *const me) |
Stops execution of an active object and removes it from the framework's supervision. | |
void | QActive_subscribe (QActive const *const me, enum_t const sig) |
Subscribes for delivery of signal sig to the active object. | |
void | QActive_unsubscribe (QActive const *const me, enum_t const sig) |
Unsubscribes from the delivery of signal sig to the active object. | |
void | QActive_unsubscribeAll (QActive const *const me) |
Unsubscribes from the delivery of all signals to the active object. | |
bool | QActive_defer (QActive const *const me, struct QEQueue *const eq, QEvt const *const e) |
Defer an event to a given separate event queue. | |
bool | QActive_recall (QActive *const me, struct QEQueue *const eq) |
Recall a deferred event from a given event queue. | |
uint_fast16_t | QActive_flushDeferred (QActive const *const me, struct QEQueue *const eq, uint_fast16_t const num) |
Flush the specified number of events from the deferred queue eq | |
Protected Member Functions inherited from QAsm | |
void | QAsm_ctor (QAsm *const me) |
Constructor of the QAsm base class. | |
QState | QHsm_top (QHsm const *const me, QEvt const *const e) |
Protected Attributes inherited from QActive | |
uint8_t | prio |
QF-priority [1..QF_MAX_ACTIVE] of this AO. | |
uint8_t | pthre |
Preemption-threshold [1..QF_MAX_ACTIVE] of this AO. | |
QACTIVE_THREAD_TYPE | thread |
Port-dependent representation of the thread of the active object. | |
QACTIVE_OS_OBJ_TYPE | osObject |
Port-dependent per-thread object. | |
QACTIVE_EQUEUE_TYPE | eQueue |
Port-dependent event-queue type (often QEQueue) | |
uint8_t | prio_dis |
uint8_t | pthre_dis |
Protected Attributes inherited from QAsm | |
struct QAsmVtable const * | vptr |
Virtual pointer inherited by all QAsm subclasses (see also Object Orientation) | |
union QAsmAttr | state |
Current state (pointer to the current state-handler function) | |
union QAsmAttr | temp |
Temporary storage for target/act-table etc. | |
eXtended (blocking) thread of the QXK preemptive kernel
QXThread represents the eXtended (blocking) thread of the QXK kernel. Each extended thread in the application must be represented by the corresponding QXThread instance
The following example illustrates how to instantiate and use an extended thread in your application.
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 tick rate for timeouts in this thread (see QXThread_delay() and QTIMEEVT_TICK_X()) |
The following example illustrates how to invoke QXThread_ctor() in the main() function
bool QXThread_delay | ( | QTimeEvtCtr const | nTicks | ) |
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 91 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 139 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 160 of file qxk_xthr.c.
|
private |
Block QXThread private implementation
Internal implementation of blocking the given extended thread.
qxk_xthr:600
Definition at line 258 of file qxk_xthr.c.
|
private |
Unblock QXThread private implementation
Internal implementation of un-blocking the given extended thread.
Definition at line 274 of file qxk_xthr.c.
|
private |
Process timeout in QXThread (either delay or during blocking)
[in,out] | act | generic QActive* pointer of the thread that times out. |
Definition at line 291 of file qxk_xthr.c.
|
private |
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 304 of file qxk_xthr.c.
|
private |
Disarm internal time event private implementation
Internal implementation of disarming the private time event.
Definition at line 348 of file qxk_xthr.c.
|
private |
Initialize the private stack of a given eXtended thread (defined in QXK port)
|
private |
|
private |