2024-02-29 12:01:58 +00:00
|
|
|
#include <time.h>
|
|
|
|
#include "ata.h"
|
|
|
|
|
|
|
|
#define REG_SECS 0x00
|
|
|
|
#define REG_MINS 0x00
|
|
|
|
#define REG_HOURS 0x00
|
|
|
|
#define REG_WKDAY 0x06
|
|
|
|
#define REG_DAY 0x07
|
|
|
|
#define REG_YEAR 0x09
|
|
|
|
#define REG_CENTURY 0x32
|
|
|
|
#define REG_STATUSA 0x0A
|
|
|
|
#define REG_STATUSB 0x0B
|
|
|
|
|
|
|
|
static uint8_t current_reg = 0x00;
|
|
|
|
|
|
|
|
void
|
|
|
|
rtc_write(uint8_t addr, uint8_t value)
|
|
|
|
{
|
2024-04-25 19:27:27 +00:00
|
|
|
if (addr == 0)
|
|
|
|
{
|
|
|
|
current_reg = value;
|
|
|
|
}
|
2024-02-29 12:01:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t
|
|
|
|
rtc_read(uint8_t addr)
|
|
|
|
{
|
2024-04-25 19:27:27 +00:00
|
|
|
time_t time;
|
|
|
|
struct tm tm;
|
2024-02-29 12:01:58 +00:00
|
|
|
|
2024-04-25 19:27:27 +00:00
|
|
|
localtime(&time);
|
2024-02-29 12:01:58 +00:00
|
|
|
|
2024-04-25 19:27:27 +00:00
|
|
|
(void)time;
|
|
|
|
(void)tm;
|
2024-02-29 12:01:58 +00:00
|
|
|
|
2024-04-25 19:27:27 +00:00
|
|
|
return (0x00);
|
2024-02-29 12:01:58 +00:00
|
|
|
}
|
|
|
|
|
2024-04-25 19:27:27 +00:00
|
|
|
struct bus rtc_device = {
|
|
|
|
"rtc-dev",
|
|
|
|
{0x070, 0x071},
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL
|
2024-02-29 12:01:58 +00:00
|
|
|
};
|