Difference between revisions of "Unit PlatformARM"

From Ultibo.org
Jump to: navigation, search
Line 186: Line 186:
 
----
 
----
  
''To be documented''
+
 
 +
'''ARM boot tag header'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagHeader = ^TARMTagHeader;</code>
 +
 
 +
<code>TARMTagHeader = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: ARM Boot Tag Structure Definitions
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| Size of tag, in words (32bit), including the header
 +
|-
 +
| <code>Tag:LongWord;</code>
 +
| One of the ATAG_* values from above
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''ARM tag core''' 
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagCore = ^TARMTagCore;</code>
 +
 
 +
<code>TARMTagCore = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Core parameters (ATAG_CORE)
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Bit 0 = read-only
 +
|-
 +
| <code>PageSize:LongWord;</code>
 +
| Systems page size (usually 4k)
 +
|-
 +
| <code>RootDev:LongWord;</code>
 +
| Root device number
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''ARM tag memory'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagMemory = ^TARMTagMemory;</code>
 +
 
 +
<code>TARMTagMemory = record</code>
 +
<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 memory region (ATAG_MEM)
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''ARM tag video text'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagVideoText = ^TARMTagVideoText;</code>
 +
 
 +
<code>TARMTagVideoText = record</code>
 +
<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 VGA text type displays (ATAG_VIDEOTEXT)
 +
|-
 +
| <code>X:Byte;</code>
 +
| Width of display
 +
|-
 +
| <code>Y:Byte;</code>
 +
| Height of display
 +
|-
 +
