Unit PlatformRPi4

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Ultibo Platform Interface unit for Raspberry Pi 4

Note: The RPi4B has the Activity LED connected to GPIO Pin 42 (Power LED is only accessible via the GPIO expander driver)

Detecting the GIC or legacy interrupt controller

The Raspberry Pi 4 contains a new GIC interrupt controller which includes modern features like the ability to service interrupts on all available cores, a full set of software generated processor to processor interrupts and complete FIQ handling for all interrupt sources.

The Pi 4 also retains and expands the legacy interrupt controller used on earlier Pi models with support for routing interrupts to any core and FIQ handling for all interrupt sources.

The documentation at https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md states that the setting enable_gic=0 or 1 can be used to select between the legacy and GIC interrupt controllers and that the GIC (enable_gic=1) is the default.

Testing however shows this is not completely correct, if no config.txt file exists and no device tree DTB files are present then the current firmware appears to enable the legacy interrupt controller by default.

If device tree DTB files containing a compatible GIC node are available on the SD card during boot the firmware will enable the GIC, this appears to happen regardless of the setting in config.txt and a value of enable_gic=0 will be ignored in favour of the device tree setting.

If the legacy interrupt controller is enabled and Ultibo configures the GIC controller during boot it will receive no interrupts and appear to hang (four color screen).

While it might be possible to read the SD card during boot, check for a config.txt and parse it to determine the value of the enable_gic setting, to be fully functional this process would also need to parse the device tree information (if available) and check for a compatible GIC node. Even then that doesn't account for booting from USB, network or some other source and all of that would have to happen very early in the boot sequence to be usable.

To make matters worse there doesn't appear to be a documented way to detect which interrupt controller is enabled by reading a register value, the GIC even behaves as though it is working when the legacy controller is enabled but no interrupts are received.

To ensure a level of reliability regardless of what firmware and files and configuration settings are present Ultibo implements drivers for both the GIC and legacy interrupt controllers and includes a detection mechanism during early stage boot.

In simple terms the boot process configures the GIC and then installs an interrupt handler for the generic virtual timer and configures the timer to fire in 1ms before enabling interrupts. It then waits 2ms and disables interrupts, unconfigures the timer and deregisters the interrupt handler.

If the test worked the local variable GICAvailable will have been set by the handler to RPI4_GIC_AVAILABLE, if not the variable will remain at RPI4_GIC_UNAVAILABLE and the boot process will proceed to configure the legacy interrupt controller for use.

This is not an ideal mechanism and could potentially fail for other reasons (although it is carefully constructed to avoid many potential failures) but at present is the best option for allowing the boot process to succeed regardless of the firmware behavior.

Constants



[Expand]
RPi ARM physical to VC IO mapping RPI4_VCIO_*


[Expand]
RPi ARM physical to VC bus mapping RPI4_VCBUS_*


[Expand]
RPi secure world boot RPI4_SECURE_*


[Expand]
RPi address of StartupHandler on reset RPI4_STARTUP_*


[Expand]
RPi page directory address and size RPI4_PAGE_DIRECTORY_*


[Expand]
RPi page table address and size RPI4_PAGE_TABLE_*


[Expand]
RPi vector table address and size RPI4_VECTOR_TABLE_*


[Expand]
RPi CPU count RPI4_CPU_*


[Expand]
RPi SWI RPI4_SWI_*


[Expand]
RPi interrupt RPI4_GIC_*


[Expand]
RPi core timer RPI4_CORE_TIMER_*


[Expand]
RPi kernel image name RPI4_KERNEL_*


[Expand]
RPi GPIO activity LED (GPIO Pin 42) RPI4_GPIO_ACTLED_*


[Expand]
RPi mailbox timeout RPI4_MAILBOX_TIMEOUT_*


[Expand]
RPi local mailbox RPI4_LOCAL_MAILBOX_*


[Expand]
RPi framebuffer RPI4_FRAMEBUFFER_*


Type definitions



RPi4 framebuffer

[Expand]

PRPi4Framebuffer = ^TRPi4Framebuffer;

TRPi4Framebuffer = record


Public variables



RPi4 specific Ultibo variables

