Difference between revisions of "Unit RTC"
Line 92: | Line 92: | ||
---- | ---- | ||
− | '' | + | |
+ | '''RTC properties''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRTCProperties = ^TRTCProperties;</code> | ||
+ | |||
+ | <code>TRTCProperties = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | Device flags (eg RTC_FLAG_ALARM) | ||
+ | |- | ||
+ | | <code>MinTime:Int64;</code> | ||
+ | | Minimum time value represented by the device (Normally the power on reset value) | ||
+ | |- | ||
+ | | <code>MaxTime:Int64;</code> | ||
+ | | Maximum time value represented by the device (Time when a rollover will occur) | ||
+ | |- | ||
+ | | <code>AlarmCount:LongWord;</code> | ||
+ | | Number of alarms supported by the device (0 if not supported) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''RTC enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCEnumerate = function(RTC:PRTCDevice; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC device start''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCDeviceStart = function(RTC:PRTCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC device stop''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCDeviceStop = function(RTC:PRTCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC device get time''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCDeviceGetTime = function(RTC:PRTCDevice):Int64;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC device set time''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCDeviceSetTime = function(RTC:PRTCDevice; const Time:Int64):Int64;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC device properties''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TRTCDeviceProperties = function(RTC:PRTCDevice; Properties:PRTCProperties):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''RTC device''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRTCDevice = ^TRTCDevice;</code> | ||
+ | |||
+ | <code>TRTCDevice = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this RTC | ||
+ | |- | ||
+ | |colspan="2"|''RTC Properties'' | ||
+ | |- | ||
+ | | <code>RTCId:LongWord;</code> | ||
+ | | Unique Id of this RTC in the RTC table | ||
+ | |- | ||
+ | | <code>RTCState:LongWord;</code> | ||
+ | | RTC state (eg RTC_STATE_ENABLED) | ||
+ | |- | ||
+ | | <code>DeviceStart:TRTCDeviceStart;</code> | ||
+ | | A Device specific DeviceStart method implementing the standard RTC device interface | ||
+ | |- | ||
+ | | <code>DeviceStop:TRTCDeviceStop;</code> | ||
+ | | A Device specific DeviceStop method implementing the standard RTC device interface | ||
+ | |- | ||
+ | | <code>DeviceGetTime:TRTCDeviceGetTime;</code> | ||
+ | | A Device specific DeviceGetTime method implementing the standard RTC device interface | ||
+ | |- | ||
+ | | <code>DeviceSetTime:TRTCDeviceSetTime;</code> | ||
+ | | A Device specific DeviceSetTime method implementing the standard RTC device interface | ||
+ | |- | ||
+ | | <code>DeviceProperties:TRTCDeviceProperties;</code> | ||
+ | | A Device specific DeviceProperties method implementing the standard RTC device interface | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>GetCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SetCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Device lock | ||
+ | |- | ||
+ | | <code>Properties:TRTCProperties;</code> | ||
+ | | Device properties | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PRTCDevice;</code> | ||
+ | | Previous entry in RTC table | ||
+ | |- | ||
+ | | <code>Next:PRTCDevice;</code> | ||
+ | | Next entry in RTC table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 03:16, 25 January 2017
Return to Unit Reference
Contents
[hide]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
RTC_*
RTC_TYPE_*
RTC_STATE_*
RTC_FLAG_*
RTC_LOG_*
Type definitions
RTC properties
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 properties
TRTCDeviceProperties = function(RTC:PRTCDevice; Properties:PRTCProperties):LongWord;
|
RTC device
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
RTC functions
function RTCDeviceSetTime(RTC:PRTCDevice; const Time:Int64):Int64;
function RTCDeviceProperties(RTC:PRTCDevice; Properties:PRTCProperties):LongWord;
function RTCDeviceDestroy(RTC:PRTCDevice):LongWord;
function RTCDeviceRegister(RTC:PRTCDevice):LongWord;
function RTCDeviceDeregister(RTC:PRTCDevice):LongWord;
function RTCDeviceFindByName(const Name:String):PRTCDevice; inline;
function RTCDeviceFindByDescription(const Description:String):PRTCDevice; inline;
function RTCDeviceEnumerate(Callback:TRTCEnumerate; Data:Pointer):LongWord;
function RTCDeviceNotification(RTC:PRTCDevice; Callback:TRTCNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
RTL RTC functions
function SysRTCSetTime(const Time:Int64):Int64;
RTC helper functions
function RTCDeviceGetDefault:PRTCDevice; inline;
function RTCDeviceSetDefault(RTC:PRTCDevice):LongWord;
function RTCDeviceCheck(RTC:PRTCDevice):PRTCDevice;
function RTCSystemTimeToFileTime(const SystemTime:TSystemTime; var FileTime:Int64):Boolean;
function RTCFileTimeToSystemTime(const FileTime:Int64; var SystemTime:TSystemTime):Boolean;
procedure RTCLog(Level:LongWord; RTC:PRTCDevice; const AText:String);
procedure RTCLogInfo(RTC:PRTCDevice; const AText:String); inline;
procedure RTCLogError(RTC:PRTCDevice; const AText:String); inline;
procedure RTCLogDebug(RTC:PRTCDevice; const AText:String); inline;
Return to Unit Reference