ReactOS 0.4.15-dev-8434-g155a7c7
clock.c
Go to the documentation of this file.
1/*
2 * PROJECT: NEC PC-98 series HAL
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: PIT rollover tables
5 * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6 */
7
8/* INCLUDES ******************************************************************/
9
10#include <hal.h>
11
12/* GLOBALS *******************************************************************/
13
14#define LPT_STATUS 0x42
15#define SYSTEM_CLOCK_8_MHZ 0x20
16
19
20/* Accuracy is 97.5% */
21static const HALP_ROLLOVER RolloverTable1[15] =
22{
23 {1996, 9996}, /* 1 ms */
24 {3993, 19997},
25 {5990, 29998},
26 {7987, 39999},
27 {9984, 50000},
28 {11980, 59996},
29 {13977, 69997},
30 {15974, 79998},
31 {17971, 89999},
32 {19968, 100000},
33 {21964, 109996},
34 {23961, 119997},
35 {25958, 129998},
36 {27955, 139999},
37 {29951, 149995} /* 15 ms */
38};
39static const HALP_ROLLOVER RolloverTable2[15] =
40{
41 {2463, 10022}, /* 1 ms */
42 {4912, 19987},
43 {7376, 30013},
44 {9825, 39978},
45 {12288, 50000},
46 {14751, 60022},
47 {17200, 69987},
48 {19664, 80013},
49 {22113, 89978},
50 {24576, 100000},
51 {27039, 110022},
52 {29488, 119987},
53 {31952, 130013},
54 {34401, 139978},
55 {36864, 150000} /* 15 ms */
56};
57
58/* PRIVATE FUNCTIONS *********************************************************/
59
60VOID
63{
64 /* Obtain system clock value from the parallel port */
66 {
69 }
70 else
71 {
74 }
75}
HALP_ROLLOVER HalpRolloverTable[15]
Definition: clock.c:15
#define SYSTEM_CLOCK_8_MHZ
Definition: clock.c:15
static const HALP_ROLLOVER RolloverTable2[15]
Definition: clock.c:39
static const HALP_ROLLOVER RolloverTable1[15]
Definition: clock.c:21
VOID NTAPI HalpInitializeClockPc98(VOID)
Definition: clock.c:62
#define LPT_STATUS
Definition: clock.c:14
ULONG PIT_FREQUENCY
Definition: clock.c:17
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539
#define TIMER_FREQUENCY_1
Definition: pit.h:16
#define TIMER_FREQUENCY_2
Definition: pit.h:17
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59