Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
rtc.h File Reference

Go to the source code of this file.

Data Structures

struct  _RTC_PROPERTIES
struct  _RTC_DEVICE

Macros

#define RTC_NAME_PREFIX   "RTC"
 Name prefix for RTC Devices.
#define RTC_TYPE_NONE   0
#define RTC_TYPE_MAX   0
#define RTC_STATE_DISABLED   0
#define RTC_STATE_ENABLED   1
#define RTC_STATE_MAX   1
#define RTC_FLAG_NONE   0x00000000
#define RTC_FLAG_ALARM   0x00000001
 Device supports one or more alarms.
#define RTC_FLAG_WATCHDOG   0x00000002
 Device has a watchdog timer function.

Typedefs

typedef struct _RTC_PROPERTIES RTC_PROPERTIES
typedef struct _RTC_DEVICE RTC_DEVICE
typedef uint32_t STDCALL(* rtc_enumerate_cb) (RTC_DEVICE *rtc, void *data)
typedef uint32_t STDCALL(* rtc_notification_cb) (DEVICE *device, void *data, uint32_t notification)
typedef uint32_t STDCALL(* rtc_device_start_proc) (RTC_DEVICE *rtc)
typedef uint32_t STDCALL(* rtc_device_stop_proc) (RTC_DEVICE *rtc)
typedef int64_t STDCALL(* rtc_device_get_time_proc) (RTC_DEVICE *rtc)
typedef int64_t STDCALL(* rtc_device_set_time_proc) (RTC_DEVICE *rtc, int64_t time)
typedef uint32_t STDCALL(* rtc_device_get_properties_proc) (RTC_DEVICE *rtc, RTC_PROPERTIES *properties)

Functions

uint32_t STDCALL rtc_device_start (RTC_DEVICE *rtc)
uint32_t STDCALL rtc_device_stop (RTC_DEVICE *rtc)
int64_t STDCALL rtc_device_get_time (RTC_DEVICE *rtc)
int64_t STDCALL rtc_device_set_time (RTC_DEVICE *rtc, int64_t time)
uint32_t STDCALL rtc_device_properties (RTC_DEVICE *rtc, RTC_PROPERTIES *properties)
 Get the properties for the specified RTC device.
uint32_t STDCALL rtc_device_get_properties (RTC_DEVICE *rtc, RTC_PROPERTIES *properties)
 Get the properties for the specified RTC device.
RTC_DEVICE *STDCALL rtc_device_create (void)
 Create a new RTC entry.
RTC_DEVICE *STDCALL rtc_device_create_ex (uint32_t size)
 Create a new RTC entry.
uint32_t STDCALL rtc_device_destroy (RTC_DEVICE *rtc)
 Destroy an existing RTC entry.
uint32_t STDCALL rtc_device_register (RTC_DEVICE *rtc)
 Register a new RTC in the RTC table.
uint32_t STDCALL rtc_device_deregister (RTC_DEVICE *rtc)
 Deregister a RTC from the RTC table.
