|
| void | init () |
| | QF initialization.
|
| void | stop () |
| | Invoked by the application layer to stop the QF framework and return control to the OS/Kernel (used in some QF ports).
|
| int_t | run () |
| | Transfers control to QF to run the application.
|
| void | onStartup () |
| | Startup QF callback.
|
| void | onCleanup () |
| | Cleanup QF callback.
|
| void | psInit (QSubscrList *const subscrSto, QSignal const maxSignal) noexcept |
| void | publish_ (QEvt const *const e, void const *const sender, std::uint_fast8_t const qsId) noexcept |
| static std::uint_fast16_t | getQueueMin (std::uint_fast8_t const prio) noexcept |
| | This function returns the minimum of free entries of the given event queue.
|
| void | tick (std::uint_fast8_t const tickRate, void const *const sender) noexcept |
| void | poolInit (void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const evtSize) noexcept |
| | Event pool initialization for dynamic allocation of events.
|
| std::uint16_t | poolGetMaxBlockSize () noexcept |
| | Obtain the block size of any registered event pools.
|
| std::uint16_t | getPoolUse (std::uint_fast8_t const poolNum) noexcept |
| std::uint16_t | getPoolFree (std::uint_fast8_t const poolNum) noexcept |
| std::uint16_t | getPoolMin (std::uint_fast8_t const poolNum) noexcept |
| | Obtain the minimum of free entries of the given event pool.
|
| QEvt * | newX_ (std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, QSignal const sig) noexcept |
| void | gc (QEvt const *const e) noexcept |
| | Recycle a mutable (mutable) event.
|
| QEvt const * | newRef_ (QEvt const *const e, QEvt const *const evtRef) noexcept |
| void | deleteRef_ (QEvt const *const evtRef) noexcept |
| template<class evtT_, typename... Args> |
| evtT_ * | q_new (QSignal const sig, Args... args) |
| template<class evtT_, typename... Args> |
| evtT_ * | q_new_x (std::uint_fast16_t const margin, QSignal const sig, Args... args) |
| template<class evtT_> |
| void | q_new_ref (QP::QEvt const *const e, evtT_ const *&evtRef) |
| | Create a new reference of the current event e.
|
| template<class evtT_> |
| void | q_delete_ref (evtT_ const *&evtRef) |
| | Delete a new reference of the current event e.
|
| QEvt * | newXfromISR_ (std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, QSignal const sig) noexcept |
| void | gcFromISR (QEvt const *e) noexcept |
| QCritStatus | critEntry (void) |
| void | critExit (QCritStatus critStat) |
| QSchedStatus | schedLock (uint_fast8_t const ceiling) |
| void | schedUnlock (QSchedStatus const prevCeil) |
QF Active Object Framework namespace.
Invoked by the application layer to stop the QF framework and return control to the OS/Kernel (used in some QF ports).
Details
This function stops the QF application. After calling this function, QF attempts to gracefully stop the application. This graceful shutdown might take some time to complete. The typical use of this function is for terminating the QF application to return back to the operating system or for handling fatal errors that require shutting down (and possibly re-setting) the system.
- Attention
- After calling QF_stop() the application must terminate and cannot continue. In particular, QF_stop() is not intended to be followed by a call to QF_init() to "resurrect" the application.
Definition at line 103 of file qv.cpp.
| void QP::QF::onStartup |
( |
| ) |
|
Startup QF callback.
Details
The purpose of the QF_onStartup() callback is to configure and enable hardware interrupts. The callback is invoked from QF_run(), right before starting the underlying real-time kernel. By that time, the application is considered ready to receive and service interrupts.
This function is application-specific and is not implemented in QF, but rather in the Board Support Package (BSP) for the given application.
| void QP::QF::poolInit |
( |
void *const | poolSto, |
|
|
std::uint_fast32_t const | poolSize, |
|
|
std::uint_fast16_t const | evtSize ) |
|
noexcept |
Event pool initialization for dynamic allocation of events.
Details
This function initializes one event pool at a time and must be called exactly once for each event pool before the pool can be used.
- Parameters
-
| [in] | poolSto | pointer to the storage for the event pool |
| [in] | poolSize | size of the storage for the pool in bytes |
| [in] | evtSize | the block-size of the pool in bytes, which determines the maximum size of events that can be allocated from the pool. |
You might initialize many event pools by making many consecutive calls to the QF_poolInit() function. However, for the simplicity of the internal implementation, you must initialize event pools in the ascending order of the event size.
- Note
- The actual number of events available in the pool might be actually less than (poolSize / evtSize) due to the internal alignment of the blocks that the pool might perform. You can always check the capacity of the pool by calling QF_getPoolMin().
-
The dynamic allocation of events is optional, meaning that you might choose not to use mutable events. In that case calling QF_poolInit() and using up memory for the memory blocks is unnecessary.
Definition at line 51 of file qf_dyn.cpp.
| void QP::QF::gc |
( |
QEvt const *const | e | ) |
|
|
noexcept |
Recycle a mutable (mutable) event.
Details
This function implements a simple garbage collector for the mutable events. Only mutable events are candidates for recycling. (A mutable event is one that is allocated from an event-pool, which is determined as non-zero QEvt_getPoolId_(e)) Next, the function decrements the reference counter of the event (e->refCtr_), and recycles the event only if the counter drops to zero (meaning that no more references are outstanding for this event). The mutable event is recycled by returning it to the pool from which it was originally allocated.
- Parameters
-
| [in] | e | pointer to the event to recycle |
- Note
- QF invokes the garbage collector at all appropriate contexts, when an event can become garbage (automatic garbage collection), so the application code should have no need to call QF_gc() directly. The QF_gc() function is exposed only for special cases when your application sends mutable events to the "raw" thread-safe queues (see ::QEQueue). Such queues are processed outside of QF and the automatic garbage collection is NOT performed for these events. In this case you need to call QF_gc() explicitly.
Definition at line 276 of file qf_dyn.cpp.
template<class evtT_>
| void QP::QF::q_new_ref |
( |
QP::QEvt const *const | e, |
|
|
evtT_ const *& | evtRef ) |
|
inline |
Create a new reference of the current event e.
Details
The current event processed by an Active Object is available only for the duration of the run-to-completion (RTC) step. After that step, the current event is no longer available and the framework might recycle (garbage-collect) the event. The function template QP::QF::q_new_ref() explicitly creates a new reference to the current event that can be stored and used beyond the current RTC step, until the reference is explicitly recycled by means of the function template QP::QF::q_delete_ref().
- See also
- Q_NEW_REF()
- Template Parameters
-
| evtT_ | event class (class name) of the event to allocate |
- Parameters
-
| [in] | e | event to create a reference to |
| [in,out] | evtRef | reference object (of the type evtT_* |
This function template does not return a value, but it modifies the evtRef parameter.
Usage
The example examples/posix-win32/defer illustrates the use of QP::QF::q_new_ref()
Definition at line 858 of file qp.hpp.
template<class evtT_>
| void QP::QF::q_delete_ref |
( |
evtT_ const *& | evtRef | ) |
|
|
inline |
Delete a new reference of the current event e.
Details
Every event reference created with the function template QP::QF::q_new_ref() needs to be eventually deleted by means of the function template QP::QF::q_delete_ref() to avoid leaking the event.
- See also
- Q_DELETE_REF()
- Template Parameters
-
| evtT_ | event class (class name) of the event to allocate |
- Parameters
-
| [in,out] | evtRef | event reference to delete |
This function template does not return a value, but it modifies the evtRef parameter.
Usage
The example examples/posix-win32/defer illustrates the use of QP::QF::q_delete_ref()
Definition at line 867 of file qp.hpp.