QK-nano preemptive kernel implementation.
More...
#include "qpn_conf.h"
#include "qfn_port.h"
#include "qassert.h"
Go to the source code of this file.
◆ initialize()
static void initialize |
( |
void |
| ) |
|
|
static |
- Description
- Helper function to set the priorities of all the statically allocated active objects in the system followed by executing the top-most initial transtions in all active objects.
- Note
- The system initialization is specifically encapsulated in a function to reduce stack use, because the temporary stack variables needed for the initialization go out of scope for the rest of system execution.
- Precondition
- the number of active objects must be initialized by calling: QF_init(Q_DIM(QF_active));
Definition at line 69 of file qkn.c.
◆ QF_run()
- Description
- QF_run() is typically called from your startup code after you initialize the QF and start at least one active object with QActive_start(). This implementation of QF_run() is for the preemptive QK-nano kernel.
- Returns
- In QK-nano QF_run() does not return.
Definition at line 121 of file qkn.c.
◆ QK_schedLock()
- Description
- This function locks the QK scheduler to the specified ceiling.
- Parameters
-
[in] | ceiling | priority ceiling to which the QK scheduler needs to be locked |
- Returns
- The previous QK Scheduler lock status, which is to be used to unlock the scheduler by restoring its previous lock status in QK_schedUnlock().
- Note
- QK_schedLock() must be always followed by the corresponding QK_schedUnlock().
- See also
- QK_schedUnlock()
- Usage
- The following example shows how to lock and unlock the QK scheduler:
uint32_t BSP_random(void) {
uint32_t rnd;
rnd = l_rnd * (3U*7U*11U*13U*23U);
l_rnd = rnd;
return (rnd >> 8);
}
uint_fast16_t QSchedStatus
QSchedStatus QK_schedLock(uint_fast8_t ceiling)
void QK_schedUnlock(QSchedStatus stat)
Definition at line 161 of file qkn.c.
◆ QK_schedUnlock()
- Description
- This function unlocks the QK scheduler to the previous status.
- Parameters
-
[in] | stat | previous QK Scheduler lock status returned from QK_schedLock() |
- Note
- QK_schedUnlock() must always follow the corresponding QK_schedLock().
- See also
- QK_schedLock()
- Usage
- The following example shows how to lock and unlock the QK scheduler:
uint32_t BSP_random(void) {
uint32_t rnd;
rnd = l_rnd * (3U*7U*11U*13U*23U);
l_rnd = rnd;
return (rnd >> 8);
}
- Precondition
- The current lock priority must be greater than the previous
Definition at line 200 of file qkn.c.
◆ QK_sched_()
uint_fast8_t QK_sched_ |
( |
void |
| ) |
|
- Description
- The QK-nano scheduler finds out the priority of the highest-priority AO that (1) has events to process and (2) has priority that is above the current priority.
- Returns
- the 1-based priority of the the active object, or zero if no eligible active object is ready to run.
- Attention
- QK_sched_() must be always called with interrupts disabled and returns with interrupts disabled.
Definition at line 247 of file qkn.c.
◆ QK_activate_()
void QK_activate_ |
( |
void |
| ) |
|
- Description
- QK_activate_() activates ready-to run AOs that are above the initial active priority (QK_attr_.actPrio).
- Note
- The activator might enable interrupts internally, but always returns with interrupts disabled.
Definition at line 291 of file qkn.c.
◆ QK_attr_
global attributes of the QK kernel
Definition at line 52 of file qkn.c.