MentOS  0.8.0
The Mentoring Operating System
Macros | Functions | Variables
rtc.c File Reference

Real Time Clock (RTC) driver. More...

Macros

#define __DEBUG_HEADER__   "[RTC ]"
 Change header.
 
#define __DEBUG_LEVEL__   LOGLEVEL_NOTICE
 Set log level.
 
#define CMOS_ADDR   0x70
 Addess where we need to write the Address.
 
#define CMOS_DATA   0x71
 Addess where we need to write the Data.
 

Functions

static unsigned int rtc_are_different (tm_t *t0, tm_t *t1)
 Checks if the two time values are different. More...
 
static unsigned int is_updating_rtc (void)
 Check if rtc is updating time currently. More...
 
static unsigned char read_register (unsigned char reg)
 Reads the given register. More...
 
static void write_register (unsigned char reg, unsigned char value)
 Writes on the given register. More...
 
static unsigned char bcd2bin (unsigned char bcd)
 Transforms a Binary-Coded Decimal (BCD) to decimal. More...
 
static void rtc_read_datetime (void)
 Reads the current datetime value from a real-time clock.
 
static void rtc_update_datetime (void)
 Updates the internal datetime value.
 
static void rtc_handler_isr (pt_regs *f)
 Callback for RTC. More...
 
void gettime (tm_t *time)
 Copies the global time inside the provided variable. More...
 
int rtc_initialize (void)
 Initializes the Real Time Clock (RTC). More...
 
int rtc_finalize (void)
 De-initializes the Real Time Clock (RTC). More...
 

Variables

tm_t global_time
 Current global time.
 
tm_t previous_global_time
 Previous global time.
 
int is_bcd
 Data type is BCD.
 

Detailed Description

Real Time Clock (RTC) driver.