RPi4Initialized:Boolean;
RPi4CNTVOFFLow:LongWord = 0; The low 32 bits of the Virtual Counter Offset register at boot time (CPU0 only) (Set by Startup) Must be initialized to remain in .data or else rewritten to zero with .bss
RPi4CNTVOFFHigh:LongWord = 0; The high 32 bits of the Virtual Counter Offset register at boot time (CPU0 only) (Set by Startup) Must be initialized to remain in .data or else rewritten to zero with .bss

Timer register

TimerRegisters:PBCM2838SystemTimerRegisters;

Mailbox register

Mailbox0Registers:PBCM2838Mailbox0Registers;
Mailbox1Registers:PBCM2838Mailbox1Registers;

Interrupt device

GICDevice:PGICDevice;
GICAvailable:LongWord = RPI4_GIC_AVAILABLE; The status of the GIC interrupt controller, determined during boot.

System call

SystemCallEntries:array[0..RPI4_SWI_COUNT - 1] of TSystemCallEntry;

Watchdog register

WatchdogRegisters:PBCM2838PMWatchdogRegisters;

ARM local register

ARMLocalRegisters:PBCM2838ARMLocalRegisters;

Virtual GPIO

VirtualGPIOBuffer:TBCM2838VirtualGPIOBuffer;


Function declarations



Initialization functions

[Expand]
procedure RPi4Init;
Description: To be documented


[Expand]
procedure RPi4SecondarySwitch;
Description: Secondary CPU switch from HYP mode handler


[Expand]
procedure RPi4SecondarySecure;
Description: Secondary CPU switch to secure mode handler


[Expand]
procedure RPi4SecondaryHandler;
Description: Secondary CPU startup handler routine


RPi4 platform functions

[Expand]
procedure RPi4SMPInit;
Description: To be documented


[Expand]
procedure RPi4BoardInit;
Description: To be documented


[Expand]
procedure RPi4MemoryInit;
Description: To be documented


[Expand]
procedure RPi4ClockInit;
Description: To be documented


[Expand]
procedure RPi4PowerInit;
Description: To be documented


[Expand]
procedure RPi4MailboxInit;
Description: To be documented


[Expand]
procedure RPi4InterruptInit;
Description: To be documented


[Expand]
procedure RPi4PeripheralInit;
Description: To be documented


[Expand]
procedure RPi4FramebufferInit;
Description: To be documented


[Expand]
procedure RPi4PageTableInit;
Description: Initialize the Hardware Page Tables before enabling the MMU (LPAE version)


[Expand]
procedure RPi4PageTableInitLegacy;
Description: Initialize the Hardware Page Tables before enabling the MMU (Legacy version)


[Expand]
procedure RPi4PowerLEDEnable;
Description: To be documented


[Expand]
procedure RPi4PowerLEDOn;
Description: To be documented


[Expand]
procedure RPi4PowerLEDOff;
Description: To be documented


[Expand]
procedure RPi4ActivityLEDEnable;
Description: To be documented


[Expand]
procedure RPi4ActivityLEDOn;
Description: To be documented


[Expand]
procedure RPi4ActivityLEDOff;
Description: To be documented


[Expand]
function RPi4MailboxReceive(Mailbox,Channel:LongWord):LongWord;
Description: Receive from specified mailbox on specified channel


[Expand]
procedure RPi4MailboxSend(Mailbox,Channel,Data:LongWord);
Description: Send to specified mailbox on specified channel


[Expand]
function RPi4MailboxCall(Mailbox,Channel,Data:LongWord; var Response:LongWord):LongWord;
Description: Perform a transaction (Send/Receive) to specified mailbox on specified channel


[Expand]
function RPi4MailboxCallEx(Mailbox,Channel,Data:LongWord; var Response:LongWord; Timeout:LongWord):LongWord;
Description: Perform a transaction (Send/Receive) to specified mailbox on specified channel


[Expand]
function RPi4MailboxPropertyCall(Mailbox,Channel:LongWord; Data:Pointer; var Response:LongWord):LongWord;
Description: Perform a property tag transaction (Send/Receive) to specified mailbox on specified channel


