RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rkhrdy.h File Reference

Native priority management. More...

#include "rkhcfg.h"
#include "rkhtype.h"

Go to the source code of this file.

Data Structures

struct  RKH_RG_T
 SMA ready table. More...
 

Macros

#define RKH_RDY_IS_EMPTY(rg)   ((rg).grp == 0)
 This macro evaluates to true if all SMAs are not ready to run. More...
 
#define RKH_RDY_ISNOT_EMPTY(rg)   ((rg).grp != 0)
 This macro evaluates to true if any SMA is ready to run. More...
 
#define RKH_RDY_INSERT(rg, p)
 Making a SMA ready-to-run inserting it into the ready list. More...
 
#define RKH_RDY_REM(rg, p)
 Removing a SMA from the ready list. More...
 
#define RKH_RDY_FIND_HIGHEST(rg, p)
 Finding the highest priority SMA ready to run. More...
 

Detailed Description

Native priority management.

Definition in file rkhrdy.h.

Macro Definition Documentation

#define RKH_RDY_IS_EMPTY (   rg)    ((rg).grp == 0)

This macro evaluates to true if all SMAs are not ready to run.

Parameters
[in]rgready group.

Definition at line 69 of file rkhrdy.h.

#define RKH_RDY_ISNOT_EMPTY (   rg)    ((rg).grp != 0)

This macro evaluates to true if any SMA is ready to run.

Parameters
[in]rgready group.

Definition at line 78 of file rkhrdy.h.

#define RKH_RDY_INSERT (   rg,
 
)
Value:
(rg).grp |= rkh_maptbl[(p) >> 3]; \
(rg).tbl[(p) >> 3] |= rkh_maptbl[(p) & 0x07]
RKHROM rui8_t rkh_maptbl[8]
rkh_maptbl[] is a table in ROM, used to equate an index from 0 to 7 to a bit mask.

Making a SMA ready-to-run inserting it into the ready list.

The lower 3 bits of the SMA's priority are used to determine the bit position in rkhrg.tbl[], while the next three most significant bits are used to determine the index into rkhrg.tbl[]. Note that rkh_maptbl[] is a table in ROM, used to equate an index from 0 to 7 to a bit mask.

Parameters
[in]rgready group.
[in]pnumber of SMA's priotity.

Definition at line 93 of file rkhrdy.h.

#define RKH_RDY_REM (   rg,
 
)
Value:
if (((rg).tbl[(p) >> 3] &= ~rkh_maptbl[(p) & 0x07]) == 0) \
(rg).grp &= ~rkh_maptbl[(p) >> 3]
RKHROM rui8_t rkh_maptbl[8]
rkh_maptbl[] is a table in ROM, used to equate an index from 0 to 7 to a bit mask.

Removing a SMA from the ready list.

Clears the ready bit of the SMA in rkhrg.tbl[] and clears the bit in rkhrg.grp only if all SMAs in a group are not ready to run, i.e. all bits in rkhrg.tbl[prio >> 3] are 0.

Parameters
[in]rgready group.
[in]pnumber of SMA's priotity.

Definition at line 108 of file rkhrdy.h.

#define RKH_RDY_FIND_HIGHEST (   rg,
 
)
Value:
(p) = rkh_unmaptbl[(rg).grp]; \
(p) = (rui8_t)(((p) << 3) + \
(rui8_t)rkh_unmaptbl[(rg).tbl[(p)]])
RKHROM rui8_t rkh_unmaptbl[256]
rkh_unmaptbl[] is a table in ROM, used to return the bit position of the highest priority bit set - a...

Finding the highest priority SMA ready to run.

Another table lookup is performed, rather than scanning through the table starting with rkhrg.tbl[0] to find the highest priority task ready to run. rkh_unmaptbl[256] is a priority resolution table. Eight bits are used to represent when tasks are ready in a group. The least significant bit has the highest priority. Using this byte to index the table returns the bit position of the highest priority bit set, a number between 0 and 7.

Parameters
[in]rgready group.
[in]pthe found highest priority is assigned to p.

Definition at line 126 of file rkhrdy.h.