QP/C  6.0.0
qf_act.c File Reference

QActive services and ::QF support code More...

#include "qf_port.h"
#include "qf_pkg.h"
#include "qassert.h"
#include "qs_port.h"

Go to the source code of this file.

Macros

#define QF_PTR_INC_(p_)   (++(p_))
 

Functions

void QF_add_ (QActive *const a)
 Register an active object to be managed by the framework. More...
 
void QF_remove_ (QActive *const a)
 Remove the active object from the framework. More...
 
void QF_bzero (void *const start, uint_fast16_t len)
 Clear a specified region of memory to zero. More...
 
uint_fast8_t QF_LOG2 (uint32_t x)
 

Variables

QActiveQF_active_ [QF_MAX_ACTIVE+1]
 array of registered active objects More...
 
uint8_t const QF_log2Lkup [256]
 Lookup table for (log2(n) + 1), where n = 0..255. More...
 

Detailed Description

QActive services and ::QF support code

Definition in file qf_act.c.

Macro Definition Documentation

◆ QF_PTR_INC_

#define QF_PTR_INC_ (   p_)    (++(p_))
Description
macro to encapsulate pointer increment, which violates MISRA-C:2004 required rule 17.4 (pointer arithmetic used).
Parameters
[in,out]p_pointer to be incremented.

Definition at line 143 of file qf_act.c.

Function Documentation

◆ QF_add_()

void QF_add_ ( QActive *const  a)

Register an active object to be managed by the framework.

Description
This function removes a given active object from the active objects managed by the QF framework. It should not be called by the application directly, only through the function QActive_stop().
Parameters
[in]apointer to the active object to add to the framework.
Note
The priority of the active object a should be set before calling this function.
See also
QF_remove_()
Precondition
the priority of the active object must not be zero and cannot exceed the maximum QF_MAX_ACTIVE. Also, the priority of the active object must not be already in use. QF requires each active object to have a unique priority.

Definition at line 69 of file qf_act.c.

◆ QF_remove_()

void QF_remove_ ( QActive *const  a)

Remove the active object from the framework.

Description
This function removes a given active object from the active objects managed by the QF framework. It should not be called by the application directly, only through the function QActive_stop().
Parameters
[in]apointer to the active object to remove from the framework.
Note
The active object that is removed from the framework can no longer participate in the publish-subscribe event exchange.
See also
QF_add_()
Precondition
the priority of the active object must not be zero and cannot exceed the maximum QF_MAX_ACTIVE. Also, the priority of the active object must be already registered with the framework.

Definition at line 109 of file qf_act.c.

◆ QF_bzero()

void QF_bzero ( void *const  start,
uint_fast16_t  len 
)

Clear a specified region of memory to zero.

Description
Clears a memory buffer by writing zeros byte-by-byte.
Parameters
[in]startpointer to the beginning of a memory buffer.
[in]lenlength of the memory buffer to clear (in bytes)
Note
The main application of this function is clearing the internal QF variables upon startup. This is done to avoid problems with non-standard startup code provided with some compilers and toolsets (e.g., TI DSPs or Microchip MPLAB), which does not zero the uninitialized variables, as required by the ANSI C standard.

Definition at line 159 of file qf_act.c.

Variable Documentation

◆ QF_active_

QActive* QF_active_[QF_MAX_ACTIVE+1]

array of registered active objects

Note
Not to be used by Clients directly, only in ports of QF

Definition at line 53 of file qf_act.c.

◆ QF_log2Lkup

uint8_t const QF_log2Lkup[256]

Lookup table for (log2(n) + 1), where n = 0..255.

Description
This lookup delivers the 1-based number of the most significant 1-bit of a byte.

Definition at line 172 of file qf_act.c.