RTC_DEVICE *STDCALL rtc_device_find (uint32_t rtcid)
RTC_DEVICE *STDCALL rtc_device_find_by_name (const char *name)
RTC_DEVICE *STDCALL rtc_device_find_by_description (const char *description)
uint32_t STDCALL rtc_device_enumerate (rtc_enumerate_cb callback, void *data)
uint32_t STDCALL rtc_device_notification (RTC_DEVICE *rtc, rtc_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
uint32_t STDCALL rtc_get_count (void)
 Get the current RTC count.
RTC_DEVICE *STDCALL rtc_device_get_default (void)
 Get the current default RTC device.
uint32_t STDCALL rtc_device_set_default (RTC_DEVICE *rtc)
 Set the current default RTC device.
RTC_DEVICE *STDCALL rtc_device_check (RTC_DEVICE *rtc)
 Check if the supplied RTC is in the RTC table.
uint32_t STDCALL rtc_device_type_to_string (uint32_t rtctype, char *string, uint32_t len)
uint32_t STDCALL rtc_device_state_to_string (uint32_t rtcstate, char *string, uint32_t len)
BOOL STDCALL rtc_time_is_valid (SYSTEMTIME *time)
BOOL STDCALL rtc_systemtime_to_filetime (SYSTEMTIME *systemtime, int64_t *filetime)
BOOL STDCALL rtc_filetime_to_systemtime (int64_t filetime, SYSTEMTIME *systemtime)

Macro Definition Documentation

◆ RTC_NAME_PREFIX

#define RTC_NAME_PREFIX   "RTC"

Name prefix for RTC Devices.

RTC specific constants

◆ RTC_TYPE_NONE

#define RTC_TYPE_NONE   0

RTC Device Types

◆ RTC_TYPE_MAX

#define RTC_TYPE_MAX   0

◆ RTC_STATE_DISABLED

#define RTC_STATE_DISABLED   0

RTC Device States

◆ RTC_STATE_ENABLED

#define RTC_STATE_ENABLED   1

◆ RTC_STATE_MAX

#define RTC_STATE_MAX   1

◆ RTC_FLAG_NONE

#define RTC_FLAG_NONE   0x00000000

RTC Device Flags

◆ RTC_FLAG_ALARM

#define RTC_FLAG_ALARM   0x00000001

Device supports one or more alarms.

◆ RTC_FLAG_WATCHDOG

#define RTC_FLAG_WATCHDOG   0x00000002

Device has a watchdog timer function.

Typedef Documentation

◆ RTC_PROPERTIES

RTC specific types RTC Properties

◆ RTC_DEVICE

typedef struct _RTC_DEVICE RTC_DEVICE

RTC Device

◆ rtc_enumerate_cb

typedef uint32_t STDCALL(* rtc_enumerate_cb) (RTC_DEVICE *rtc, void *data)

RTC Enumeration Callback

◆ rtc_notification_cb

typedef uint32_t STDCALL(* rtc_notification_cb) (DEVICE *device, void *data, uint32_t notification)

RTC Notification Callback

◆ rtc_device_start_proc

typedef uint32_t STDCALL(* rtc_device_start_proc) (RTC_DEVICE *rtc)

RTC Device Methods

◆ rtc_device_stop_proc

typedef uint32_t STDCALL(* rtc_device_stop_proc) (RTC_DEVICE *rtc)

◆ rtc_device_get_time_proc

typedef int64_t STDCALL(* rtc_device_get_time_proc) (RTC_DEVICE *rtc)

◆ rtc_device_set_time_proc

typedef int64_t STDCALL(* rtc_device_set_time_proc) (RTC_DEVICE *rtc, int64_t time)

◆ rtc_device_get_properties_proc

typedef uint32_t STDCALL(* rtc_device_get_properties_proc) (RTC_DEVICE *rtc, RTC_PROPERTIES *properties)

Function Documentation

◆ rtc_device_start()

uint32_t STDCALL rtc_device_start ( RTC_DEVICE * rtc)

RTC Functions

◆ rtc_device_stop()

uint32_t STDCALL rtc_device_stop ( RTC_DEVICE * rtc)

◆ rtc_device_get_time()

int64_t STDCALL rtc_device_get_time ( RTC_DEVICE * rtc)

◆ rtc_device_set_time()

int64_t STDCALL rtc_device_set_time ( RTC_DEVICE * rtc,
int64_t time )

◆ rtc_device_properties()

uint32_t STDCALL rtc_device_properties ( RTC_DEVICE * rtc,
RTC_PROPERTIES * properties )

Get the properties for the specified RTC device.

Parameters
RTCThe RTC device to get properties from
PropertiesPointer to a PRTCProperties structure to fill in
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Replaced by RTCDeviceGetProperties for consistency

◆ rtc_device_get_properties()

uint32_t STDCALL rtc_device_get_properties ( RTC_DEVICE * rtc,
RTC_PROPERTIES * properties )

Get the properties for the specified RTC device.

Parameters
RTCThe RTC device to get properties from
PropertiesPointer to a PRTCProperties structure to fill in
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ rtc_device_create()

RTC_DEVICE *STDCALL rtc_device_create ( void )

Create a new RTC entry.

Returns
Pointer to new RTC entry or nil if RTC could not be created

◆ rtc_device_create_ex()

RTC_DEVICE *STDCALL rtc_device_create_ex ( uint32_t size)

Create a new RTC entry.

Parameters
SizeSize in bytes to allocate for new RTC (Including the RTC entry)
Returns
Pointer to new RTC entry or nil if RTC could not be created

◆ rtc_device_destroy()

uint32_t STDCALL rtc_device_destroy ( RTC_DEVICE * rtc)

Destroy an existing RTC entry.

◆ rtc_device_register()

uint32_t STDCALL rtc_device_register ( RTC_DEVICE * rtc)

Register a new RTC in the RTC table.

◆ rtc_device_deregister()

uint32_t STDCALL rtc_device_deregister ( RTC_DEVICE * rtc)

Deregister a RTC from the RTC table.

◆ rtc_device_find()

RTC_DEVICE *STDCALL rtc_device_find ( uint32_t rtcid)

◆ rtc_device_find_by_name()

RTC_DEVICE *STDCALL rtc_device_find_by_name ( const char * name)

◆ rtc_device_find_by_description()

RTC_DEVICE *STDCALL rtc_device_find_by_description ( const char * description)

◆ rtc_device_enumerate()

uint32_t STDCALL rtc_device_enumerate ( rtc_enumerate_cb callback,
void * data )

◆ rtc_device_notification()

uint32_t STDCALL rtc_device_notification ( RTC_DEVICE * rtc,
rtc_notification_cb callback,
void * data,
uint32_t notification,
uint32_t flags )

◆ rtc_get_count()

uint32_t STDCALL rtc_get_count ( void )

Get the current RTC count.

RTC Helper Functions

◆ rtc_device_get_default()

RTC_DEVICE *STDCALL rtc_device_get_default ( void )

Get the current default RTC device.

◆ rtc_device_set_default()

uint32_t STDCALL rtc_device_set_default ( RTC_DEVICE * rtc)

Set the current default RTC device.

◆ rtc_device_check()

RTC_DEVICE *STDCALL rtc_device_check ( RTC_DEVICE * rtc)

Check if the supplied RTC is in the RTC table.

◆ rtc_device_type_to_string()

uint32_t STDCALL rtc_device_type_to_string ( uint32_t rtctype,
char * string,
uint32_t len )

◆ rtc_device_state_to_string()

uint32_t STDCALL rtc_device_state_to_string ( uint32_t rtcstate,
char * string,
uint32_t len )

◆ rtc_time_is_valid()

BOOL STDCALL rtc_time_is_valid ( SYSTEMTIME * time)

◆ rtc_systemtime_to_filetime()

BOOL STDCALL rtc_systemtime_to_filetime ( SYSTEMTIME * systemtime,
int64_t * filetime )
Note
System time is assumed to be UTC and returned file time is UTC

◆ rtc_filetime_to_systemtime()

BOOL STDCALL rtc_filetime_to_systemtime ( int64_t filetime,
SYSTEMTIME * systemtime )
Note
File time is assumed to be UTC and returned system time is UTC