QP/C++  7.4.0-rc.1
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QP::QTicker Class Reference

"Ticker" Active Object class More...

#include "qp.hpp"

Inheritance diagram for QP::QTicker:
QP::QActive QP::QAsm

Public Member Functions

 QTicker (std::uint_fast8_t const tickRate) noexcept
 
void init (void const *const e, std::uint_fast8_t const qsId) override
 
void init (std::uint_fast8_t const qsId) override
 
void dispatch (QEvt const *const e, std::uint_fast8_t const qsId) override
 
void trig_ (void const *const sender) noexcept
 
- Public Member Functions inherited from QP::QActive
bool isIn (QStateHandler const state) noexcept override
 
QStateHandler childState (QStateHandler const parent) noexcept
 
void setAttr (std::uint32_t attr1, void const *attr2=nullptr)
 
void start (QPrioSpec const prioSpec, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize, void const *const par)
 
void start (QPrioSpec const prioSpec, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize)
 
void stop ()
 
void register_ () noexcept
 
void unregister_ () noexcept
 
bool post_ (QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept
 
void postLIFO (QEvt const *const e) noexcept
 
QEvt const * get_ () noexcept
 
void subscribe (enum_t const sig) const noexcept
 
void unsubscribe (enum_t const sig) const noexcept
 
void unsubscribeAll () const noexcept
 
bool defer (QEQueue *const eq, QEvt const *const e) const noexcept
 
bool recall (QEQueue *const eq) noexcept
 
std::uint_fast16_t flushDeferred (QEQueue *const eq, std::uint_fast16_t const num=0xFFFFU) const noexcept
 
std::uint_fast8_t getPrio () const noexcept
 
void setPrio (QPrioSpec const prio) noexcept
 
std::uint_fast8_t getPThre () const noexcept
 
QACTIVE_EQUEUE_TYPE const & getEQueue () const noexcept
 
QACTIVE_OS_OBJ_TYPE const & getOsObject () const noexcept
 
QACTIVE_THREAD_TYPE const & getThread () const noexcept
 
void setThread (QACTIVE_THREAD_TYPE const &thr)
 
virtual bool postFromISR (QEvt const *const e, std::uint_fast16_t const margin, void *par, void const *const sender) noexcept
 
- Public Member Functions inherited from QP::QAsm
virtual ~QAsm () noexcept
 
QStateHandler state () const noexcept
 
QMState const * stateObj () const noexcept
 
virtual QStateHandler getStateHandler () noexcept
 

Additional Inherited Members

- Public Types inherited from QP::QAsm
enum  QStateRet : QState {
  Q_RET_SUPER , Q_RET_SUPER_SUB , Q_RET_UNHANDLED , Q_RET_HANDLED ,
  Q_RET_IGNORED , Q_RET_ENTRY , Q_RET_EXIT , Q_RET_NULL ,
  Q_RET_TRAN , Q_RET_TRAN_INIT , Q_RET_TRAN_EP , Q_RET_TRAN_HIST ,
  Q_RET_TRAN_XP
}
 
enum  ReservedSig : QSignal { Q_EMPTY_SIG , Q_ENTRY_SIG , Q_EXIT_SIG , Q_INIT_SIG }
 Reserved signals by the QP-framework. More...
 
- Static Public Member Functions inherited from QP::QActive
static std::uint_fast16_t getQueueMin (std::uint_fast8_t const prio) noexcept
 
static void psInit (QSubscrList *const subscrSto, enum_t const maxSignal) noexcept
 
static void publish_ (QEvt const *const e, void const *const sender, std::uint_fast8_t const qsId) noexcept
 
static void evtLoop_ (QActive *act)
 
static void publishFromISR (QEvt const *e, void *par, void const *sender) noexcept
 
- Static Public Member Functions inherited from QP::QAsm
static QState top (void *const me, QEvt const *const e) noexcept
 
- Public Attributes inherited from QP::QActive
std::uint8_t m_prio_dis
 
std::uint8_t m_pthre_dis
 
- Static Public Attributes inherited from QP::QActive
static QActiveregistry_ [QF_MAX_ACTIVE+1U]
 
static QSubscrListsubscrList_
 
static enum_t maxPubSignal_
 
- Protected Member Functions inherited from QP::QActive
 QActive (QStateHandler const initial) noexcept
 
- Protected Member Functions inherited from QP::QAsm
 QAsm () noexcept
 
QState tran (QStateHandler const target) noexcept
 
QState tran_hist (QStateHandler const hist) noexcept
 
QState super (QStateHandler const superstate) noexcept
 
QState qm_tran (void const *const tatbl) noexcept
 
QState qm_tran_init (void const *const tatbl) noexcept
 
QState qm_tran_hist (QMState const *const hist, void const *const tatbl) noexcept
 
QState qm_tran_ep (void const *const tatbl) noexcept
 
QState qm_tran_xp (QActionHandler const xp, void const *const tatbl) noexcept
 
QState qm_entry (QMState const *const s) noexcept
 
QState qm_exit (QMState const *const s) noexcept
 
QState qm_sm_exit (QMState const *const s) noexcept
 
QState qm_super_sub (QMState const *const s) noexcept
 
- Protected Attributes inherited from QP::QActive
std::uint8_t m_prio
 
std::uint8_t m_pthre
 
QACTIVE_THREAD_TYPE m_thread
 
QACTIVE_OS_OBJ_TYPE m_osObject
 
QACTIVE_EQUEUE_TYPE m_eQueue
 
- Protected Attributes inherited from QP::QAsm
QAsmAttr m_state
 
QAsmAttr m_temp
 

Detailed Description

"Ticker" Active Object class

Description
QTicker is an efficient active object specialized to process QF system clock tick at a specified tick rate [0..QF_MAX_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.
Usage
The following example illustrates use of QTicker active objects:
// bsp.hpp -----------------
extern QP::QActive * const AO_Ticker0; // "ticker" pointer for clock rate 0
extern QP::QActive * const AO Ticker1; // "ticker" pointer for clock rate 1
// bsp.cpp -----------------
static QP::QTicker l_ticker0; // "ticker" instance for clock rate 0
QP::QActive * const AO_Ticker0 = &l_ticker0;
static QTicker l_ticker1; // "ticker" instance for clock rate 1
QP::QActive * const AO_Ticker1 = &l_ticker1;
// clock tick ISR for tick rate 0
void SysTick_Handler(void) {
. . .
AO_Ticker0->TRIG(&qs_tick0_id);
. . .
}
// clock tick ISR for tick rate 1
void Timer0A_IRQHandler(void) {
. . .
AO_Ticker1->TRIG(&qs_tick1_id);
. . .
}
// main.cpp ---------------
main () {
. . .
AO_Ticker0->start(
1U, // priority
0, 0, 0, 0, 0); // not used
AO_Ticker1->start(
2U, // priority
0, 0, 0, 0, 0); // not used
. . .
}
Active object class (based on the QHsm implementation strategy)
Definition qp.hpp:722
void start(QPrioSpec const prioSpec, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize, void const *const par)
Definition qk.cpp:449
"Ticker" Active Object class
Definition qp.hpp:1023

Definition at line 1023 of file qp.hpp.

Constructor & Destructor Documentation

◆ QTicker()

QP::QTicker::QTicker ( std::uint_fast8_t const tickRate)
explicitnoexcept

Constructor of the QTicker Active Object class

Definition at line 389 of file qf_actq.cpp.

Member Function Documentation

◆ init() [1/2]

void QP::QTicker::init ( void const *const e,
std::uint_fast8_t const qsId )
overridevirtual

Virtual function to take the top-most initial transition in the state machine.

Description
Synchronously executes the top-most initial transition in a state machine (must be overridden in the subclasses).
Parameters
[in]epointer to an initialization parameter (might be nullptr)
[in]qsIdQS-id of this state machine (for QS local filter)
Precondition qep_asm:200
  • the virtual pointer must be initialized,
  • the top-most initial transition must be initialized,
  • the initial transition must not be taken yet.

Reimplemented from QP::QActive.

Definition at line 397 of file qf_actq.cpp.

◆ init() [2/2]

void QP::QTicker::init ( std::uint_fast8_t const qsId)
inlineoverridevirtual

Virtual function to take the top-most initial transition in the state machine (overloaded).

Description
Synchronously executes the top-most initial transition in a state machine. This overloaded version takes no initialization parameter.
Parameters
[in]qsIdQS-id of this state machine (for QS local filter)

Reimplemented from QP::QActive.

Definition at line 1029 of file qp.hpp.

◆ dispatch()

void QP::QTicker::dispatch ( QEvt const *const e,
std::uint_fast8_t const qsId )
overridevirtual

Virtual function to dispatch an event to the state machine.

Description
Synchronously dispatches an event for processing to a state machine (must be overridden in the subclasses). The processing of an event represents one run-to-completion (RTC) step.
Parameters
[in]epointer to the event to be dispatched to the MSM
[in]qsIdQS-id of this state machine (for QS local filter)
Precondition qep_asm:302
  • current state must be initialized
  • check the internal integrity (Software Self-Monitoring (SSM))

Reimplemented from QP::QActive.

Definition at line 415 of file qf_actq.cpp.

◆ trig_()

void QP::QTicker::trig_ ( void const *const sender)
noexcept

Asynchronously trigger the QTicker active object to perform tick processing.

Description
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.

Definition at line 439 of file qf_actq.cpp.


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