Difference between revisions of "Unit PlatformARM"

From Ultibo.org
Jump to: navigation, search
 
(14 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo Platform interface unit for ARM'''
+
'''Ultibo Platform Interface unit for ARM'''
 
+
''To be documented''
+
  
 
=== Constants ===
 
=== Constants ===
Line 39: Line 37:
 
|-
 
|-
 
| <code>ARM_MODE_MON = $16;</code>
 
| <code>ARM_MODE_MON = $16;</code>
| Secure Monitor Mode (For Secure / Non Secure Switching)
+
| Secure Monitor Mode (For Secure/Non Secure Switching)
 
|-
 
|-
 
| <code>ARM_MODE_MON = $16;</code>
 
| <code>ARM_MODE_MON = $16;</code>
| Secure Monitor Mode (For Secure / Non Secure Switching)
+
| Secure Monitor Mode (For Secure/Non Secure Switching)
 
|-
 
|-
 
| <code>ARM_MODE_ABT = $17;</code>
 
| <code>ARM_MODE_ABT = $17;</code>
Line 139: Line 137:
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
| <code>ATAG_INITRD2 = $54410005;</code>
+
| <code>ATAG_INITRD = $54410005;</code>
 +
| Deprecated
 +
|-
 +
| <code>ATAG_INITRD2 = $54420005;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 162: Line 163:
 
</div></div>
 
</div></div>
 
<br />
 
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Device tree blob''' <code> DTB_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DTB_SIGNATURE = $d00dfeed;</code>
 +
| style="width: 50%;"|See: https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div style="font-size: 14px; padding-left: 12px;">'''ARM machine type''' <code> ARM_MACHINE_* </code></div>
 
<div style="font-size: 14px; padding-left: 12px;">'''ARM machine type''' <code> ARM_MACHINE_* </code></div>
Line 178: Line 190:
 
| <code>ARM_MACHINE_BCM2710 = $00000C42;</code>
 
| <code>ARM_MACHINE_BCM2710 = $00000C42;</code>
 
| BCM2710 uses the same Machine Type as BCM2708
 
| BCM2710 uses the same Machine Type as BCM2708
 +
|-
 +
| <code>ARM_MACHINE_BCM2711 = $00000C42;</code>
 +
| BCM2711 uses the same Machine Type as BCM2708
 
|-
 
|-
 
|}
 
|}
Line 314: Line 329:
 
</div></div>   
 
</div></div>   
 
   
 
   
'''ARM tag init ramdisk'''  
+
'''Tag initialize RD'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TagInitRdCount:LongWord;</code>
 +
| style="width: 40%;"|Number of ARM INITRD Tags found during parse (Deprecated)
 +
|-
 +
|}
 
   
 
   
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
'''Tag initialize RD2'''
<code>PARMTagInitRd2 = ^TARMTagInitRd2;</code>
+
  
<code>TARMTagInitRd2 = record</code>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Description of the physical location of the compressed ramdisk image (ATAG_INITRD2)
+
| <code>TagInitRd2Count:LongWord;</code>
 +
| style="width: 40%;"|Number of ARM INITRD2 Tags found during parse
 
|-
 
|-
| <code>Start:LongWord;</code>
+
|}
| Physical start address
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
|-
 
|-
| <code>Size:LongWord;</code>
+
| <code>TagInitRd2Start:LongWord;</code>
| Size of compressed ramdisk image in bytes
+
| style="width: 40%;"|
 
|-
 
|-
 
|}
 
|}
</div></div>   
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TagInitRd2Size:LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}  
 
    
 
    
 
'''ARM tag serial'''  
 
'''ARM tag serial'''  
Line 438: Line 463:
 
|colspan="2"|Note: Commandline for the kernel (ATAG_CMDLINE)
 
|colspan="2"|Note: Commandline for the kernel (ATAG_CMDLINE)
 
|-
 
|-
| <code>Cmdline:array[0..0] of Char;</code>
+
| <code>Cmdline:array[0..0] of AnsiChar;</code>
 
| This is the minimum size
 
| This is the minimum size
 
|-
 
|-
Line 487: Line 512:
 
| <code>8:(Command:TARMTagCommand)</code>
 
| <code>8:(Command:TARMTagCommand)</code>
 
| &nbsp;
 
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 +
'''Device tree blob header'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PDTBHeader = ^TDTBHeader;</code>
 +
 +