| <code>Video_page:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Video_mode:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Video_cols:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Video_ega_bx:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Video_lines:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Video_isvga:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Video_points:Word;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''ARM tag ramdisk''' 
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagRamdisk = ^TARMTagRamdisk;</code>
 +
 
 +
<code>TARMTagRamdisk = record</code>
 +
<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 how the ramdisk will be used by the kernel (ATAG_RAMDISK)
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Bit 0 = load, Bit 1 = prompt
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| Decompressed ramdisk size in _kilo_ bytes
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| Starting block of floppy-based RAM disk image
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''ARM tag init ramdisk'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagInitRd2 = ^TARMTagInitRd2;</code>
 +
 
 +
<code>TARMTagInitRd2 = record</code>
 +
<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>Start:LongWord;</code>
 +
| Physical start address
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| Size of compressed ramdisk image in bytes
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''ARM tag serial'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagSerial = ^TARMTagSerial;</code>
 +
 
 +
<code>TARMTagSerial = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Board serial number (ATAG_SERIAL)
 +
|-
 +
| <code>Low:LongWord;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>High:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''ARM tag revision'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagRevision = ^TARMTagRevision;</code>
 +
 
 +
<code>TARMTagRevision = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Board revision (ATAG_REVISION)
 +
|-
 +
| <code>Revision:LongWord;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''ARM tag video framebuffer'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagVideoFB = ^TARMTagVideoFB;</code>
 +
 
 +
<code>TARMTagVideoFB = record</code>
 +
<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 parameters for a linear framebuffer type display (ATAG_VIDEOLFB)
 +
|-
 +
| <code>Lfb_width:Word;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>Lfb_height:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Lfb_depth:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Lfb_linelength:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Lfb_base:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Lfb_size:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Red_size:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Red_pos:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Green_size:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Green_pos:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Blue_size:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Blue_pos:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Rsvd_size:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Rsvd_pos:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''ARM tag command'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTagCommand = ^TARMTagCommand;</code>
 +
 
 +
<code>TARMTagCommand = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Commandline for the kernel (ATAG_CMDLINE)
 +
|-
 +
| <code>Cmdline:array[0..0] of Char;</code>
 +
| This is the minimum size
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''ARM boot tag'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PARMTag = ^TARMTag;</code>
 +
 
 +
<code>TARMTag = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Format of ARM Boot Tag
 +
|-
 +
| <code>Header:TARMTagHeader;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>case Integer of</code>
 +
| &nbsp;
 +
|-
 +
| <code>0:(Core:TARMTagCore);</code>
 +
| &nbsp;
 +
|-
 +
| <code>1:(Memory:TARMTagMemory);</code>
 +
| &nbsp;
 +
|-
 +
| <code>2:(VideoText:TARMTagVideoText);</code>
 +
| &nbsp;
 +
|-
 +
| <code>3:(Ramdisk:TARMTagRamdisk);</code>
 +
| &nbsp;
 +
|-
 +
| <code>4:(InitRd2:TARMTagInitRd2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>5:(Serial:TARMTagSerial);</code>
 +
| &nbsp;
 +
|-
 +
| <code>6:(Revision:TARMTagRevision);</code>
 +
| &nbsp;
 +
|-
 +
| <code>7:(VideoFB:TARMTagVideoFB);</code>
 +
| &nbsp;
 +
|-
 +
| <code>8:(Command:TARMTagCommand)</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''ARM wait'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TARMWait = procedure;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''ARM long wait'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TARMLongWait = procedure;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''ARM short wait'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TARMShortWait = procedure;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''ARM slow blink'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TARMSlowBlink = procedure;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''ARM fast blink'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TARMFastBlink = procedure;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===

Revision as of 02:09, 24 January 2017

Return to Unit Reference


Description


Ultibo Platform interface unit for ARM

To be documented

Constants



[Expand]
ARM mode constants ARM_MODE_*


[Expand]
ARM interrupt disable constants ARM_I_*


[Expand]
ARM thumb and jazelle constants ARM_*_BIT


[Expand]
ARM abort constants ARM_A_*


[Expand]
ARM boot tag constants ATAG_*


[Expand]
ARM machine type constants ARM_MACHINE_*


Type definitions



ARM boot tag header

[Expand]

PARMTagHeader = ^TARMTagHeader;

TARMTagHeader = record

ARM tag core

[Expand]

PARMTagCore = ^TARMTagCore;

TARMTagCore = record

ARM tag memory

[Expand]

PARMTagMemory = ^TARMTagMemory;

TARMTagMemory = record

ARM tag video text

[Expand]

PARMTagVideoText = ^TARMTagVideoText;

TARMTagVideoText = record

ARM tag ramdisk

[Expand]

PARMTagRamdisk = ^TARMTagRamdisk;

TARMTagRamdisk = record

ARM tag init ramdisk

[Expand]

PARMTagInitRd2 = ^TARMTagInitRd2;

TARMTagInitRd2 = record

ARM tag serial

[Expand]

PARMTagSerial = ^TARMTagSerial;

TARMTagSerial = record

ARM tag revision

[Expand]

PARMTagRevision = ^TARMTagRevision;

TARMTagRevision = record

ARM tag video framebuffer

[Expand]

PARMTagVideoFB = ^TARMTagVideoFB;

TARMTagVideoFB = record

ARM tag command

[Expand]

PARMTagCommand = ^TARMTagCommand;

TARMTagCommand = record

ARM boot tag

[Expand]

PARMTag = ^TARMTag;

TARMTag = record

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). Must be initialized to remain in .data or else rewritten to zero with .bss
ARMBootVectors:LongWord = 0; 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
ARMTagsAddress:LongWord = ARMTAGS_INITIAL; 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
ARMMachineType:LongWord = 0; 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

ARM tags variables

ARMTagsCount:LongWord; Number of ARM Tags found during parse

Tag none variables

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

Tag core variables

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

Tag memory variables

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

Tag video text variables

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

Tag ramdisk variables

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

Tag Init RD2 variables

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

Tag serial variables

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

Tag revision variables

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

Tag video FB variables

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

Tag command variables

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:PChar; 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

[Expand]
procedure ARMInit;
Description: To be documented


ARM platform functions

[Expand]
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


[Expand]
procedure ARMParseCommandLine;
Description: Setup argc, argv and cmdline and process known command line options


[Expand]
procedure ARMParseEnvironment;
Description: Setup envp and process known environment options


[Expand]
function ARMGetSP:PtrUInt; assembler; nostackframe;
Description: Get the current stack pointer (SP)


[Expand]
function ARMGetPC:PtrUInt; assembler; nostackframe;
Description: Get the current program counter (PC)


[Expand]
function ARMGetIRQ:Boolean; assembler; nostackframe;
Description: Get Interrupts (IRQ) state


[Expand]
procedure ARMEnableIRQ; assembler; nostackframe;
Description: Enable Interrupts (IRQ) unconditionally


[Expand]
procedure ARMDisableIRQ; assembler; nostackframe;
Description: Disable Interrupts (IRQ) unconditionally


[Expand]
function ARMSaveIRQ:TIRQMask; assembler; nostackframe;
Description: Disable Interrupts (IRQ) and return the previous state


[Expand]
function ARMRestoreIRQ(IRQMask:TIRQMask):TIRQMask; assembler; nostackframe;
Description: Restore Interrupts (IRQ) to a previous state


[Expand]
function ARMGetFIQ:Boolean; assembler; nostackframe;
Description: Get Fast Interrupts (FIQ) state


[Expand]
procedure ARMEnableFIQ; assembler; nostackframe;
Description: Enable Fast Interrupts (FIQ) unconditionally


[Expand]
procedure ARMDisableFIQ; assembler; nostackframe;
Description: Disable Fast Interrupts (FIQ) unconditionally


[Expand]
function ARMSaveFIQ:TFIQMask; assembler; nostackframe;
Description: Disable Fast Interrupts (FIQ) and return the previous state


[Expand]
function ARMRestoreFIQ(FIQMask:TFIQMask):TFIQMask; assembler; nostackframe;
Description: Restore Fast Interrupts (FIQ) to a previous state


[Expand]
procedure ARMEnableIRQFIQ; assembler; nostackframe;
Description: Enable Interrupts and Fast Interrupts (IRQ/FIQ) unconditionally


[Expand]
procedure ARMDisableIRQFIQ; assembler; nostackframe;
Description: Disable Interrupts and Fast Interrupts (IRQ/FIQ) unconditionally


[Expand]
function ARMSaveIRQFIQ:TIRQFIQMask; assembler; nostackframe;
Description: Disable Interrupts and Fast Interrupts (IRQ/FIQ) and return the previous state


[Expand]
function ARMRestoreIRQFIQ(IRQFIQMask:TIRQFIQMask):TIRQFIQMask; assembler; nostackframe;
Description: Restore Interrupts and Fast Interrupts (IRQ/FIQ) to a previous state


[Expand]
function ARMGetAbort:Boolean; assembler; nostackframe;
Description: Get Abort state


[Expand]
procedure ARMEnableAbort; assembler; nostackframe;
Description: Enable Aborts unconditionally


[Expand]
procedure ARMDisableAbort; assembler; nostackframe;
Description: Disable Aborts unconditionally


[Expand]
function ARMSaveAbort:TAbortMask; assembler; nostackframe;
Description: Disable Aborts and return the previous state


[Expand]
function ARMRestoreAbort(AbortMask:TAbortMask):TAbortMask; assembler; nostackframe;
Description: Restore Aborts to a previous state


ARM helper functions

[Expand]
procedure ARMWait; inline;
Description: To be documented


[Expand]
procedure ARMLongWait; inline;
Description: To be documented


[Expand]
procedure ARMShortWait; inline;
Description: To be documented


[Expand]
procedure ARMSlowBlink; inline;
Description: To be documented


[Expand]
procedure ARMFastBlink; inline;
Description: To be documented


[Expand]
function ARMModeToString(ARMMode:LongWord):String;
Description: To be documented


Return to Unit Reference