[Expand]
function RPi4MailboxPropertyCallEx(Mailbox,Channel:LongWord; Data:Pointer; var Response:LongWord; Timeout:LongWord):LongWord;
Description: Perform a property tag transaction (Send/Receive) to specified mailbox on specified channel


[Expand]
function RPi4MailboxPropertyTag(Tag:LongWord; Data:Pointer; Size:LongWord):LongWord;
Description: Request a property tag (Get/Set) from the mailbox property channel


[Expand]
function RPi4RequestExIRQ(CPUID,Number:LongWord; Handler:TInterruptHandler; HandlerEx:TInterruptExHandler; Parameter:Pointer):LongWord;
Description: Request registration of the supplied extended handler to the specified IRQ number


[Expand]
function RPi4ReleaseExIRQ(CPUID,Number:LongWord; Handler:TInterruptHandler; HandlerEx:TInterruptExHandler; Parameter:Pointer):LongWord;
Description: Request deregistration of the supplied extended handler from the specified IRQ number


[Expand]
function RPi4RequestExFIQ(CPUID,Number:LongWord; Handler:TInterruptHandler; HandlerEx:TInterruptExHandler; Parameter:Pointer):LongWord;
Description: Request registration of the supplied extended handler to the specified FIQ number


[Expand]
function RPi4ReleaseExFIQ(CPUID,Number:LongWord; Handler:TInterruptHandler; HandlerEx:TInterruptExHandler; Parameter:Pointer):LongWord;
Description: Request deregistration of the supplied extended handler from the specified FIQ number


[Expand]
function RPi4RequestIPI(CPUID,Number:LongWord; Handler:TIPIHandler; Parameter:Pointer):LongWord;
Description: Request registration of the supplied handler to the specified IPI number


[Expand]
function RPi4ReleaseIPI(CPUID,Number:LongWord; Handler:TIPIHandler; Parameter:Pointer):LongWord;
Description: Request deregistration of the supplied handler from the specified IPI number


[Expand]
function RPi4RegisterInterrupt(Number,Mask,Priority,Flags:LongWord; Handler:TSharedInterruptHandler; Parameter:Pointer):LongWord;
Description: Request registration of the supplied handler to the specified interrupt number (Where Applicable)


[Expand]
function RPi4DeregisterInterrupt(Number,Mask,Priority,Flags:LongWord; Handler:TSharedInterruptHandler; Parameter:Pointer):LongWord;
Description: Request deregistration of the supplied handler from the specified interrupt number (Where Applicable)


[Expand]
function RPi4RegisterSystemCallEx(CPUID,Number:LongWord; Handler:TSystemCallHandler; HandlerEx:TSystemCallExHandler):LongWord;
Description: Request registration of the supplied extended handler to the specified System Call number


[Expand]
function RPi4DeregisterSystemCallEx(CPUID,Number:LongWord; Handler:TSystemCallHandler; HandlerEx:TSystemCallExHandler):LongWord;
Description: Request deregistration of the supplied extended handler from the specified System Call number


[Expand]
function RPi4GetInterruptEntry(Number,Instance:LongWord; var Interrupt:TInterruptEntry):LongWord;
Description: Get the interrupt entry for the specified interrupt number and instance


[Expand]
function RPi4GetLocalInterruptEntry(CPUID,Number,Instance:LongWord; var Interrupt:TInterruptEntry):LongWord;
Description: Get the local interrupt entry for the specified interrupt number and instance


[Expand]
function RPi4GetSoftwareInterruptEntry(CPUID,Number,Instance:LongWord; var Interrupt:TInterruptEntry):LongWord;
Description: Get the software interrupt entry for the specified interrupt number and instance


[Expand]
function RPi4GetSystemCallEntry(Number:LongWord):TSystemCallEntry;
Description: Get the system call entry for the specified system call number


[Expand]
function RPi4SystemRestart(Delay:LongWord):LongWord;
Description: To be documented


[Expand]
function RPi4SystemShutdown(Delay:LongWord):LongWord;
Description: To be documented


[Expand]
function RPi4SystemGetCommandLine:String;
Description: Get the Command Line from the Mailbox property tags channel


[Expand]
function RPi4CPUGetMemory(var Address:PtrUInt; var Length:UInt64):LongWord;
Description: Get the CPU Memory from the Mailbox property tags channel


