![]() |
MCCI Trusted Bootloader
Simple trusted bootloader and tools for small embedded systems
|
Go to the source code of this file.
Macros | |
| #define | _mcci_bootloader_bits_h_ /* prevent multiple includes */ |
| #define | MCCI_BOOTLOADER_FIELD_LSB(fmask) ((fmask) & (~(fmask) + 1u)) |
| #define | MCCI_BOOTLOADER_FIELD_SET_VALUE(fmask, val) (MCCI_BOOTLOADER_FIELD_LSB(fmask) * (val)) |
| #define | MCCI_BOOTLOADER_FIELD_SHIFT(x) MCCI_BOOTLOADER_LOG2_POW2((x) & (~(x)+1)) |
| get shift count from field mask. | |
| #define | MCCI_BOOTLOADER_LOG2_POW2(x) |
| compute log2 of an power of 2. | |
| #define | MCCI_BOOTLOADER_VALUE_GET_FIELD(val, fmask) (((val) & (fmask)) >> MCCI_BOOTLOADER_FIELD_SHIFT(fmask)) |
| #define | MCCI_BOOTLOADER_VALUE_MAKE_FIELD(val, fmask) (MCCI_BOOTLOADER_FIELD_LSB(fmask) * (val)) |
| #define _mcci_bootloader_bits_h_ /* prevent multiple includes */ |
Definition at line 23 of file mcci_bootloader_bits.h.
| #define MCCI_BOOTLOADER_FIELD_LSB | ( | fmask | ) | ((fmask) & (~(fmask) + 1u)) |
get LSB from field mask
Definition at line 64 of file mcci_bootloader_bits.h.
| #define MCCI_BOOTLOADER_FIELD_SET_VALUE | ( | fmask, | |
| val | |||
| ) | (MCCI_BOOTLOADER_FIELD_LSB(fmask) * (val)) |
generate field value (properly positioned)
Definition at line 72 of file mcci_bootloader_bits.h.
| #define MCCI_BOOTLOADER_FIELD_SHIFT | ( | x | ) | MCCI_BOOTLOADER_LOG2_POW2((x) & (~(x)+1)) |
get shift count from field mask.
| [in] | x | field mask; bitmask should be of form 0*11*0* |
We might have some 64-bit fields, so... this goes through through bit 63. We use ~(x)+1 to form the unsigned twos- complement of x without trying to negate an unsigned or doing a type-cast. Avoids warnings on some compilers. This is exactly what Knuth calls "rho" (the ruler function).
Definition at line 61 of file mcci_bootloader_bits.h.
| #define MCCI_BOOTLOADER_LOG2_POW2 | ( | x | ) |
compute log2 of an power of 2.
This can be used at compile time or run time.
Definition at line 38 of file mcci_bootloader_bits.h.
| #define MCCI_BOOTLOADER_VALUE_GET_FIELD | ( | val, | |
| fmask | |||
| ) | (((val) & (fmask)) >> MCCI_BOOTLOADER_FIELD_SHIFT(fmask)) |
extract and normalize value of field
Definition at line 76 of file mcci_bootloader_bits.h.
| #define MCCI_BOOTLOADER_VALUE_MAKE_FIELD | ( | val, | |
| fmask | |||
| ) | (MCCI_BOOTLOADER_FIELD_LSB(fmask) * (val)) |
generate field value (properly positioned)
Definition at line 68 of file mcci_bootloader_bits.h.