xref: /reactos/boot/armllb/fw.c (revision 98e8827a)
1 /*
2  * PROJECT:         ReactOS Boot Loader
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            boot/armllb/fw.c
5  * PURPOSE:         LLB Firmware Routines (accessible by OS Loader)
6  * PROGRAMMERS:     ReactOS Portable Systems Group
7  */
8 
9 #include "precomp.h"
10 
11 USHORT ColorPalette[16][3] =
12 {
13     {0x00, 0x00, 0x00},
14     {0x00, 0x00, 0xAA},
15     {0x00, 0xAA, 0x00},
16     {0x00, 0xAA, 0xAA},
17     {0xAA, 0x00, 0x00},
18     {0xAA, 0x00, 0xAA},
19     {0xAA, 0x55, 0x00},
20     {0xAA, 0xAA, 0xAA},
21     {0x55, 0x55, 0x55},
22     {0x55, 0x55, 0xFF},
23     {0x55, 0xFF, 0x55},
24     {0x55, 0xFF, 0xFF},
25     {0xFF, 0x55, 0x55},
26     {0xFF, 0x55, 0xFF},
27     {0xFF, 0xFF, 0x55},
28     {0xFF, 0xFF, 0xFF},
29 };
30 
31 VOID
32 LlbFwPutChar(INT Ch)
33 {
34     /* Just call directly the video function */
35     LlbVideoPutChar(Ch);
36 
37     /* DEBUG ONLY */
38     LlbSerialPutChar(Ch);
39 }
40 
41 BOOLEAN
42 LlbFwKbHit(VOID)
43 {
44     /* Check RX buffer */
45     return LlbHwKbdReady();
46 }
47 
48 INT
49 LlbFwGetCh(VOID)
50 {
51     /* Return the key pressed */
52 #ifdef _ZOOM2_
53     return LlbKeypadGetChar();
54 #else
55     return LlbKeyboardGetChar();
56 #endif
57 }
58 
59 ULONG
60 LlbFwVideoSetDisplayMode(IN PCHAR DisplayModeName,
61                          IN BOOLEAN Init)
62 {
63     /* Return text mode */
64     return 0;
65 }
66 
67 VOID
68 LlbFwVideoGetDisplaySize(OUT PULONG Width,
69                          OUT PULONG Height,
70                          OUT PULONG Depth)
71 {
72     /* Query static settings */
73     *Width = LlbHwGetScreenWidth() / 8;
74     *Height = LlbHwGetScreenHeight() / 16;
75 
76     /* Depth is always 16 bpp */
77     *Depth = 16;
78 }
79 
80 VOID
81 LlbFwVideoClearScreen(IN UCHAR Attr)
82 {
83     /* Clear the screen */
84     LlbVideoClearScreen(TRUE);
85 }
86 
87 VOID
88 LlbFwVideoPutChar(IN INT c,
89                   IN UCHAR Attr,
90                   IN ULONG X,
91                   IN ULONG Y)
92 {
93     ULONG Color, BackColor;
94     PUSHORT Buffer;
95 
96     /* Convert EGA index to color used by hardware */
97     Color = LlbHwVideoCreateColor(ColorPalette[Attr & 0xF][0],
98                                   ColorPalette[Attr & 0xF][1],
99                                   ColorPalette[Attr & 0xF][2]);
100     BackColor = LlbHwVideoCreateColor(ColorPalette[Attr >> 4][0],
101                                       ColorPalette[Attr >> 4][1],
102                                       ColorPalette[Attr >> 4][2]);
103 
104     /* Compute buffer address */
105     Buffer = (PUSHORT)LlbHwGetFrameBuffer() + (LlbHwGetScreenWidth() * (Y * 16)) + (X * 8);
106 
107     /* Draw it */
108     LlbVideoDrawChar(c, Buffer, Color, BackColor);
109 }
110 
111 
112 TIMEINFO*
113 LlbFwGetTime(VOID)
114 {
115     /* Call existing function */
116     return LlbGetTime();
117 }
118 
119 /* EOF */
120