[Expand]
function RPi4GPUGetState:LongWord;
Description: To be documented


[Expand]
function RPi4GPUGetMemory(var Address:PtrUInt; var Length:UInt64):LongWord;
Description: Get the GPU Memory from the Mailbox property tags channel


[Expand]
function RPi4BoardGetModel:LongWord;
Description: Get the Board Model from the Mailbox property tags channel


[Expand]
function RPi4BoardGetSerial:Int64;
Description: Get the Board Serial from the Mailbox property tags channel


[Expand]
function RPi4BoardGetRevision:LongWord;
Description: Get the Board Revision from the Mailbox property tags channel


[Expand]
function RPi4BoardGetMACAddress:String;
Description: Get the Board MAC Address from the Mailbox property tags channel


[Expand]
function RPi4ChipGetRevision:LongWord;
Description: Get the Chip Revision from the revision register


[Expand]
function RPi4FirmwareGetRevision:LongWord;
Description: Get the Firmware Revision from the Mailbox property tags channel


[Expand]
function RPi4FirmwareGetThrottled:LongWord;
Description: Get the Firmware Throttling state from the Mailbox property tags channel


[Expand]
function RPi4PowerGetWait(PowerId:LongWord):LongWord;
Description: Get the Power Wait from the Mailbox property tags channel


[Expand]
function RPi4PowerGetState(PowerId:LongWord):LongWord;
Description: Get the Power State from the Mailbox property tags channel


[Expand]
function RPi4PowerSetState(PowerId,State:LongWord; Wait:Boolean):LongWord;
Description: Set the Power State in the Mailbox property tags channel


[Expand]
function RPi4ClockGetCount:LongWord;
Description: Gets the current system clock count (32 least significant bits of total)


[Expand]
function RPi4ClockGetTotal:Int64;
Description: Gets the total system clock count


[Expand]
function RPi4ClockGetRate(ClockId:LongWord):LongWord;
Description: Get the Clock Rate from the Mailbox property tags channel


[Expand]
function RPi4ClockSetRate(ClockId,Rate:LongWord; Turbo:Boolean):LongWord;
Description: Set the Clock Rate in the Mailbox property tags channel


[Expand]
function RPi4ClockGetState(ClockId:LongWord):LongWord;
Description: Get the Clock State from the Mailbox property tags channel


[Expand]
function RPi4ClockSetState(ClockId,State:LongWord):LongWord;
Description: Set the Clock State in the Mailbox property tags channel


[Expand]
function RPi4ClockGetMinRate(ClockId:LongWord):LongWord;
Description: Get the Clock Min Rate from the Mailbox property tags channel


[Expand]
function RPi4ClockGetMaxRate(ClockId:LongWord):LongWord;
Description: Get the Clock Max Rate from the Mailbox property tags channel


[Expand]
function RPi4TurboGetState(TurboId:LongWord):LongWord;
Description: Get the Turbo State from the Mailbox property tags channel


[Expand]
function RPi4TurboSetState(TurboId,State:LongWord):LongWord;
Description: Set the Turbo State in the Mailbox property tags channel


[Expand]
function RPi4VoltageGetValue(VoltageId:LongWord):LongWord;
Description: Get the Voltage Value from the Mailbox property tags channel


[Expand]
function RPi4VoltageSetValue(VoltageId,Value:LongWord):LongWord;
Description: Set the Voltage Value in the Mailbox property tags channel


[Expand]
function RPi4VoltageGetMinValue(VoltageId:LongWord):LongWord;
Description: Get the Voltage Min Value from the Mailbox property tags channel


[Expand]
function RPi4VoltageGetMaxValue(VoltageId:LongWord):LongWord;
Description: Get the Voltage Max Value from the Mailbox property tags channel


[Expand]
function RPi4TemperatureGetCurrent(TemperatureId:LongWord):LongWord;
Description: Get the Temperature Current from the Mailbox property tags channel


[Expand]
function RPi4TemperatureGetMaximum(TemperatureId:LongWord):LongWord;
Description: Get the Temperature Maximum Model from the Mailbox property tags channel


