RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
RKH_RG_T Struct Reference

SMA ready table. More...

#include <rkhrdy.h>

Data Fields

rui8_t grp
 Each bit in rkhrg.grp is used to indicate whenever any SMA in a group is ready to run.
 
unsigned char tbl [RKH_NUM_RDYGRP]
 When a task is ready to run it also sets its corresponding bit in the ready table, rkhrg.tbl[].
 

Detailed Description

SMA ready table.

Each SMA is assigned a unique priority level between 0 and RKH_LOWEST_PRIO. Each SMA that is ready to run is placed in a ready list consisting of two variables, rkhrg.grp and rkhrg.tbl[]. SMA priorities are grouped (8 SMA per group) in rkhrg.grp. Each bit in rkhrg.grp is used to indicate whenever any SMA in a group is ready to run. When a task is ready to run it also sets its corresponding bit in the ready table, rkhrg.tbl[]. The size of rkhrg.tbl[] depends on RKH_LOWEST_PRIO (see rkhcfg.h).

SMA's priority = | 0 | 0 | Y | Y | Y | X | X | X |

Y's: bit position in rkhrg.grp and index into rkhrg.tbl[RKH_LOWEST_PRIO / 8 + 1]
X's: bit position in rkhrg.tbl[RKH_LOWEST_PRIO / 8 + 1]

The lower 3 bits (X's) of the SMA's priority are used to determine the bit position in rkhrg.tbl[], while the next three most significant bits (Y's) 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.

To determine which priority (and thus which SMA) will run next, the scheduler determines the lowest priority number that has its bit set in rkhrg.tbl[]. The relationship between rkhrg.grp and rkhrg.tbl[] is given by the following rules:

Bit 0 in rkhrg.grp is 1 when any bit in rkhrg.tbl[0] is 1.
Bit 1 in rkhrg.grp is 1 when any bit in rkhrg.tbl[1] is 1.
Bit 2 in rkhrg.grp is 1 when any bit in rkhrg.tbl[2] is 1.
Bit 3 in rkhrg.grp is 1 when any bit in rkhrg.tbl[3] is 1.
Bit 4 in rkhrg.grp is 1 when any bit in rkhrg.tbl[4] is 1.
Bit 5 in rkhrg.grp is 1 when any bit in rkhrg.tbl[5] is 1.
Bit 6 in rkhrg.grp is 1 when any bit in rkhrg.tbl[6] is 1.
Bit 7 in rkhrg.grp is 1 when any bit in rkhrg.tbl[7] is 1.

[JL]

Definition at line 193 of file rkhrdy.h.


The documentation for this struct was generated from the following file: