FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
rtc.h File Reference

The Real Time Clock (RTC) code header. More...

#include <basics.h>
#include <graphics.h>
Include dependency graph for rtc.h:

Go to the source code of this file.

Macros

#define RTC_PORT   0x70
#define RTC_DATA   0x71
#define RTC_SECONDS   0x00
#define RTC_MINUTES   0x02
#define RTC_HOURS   0x04
#define RTC_DAY   0x07
#define RTC_MONTH   0x08
#define RTC_YEAR   0x09
#define RTC_CENTURY   0x32

Functions

int8 bcd_to_bin (int8 val)
 Converts BDC to binary.
int8 read_rtc_register (int8 reg)
 Reads the value from an RTC register.
void wait_rtc_update ()
 Wait till RTC is responding.
int8 rtc_read_stable (int8 reg)
 Reads from a register without tick glitch (more stable).
void init_rtc ()
 Initializes the main RTC for use.
void update_system_time (int8 *second, int8 *minute, int8 *hour, int8 *day, int8 *month, int16 *year)
 Updated the given variable with system time.
void display_time ()
 Displays time in an neat format.
void sleep (int seconds)
 Pauses the OS for set seconds. Use PIT for accuracy.

Detailed Description

The Real Time Clock (RTC) code header.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2025-10-11

Definition in file rtc.h.

Macro Definition Documentation

◆ RTC_CENTURY

#define RTC_CENTURY   0x32

Definition at line 29 of file rtc.h.

◆ RTC_DATA

#define RTC_DATA   0x71

Definition at line 20 of file rtc.h.

◆ RTC_DAY

#define RTC_DAY   0x07

Definition at line 26 of file rtc.h.

◆ RTC_HOURS

#define RTC_HOURS   0x04

Definition at line 25 of file rtc.h.

◆ RTC_MINUTES

#define RTC_MINUTES   0x02

Definition at line 24 of file rtc.h.

◆ RTC_MONTH

#define RTC_MONTH   0x08

Definition at line 27 of file rtc.h.

◆ RTC_PORT

#define RTC_PORT   0x70

Definition at line 19 of file rtc.h.

◆ RTC_SECONDS

#define RTC_SECONDS   0x00

Definition at line 23 of file rtc.h.

◆ RTC_YEAR

#define RTC_YEAR   0x09

Definition at line 28 of file rtc.h.

Function Documentation

◆ bcd_to_bin()

int8 bcd_to_bin ( int8 val)

Converts BDC to binary.

Parameters
valThe BCD value.
Returns
int8

◆ read_rtc_register()

int8 read_rtc_register ( int8 reg)

Reads the value from an RTC register.

Parameters
regThe register number
Returns
int8 Value of the Register

◆ rtc_read_stable()

int8 rtc_read_stable ( int8 reg)

Reads from a register without tick glitch (more stable).

Parameters
reg
Returns
int8

◆ sleep()

void sleep ( int seconds)

Pauses the OS for set seconds. Use PIT for accuracy.

Parameters
seconds

◆ update_system_time()

void update_system_time ( int8 * second,
int8 * minute,
int8 * hour,
int8 * day,
int8 * month,
int16 * year )

Updated the given variable with system time.

Parameters
second
minute
hour
day
month
year