FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
rtc.h
Go to the documentation of this file.
1
11
12#ifndef RTC_H
13#define RTC_H
14
15#include <basics.h>
16#include <graphics.h>
17
18// I/O ports for RTC
19#define RTC_PORT 0x70
20#define RTC_DATA 0x71
21
22// RTC Registers
23#define RTC_SECONDS 0x00
24#define RTC_MINUTES 0x02
25#define RTC_HOURS 0x04
26#define RTC_DAY 0x07
27#define RTC_MONTH 0x08
28#define RTC_YEAR 0x09
29#define RTC_CENTURY 0x32 // Optional, not all BIOSes use it
30
37int8 bcd_to_bin(int8 val);
38
45int8 read_rtc_register(int8 reg);
46
52
59int8 rtc_read_stable(int8 reg);
60
65void init_rtc();
66
77void update_system_time(int8 *second, int8 *minute, int8 *hour, int8 *day, int8 *month, int16 *year);
78
84
90void sleep(int seconds);
91
92#endif
This is a basic header files with FrostWing specific short forms and basically a good for life header...
Contains all the print functions.
int8 rtc_read_stable(int8 reg)
Reads from a register without tick glitch (more stable).
void display_time()
Displays time in an neat format.
void update_system_time(int8 *second, int8 *minute, int8 *hour, int8 *day, int8 *month, int16 *year)
Updated the given variable with system time.
int8 bcd_to_bin(int8 val)
Converts BDC to binary.
void wait_rtc_update()
Wait till RTC is responding.
void sleep(int seconds)
Pauses the OS for set seconds. Use PIT for accuracy.
void init_rtc()
Initializes the main RTC for use.
int8 read_rtc_register(int8 reg)
Reads the value from an RTC register.