<code>TDTBHeader = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Magic:LongWord;</code>
 +
| The value 0xd00dfeed (big-endian)
 +
|-
 +
| <code>TotalSize:LongWord;</code>
 +
| The total size in bytes of the devicetree data structure (big-endian)
 +
|-
 +
| <code>StructureOffset:LongWord;</code>
 +
| The offset in bytes of the structure block from the beginning of the header (big-endian)
 +
|-
 +
| <code>StringsOffset:LongWord;</code>
 +
| The offset in bytes of the strings block from the beginning of the header (big-endian)
 +
|-
 +
| <code>ReservationOffset:LongWord;</code>
 +
| The offset in bytes of the memory reservation block from the beginning of the header (big-endian)
 +
|-
 +
| <code>Version:LongWord;</code>
 +
| The version of the devicetree data structure (big-endian)
 +
|-
 +
| <code>CompatibleVersion:LongWord;</code>
 +
| The lowest version of the devicetree data structure with which the version used is backwards compatible (big-endian)
 +
|-
 +
| <code>BootCPUID:LongWord;</code>
 +
| The physical ID of the system’s boot CPU (big-endian)
 +
|-
 +
| <code>StringsSize:LongWord;</code>
 +
| The length in bytes of the strings block section of the devicetree blob (big-endian)
 +
|-
 +
| <code>StructureSize:LongWord;</code>
 +
| The length in bytes of the structure block section of the devicetree blob (big-endian)
 
|-
 
|-
 
|}
 
|}
Line 552: Line 619:
 
|-
 
|-
 
| <code>ARMBootMode:LongWord = 0;</code>
 
| <code>ARMBootMode:LongWord = 0;</code>
| style="width: 40%;"|The ARM Mode that the processor was in at boot time (Set by Startup). Must be initialized to remain in .data or else rewritten to zero with .bss
+
| style="width: 40%;"|The ARM Mode that the processor was in at boot time (Set by Startup)
 
|-
 
|-
 
|}
 
|}
Line 558: Line 625:
 
|-
 
|-
 
| <code>ARMBootVectors:LongWord = 0;</code>
 
| <code>ARMBootVectors:LongWord = 0;</code>
| style="width: 40%;"|The Vector Base Address that was current at boot time (Set by Startup). Must be initialized to remain in .data or else rewritten to zero with .bss
+
| style="width: 40%;"|The Vector Base Address that was current at boot time (Set by Startup)
 
|-
 
|-
 
|}
 
|}
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
|-
 
|-
| <code>ARMTagsAddress:LongWord = ARMTAGS_INITIAL;</code>
+
| <code>ARMTagsAddress:PtrUInt = ARMTAGS_INITIAL;</code>
| style="width: 40%;"|Pointer to the ARM TAGS provided by the bootloader at startup (Set by Startup). Must be initialized to remain in .data or else rewritten to zero with .bss
+
| style="width: 40%;"|Pointer to the ARM TAGS provided by the bootloader at startup (Set by Startup)
 
|-
 
|-
 
|}
 
|}
Line 570: Line 637:
 
|-
 
|-
 
| <code>ARMMachineType:LongWord = 0;</code>
 
| <code>ARMMachineType:LongWord = 0;</code>
| style="width: 40%;"|ARM Machine Type provided by the bootloader at startup (Set by Startup). Must be initialized to remain in .data or else rewritten to zero with .bss
+
| style="width: 40%;"|ARM Machine Type provided by the bootloader at startup (Set by Startup)
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>ARMSecureBoot:LongWord = 1;</code>
 +
| style="width: 40%;"|If 1 then startup will attempt to switch back to secure world during boot process (If supported by the ARM boot stub)
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>ARMEmulatorMode:LongWord = 0;</code>
 +
| style="width: 40%;"|If 1 then startup detected that the machine is running in an emulator (If applicable)
 +
Note: These variables must be initialized to remain in .data or else they are rewritten to zero with .bss
 
|-
 
|-
 
|}
 
|}
  
'''ARM tags variables'''
+
'''ARM tags'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 592: Line 672:
 
|}
 
|}
 
   
 
   
'''Tag core variables'''
+
'''Tag core'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 619: Line 699:
 
|}
 