[Expand]
function RPi4GPUMemoryAllocate(Length,Alignment,Flags:LongWord):THandle;
Description: Allocate GPU Memory from the Mailbox property tags channel


[Expand]
function RPi4GPUMemoryRelease(Handle:THandle):LongWord;
Description: Release GPU Memory from the Mailbox property tags channel


[Expand]
function RPi4GPUMemoryLock(Handle:THandle):LongWord;
Description: Lock GPU Memory from the Mailbox property tags channel


[Expand]
function RPi4GPUMemoryUnlock(Handle:THandle):LongWord;
Description: Unlock GPU Memory from the Mailbox property tags channel


[Expand]
function RPi4GPUExecuteCode(Address:Pointer; R0,R1,R2,R3,R4,R5:LongWord):LongWord;
Description: Execute GPU Code from the Mailbox property tags channel


[Expand]
function RPi4DispmanxHandleGet(Resource:THandle):THandle;
Description: Get Dispmanx Memory Handle from the Mailbox property tags channel


[Expand]
function RPi4EDIDBlockGet(Block:LongWord; Buffer:Pointer; Length:LongWord):LongWord;
Description: Get EDID Block from the Mailbox property tags channel


[Expand]
function RPi4FramebufferAllocate(Alignment:LongWord; var Address,Length:LongWord):LongWord;
Description: Allocate Framebuffer from the Mailbox property tags channel


[Expand]
function RPi4FramebufferRelease:LongWord;
Description: Release Framebuffer from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetState(State:LongWord):LongWord;
Description: Set Framebuffer State (Blank Screen) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetDimensions(var Width,Height,Top,Bottom,Left,Right:LongWord):LongWord;
Description: Get Framebuffer Dimensions from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetPhysical(var Width,Height:LongWord):LongWord;
Description: Get Framebuffer Physical size from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetPhysical(var Width,Height:LongWord):LongWord;
Description: Set Framebuffer Physical size from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestPhysical(var Width,Height:LongWord):LongWord;
Description: Test Framebuffer Physical size from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetVirtual(var Width,Height:LongWord):LongWord;
Description: Get Framebuffer Virtual size from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetVirtual(var Width,Height:LongWord):LongWord;
Description: Set Framebuffer Virtual size from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestVirtual(var Width,Height:LongWord):LongWord;
Description: Test Framebuffer Virtual size from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetDepth(var Depth:LongWord):LongWord;
Description: Get Framebuffer Depth (Bits per pixel) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetDepth(var Depth:LongWord):LongWord;
Description: Set Framebuffer Depth (Bits per pixel) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestDepth(var Depth:LongWord):LongWord;
Description: Test Framebuffer Depth (Bits per pixel) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetPixelOrder(var Order:LongWord):LongWord;
Description: Get Framebuffer Pixel Order (RGB) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetPixelOrder(var Order:LongWord):LongWord;
Description: Set Framebuffer Pixel Order (RGB) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestPixelOrder(var Order:LongWord):LongWord;
Description: Test Framebuffer Pixel Order (RGB) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetAlphaMode(var Mode:LongWord):LongWord;
Description: Get Framebuffer Alpha Mode from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetAlphaMode(var Mode:LongWord):LongWord;
Description: Set Framebuffer Alpha Mode from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestAlphaMode(var Mode:LongWord):LongWord;
Description: Test Framebuffer Alpha Mode from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetPitch:LongWord;
Description: Get Framebuffer Pitch (Bytes per line) from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetOffset(var X,Y:LongWord):LongWord;
Description: Get Framebuffer Virtual Offset from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetOffset(var X,Y:LongWord):LongWord;
Description: Set Framebuffer Virtual Offset from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestOffset(var X,Y:LongWord):LongWord;
Description: Test Framebuffer Virtual Offset from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetOverscan(var Top,Bottom,Left,Right:LongWord):LongWord;
Description: Get Framebuffer Overscan from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetOverscan(var Top,Bottom,Left,Right:LongWord):LongWord;
Description: Set Framebuffer Overscan from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestOverscan(var Top,Bottom,Left,Right:LongWord):LongWord;
Description: Test Framebuffer Overscan from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetPalette(Buffer:Pointer;Length:LongWord):LongWord;
Description: Get Framebuffer Palette from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetPalette(Start,Count:LongWord; Buffer:Pointer; Length:LongWord):LongWord;
Description: Set Framebuffer Palette from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestPalette(Start,Count:LongWord; Buffer:Pointer; Length:LongWord):LongWord;
Description: Test Framebuffer Palette from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetLayer(var Layer:LongInt):LongWord;
Description: Get Framebuffer Layer from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetLayer(var Layer:LongInt):LongWord;
Description: Set Framebuffer Layer from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestLayer(var Layer:LongInt):LongWord;
Description: Test Framebuffer Layer from the Mailbox property tags channel


