Unit RTC

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Ultibo Real Time Clock Device Interface unit

The RTC unit provides the device interface for real time clock modules to be registered with Ultibo core. Each RTC module requires a driver that communicates with the specific hardware to implement the device interface although many devices may use the same chip and will be covered by a single driver.

This unit registers the RTCGetTime and RTCSetTime functions with the Platform unit to enable hardware independent access to a real time clock module.

Constants



[Expand]
RTC specific constants RTC_*


[Expand]
RTC device type RTC_TYPE_*


[Expand]
RTC device state RTC_STATE_*


[Expand]
RTC device flag RTC_FLAG_*


[Expand]
RTC logging RTC_LOG_*


Type definitions



RTC properties

[Expand]

PRTCProperties = ^TRTCProperties;

TRTCProperties = record

RTC enumeration callback

TRTCEnumerate = function(RTC:PRTCDevice; Data:Pointer):LongWord;

RTC notification callback

TRTCNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

RTC device start

TRTCDeviceStart = function(RTC:PRTCDevice):LongWord;

RTC device stop

TRTCDeviceStop = function(RTC:PRTCDevice):LongWord;

RTC device get time

TRTCDeviceGetTime = function(RTC:PRTCDevice):Int64;

RTC device set time

TRTCDeviceSetTime = function(RTC:PRTCDevice; const Time:Int64):Int64;

RTC device get properties

TRTCDeviceGetProperties = function(RTC:PRTCDevice; Properties:PRTCProperties):LongWord;

RTC device

[Expand]

PRTCDevice = ^TRTCDevice;

TRTCDevice = record


Public variables



RTC logging

RTC_DEFAULT_LOG_LEVEL:LongWord = RTC_LOG_LEVEL_DEBUG; Minimum level for RTC messages. Only messages with level greater than or equal to this will be printed.
RTC_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

[Expand]
procedure RTCInit;
Description: To be documented


RTC functions

[Expand]
function RTCDeviceStart(RTC:PRTCDevice):LongWord;
Description: To be documented


[Expand]
function RTCDeviceStop(RTC:PRTCDevice):LongWord;
Description: To be documented


[Expand]
function RTCDeviceGetTime(RTC:PRTCDevice):Int64;
Description: To be documented


[Expand]
function RTCDeviceSetTime(RTC:PRTCDevice; const Time:Int64):Int64;
Description: To be documented


[Expand]
function RTCDeviceProperties(RTC:PRTCDevice; Properties:PRTCProperties):LongWord; inline;
Description: Get the properties for the specified RTC device


[Expand]
function RTCDeviceGetProperties(RTC:PRTCDevice;Properties:PRTCProperties):LongWord;
Description: Get the properties for the specified RTC device


[Expand]
function RTCDeviceCreate:PRTCDevice;
Description: Create a new RTC entry


[Expand]
function RTCDeviceCreateEx(Size:LongWord):PRTCDevice;
Description: Create a new RTC entry


[Expand]
function RTCDeviceDestroy(RTC:PRTCDevice):LongWord;
Description: Destroy an existing RTC entry


[Expand]
function RTCDeviceRegister(RTC:PRTCDevice):LongWord;
Description: Register a new RTC in the RTC table


[Expand]
function RTCDeviceDeregister(RTC:PRTCDevice):LongWord;
Description: Deregister a RTC from the RTC table


[Expand]
function RTCDeviceFind(RTCId:LongWord):PRTCDevice;
Description: To be documented


[Expand]
function RTCDeviceFindByName(const Name:String):PRTCDevice; inline;
Description: To be documented


[Expand]
function RTCDeviceFindByDescription(const Description:String):PRTCDevice; inline;
Description: To be documented


[Expand]
function RTCDeviceEnumerate(Callback:TRTCEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function RTCDeviceNotification(RTC:PRTCDevice; Callback:TRTCNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


RTL RTC functions

[Expand]
function SysRTCAvailable:Boolean;
Description: Check if an RTC device is available


[Expand]
function SysRTCGetTime:Int64;
Description: Get the current time from a RTC device


[Expand]
function SysRTCSetTime(const Time:Int64):Int64;
Description: Set the current time for a RTC device


RTC helper functions

[Expand]
function RTCGetCount:LongWord;
Description: Get the current RTC count


[Expand]
function RTCDeviceGetDefault:PRTCDevice;
Description: Get the current default RTC device


[Expand]
function RTCDeviceSetDefault(RTC:PRTCDevice):LongWord;
Description: Set the current default RTC device


[Expand]
function RTCDeviceCheck(RTC:PRTCDevice):PRTCDevice;
Description: Check if the supplied RTC is in the RTC table


[Expand]
function RTCDeviceTypeToString(RTCType:LongWord):String;
Description: To be documented


[Expand]
function RTCDeviceStateToString(RTCState:LongWord):String;
Description: To be documented


[Expand]
function RTCTimeIsValid(const Time:TSystemTime):Boolean;
Description: To be documented


[Expand]
function RTCSystemTimeToFileTime(const SystemTime:TSystemTime; var FileTime:Int64):Boolean;
Description: System time is assumed to be UTC and returned file time is UTC


[Expand]
function RTCFileTimeToSystemTime(const FileTime:Int64; var SystemTime:TSystemTime):Boolean;
Description: File time is assumed to be UTC and returned system time is UTC


[Expand]
procedure RTCLog(Level:LongWord; RTC:PRTCDevice; const AText:String);
Description: To be documented


[Expand]
procedure RTCLogInfo(RTC:PRTCDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure RTCLogWarn(RTC:PRTCDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure RTCLogError(RTC:PRTCDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure RTCLogDebug(RTC:PRTCDevice; const AText:String); inline;
Description: To be documented


Return to Unit Reference