|}
 
   
 
   
'''Tag memory variables'''
+
'''Tag memory'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 635: Line 715:
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
|-
 
|-
| <code>TagMemoryStart:LongWord;</code>
+
| <code>TagMemoryStart:PtrUInt;</code>
 
| style="width: 40%;"|Start of the last block reported by ARM Tags
 
| style="width: 40%;"|Start of the last block reported by ARM Tags
 
|-
 
|-
Line 647: Line 727:
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
|-
 
|-
| <code>TagMemoryAddress:LongWord;</code>
+
| <code>TagMemoryAddress:PtrUInt;</code>
 
| style="width: 40%;"|Adjusted Address of the last block reported by ARM Tags
 
| style="width: 40%;"|Adjusted Address of the last block reported by ARM Tags
 
|-
 
|-
 
|}
 
|}
 
   
 
   
'''Tag video text variables'''
+
'''Tag video text'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 661: Line 741:
 
|}
 
|}
 
   
 
   
'''Tag ramdisk variables'''
+
'''Tag ramdisk'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 670: Line 750:
 
|}
 
|}
 
   
 
   
'''Tag Init RD2 variables'''
+
'''Tag initialize RD2'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 679: Line 759:
 
|}
 
|}
 
   
 
   
'''Tag serial variables'''
+
'''Tag serial'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 700: Line 780:
 
|}
 
|}
 
   
 
   
'''Tag revision variables'''
+
'''Tag revision'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 715: Line 795:
 
|}
 
|}
 
   
 
   
'''Tag video FB variables'''
+
'''Tag video framebuffer'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 724: Line 804:
 
|}
 
|}
 
   
 
   
'''Tag command variables'''
+
'''Tag command'''
  
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
Line 746: Line 826:
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
|-
 
|-
| <code>TagCommandAddress:PChar;</code>
+
| <code>TagCommandAddress:PAnsiChar;</code>
 
| style="width: 40%;"|Pointer to the start of the command line
 
| style="width: 40%;"|Pointer to the start of the command line
 
|-
 
|-
Line 800: Line 880:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 815: Line 895:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ExtractCommandLine(Value:PAnsiChar):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ExtractMemoryBlock(Address,Size:LongWord):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function ExtractInitialRamdisk(Address,Size:LongWord):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 827: Line 943:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 839: Line 955:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 851: Line 967:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 863: Line 979:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 875: Line 991:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
| True is enabled, False if disabled (Returned in R0)
+
| True is enabled, False if disabled (Returned in R0).
 
|-
 
|-
 
|}
 
|}
Line 887: Line 1,003:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 899: Line 1,015:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 911: Line 1,027:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| IRQ state when called (Returned in R0)
 
| IRQ state when called (Returned in R0)
 
|-
 
|-
Line 923: Line 1,039:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''IRQMask'''
+
! IRQMask
 
| IRQ state to restore (Passed in R0)
 
| IRQ state to restore (Passed in R0)
 
|-
 
|-
! '''Return'''
+
! Return
 
| IRQ state when called (Returned in R0)
 
| IRQ state when called (Returned in R0)
 
|-
 
|-
Line 938: Line 1,054:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
| True is enabled, False if disabled (Returned in R0)
+
| True is enabled, False if disabled (Returned in R0).
 
|-
 
|-
 
|}
 
|}
Line 950: Line 1,066:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 962: Line 1,078:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 974: Line 1,090:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| FIQ state when called (Returned in R0)
 
| FIQ state when called (Returned in R0)
 
|-
 
|-
Line 986: Line 1,102:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''FIQMask'''
+
! FIQMask
 
| FIQ state to restore (Passed in R0)
 
| FIQ state to restore (Passed in R0)
 
|-
 
|-
! '''Return'''
+
! Return
 
| FIQ state when called (Returned in R0)
 
| FIQ state when called (Returned in R0)
 
|-
 
|-
Line 1,001: Line 1,117:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,013: Line 1,129:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,025: Line 1,141:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| IRQ/FIQ state when called (Returned in R0)
 
| IRQ/FIQ state when called (Returned in R0)
 
|-
 
|-
Line 1,037: Line 1,153:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''IRQFIQMask'''
+
! IRQFIQMask
 
| IRQ/FIQ state to restore (Passed in R0)
 
| IRQ/FIQ state to restore (Passed in R0)
 
|-
 
|-
! '''Return'''
+
! Return
 
| IRQ/FIQ state when called (Returned in R0)
 
| IRQ/FIQ state when called (Returned in R0)
 
|-
 