[Expand]
function RPi4FramebufferTestVsync:LongWord;
Description: Test Framebuffer Vertical Sync from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetVsync:LongWord;
Description: Set Framebuffer Vertical Sync from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetBacklight(Brightness:LongWord):LongWord;
Description: Set Framebuffer Backlight Brightness from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetNumDisplays(var NumDisplays:LongWord):LongWord;
Description: Get the number of displays from the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetDisplayId(DisplayNum:LongWord):LongWord;
Description: Get the display id for the specified display number from the Mailbox property tags channel


[Expand]
function RPi4FramebufferSetDisplayNum(DisplayNum:LongWord):LongWord;
Description: Get the display number that all framebuffer requests will refer to using the Mailbox property tags channel


[Expand]
function RPi4FramebufferGetDisplaySettings(DisplayNum:LongWord; var DisplaySettings:TDisplaySettings):LongWord;
Description: Get the display settings for the specified display number from the Mailbox property tags channel


[Expand]
function RPi4FramebufferDisplayIdToName(DisplayId:LongWord):String;
Description: Get the name for the specified display id


[Expand]
function RPi4TouchGetBuffer(var Address:PtrUInt):LongWord;
Description: Get the Touchscreen buffer from the Mailbox property tags channel


[Expand]
function RPi4TouchSetBuffer(Address:PtrUInt):LongWord;
Description: Set the Touchscreen buffer in the Mailbox property tags channel


[Expand]
function RPi4VirtualGPIOGetBuffer(var Address:PtrUInt):LongWord;
Description: Get the Virtual GPIO buffer from the Mailbox property tags channel


[Expand]
function RPi4VirtualGPIOSetBuffer(Address:PtrUInt):LongWord;
Description: Set the Virtual GPIO buffer in the Mailbox property tags channel


[Expand]
function RPi4CursorSetDefault:LongWord;
Description: Set Cursor Default (Pixels) from the Mailbox property tags channel


[Expand]
function RPi4CursorSetInfo(Width,Height,HotspotX,HotspotY:LongWord; Pixels:Pointer; Length:LongWord):LongWord;
Description: Set Cursor Info (Pixels) from the Mailbox property tags channel


[Expand]
function RPi4CursorSetState(Enabled:Boolean; X,Y:LongWord; Relative:Boolean):LongWord;
Description: Set Cursor State (Enable, X, Y) from the Mailbox property tags channel


[Expand]
function RPi4DMAGetChannels:LongWord;
Description: Get the available DMA Channels from the Mailbox property tags channel


[Expand]
function RPi4VirtualGPIOInputGet(Pin:LongWord):LongWord;
Description: To be documented


[Expand]
function RPi4VirtualGPIOOutputSet(Pin,Level:LongWord):LongWord;
Description: To be documented


[Expand]
function RPi4VirtualGPIOFunctionSelect(Pin,Mode:LongWord):LongWord;
Description: To be documented


RPi4 thread functions

[Expand]
procedure RPi4SchedulerInit;
Description: Initialize the scheduler interrupt on the boot CPU


[Expand]
procedure RPi4SchedulerStart(CPUID:LongWord);
Description: Initialize the scheduler interrupt on the specified secondary CPU


[Expand]
procedure RPi4SecondaryBoot(CPUID:LongWord);
Description: To be documented


RPi4 SWI functions

[Expand]
function RPi4DispatchSWI(CPUID:LongWord; Thread:TThreadHandle; Request:PSystemCallRequest):TThreadHandle;
Description: Process an SWI request


RPi4 clock functions

