NCCH/Extended Header: Difference between revisions

Neobrain (talk | contribs)
Neobrain (talk | contribs)
the wiki is not a C primer
Line 212: Line 212:


==== Flag0 ====
==== Flag0 ====
This stores the ''System Mode'', ''Affinity Mask'' and ''Ideal Processor'' values in one byte. They are stored as follows:
{| class="wikitable" border="1"
u8 Flag0 = (SystemMode << 4 | AffinityMask << 2 | IdealProcessor);
|-
And can be retrieved as follows:
!  Bits
u8 SystemMode = (Flag0>>4)&0xF;
!  Description
u8 AffinityMask = (Flag0>>2)&0x3;
|-
u8 IdealProcessor = (Flag0>>0)&0x3;
| 0-1
| Ideal Processor
|-
| 2-3
| Affinity Mask
|-
| 4-7
| System Mode
|}


In the exheader data, the IdealProcessor field is a bit-index, while in the accessdesc the IdealProcessor field is a bitmask. When the bit specified by the exheader field is not set in the accessdesc field, an error is returned. "if((1<<exheaderval) & accessdescval == 0)return error"
In the exheader data, the IdealProcessor field is a bit-index, while in the accessdesc the IdealProcessor field is a bitmask. When the bit specified by the exheader field is not set in the accessdesc field, an error is returned. "if((1<<exheaderval) & accessdescval == 0)return error"
Line 226: Line 234:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Bit
Bits
!  Description
!  Description
|-
|-