QP/C 6.9.1
QXThread Struct Reference

eXtended (blocking) thread of the QXK preemptive kernel More...

#include <qxthread.h>

Inheritance diagram for QXThread:
Inheritance graph
Collaboration diagram for QXThread:
Collaboration graph

Data Fields

QActive super
 inherited QActive More...
 
QTimeEvt timeEvt
 time event to handle blocking timeouts More...
 
- Data Fields inherited from QActive
QHsm super
 inherits QHsm More...
 
uint8_t prio
 QF priority (1..QF_MAX_ACTIVE) of this active object. More...
 
- Data Fields inherited from QHsm
struct QHsmVtable const * vptr
 virtual pointer More...
 
union QHsmAttr state
 current active state (state-variable) More...
 
union QHsmAttr temp
 temporary: tran. More...
 

Additional Inherited Members

- Public Member Functions inherited from QActive
#define QACTIVE_START(me_, prio_, qSto_, qLen_, stkSto_, stkLen_, par_)
 Polymorphically start an active object. More...
 
#define QACTIVE_POST(me_, e_, sender_)
 Polymorphically posts an event to an active object (FIFO) with delivery guarantee. More...
 
#define QACTIVE_POST_X(me_, e_, margin_, sender_)
 Polymorphically posts an event to an active object (FIFO) without delivery guarantee. More...
 
#define QACTIVE_POST_LIFO(me_, e_)
 Polymorphically posts an event to an active object using the Last-In-First-Out (LIFO) policy. More...
 
- Public Member Functions inherited from QHsm
#define QHSM_INIT(me_, par_, qs_id_)
 Polymorphically executes the top-most initial transition in a HSM. More...
 
#define QHSM_DISPATCH(me_, e_, qs_id_)    ((*(me_)->vptr->dispatch)((me_), (e_), (qs_id_)))
 Polymorphically dispatches an event to a HSM. More...
 
#define QHsm_state(me_)   (Q_STATE_CAST(Q_HSM_UPCAST(me_)->state.fun))
 Obtain the current active state from a HSM (read only). More...
 
#define QHsm_childState(me_, parent_)    QHsm_childState_(Q_HSM_UPCAST(me_), Q_STATE_CAST(parent_))
 Obtain the current active child state of a given parent in QHsm. More...
 
bool QHsm_isIn (QHsm *const me, QStateHandler const state)
 Tests if a given state is part of the current active state configuration in QHsm subclasses. More...
 
- Protected Member Functions inherited from QActive
void QActive_ctor (QActive *const me, QStateHandler initial)
 protected "constructor" of an QActive active object More...
 
void QActive_stop (QActive *const me)
 Stops execution of an active object and removes it from the framework's supervision. More...
 
void QActive_subscribe (QActive const *const me, enum_t const sig)
 Subscribes for delivery of signal sig to the active object me. More...
 
void QActive_unsubscribe (QActive const *const me, enum_t const sig)
 Un-subscribes from the delivery of signal sig to the AO me. More...
 
void QActive_unsubscribeAll (QActive const *const me)
 Un-subscribes from the delivery of all signals to the AO me. More...
 
bool QActive_defer (QActive const *const me, QEQueue *const eq, QEvt const *const e)
 Defer an event e to a given event queue eq. More...
 
bool QActive_recall (QActive *const me, QEQueue *const eq)
 Recall a deferred event from a given event queue eq. More...
 
uint_fast16_t QActive_flushDeferred (QActive const *const me, QEQueue *const eq)
 Flush the specified deferred queue eq. More...
 
void QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2)
 Generic setting of additional attributes (useful in QP ports) More...
 
- Protected Member Functions inherited from QHsm
void QHsm_ctor (QHsm *const me, QStateHandler initial)
 Protected "constructor" of QHsm. More...
 
QState QHsm_top (void const *const me, QEvt const *const e)
 the top-state. More...
 

Detailed Description

eXtended (blocking) thread of the QXK preemptive kernel

Description
QXThread represents the eXtended (blocking) thread of the QXK preemptive kernel. Each extended thread in the application must be represented by the corresponding QXThread instance
Note
Typically, QXThread is instantiated directly in the application code. The customization of the thread occurs in the QXThread_ctor(), where you provide the thred-handler function as the parameter.
See also
Usage
The following example illustrates how to instantiate and use an extended thread in your application.
#include "qpc.h"
QXThread blinky; /* QXK extended-thread object */
uint32_t stack_blinky[80]; /* stack for the thread */
void main_blinky(QXThread * const me) { /* thread function */
while (1) {
uint32_t volatile i;
for (i = 1500U; i != 0U; --i) {
BSP_ledGreenOn();
BSP_ledGreenOff();
}
QXThread_delay(1U); /* block for 1 tick */
}
}
int main() {
. . .
/* initialize and start blinky thread */
QXThread_ctor(&blinky, &main_blinky, 0);
QXTHREAD_START(&blinky,
5U, /* priority */
(void *)0, 0, /* message queue (not used) */
stack_blinky, sizeof(stack_blinky), /* stack */
(void *)0); /* extra parameter (not used) */
. . .
return QF_run(); /* run the application */
}

Definition at line 73 of file qxthread.h.

Field Documentation

◆ super

QActive super

inherited QActive

Definition at line 74 of file qxthread.h.

◆ timeEvt

QTimeEvt timeEvt

time event to handle blocking timeouts

Definition at line 75 of file qxthread.h.


The documentation for this struct was generated from the following file:
qpc.h
QP/C public interface including backwards-compatibility layer.
Q_DEFINE_THIS_FILE
#define Q_DEFINE_THIS_FILE
Define the file name (with __FILE__) for assertions in this file.
Definition: qassert.h:104
QXThread_ctor
void QXThread_ctor(QXThread *const me, QXThreadHandler handler, uint_fast8_t tickRate)
constructor of an extended-thread
Definition: qxk_xthr.c:113
QXThread_delay
bool QXThread_delay(uint_fast16_t const nTicks)
delay (block) the current extended thread for a specified # ticks
Definition: qxk_xthr.c:644
QF_run
int_t QF_run(void)
Transfers control to QF to run the application.
Definition: qk.c:133
QXThread
eXtended (blocking) thread of the QXK preemptive kernel
Definition: qxthread.h:73
QXTHREAD_START
#define QXTHREAD_START(me_, prio_, qSto_, qLen_, stkSto_, stkSize_, par_)
Polymorphically start an extended thread.
Definition: qxthread.h:103
uint32_t
unsigned long int uint32_t
exact-width 32-bit unsigned int
Definition: 16bit/stdint.h:31