This commit is contained in:
Adrien Bourmault 2019-04-25 13:08:54 +02:00
parent 50e29d5ad1
commit 1423366d88
3 changed files with 13 additions and 22 deletions

View File

@ -66,20 +66,6 @@ extern void IoEnableNMI(void);
extern void IoDisableNMI(void); extern void IoDisableNMI(void);
extern void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags); extern void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags);
typedef struct
{
uchar sec;
uchar min;
uchar hour;
uchar weekday;
uchar day;
uchar month;
uchar year;
uchar century;
} Time_t;
extern void IoPrintRtcTime(void);
// //
// Restore IRQ flag to its state before KePauseIRQs // Restore IRQ flag to its state before KePauseIRQs
// //

View File

@ -28,6 +28,7 @@
#include <kernel/mboot.h> #include <kernel/mboot.h>
#include <kernel/heap.h> #include <kernel/heap.h>
#include <kernel/mm.h> #include <kernel/mm.h>
#include <kernel/time.h>
// info.c // info.c
extern void BtDoSanityChecks(uint mbMagic); extern void BtDoSanityChecks(uint mbMagic);
@ -40,11 +41,6 @@ extern error_t IoInitVGABuffer(void);
extern void IoSetupKeyb(void); extern void IoSetupKeyb(void);
extern void IoEnableKeyb(void); extern void IoEnableKeyb(void);
//io/rtc.c
extern void IoSetupRtc(void);
extern void IoEnableRtc(void);
extern ulong IoRtcTicks;
// cpu/idt.c // cpu/idt.c
extern void IdtSetup(void); extern void IdtSetup(void);

View File

@ -25,6 +25,7 @@
#include <kernel/base.h> #include <kernel/base.h>
#include <kernel/iomisc.h> #include <kernel/iomisc.h>
#include <extras/buf.h> #include <extras/buf.h>
#include <kernel/time.h>
extern void RtcIsr(void); extern void RtcIsr(void);
@ -32,9 +33,6 @@ ulong IoRtcTicks = 0;
Time_t IoRtcTime; Time_t IoRtcTime;
char* WeekDays[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
void IoSetupRtc(void) void IoSetupRtc(void)
{ {
IdtRegisterIrq(RtcIsr, 0x28, 0x8E); IdtRegisterIrq(RtcIsr, 0x28, 0x8E);
@ -195,3 +193,14 @@ void IoPrintRtcTime(void)
IoRtcTime.sec IoRtcTime.sec
); );
} }
Time_t* IoGetRtcTime(void)
{
return &IoRtcTime;
}
ulong IoGetRtcTicks(void)
{
return IoRtcTicks;
}