Difference between revisions of "Unit Threads"

From Ultibo.org
Jump to: navigation, search
Line 216: Line 216:
 
! '''Note'''
 
! '''Note'''
 
| To be documented
 
| To be documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''Spin functions'''
 +
 +
<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 SpinCreate:TSpinHandle;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and insert a new Spin entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Return'''
 +
| Handle of new Spin entry or INVALID_HANDLE_VALUE if entry could not be created
 +
|-
 +
|}
 +
</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 SpinCreateEx(InitialOwner:Boolean):TSpinHandle;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and insert a new Spin entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''InitialOwner'''
 +
| If true set the state of the spin to locked and the owner to the current thread
 +
|-
 +
! '''Return'''
 +
| Handle of new Spin entry or INVALID_HANDLE_VALUE if entry could not be created
 +
|-
 +
|}
 +
</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 SpinDestroy(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy and remove an existing Spin entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to destroy
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinOwner(Spin:TSpinHandle):TThreadHandle;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current owner of an existing Spin entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to get owner for
 +
|-
 +
! '''Return'''
 +
| Handle of owning thread or INVALID_HANDLE_VALUE if not currently owned
 +
|-
 +
|}
 +
</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 SpinLock(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Lock an existing Spin entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to lock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinUnlock(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unlock an existing Spin entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to unlock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinLockIRQ(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Lock an existing Spin entry, disable IRQ and save the previous IRQ state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to lock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinUnlockIRQ(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unlock an existing Spin entry and restore the previous IRQ state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to unlock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinLockFIQ(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Lock an existing Spin entry, disable FIQ and save the previous FIQ state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to lock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinUnlockFIQ(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unlock an existing Spin entry and restore the previous FIQ state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to unlock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinLockIRQFIQ(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Lock an existing Spin entry, disable IRQ and FIQ and save the previous IRQ and FIQ state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to lock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinUnlockIRQFIQ(Spin:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unlock an existing Spin entry and restore the previous IRQ and FIQ state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to unlock
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</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 SpinCheckIRQ(Spin:TSpinHandle):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the mask that stores the previous IRQ state to determine if IRQ is enabled</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to check
 +
|-
 +
! '''Return'''
 +
| True if the mask would enable IRQ on restore, False if it would not
 +
|-
 +
! '''Note'''
 +
| The Spin entry must be locked by the current thread
 +
|-
 +
|}
 +
</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 SpinCheckFIQ(Spin:TSpinHandle):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the mask that stores the previous FIQ state to determine if FIQ is enabled</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin'''
 +
| Handle of Spin entry to check
 +
|-
 +
! '''Return'''
 +
| True if the mask would enable FIQ on restore, False if it would not
 +
|-
 +
! '''Note'''
 +
| The Spin entry must be locked by the current thread
 +
|-
 +
|}
 +
</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 SpinExchangeIRQ(Spin1,Spin2:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Exchange the previous IRQ state between two Spin entries</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin1'''
 +
| Handle of first Spin entry
 +
|-
 +
! '''Spin2'''
 +
| Handle of second Spin entry
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! '''Note'''
 +
| Both Spin entries must be locked by the current thread
 +
|-
 +
|}
 +
</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 SpinExchangeFIQ(Spin1,Spin2:TSpinHandle):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Exchange the previous FIQ state between two Spin entries</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Spin1'''
 +
| Handle of first Spin entry
 +
|-
 +
! '''Spin2'''
 +
| Handle of second Spin entry
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! '''Note'''
 +
| Both Spin entries must be locked by the current thread
 
|-
 
|-
 
|}
 
|}

Revision as of 01:19, 9 September 2016

Return to Unit Reference


Description


To be documented

Constants


To be documented

Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

[Expand]
procedure LocksInit;
Description: Initialize Locks


[Expand]
procedure ThreadsInit;
Description: Initialize Threading


[Expand]
procedure PrimaryInit;
Description: Initialize the primary CPU


[Expand]
procedure SchedulerInit;
Description: Initialize the thread scheduler


[Expand]
procedure SchedulerStart(CPUID:LongWord);
Description: Initialize the thread scheduler for secondary CPUs (Where Applicable)


[Expand]
procedure SecondaryInit;
Description: Initialize the secondary CPUs (Where Applicable)


[Expand]
procedure SecondaryBoot(CPUID:LongWord);
Description: Boot the specified secondary CPU (Where Applicable)


[Expand]
procedure SecondaryStart(CPUID:LongWord);
Description: Startup procedure for secondary CPUs (Where Applicable)


[Expand]
function IRQExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function FIQExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function SWIExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function IdleExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function MainExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function TimerExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function WorkerExecute(Parameter:Pointer):PtrInt;
Description: To be documented


[Expand]
function IdleCalibrate:LongWord;
Description: Calibrate the idle thread loop by counting the number of loops in 100ms


Spin functions

[Expand]
function SpinCreate:TSpinHandle;
Description: Create and insert a new Spin entry


[Expand]
function SpinCreateEx(InitialOwner:Boolean):TSpinHandle;
Description: Create and insert a new Spin entry


[Expand]
function SpinDestroy(Spin:TSpinHandle):LongWord;
Description: Destroy and remove an existing Spin entry


[Expand]
function SpinOwner(Spin:TSpinHandle):TThreadHandle;
Description: Get the current owner of an existing Spin entry


[Expand]
function SpinLock(Spin:TSpinHandle):LongWord;
Description: Lock an existing Spin entry


[Expand]
function SpinUnlock(Spin:TSpinHandle):LongWord;
Description: Unlock an existing Spin entry


[Expand]
function SpinLockIRQ(Spin:TSpinHandle):LongWord;
Description: Lock an existing Spin entry, disable IRQ and save the previous IRQ state


[Expand]
function SpinUnlockIRQ(Spin:TSpinHandle):LongWord;
Description: Unlock an existing Spin entry and restore the previous IRQ state


[Expand]
function SpinLockFIQ(Spin:TSpinHandle):LongWord;
Description: Lock an existing Spin entry, disable FIQ and save the previous FIQ state


[Expand]
function SpinUnlockFIQ(Spin:TSpinHandle):LongWord;
Description: Unlock an existing Spin entry and restore the previous FIQ state


[Expand]
function SpinLockIRQFIQ(Spin:TSpinHandle):LongWord;
Description: Lock an existing Spin entry, disable IRQ and FIQ and save the previous IRQ and FIQ state


[Expand]
function SpinUnlockIRQFIQ(Spin:TSpinHandle):LongWord;
Description: Unlock an existing Spin entry and restore the previous IRQ and FIQ state


[Expand]
function SpinCheckIRQ(Spin:TSpinHandle):Boolean;
Description: Check the mask that stores the previous IRQ state to determine if IRQ is enabled


[Expand]
function SpinCheckFIQ(Spin:TSpinHandle):Boolean;
Description: Check the mask that stores the previous FIQ state to determine if FIQ is enabled


[Expand]
function SpinExchangeIRQ(Spin1,Spin2:TSpinHandle):LongWord;
Description: Exchange the previous IRQ state between two Spin entries


[Expand]
function SpinExchangeFIQ(Spin1,Spin2:TSpinHandle):LongWord;
Description: Exchange the previous FIQ state between two Spin entries


Return to Unit Reference