From 272a0f243e5f1dc3228e0217089fc136d9dffbd3 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Sun, 5 May 2019 23:29:17 +0200 Subject: [PATCH] RTC --- include/kernel/time.h | 2 +- kaleid/kernel/init/init.c | 12 +----------- kaleid/kernel/io/rtc.c | 9 ++++----- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/include/kernel/time.h b/include/kernel/time.h index 894c5ab..fc8fc67 100644 --- a/include/kernel/time.h +++ b/include/kernel/time.h @@ -39,6 +39,6 @@ extern void IoEnableRtc(void); extern void IoPrintRtcTime(void); extern ulong IoGetRtcTicks(void); extern Time_t* IoGetRtcTime(void); -extern error_t IoGetRtcTimeChar(char* timeChar); +extern char* IoGetRtcTimeChar(void); //static char* WeekDays[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 02609d9..d580101 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -94,17 +94,7 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg) /* i++; */ /* } */ - char cc[255]; - IoGetRtcTimeChar(cc); - - KernLog("\nTEST 1:\n"); - KernLog("%s\n", cc); - - KernLog("\nTEST 2:\n"); - KernLog("[test] %s\n", cc); - - KernLog("\nTEST 3:\n"); - KernLog("[test] %s [fin du test]\n", cc); + KernLog("Goodbye at %s", IoGetRtcTimeChar()); // End this machine's suffering BStdOut->flusher(BStdOut); diff --git a/kaleid/kernel/io/rtc.c b/kaleid/kernel/io/rtc.c index 6a3aa1a..1fa5f88 100644 --- a/kaleid/kernel/io/rtc.c +++ b/kaleid/kernel/io/rtc.c @@ -28,6 +28,7 @@ #include static ulong IoRtcTicks = 0; +static char IoTimeChar[22] = { 0 }; static uchar RtcRate = 0x05; //2048Hz static Time_t IoRtcOriginTime; static Time_t IoRtcTime; @@ -160,11 +161,10 @@ void IoPrintRtcTime(void) ); } -// FIXME XXX FIXME -error_t IoGetRtcTimeChar(char *timeChar) +char* IoGetRtcTimeChar(void) { Time_t *RtcTime = IoGetRtcTime(); - sprintf(timeChar, "%hhd/%hhd/%hd ; %hhd:%hhd:%hhd", + sprintf(IoTimeChar, "%hhd/%hhd/%hd ; %hhd:%hhd:%hhd", RtcTime->day, RtcTime->month, RtcTime->year + RtcTime->century*100, @@ -172,9 +172,8 @@ error_t IoGetRtcTimeChar(char *timeChar) RtcTime->min, RtcTime->sec ); - return EOK; + return IoTimeChar; } -// END OF FIXME XXX FIXME static void UpdateRtcTime(void)