|-
Line 1,052: Line 1,168:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
| True is enabled, False if disabled (Returned in R0)
+
| True is enabled, False if disabled (Returned in R0).
 
|-
 
|-
 
|}
 
|}
Line 1,064: Line 1,180:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,076: Line 1,192:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,088: Line 1,204:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| Abort state when called (Returned in R0)
 
| Abort state when called (Returned in R0)
 
|-
 
|-
Line 1,100: Line 1,216:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''AbortMask'''
+
! AbortMask
 
| Abort state to restore (Passed in R0)
 
| Abort state to restore (Passed in R0)
 
|-
 
|-
! '''Return'''
+
! Return
 
| Abort state when called (Returned in R0)
 
| Abort state when called (Returned in R0)
 
|-
 
|-
Line 1,118: Line 1,234:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,130: Line 1,246:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,142: Line 1,258:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,154: Line 1,270:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,166: Line 1,282:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,178: Line 1,294:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Latest revision as of 06:17, 6 September 2024

Return to Unit Reference


Description


Ultibo Platform Interface unit for ARM

Constants



ARM mode ARM_MODE_*
Bits 4..0 in the ARM program status register
See: A2.2 Processor Modes of the ARM Architecture Reference Manual and also A2.5.7 The mode bits
See also: B1.3.1 ARM processor modes of the ARM Architecture Reference Manual (ARMv7-A and ARMv7-R edition)
 
ARM_MODE_USR = $10; Normal User Mode
ARM_MODE_FIQ = $11; FIQ Processing Fast Interrupts Mode
ARM_MODE_IRQ = $12; IRQ Processing Standard Interrupts Mode
ARM_MODE_SVC = $13; Supervisor Processing Software Interrupts Mode
ARM_MODE_MON = $16; Secure Monitor Mode (For Secure/Non Secure Switching)
ARM_MODE_MON = $16; Secure Monitor Mode (For Secure/Non Secure Switching)
ARM_MODE_ABT = $17; Abort Processing memory Faults Mode
ARM_MODE_HYP = $1A; Hypervisor Mode
ARM_MODE_UND = $1B; Undefined Processing Undefined Instructions Mode
ARM_MODE_SYS = $1F; System Running Priviledged Operating System Tasks Mode
 
ARM_MODE_BITS = $0000001F; Mask of the mode bits in the program status register


ARM interrupt disable ARM_I_*
Bits 7 and 6 in the ARM program status register
See: A2.5.6 "The interrupt disable bits" of the ARM Architecture Reference Manual
 
ARM_I_BIT = $00000080; IRQs disabled when set to 1
ARM_F_BIT = $00000040; FIQs disabled when set to 1


ARM thumb and jazelle ARM_*_BIT
Bits 24 and 5 in the ARM program status register
See: A2.5.8 "The T and J bits" of the ARM Architecture Reference Manual
 
ARM_T_BIT = $00000020; Thumb mode enabled when set to 1
ARM_J_BIT = $01000000; Jazelle mode enabled when set to 1


ARM abort ARM_A_*
Bit 8 in the ARM program status register
 
ARM_A_BIT = $00000100; Data Abort masked when set to 1


ARM boot tag ATAG_*
ATAG_NONE = $00000000;  
ATAG_CORE = $54410001;  
ATAG_MEM = $54410002;  
ATAG_VIDEOTEXT = $54410003;  
ATAG_RAMDISK = $54410004;  
ATAG_INITRD = $54410005; Deprecated
ATAG_INITRD2 = $54420005;  
ATAG_SERIAL = $54410006;  
ATAG_REVISION = $54410007;  
ATAG_VIDEOLFB = $54410008;  
ATAG_CMDLINE = $54410009;  
 
ARMTAGS_INITIAL = $FFFFFFFF;  



ARM machine type ARM_MACHINE_*
ARM_MACHINE_VERSATILE_PB = $00000183;  
ARM_MACHINE_BCM2708 = $00000C42;  
ARM_MACHINE_BCM2709 = $00000C42; BCM2709 uses the same Machine Type as BCM2708
ARM_MACHINE_BCM2710 = $00000C42; BCM2710 uses the same Machine Type as BCM2708
ARM_MACHINE_BCM2711 = $00000C42; BCM2711 uses the same Machine Type as BCM2708


Type definitions



ARM boot tag header

PARMTagHeader = ^TARMTagHeader;

TARMTagHeader = record

Note: ARM Boot Tag Structure Definitions
Size:LongWord; Size of tag, in words (32bit), including the header
Tag:LongWord; One of the ATAG_* values from above

ARM tag core

PARMTagCore = ^TARMTagCore;

TARMTagCore = record

Note: Core parameters (ATAG_CORE)
Flags:LongWord; Bit 0 = read-only
PageSize:LongWord; Systems page size (usually 4k)
RootDev:LongWord; Root device number

ARM tag memory

PARMTagMemory = ^TARMTagMemory;

TARMTagMemory = record

Note: Description of memory region (ATAG_MEM)
Size:LongWord;  
Start:LongWord;  

ARM tag video text

PARMTagVideoText = ^TARMTagVideoText;

TARMTagVideoText = record

Note: Description of VGA text type displays (ATAG_VIDEOTEXT)
X:Byte; Width of display
Y:Byte; Height of display
Video_page:Word;  
Video_mode:Byte;  
Video_cols:Byte;  
Video_ega_bx:Word;  
Video_lines:Byte;  
Video_isvga:Byte;  
Video_points:Word;  

ARM tag ramdisk

PARMTagRamdisk = ^TARMTagRamdisk;

TARMTagRamdisk = record

Note: Description of how the ramdisk will be used by the kernel (ATAG_RAMDISK)
Flags:LongWord; Bit 0 = load, Bit 1 = prompt
Size:LongWord; Decompressed ramdisk size in _kilo_ bytes
Start:LongWord; Starting block of floppy-based RAM disk image

Tag initialize RD

TagInitRdCount:LongWord; Number of ARM INITRD Tags found during parse (Deprecated)

Tag initialize RD2

TagInitRd2Count:LongWord; Number of ARM INITRD2 Tags found during parse
TagInitRd2Start:LongWord;
TagInitRd2Size:LongWord;

ARM tag serial

PARMTagSerial = ^TARMTagSerial;

TARMTagSerial = record

Note: Board serial number (ATAG_SERIAL)
Low:LongWord;  
High:LongWord;  

ARM tag revision

PARMTagRevision = ^TARMTagRevision;

TARMTagRevision = record

Note: Board revision (ATAG_REVISION)
Revision:LongWord;  

ARM tag video framebuffer

PARMTagVideoFB = ^TARMTagVideoFB;

TARMTagVideoFB = record

Note: Description of the parameters for a linear framebuffer type display (ATAG_VIDEOLFB)
Lfb_width:Word;  
Lfb_height:Word;  
Lfb_depth:Word;  
Lfb_linelength:Word;  
Lfb_base:LongWord;  
Lfb_size:LongWord;  
Red_size:Byte;  
Red_pos:Byte;  
Green_size:Byte;  
Green_pos:Byte;  
Blue_size:Byte;  
Blue_pos:Byte;  
Rsvd_size:Byte;  
Rsvd_pos:Byte;  

ARM tag command

PARMTagCommand = ^TARMTagCommand;

TARMTagCommand = record

Note: Commandline for the kernel (ATAG_CMDLINE)
Cmdline:array[0..0] of AnsiChar; This is the minimum size

ARM boot tag

PARMTag = ^TARMTag;

TARMTag = record

Note: Format of ARM Boot Tag
Header:TARMTagHeader;  
case Integer of  
0:(Core:TARMTagCore);  
1:(Memory:TARMTagMemory);  
2:(VideoText:TARMTagVideoText);  
3:(Ramdisk:TARMTagRamdisk);  
4:(InitRd2:TARMTagInitRd2);  
5:(Serial:TARMTagSerial);  
6:(Revision:TARMTagRevision);  
7:(VideoFB:TARMTagVideoFB);  
8:(Command:TARMTagCommand)  

Device tree blob header

PDTBHeader = ^TDTBHeader;

TDTBHeader = packed record

Magic:LongWord; The value 0xd00dfeed (big-endian)
TotalSize:LongWord; The total size in bytes of the devicetree data structure (big-endian)
StructureOffset:LongWord; The offset in bytes of the structure block from the beginning of the header (big-endian)
StringsOffset:LongWord; The offset in bytes of the strings block from the beginning of the header (big-endian)
ReservationOffset:LongWord; The offset in bytes of the memory reservation block from the beginning of the header (big-endian)
Version:LongWord; The version of the devicetree data structure (big-endian)
CompatibleVersion:LongWord; The lowest version of the devicetree data structure with which the version used is backwards compatible (big-endian)
BootCPUID:LongWord; The physical ID of the system’s boot CPU (big-endian)
StringsSize:LongWord; The length in bytes of the strings block section of the devicetree blob (big-endian)
StructureSize:LongWord; The length in bytes of the structure block section of the devicetree blob (big-endian)

ARM wait

TARMWait = procedure;

ARM long wait

TARMLongWait = procedure;

ARM short wait

TARMShortWait = procedure;

ARM slow blink

TARMSlowBlink = procedure;

ARM fast blink

TARMFastBlink = procedure;


Public variables



ARM specific variables

ARMInitialized:Boolean;
ARMBootMode:LongWord = 0; The ARM Mode that the processor was in at boot time (Set by Startup)
ARMBootVectors:LongWord = 0; The Vector Base Address that was current at boot time (Set by Startup)
ARMTagsAddress:PtrUInt = ARMTAGS_INITIAL; Pointer to the ARM TAGS provided by the bootloader at startup (Set by Startup)
ARMMachineType:LongWord = 0; ARM Machine Type provided by the bootloader at startup (Set by Startup)
ARMSecureBoot:LongWord = 1; If 1 then startup will attempt to switch back to secure world during boot process (If supported by the ARM boot stub)
ARMEmulatorMode:LongWord = 0; If 1 then startup detected that the machine is running in an emulator (If applicable)

Note: These variables must be initialized to remain in .data or else they are rewritten to zero with .bss

ARM tags

ARMTagsCount:LongWord; Number of ARM Tags found during parse

Tag none variables

TagNoneCount:LongWord; Number of ARM NONE Tags found during parse

Tag core

TagCoreCount:LongWord; Number of ARM CORE Tags found during parse
TagCoreFlags:LongWord;
TagCorePageSize:LongWord;
TagCoreRootDevice:LongWord;

Tag memory

TagMemoryCount:LongWord; Number of ARM MEM Tags found during parse
TagMemorySize:LongWord; Size of the last block reported by ARM Tags
TagMemoryStart:PtrUInt; Start of the last block reported by ARM Tags
TagMemoryLength:LongWord; Adjusted Size of the last block reported by ARM Tags
TagMemoryAddress:PtrUInt; Adjusted Address of the last block reported by ARM Tags

Tag video text

TagVideoTextCount:LongWord; Number of ARM VIDEOTEXT Tags found during parse

Tag ramdisk

TagRamdiskCount:LongWord; Number of ARM RAMDISK Tags found during parse

Tag initialize RD2

TagInitRd2Count:LongWord; Number of ARM INITRD2 Tags found during parse

Tag serial

TagSerialCount:LongWord; Number of ARM SERIAL Tags found during parse
TagSerialNoLow:LongWord;
TagSerialNoHigh:LongWord;

Tag revision

TagRevisionCount:LongWord; Number of ARM REVISION Tags found during parse
TagRevisionNo:LongWord;

Tag video framebuffer

TagVideoFBCount:LongWord; Number of ARM VIDEOLFB Tags found during parse

Tag command

TagCmdCount:LongWord; Number of ARM CMDLINE Tags found during parse
TagCommandSize:LongWord; Length of the command line in characters (Including null terminator)
TagCommandCount:LongInt; Count of parameters (space delimited) in the command line
TagCommandAddress:PAnsiChar; Pointer to the start of the command line

Wait handlers

ARMWaitHandler:TARMWait;
ARMLongWaitHandler:TARMLongWait;
ARMShortWaitHandler:TARMShortWait;

Blink handlers

ARMSlowBlinkHandler:TARMSlowBlink;
ARMFastBlinkHandler:TARMFastBlink;


Function declarations



Initialization functions

procedure ARMInit;
Description: To be documented
Note None documented


ARM platform functions

procedure ARMParseBootTags;
Description: Extract some information from the ARM boot tag list and use it to load the memory manager, some other information is stored in variables for future use
Note None documented


function ExtractCommandLine(Value:PAnsiChar):Boolean;
Description: To be documented
Note None documented


function ExtractMemoryBlock(Address,Size:LongWord):Boolean;
Description: To be documented
Note None documented


function ExtractInitialRamdisk(Address,Size:LongWord):Boolean;
Description: To be documented
Note None documented


procedure ARMParseCommandLine;
Description: Setup argc, argv and cmdline and process known command line options
Note None documented


procedure ARMParseEnvironment;
Description: Setup envp and process known environment options
Note None documented


function ARMGetSP:PtrUInt; assembler; nostackframe;
Description: Get the current stack pointer (SP)
Note None documented


function ARMGetPC:PtrUInt; assembler; nostackframe;
Description: Get the current program counter (PC)
Note None documented


function ARMGetIRQ:Boolean; assembler; nostackframe;
Description: Get Interrupts (IRQ) state
Return True is enabled, False if disabled (Returned in R0).


procedure ARMEnableIRQ; assembler; nostackframe;
Description: Enable Interrupts (IRQ) unconditionally
Note None documented


procedure ARMDisableIRQ; assembler; nostackframe;
Description: Disable Interrupts (IRQ) unconditionally
Note None documented


function ARMSaveIRQ:TIRQMask; assembler; nostackframe;
Description: Disable Interrupts (IRQ) and return the previous state
Return IRQ state when called (Returned in R0)


function ARMRestoreIRQ(IRQMask:TIRQMask):TIRQMask; assembler; nostackframe;
Description: Restore Interrupts (IRQ) to a previous state
IRQMask IRQ state to restore (Passed in R0)
Return IRQ state when called (Returned in R0)


function ARMGetFIQ:Boolean; assembler; nostackframe;
Description: Get Fast Interrupts (FIQ) state
Return True is enabled, False if disabled (Returned in R0).


procedure ARMEnableFIQ; assembler; nostackframe;
Description: Enable Fast Interrupts (FIQ) unconditionally
Note None documented


procedure ARMDisableFIQ; assembler; nostackframe;
Description: Disable Fast Interrupts (FIQ) unconditionally
Note None documented


function ARMSaveFIQ:TFIQMask; assembler; nostackframe;
Description: Disable Fast Interrupts (FIQ) and return the previous state
Return FIQ state when called (Returned in R0)


function ARMRestoreFIQ(FIQMask:TFIQMask):TFIQMask; assembler; nostackframe;
Description: Restore Fast Interrupts (FIQ) to a previous state
FIQMask FIQ state to restore (Passed in R0)
Return FIQ state when called (Returned in R0)


procedure ARMEnableIRQFIQ; assembler; nostackframe;
Description: Enable Interrupts and Fast Interrupts (IRQ/FIQ) unconditionally
Note None documented


procedure ARMDisableIRQFIQ; assembler; nostackframe;
Description: Disable Interrupts and Fast Interrupts (IRQ/FIQ) unconditionally
Note None documented


function ARMSaveIRQFIQ:TIRQFIQMask; assembler; nostackframe;
Description: Disable Interrupts and Fast Interrupts (IRQ/FIQ) and return the previous state
Return IRQ/FIQ state when called (Returned in R0)


function ARMRestoreIRQFIQ(IRQFIQMask:TIRQFIQMask):TIRQFIQMask; assembler; nostackframe;
Description: Restore Interrupts and Fast Interrupts (IRQ/FIQ) to a previous state
IRQFIQMask IRQ/FIQ state to restore (Passed in R0)
Return IRQ/FIQ state when called (Returned in R0)


function ARMGetAbort:Boolean; assembler; nostackframe;
Description: Get Abort state
Return True is enabled, False if disabled (Returned in R0).


procedure ARMEnableAbort; assembler; nostackframe;
Description: Enable Aborts unconditionally
Note None documented


procedure ARMDisableAbort; assembler; nostackframe;
Description: Disable Aborts unconditionally
Note None documented


function ARMSaveAbort:TAbortMask; assembler; nostackframe;
Description: Disable Aborts and return the previous state
Return Abort state when called (Returned in R0)


function ARMRestoreAbort(AbortMask:TAbortMask):TAbortMask; assembler; nostackframe;
Description: Restore Aborts to a previous state
AbortMask Abort state to restore (Passed in R0)
Return Abort state when called (Returned in R0)


ARM helper functions

procedure ARMWait; inline;
Description: To be documented
Note None documented


procedure ARMLongWait; inline;
Description: To be documented
Note None documented


procedure ARMShortWait; inline;
Description: To be documented
Note None documented


procedure ARMSlowBlink; inline;
Description: To be documented
Note None documented


procedure ARMFastBlink; inline;
Description: To be documented
Note None documented


function ARMModeToString(ARMMode:LongWord):String;
Description: To be documented
Note None documented


Return to Unit Reference