Difference between revisions of "Unit Devices"

From Ultibo.org
Jump to: navigation, search
Line 24: Line 24:
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
 +
 +
 +
'''Initialization 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;">procedure DevicesInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the Devices unit and device, notifier and driver tables</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Called only during system startup
 +
|-
 +
|}
 +
</div></div>
 
<br />
 
<br />
 +
 
'''Device functions'''
 
'''Device functions'''
  

Revision as of 05:43, 25 August 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

procedure DevicesInit;
Description: Initialize the Devices unit and device, notifier and driver tables
Note Called only during system startup


Device functions

function function DeviceCreate:PDevice;
Description: Create a new Device entry
Return Pointer to new Device entry or nil if device could not be created


function DeviceCreateEx(Size:LongWord):PDevice;
Description: Create a new Device entry
Size Size in bytes to allocate for new device (Including the device entry)
Return Pointer to new Device entry or nil if device could not be created


function DeviceDestroy(Device:PDevice):LongWord;
Description: Destroy an existing Device entry
Note To be documented


function DeviceGetName(Device:PDevice):String;
Description: Get the name of the supplied Device
Note To be documented


function DeviceSetName(Device:PDevice; const Name:String):LongWord;
Description: Set the name of the supplied Device
Note To be documented


function DeviceGetDescription(Device:PDevice):String;
Description: Get the description of the supplied Device
Note To be documented


function DeviceSetDescription(Device:PDevice; const Description:String):LongWord;
Description: Set the description of the supplied Device
Note To be documented


function DeviceRegister(Device:PDevice):LongWord;
Description: Register a new Device in the Device table
Note To be documented


function DeviceDeregister(Device:PDevice):LongWord;
Description: Deregister a Device from the Device table
Note To be documented


function DeviceFind(DeviceClass,DeviceId:LongWord):PDevice;
Description: To be documented
Note To be documented


function DeviceFindByName(const Name:String):PDevice;
Description: To be documented
Note To be documented


function DeviceFindByDescription(const Description:String):PDevice;
Description: To be documented
Note To be documented


function DeviceEnumerate(DeviceClass:LongWord; Callback:TDeviceEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function DeviceNotification(Device:PDevice; DeviceClass:LongWord; Callback:TDeviceNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be documented


function NotifierAllocate(Device:PDevice; DeviceClass:LongWord; Callback:TDeviceNotification; Data:Pointer; Notification,Flags:LongWord):PNotifier;
Description: Create and Register a new Notifier entry in the Notifier table
Note To be documented


function NotifierRelease(Notifier:PNotifier):LongWord;
Description: Deregister and Destroy a Notifier from the Notifier table
Note To be documented


function NotifierFind(Device:PDevice; DeviceClass:LongWord; Callback:TDeviceNotification; Data:Pointer):PNotifier;
Description: To be documented
Note To be documented


function NotifierNotify(Device:PDevice; Notification:LongWord):LongWord;
Description: To be documented
Note To be documented


Driver functions

function DriverCreate:PDriver;
Description: Create a new Driver entry
Return Pointer to new Driver entry or nil if driver could not be created


function DriverCreateEx(Size:LongWord):PDriver;
Description: Create a new Driver entry
Size Size in bytes to allocate for new driver (Including the driver entry)
Return Pointer to new Driver entry or nil if driver could not be created


function DriverDestroy(Driver:PDriver):LongWord;
Description: Destroy an existing Driver entry
Note To be documented


function DriverGetName(Driver:PDriver):String;
Description: Get the name of the supplied Driver
Note To be documented


function DriverSetName(Driver:PDriver; const Name:String):LongWord;
Description: Set the name of the supplied Driver
Note To be documented


function DriverRegister(Driver:PDriver):LongWord;
Description: Register a new Driver in the Driver table
Note To be documented


function DriverDeregister(Driver:PDriver):LongWord;
Description: Deregister a Driver from the Driver table
Note To be documented


function DriverFind(DriverClass,DriverId:LongWord):PDriver;
Description: To be documented
Note To be documented


function DriverFindByName(const Name:String):PDriver;
Description: To be documented
Note To be documented


function DriverEnumerate(DriverClass:LongWord; Callback:TDriverEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


Clock device functions

function ClockDeviceStart(Clock:PClockDevice):LongWord;
Description: To be documented
Note To be documented


function ClockDeviceStop(Clock:PClockDevice):LongWord;
Description: To be documented
Note To be documented


function ClockDeviceRead(Clock:PClockDevice):LongWord;
Description: To be documented
Note To be documented


function ClockDeviceRead64(Clock:PClockDevice):Int64;
Description: To be documented
Note To be documented


function ClockDeviceGetRate(Clock:PClockDevice):LongWord;
Description: To be documented
Note To be documented


function ClockDeviceCreate:PClockDevice;
Description: Create a new Clock entry
Return Pointer to new Clock entry or nil if Clock could not be created


function ClockDeviceCreateEx(Size:LongWord):PClockDevice;
Description: Create a new Clock entry
Size Size in bytes to allocate for new Clock (Including the Clock entry)
Return Pointer to new Clock entry or nil if Clock could not be created


function ClockDeviceDestroy(Clock:PClockDevice):LongWord;
Description: Destroy an existing Clock entry
Note To be documented


function ClockDeviceRegister(Clock:PClockDevice):LongWord;
Description: Register a new Clock in the Clock table
Note To be documented


function ClockDeviceDeregister(Clock:PClockDevice):LongWord;
Description: Deregister a Clock from the Clock table
Note To be documented


function ClockDeviceFind(ClockId:LongWord):PClockDevice;
Description: To be documented
Note To be documented


function ClockDeviceFindByName(const Name:String):PClockDevice; inline;
Description: To be documented
Note To be documented


function ClockDeviceFindByDescription(const Description:String):PClockDevice; inline;
Description: To be documented
Note To be documented


function ClockDeviceEnumerate(Callback:TClockEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function ClockDeviceNotification(Clock:PClockDevice; Callback:TClockNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be documented


Timer device functions

function TimerDeviceStart(Timer:PTimerDevice):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceStop(Timer:PTimerDevice):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceRead(Timer:PTimerDevice):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceRead64(Timer:PTimerDevice):Int64;
Description: To be documented
Note To be documented


function TimerDeviceWait(Timer:PTimerDevice):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceEvent(Timer:PTimerDevice; Flags:LongWord; Callback:TTimerCallback; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceGetRate(Timer:PTimerDevice):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceSetRate(Timer:PTimerDevice; Rate:LongWord):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceGetInterval(Timer:PTimerDevice):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceSetInterval(Timer:PTimerDevice; Interval:LongWord):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceProperties(Timer:PTimerDevice; Properties:PTimerProperties):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceCreate:PTimerDevice;
Description: Create a new Timer entry
Return Pointer to new Timer entry or nil if Timer could not be created


function TimerDeviceCreateEx(Size:LongWord):PTimerDevice;
Description: Create a new Timer entry
Size Size in bytes to allocate for new Timer (Including the Timer entry)
Return Pointer to new Timer entry or nil if Timer could not be created


function TimerDeviceDestroy(Timer:PTimerDevice):LongWord;
Description: Destroy an existing Timer entry
Note To be documented


function TimerDeviceRegister(Timer:PTimerDevice):LongWord;
Description: Register a new Timer in the Timer table
Note To be documented


function TimerDeviceDeregister(Timer:PTimerDevice):LongWord;
Description: Deregister a Timer from the Timer table
Note To be documented


function TimerDeviceFind(TimerId:LongWord):PTimerDevice;
Description: To be documented
Note To be documented


function TimerDeviceFindByName(const Name:String):PTimerDevice; inline;
Description: To be documented
Note To be documented


function TimerDeviceFindByDescription(const Description:String):PTimerDevice; inline;
Description: To be documented
Note To be documented


function TimerDeviceEnumerate(Callback:TTimerEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function TimerDeviceNotification(Timer:PTimerDevice; Callback:TTimerNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be documented


Random device functions

function RandomDeviceStart(Random:PRandomDevice):LongWord;
Description: To be documented
Note To be documented


function RandomDeviceStop(Random:PRandomDevice):LongWord;
Description: To be documented
Note To be documented


function RandomDeviceSeed(Random:PRandomDevice; Seed:LongWord):LongWord;
Description: To be documented
Note To be documented


function RandomDeviceReadByte(Random:PRandomDevice):Byte;
Description: To be documented
Note To be documented


function RandomDeviceReadWord(Random:PRandomDevice):Word;
Description: To be documented
Note To be documented


function RandomDeviceReadLongWord(Random:PRandomDevice):LongWord;
Description: To be documented
Note To be documented


function RandomDeviceReadQuadWord(Random:PRandomDevice):Int64;
Description: To be documented
Note To be documented


function RandomDeviceReadExtended(Random:PRandomDevice):Extended;
Description: To be documented
Note To be documented


function RandomDeviceCreate:PRandomDevice;
Description: Create a new Random entry
Return Pointer to new Random entry or nil if Random could not be created


function RandomDeviceCreateEx(Size:LongWord):PRandomDevice;
Description: Create a new Random entry
Size Size in bytes to allocate for new Random (Including the Random entry)
Return Pointer to new Random entry or nil if Random could not be created


function RandomDeviceDestroy(Random:PRandomDevice):LongWord;
Description: Destroy an existing Random entry
Note To be documented


function RandomDeviceRegister(Random:PRandomDevice):LongWord;
Description: Register a new Random in the Random table
Note To be documented


function RandomDeviceDeregister(Random:PRandomDevice):LongWord;
Description: Deregister a Random from the Random table
Note To be documented


function RandomDeviceFind(RandomId:LongWord):PRandomDevice;
Description: To be documented
Note To be documented


function RandomDeviceFindByName(const Name:String):PRandomDevice; inline;
Description: To be documented
Note To be documented


function RandomDeviceFindByDescription(const Description:String):PRandomDevice; inline;
Description: To be documented
Note To be documented


function RandomDeviceEnumerate(Callback:TRandomEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function RandomDeviceNotification(Random:PRandomDevice; Callback:TRandomNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be documented


Mailbox device functions

function MailboxDeviceStart(Mailbox:PMailboxDevice):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceStop(Mailbox:PMailboxDevice):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceReceive(Mailbox:PMailboxDevice; Channel:LongWord):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceSend(Mailbox:PMailboxDevice; Channel,Data:LongWord):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceCall(Mailbox:PMailboxDevice; Channel,Data:LongWord; var Response:LongWord):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceGetTimeout(Mailbox:PMailboxDevice):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceSetTimeout(Mailbox:PMailboxDevice; Timeout:LongWord):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceCreate:PMailboxDevice;
Description: Create a new Mailbox entry
Return Pointer to new Mailbox entry or nil if Mailbox could not be created


function MailboxDeviceCreateEx(Size:LongWord):PMailboxDevice;
Description: Create a new Mailbox entry
Size Size in bytes to allocate for new Mailbox (Including the Mailbox entry)
Return Pointer to new Mailbox entry or nil if Mailbox could not be created


function MailboxDeviceDestroy(Mailbox:PMailboxDevice):LongWord;
Description: Destroy an existing Mailbox entry
Note To be documented


function MailboxDeviceRegister(Mailbox:PMailboxDevice):LongWord;
Description: Register a new Mailbox in the Mailbox table
Note To be documented


function MailboxDeviceDeregister(Mailbox:PMailboxDevice):LongWord;
Description: Deregister a Mailbox from the Mailbox table
Note To be documented


function MailboxDeviceFind(MailboxId:LongWord):PMailboxDevice;
Description: To be documented
Note To be documented


function MailboxDeviceFindByName(const Name:String):PMailboxDevice; inline;
Description: To be documented
Note To be documented


function MailboxDeviceFindByDescription(const Description:String):PMailboxDevice; inline;
Description: To be documented
Note To be documented


function MailboxDeviceEnumerate(Callback:TMailboxEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function MailboxDeviceNotification(Mailbox:PMailboxDevice; Callback:TMailboxNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be documented


Watchdog device functions

function WatchdogDeviceStart(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceStop(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceRefresh(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceGetRemain(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceGetTimeout(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceSetTimeout(Watchdog:PWatchdogDevice; Timeout:LongWord):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceCreate:PWatchdogDevice;
Description: Create a new Watchdog entry
Return Pointer to new Watchdog entry or nil if Watchdog could not be created


function WatchdogDeviceCreateEx(Size:LongWord):PWatchdogDevice;
Description: Create a new Watchdog entry
Size Size in bytes to allocate for new Watchdog (Including the Watchdog entry)
Return Pointer to new Watchdog entry or nil if Watchdog could not be created


function WatchdogDeviceDestroy(Watchdog:PWatchdogDevice):LongWord;
Description: Destroy an existing Watchdog entry
Note To be documented


function WatchdogDeviceRegister(Watchdog:PWatchdogDevice):LongWord;
Description: Register a new Watchdog in the Watchdog table
Note To be documented


function WatchdogDeviceDeregister(Watchdog:PWatchdogDevice):LongWord;
Description: Deregister a Watchdog from the Watchdog table
Note To be documented


function WatchdogDeviceFind(WatchdogId:LongWord):PWatchdogDevice;
Description: To be documented
Note To be documented


function WatchdogDeviceFindByName(const Name:String):PWatchdogDevice; inline;
Description: To be documented
Note To be documented


function WatchdogDeviceFindByDescription(const Description:String):PWatchdogDevice; inline;
Description: To be documented
Note To be documented


function WatchdogDeviceEnumerate(Callback:TWatchdogEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note To be documented


function WatchdogDeviceNotification(Watchdog:PWatchdogDevice; Callback:TWatchdogNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note To be documented


RTL clock functions

function SysClockRead:LongWord;
Description: To be documented
Note To be documented


function SysClockRead64:Int64;
Description: To be documented
Note To be documented


RTL timer (counter) functions

function SysTimerAvailable:Boolean;
Description: Check if a timer device is available
Note To be documented


function SysTimerRead:LongWord;
Description: Read the current value of the default counter
Return The 32 bit current value of the current or 0 on failure


function SysTimerRead64:Int64;
Description: Read the current value of the default counter
Return The 64 bit current value of the current or 0 on failure


function SysTimerWait:LongWord;
Description: Wait for the current interval to expire on the default counter
Return ERROR_SUCCESS if the interval expired or another error code on failure


function SysTimerEvent(Callback:TTimerCallback; Data:Pointer):LongWord;
Description: Schedule a function to be called when the current interval expires on the default counter
Callback The function to be called when the interval expires
Data A pointer to be pass to the function when the interval expires (Optional)
Return ERROR_SUCCESS if the callback was scheduled successfully or another error code on failure


function SysTimerGetRate:LongWord;
Description: Get the current clock rate in Hz of the default counter
Return The current clock rate in Hz or 0 on failure


function SysTimerSetRate(Rate:LongWord):LongWord;
Description: Set the current clock rate in Hz of the default counter
Rate The clock rate in Hz to set
Return ERROR_SUCCESS if the clock rate was set or another error code on failure


function SysTimerGetInterval:LongWord;
Description: Get the current interval in milliseconds of the default counter
Return The current interval in milliseconds or 0 on failure (or not set)


function SysTimerSetInterval(Interval:LongWord):LongWord;
Description: Set the current interval in milliseconds of the default counter
Interval The interval in milliseconds to set
Return ERROR_SUCCESS if the interval was set or another error code on failure


RTL random functions

function SysRandomAvailable:Boolean;
Description: Check if a random (RNG) device is available
Note To be documented


procedure SysRandomize;
Description: To be documented
Note To be documented


procedure SysRandomSeed(Seed:LongWord);
Description: To be documented
Note To be documented


function SysRandomReadLongInt(Limit:LongInt):LongInt;
Description: To be documented
Note To be documented


function SysRandomReadInt64(Limit:Int64):Int64;
Description: To be documented
Note To be documented


function SysRandomReadExtended:Extended;
Description: To be documented
Note To be documented


RTL watchdog functions

function SysWatchdogAvailable:Boolean;
Description: Check if a watchdog timer device is available
Note To be documented


function SysWatchdogStart(Milliseconds:LongWord):LongWord; 
Description: To be documented
Note To be documented


function SysWatchdogStop:LongWord;
Description: To be documented
Note To be documented


function SysWatchdogRefresh(Milliseconds:LongWord):LongWord;
Description: To be documented
Note To be documented


Device helper functions

function DeviceGetCount:LongWord; inline;
Description: Get the current device count
Note To be documented


function DeviceCheck(Device:PDevice):PDevice;
Description: Check if the supplied Device is in the device table
Note To be documented


function NotifierGetCount:LongWord; inline;
Description: Get the current notifier count
Note To be documented


function NotifierCheck(Notifier:PNotifier):PNotifier;
Description: Check if the supplied Notifier is in the notifier table
Note To be documented


function DeviceBusToString(DeviceBus:LongWord):String;
Description: To be documented
Note To be documented


function DeviceStateToString(DeviceState:LongWord):String;
Description: To be documented
Note To be documented


function DeviceClassToString(DeviceClass:LongWord):String;
Description: To be documented
Note To be documented


function NotificationToString(Notification:LongWord):String;
Description: To be documented
Note To be documented


procedure DeviceLog(Level:LongWord; Device:PDevice; const AText:String);
Description: To be documented
Note To be documented


procedure DeviceLogInfo(Device:PDevice; const AText:String);
Description: To be documented
Note To be documented


procedure DeviceLogError(Device:PDevice; const AText:String);
Description: To be documented
Note To be documented


procedure DeviceLogDebug(Device:PDevice; const AText:String);
Description: To be documented
Note To be documented


Driver helper functions

function DriverGetCount:LongWord; inline;
Description: Get the current driver count
Note To be documented


function DriverCheck(Driver:PDriver):PDriver;
Description: Check if the supplied Driver is in the driver table
Note To be documented


function DriverStateToString(DriverState:LongWord):String;
Description: To be documented
Note To be documented


function DriverClassToString(DriverClass:LongWord):String;
Description: To be documented
Note To be documented


Clock device helper functions

function ClockDeviceGetCount:LongWord; inline;
Description: Get the current clock device count
Note To be documented


function ClockDeviceGetDefault:PClockDevice; inline;
Description: Get the current default clock device
Note To be documented


function ClockDeviceSetDefault(Clock:PClockDevice):LongWord;
Description: Set the current default clock device
Note To be documented


function ClockDeviceCheck(Clock:PClockDevice):PClockDevice;
Description: Check if the supplied Clock is in the Clock table
Note To be documented


Timer device helper functions

function TimerDeviceGetCount:LongWord; inline;
Description: Get the current timer device count
Note To be documented


function TimerDeviceGetDefault:PTimerDevice; inline;
Description: Get the current default timer device
Note To be documented


function TimerDeviceSetDefault(Timer:PTimerDevice):LongWord; 
Description: Set the current default timer device
Note To be documented


function TimerDeviceCheck(Timer:PTimerDevice):PTimerDevice;
Description: Check if the supplied Timer is in the Timer table
Note To be documented


Random device helper functions

function RandomDeviceGetCount:LongWord; inline;
Description: Get the current random device count
Note To be documented


function RandomDeviceGetDefault:PRandomDevice; inline;
Description: Get the current default random device
Note To be documented


function RandomDeviceSetDefault(Random:PRandomDevice):LongWord;
Description: Set the current default random device
Note To be documented


function RandomDeviceCheck(Random:PRandomDevice):PRandomDevice;
Description: Check if the supplied Random is in the Random table
Note To be documented


Mailbox device helper functions

function MailboxDeviceGetCount:LongWord; inline;
Description: Get the current mailbox device count
Note To be documented


function MailboxDeviceGetDefault:PMailboxDevice; inline;
Description: Get the current default mailbox device
Note To be documented


function MailboxDeviceSetDefault(Mailbox:PMailboxDevice):LongWord; 
Description: Set the current default mailbox device
Note To be documented


function MailboxDeviceCheck(Mailbox:PMailboxDevice):PMailboxDevice;
Description: Check if the supplied Mailbox is in the Mailbox table
Note To be documented


Watchdog device helper functions

function WatchdogDeviceGetCount:LongWord; inline;
Description: Get the current watchdog device count
Note To be documented


function WatchdogDeviceGetDefault:PWatchdogDevice; inline;
Description: Get the current default watchdog device
Note To be documented


function WatchdogDeviceSetDefault(Watchdog:PWatchdogDevice):LongWord;
Description: Set the current default watchdog device
Note To be documented


function WatchdogDeviceCheck(Watchdog:PWatchdogDevice):PWatchdogDevice;
Description: Check if the supplied Watchdog is in the Watchdog table
Note To be documented


Return to Unit Reference