ReactOS  0.4.15-dev-1018-g0695ecb
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% */
21 static 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 };
39 static 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 
60 VOID
61 NTAPI
63 {
64  /* Obtain system clock value from the parallel port */
66  {
69  }
70  else
71  {
74  }
75 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define LPT_STATUS
Definition: clock.c:14
VOID NTAPI HalpInitializeClockPc98(VOID)
Definition: clock.c:62
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static const HALP_ROLLOVER RolloverTable2[15]
Definition: clock.c:39
#define TIMER_FREQUENCY_1
Definition: pit.h:16
ULONG PIT_FREQUENCY
Definition: clock.c:17
static const HALP_ROLLOVER RolloverTable1[15]
Definition: clock.c:21
HALP_ROLLOVER HalpRolloverTable[15]
Definition: clock.c:15
unsigned int ULONG
Definition: retypes.h:1
#define SYSTEM_CLOCK_8_MHZ
Definition: clock.c:15
#define TIMER_FREQUENCY_2
Definition: pit.h:17
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539