os-k/include/kernel/ke/time.h

73 lines
2.8 KiB
C
Raw Normal View History

2019-04-25 13:09:07 +02:00
//----------------------------------------------------------------------------//
2020-09-27 17:33:48 +02:00
// OS on Kaleid //
2019-04-25 13:09:07 +02:00
// //
// Desc: Time-related functions //
// //
// //
2021-02-18 19:54:35 +01:00
// Copyright © 2018-2021 The OS/K Team //
2019-04-25 13:09:07 +02:00
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
2019-05-13 23:22:27 +02:00
#ifndef _KERNEL_H
#include <kernel.h>
2019-05-06 21:08:16 +02:00
#endif
2019-05-14 11:48:07 +02:00
#ifndef _KE_TIME_H
#define _KE_TIME_H
2019-05-06 21:08:16 +02:00
//----------------------------------------------------------------------------//
2019-05-14 11:48:07 +02:00
struct Time_t
2019-04-25 13:09:07 +02:00
{
uchar sec;
uchar min;
uchar hour;
uchar weekday;
uchar day;
uchar month;
uchar year;
uchar century;
2019-05-14 11:48:07 +02:00
} __attribute__((packed));
2019-11-15 00:09:20 +01:00
struct Timer_t {
2019-11-11 23:57:31 +01:00
uint countDown;
2019-11-14 10:19:01 +01:00
ulong sema;
2019-11-11 23:57:31 +01:00
} __attribute__((packed));
2019-11-18 00:15:39 +01:00
void KeSetupRTC(void);
void KeEnableRTC(void);
2019-05-14 11:48:07 +02:00
2019-11-18 00:15:39 +01:00
ulong KeGetTimeStamp(void);
ulong KeGetClockTicks(void);
Time_t *KeGetOriginTime(void);
void KeDelayExecution(uint);
2019-05-14 11:48:07 +02:00
2019-11-18 00:15:39 +01:00
Time_t *KeGetCurTime(void);
char *KeFormatCurTime(void);
void KeSetCurTime(Time_t);
2019-05-14 11:48:07 +02:00
2019-11-18 00:15:39 +01:00
void KeEnablePIT(void);
void KeSleep(uint);
Timer_t *KeSetTimer(uint delay);
int KeGetTimer(Timer_t*);
2020-01-18 00:48:05 +01:00
ulong KeGetTicks(void);
2019-04-25 13:09:07 +02:00
2019-05-06 21:08:16 +02:00
//----------------------------------------------------------------------------//
#endif