QP/C  8.0.3
Real-Time Event Framework
Loading...
Searching...
No Matches
QTicker Class Reference

"Ticker" Active Object class More...

#include "qp.h"

Inheritance diagram for QTicker:
QActive QAsm

Public Member Functions

void QTicker_ctor (QTicker *const me, uint_fast8_t const tickRate)
 Constructor of the QTicker Active Object class.
 
- Public Member Functions inherited from QActive
void QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2)
 
void QActive_start (QActive *const me, QPrioSpec const prioSpec, QEvtPtr *const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
 Starts execution of an active object and registers the object with the framework.
 

Protected Attributes

QActive super
 
- Protected Attributes inherited from QActive
QAsm super
 
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)
 
- Protected Attributes inherited from QAsm
struct QAsmVtable const * vptr
 Virtual pointer inherited by all QAsm subclasses (see also SAS_QP_OO)
 
union QAsmAttr state
 Current state (pointer to the current state-handler function)
 
union QAsmAttr temp
 Temporary storage for target/act-table etc.
 

Private Member Functions

void QTicker_init_ (QAsm *const me, void const *const par, uint_fast8_t const qsId)
 
void QTicker_dispatch_ (QAsm *const me, QEvt const *const e, uint_fast8_t const qsId)
 
void QTicker_trig_ (QActive *const me, void const *const sender)
 Asynchronously trigger the QTicker active object to perform tick processing.
 

Additional Inherited Members

- 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
 
uint_fast16_t QActive_getQueueMin (uint_fast8_t const prio)
 This function returns the minimum of free entries of the given event queue.
 
- 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
 
- Static Protected Member Functions inherited from QAsm
static void QAsm_ctor (QAsm *const me)
 Constructor of the QAsm base class.
 

Detailed Description

"Ticker" Active Object class

Details
QTicker is a QActive subclass specialized to process QF system clock tick at a specified tick rate. Placing system clock tick processing in an active object allows you to remove the non-deterministic QTIMEEVT_TICK_X() processing from the interrupt level and move it into the thread-level, where you can prioritize it as low as you wish.
Backward Traceability
Usage
The following example illustrates use of QTicker active objects.
Attention
The QTicker active objects must be started without any queue buffer and without any stack (see QActive_start() calls in the code below).
// bsp.h -----------------
// opaque pointers to the ticker active objects in the application
extern QActive * const the_Ticker0; // "ticker" pointer for clock rate 0
extern QActive * const the Ticker1; // "ticker" pointer for clock rate 1
// bsp.c -----------------
static QTicker l_ticker0; // "ticker" instance for clock rate 0
QActive * const the_Ticker0 = &l_ticker0.super;
static QTicker l_ticker1; // "ticker" instance for clock rate 1
QActive * const the_Ticker1 = &l_ticker1.super;
// clock tick ISR for tick rate 0
void SysTick_Handler(void) {
. . .
QTICKER_TRIG(the_Ticker0, &qs_tick0_id);
. . .
}
// clock tick ISR for tick rate 1
void Timer0A_IRQHandler(void) {
. . .
QTICKER_TRIG(the_Ticker1, &qs_tick1_id);
. . .
}
// main.c ---------------
main () {
. . .
QTicker_ctor(&l_ticker0, 0U); // active object for tick rate 0
QActive_start(the_Ticker0,
1U, // priority
0, 0, 0, 0, 0); // must be always 0 for ticker AO
QTicker_ctor(&l_ticker1, 1U); // active object for tick rate 1
QActive_start(the_Ticker1,
2U, // priority
0, 0, 0, 0, 0); // must be always 0 for ticker AO
. . .
}
#define QTICKER_TRIG(ticker_, sender_)
Asynchronously trigger the QTicker AO to perform tick processing.
Definition qp.h:813
Active object class (based on the QHsm implementation strategy)
Definition qp.h:504
void QActive_start(QActive *const me, QPrioSpec const prioSpec, QEvtPtr *const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
Starts execution of an active object and registers the object with the framework.
Definition qv.c:213
"Ticker" Active Object class
Definition qp.h:694
QActive super
Definition qp.h:695
void QTicker_ctor(QTicker *const me, uint_fast8_t const tickRate)
Constructor of the QTicker Active Object class.
Definition qf_actq.c:349

Definition at line 694 of file qp.h.

Member Function Documentation

◆ QTicker_ctor()

void QTicker_ctor ( QTicker *const me,
uint_fast8_t const tickRate )

Constructor of the QTicker Active Object class.

Backward Traceability
  • QTicker: "Ticker" Active Object class

Definition at line 349 of file qf_actq.c.

◆ QTicker_init_()

void QTicker_init_ ( QAsm *const me,
void const *const par,
uint_fast8_t const qsId )
private

Definition at line 370 of file qf_actq.c.

◆ QTicker_dispatch_()

void QTicker_dispatch_ ( QAsm *const me,
QEvt const *const e,
uint_fast8_t const qsId )
private

Definition at line 389 of file qf_actq.c.

◆ QTicker_trig_()

void QTicker_trig_ ( QActive *const me,
void const *const sender )
private

Asynchronously trigger the QTicker active object to perform tick processing.

Details
This function only triggers the given "ticker" AO. The actual clock-tick processing happens in the thread context of the "ticker" AO, running at the configured priority level.
Backward Traceability
  • QTicker: "Ticker" Active Object class

Definition at line 417 of file qf_actq.c.

Member Data Documentation

◆ super

QActive super
protected

Definition at line 695 of file qp.h.


The documentation for this class was generated from the following files: