QF Active Object Framework (QF namespace emulated as a "class" in C). More...
Static Public Member Functions | |
| void | QF_init (void) |
| QF initialization. | |
| void | QF_stop (void) |
| Invoked by the application layer to stop the QF framework and return control to the OS/Kernel (used in some QF ports). | |
| int_t | QF_run (void) |
| Transfers control to QF to run the application. | |
| void | QF_onStartup (void) |
| Startup callback. | |
| void | QF_onCleanup (void) |
| Cleanup QF callback. | |
| void | QF_onContextSw (QActive *prev, QActive *next) |
| QF context switch callback used in built-in kernels (QV/QK/QXK). | |
| void | QF_poolInit (void *const poolSto, uint_fast32_t const poolSize, uint_fast16_t const evtSize) |
| Event pool initialization for dynamic allocation of events. | |
| uint16_t | QF_poolGetMaxBlockSize (void) |
| Obtain the block size of any registered event pools. | |
| uint16_t | QF_getPoolUse (uint_fast8_t const poolNum) |
| uint16_t | QF_getPoolFree (uint_fast8_t const poolNum) |
| uint16_t | QF_getPoolMin (uint_fast8_t const poolNum) |
| Obtain the minimum of free entries of the given event pool. | |
| void | QF_gc (QEvt const *const e) |
| Recycle a mutable (mutable) event. | |
| void | QF_gcFromISR (QEvt const *const e) |
| static void | QF_psInit (QSubscrList *const subscrSto, enum_t const maxSignal) |
Static Private Member Functions | |
| QEvt * | QF_newX_ (uint_fast16_t const evtSize, uint_fast16_t const margin, enum_t const sig) |
| Internal QF implementation of creating new mutable (dynamic) event. | |
| QEvt const * | QF_newRef_ (QEvt const *const e, void const *const evtRef) |
| Internal QF implementation of creating new event reference. | |
| void | QF_deleteRef_ (void const *const evtRef) |
| Internal QF implementation of deleting event reference. | |
Static Private Attributes | |
| QF_Attr | QF_priv_ |
|
static |
QF initialization.
Details
Initializes QF and must be called exactly once before any other QF function. Typically, QF_init() is called from main() even before initializing the Board Support Package (BSP).
Backward Traceability
Forward Traceability
|
static |
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 stop the application gracefully. This graceful shutdown might take some time to complete. The typical use of this function is for terminating the QF application to return to the operating system or for handling fatal errors that require shutting down (and possibly resetting) the system.
Backward Traceability
Forward Traceability
|
static |
Transfers control to QF to run the application.
Details
QF_run() is typically called from your startup code after you initialize the QF and start at least one active object with QActive_start().
Backward Traceability
Forward Traceability
|
static |
Startup 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.
Backward Traceability
Forward Traceability
|
static |
Cleanup QF callback.
Details
QF_onCleanup() is called in some QF ports before QF returns to the underlying real-time kernel or operating system.
This function is strongly platform-specific and is not implemented in the QF, but either in the QF port or in the Board Support Package (BSP) for the given application. Some QF ports might not require implementing QF_onCleanup() at all, because many embedded applications don't have anything to exit to.
Backward Traceability
Forward Traceability
QF context switch callback used in built-in kernels (QV/QK/QXK).
Details
This callback function provides a mechanism to perform additional custom operations when one of the built-in kernels switches context from one thread to another.
| [in] | prev | pointer to the previous thread (active object) (prev==0 means that prev was the idle loop) |
| [in] | next | pointer to the next thread (active object) (next==0) means that next is the idle loop) |
Usage
This callback is enabled by defining the macro QF_ON_CONTEXT_SW.
Backward Traceability
Forward Traceability
|
static |
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.
| [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.
Backward Traceability
Forward Traceability
|
static |
|
static |
|
static |
|
static |
Obtain the minimum of free entries of the given event pool.
Details
This function obtains the minimum number of free blocks in the given event pool since a call to QF_poolInit() has initialized this pool.
| [in] | poolNum | event pool ID in the range 1..max_pool, where max_pool is the number of event pools initialized with the function QF_poolInit(). |
Backward Traceability
Forward Traceability
|
staticprivate |
Internal QF implementation of creating new mutable (dynamic) event.
Details
Allocates an event dynamically from one of the QF event pools.
| [in] | evtSize | the size (in bytes) of the event to allocate |
| [in] | margin | the number of unallocated events still available in a given event pool after the allocation completes. The special value QF_NO_MARGIN means that this function will assert if allocation fails. |
| [in] | sig | the signal to be assigned to the allocated event |
Backward Traceability
Forward Traceability
|
static |
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 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_). It 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 initially allocated.
| [in] | e | pointer to the event to recycle |
Backward Traceability
Forward Traceability
Internal QF implementation of creating new event reference.
Details
Creates and returns a new reference to the current event e
| [in] | e | pointer to the current event |
| [in] | evtRef | the event reference |
Backward Traceability
Forward Traceability
|
staticprivate |
Internal QF implementation of deleting event reference.
Details
Deletes an existing reference to the event e
| [in] | evtRef | the event reference |
Backward Traceability
Forward Traceability
|
static |
|
inlinestatic |