[Expand]
procedure RPi4ClockInterrupt(Parameter:Pointer);
Description: Interrupt handler function for the clock interrupt


[Expand]
procedure RPi4ClockUpdate(Cycles:LongWord; var Last:LongWord);
Description: Setup a clock interrupt to trigger after the specified number of clock cycles


RPi4 scheduler functions

[Expand]
function RPi4SchedulerInterrupt(CPUID:LongWord; Thread:TThreadHandle; Parameter:Pointer):TThreadHandle;
Description: Interrupt handler function for the scheduler interrupt


[Expand]
procedure RPi4SchedulerUpdate(Cycles:LongWord; var Last:LongWord);
Description: Setup a scheduler interrupt to trigger after the specified number of clock cycles


[Expand]
procedure RPi4SchedulerSystemCall(Request:PSystemCallRequest);
Description: System Call handler for the scheduler


RPi4 framebuffer functions

[Expand]
function RPi4FramebufferDeviceAllocate(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;
Description: Allocate a framebuffer using the Mailbox Property Tags


[Expand]
function RPi4FramebufferDeviceAllocateAlt(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;
Description: Allocate a framebuffer using a simple Mailbox Call


[Expand]
function RPi4FramebufferDeviceRelease(Framebuffer:PFramebufferDevice):LongWord;
Description: To be documented


[Expand]
function RPi4FramebufferDeviceBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
Description: To be documented


[Expand]
function RPi4FramebufferDeviceCommit(Framebuffer:PFramebufferDevice; Address:PtrUInt; Size,Flags:LongWord):LongWord;
Description: To be documented


[Expand]
function RPi4FramebufferDeviceSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;
Description: To be documented


RPi4 helper functions

[Expand]
procedure RPi4Wait;
Description: To be documented


[Expand]
procedure RPi4LongWait;
Description: To be documented


[Expand]
procedure RPi4ShortWait;
Description: To be documented


[Expand]
procedure RPi4SlowBlink;
Description: To be documented


[Expand]
procedure RPi4FastBlink;
Description: To be documented


[Expand]
procedure RPi4BootBlink;
Description: Blink the Activity LED without dependency on any other RTL setup


[Expand]
procedure RPi4BootOutput(Value:LongWord);
Description: Output characters to UART0 without dependency on any other RTL setup


[Expand]
procedure RPi4BootConsoleStart;
Description: To be documented


[Expand]
procedure RPi4BootConsoleWrite(const Value:String);
Description: To be documented


[Expand]
procedure RPi4BootConsoleWriteEx(const Value:String; X,Y:LongWord);
Description: To be documented


[Expand]
function RPi4BootConsoleGetX:LongWord;
Description: To be documented


[Expand]
function RPi4BootConsoleGetY:LongWord;
Description: To be documented


[Expand]
function RPi4ConvertPowerIdRequest(PowerId:LongWord):LongWord;
Description: Convert Ultibo Power Id to BCM2838 Power Id


[Expand]
function RPi4ConvertPowerStateRequest(PowerState:LongWord):LongWord;
Description: Convert Ultibo Power State to BCM2838 Power State


[Expand]
function RPi4ConvertPowerStateResponse(PowerState:LongWord):LongWord;
Description: Convert BCM2838 Power State to Ultibo Power State


[Expand]
function RPi4ConvertClockIdRequest(ClockId:LongWord):LongWord;
Description: Convert Ultibo Clock Id to BCM2838 Clock Id


[Expand]
function RPi4ConvertClockStateRequest(ClockState:LongWord):LongWord;
Description: Convert Ultibo Clock State to BCM2838 Clock State


[Expand]
function RPi4ConvertClockStateResponse(ClockState:LongWord):LongWord;
Description: Convert BCM2838 Clock State to Ultibo Clock State


[Expand]
function RPi4ConvertVoltageIdRequest(VoltageId:LongWord):LongWord;
Description: Convert Ultibo Voltage Id to BCM2838 Voltage Id


[Expand]
function RPi4ConvertTemperatureIdRequest(TemperatureId:LongWord):LongWord;
Description: Convert Ultibo Temperature Id to BCM2838 Temperature Id


Return to Unit Reference