xref: /reactos/boot/armllb/hw/omap3-zoom2/hwinfo.c (revision 9393fc32)
1 /*
2  * PROJECT:         ReactOS Boot Loader
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            boot/armllb/hw/omap3-zoom2/hwinfo.c
5  * PURPOSE:         LLB Hardware Info Routines for OMAP3 ZOOM2
6  * PROGRAMMERS:     ReactOS Portable Systems Group
7  */
8 
9 #include "precomp.h"
10 
11 TIMEINFO LlbTime;
12 
13 #define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
14 
15 ULONG
16 NTAPI
LlbHwGetBoardType(VOID)17 LlbHwGetBoardType(VOID)
18 {
19     return MACH_TYPE_OMAP_ZOOM2;
20 }
21 
22 ULONG
23 NTAPI
LlbHwGetPClk(VOID)24 LlbHwGetPClk(VOID)
25 {
26     return 48000000;
27 }
28 
29 ULONG
30 NTAPI
LlbHwGetTmr0Base(VOID)31 LlbHwGetTmr0Base(VOID)
32 {
33     return 0x48318000;
34 }
35 
36 ULONG
37 NTAPI
LlbHwGetSerialUart(VOID)38 LlbHwGetSerialUart(VOID)
39 {
40     return 0;
41 }
42 
43 ULONG
LlbHwRtcRead(VOID)44 LlbHwRtcRead(VOID)
45 {
46     /* Issue the GET_TIME request on the RTC control register */
47     LlbHwOmap3TwlWrite1(0x4B, 0x29, 0x41);
48 
49     /* Read the BCD registers and convert them */
50     LlbTime.Second = BCD_INT(LlbHwOmap3TwlRead1(0x4B, 0x1C));
51     LlbTime.Minute = BCD_INT(LlbHwOmap3TwlRead1(0x4B, 0x1D));
52     LlbTime.Hour = BCD_INT(LlbHwOmap3TwlRead1(0x4B, 0x1E));
53     LlbTime.Day = BCD_INT(LlbHwOmap3TwlRead1(0x4B, 0x1F));
54     LlbTime.Month = BCD_INT(LlbHwOmap3TwlRead1(0x4B, 0x20));
55     LlbTime.Year = BCD_INT(LlbHwOmap3TwlRead1(0x4B, 0x21));
56     LlbTime.Year += (LlbTime.Year > 80) ? 1900 : 2000;
57     return 0;
58 }
59 
60 /* EOF */
61