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#include <hal.h>
18
19// I/O ports for RTC
20#define RTC_PORT 0x70
21#define RTC_DATA 0x71
22
23// RTC Registers
24#define RTC_SECONDS 0x00
25#define RTC_MINUTES 0x02
26#define RTC_HOURS 0x04
27#define RTC_DAY 0x07
28#define RTC_MONTH 0x08
29#define RTC_YEAR 0x09
30#define RTC_CENTURY 0x32 // Optional, not all BIOSes use it
31
38uint8 bcd_to_bin(uint8 val);
39
46uint8 read_rtc_register(uint8 reg);
47
52void wait_rtc_update(void);
53
60uint8 rtc_read_stable(uint8 reg);
61
66void init_rtc(void);
67
78void update_system_time(uint8 *second, uint8 *minute, uint8 *hour, uint8 *day, uint8 *month, uint16 *year);
79
84void display_time(void);
85
91void sleep(int seconds);
92
93#endif
This is a basic header files with FrostWing specific short forms and basically a good for life header...
Contains all the print functions.
Header file for Hardware Abstraction Layer -> Source from GoGX OS.
uint8 read_rtc_register(uint8 reg)
Reads the value from an RTC register.
uint8 bcd_to_bin(uint8 val)
Converts BDC to binary.
void display_time(void)
Displays time in an neat format.
void wait_rtc_update(void)
Wait till RTC is responding.
void update_system_time(uint8 *second, uint8 *minute, uint8 *hour, uint8 *day, uint8 *month, uint16 *year)
Updated the given variable with system time.
uint8 rtc_read_stable(uint8 reg)
Reads from a register without tick glitch (more stable).
void init_rtc(void)
Initializes the main RTC for use.
void sleep(int seconds)
Pauses the OS for set seconds. Use PIT for accuracy.