Kernel - Add a quick and dirty (and useless) emergency console
[tpg/acess2.git] / KernelLand / Modules / Display / VGA / vgaregs.c
1 /*
2  * Acess2 VGA Driver
3  * - By John Hodge (thePowersGang)
4  */
5
6 #define VGA_CRTC_IDX    0x3B4
7 #define VGA_CRTC_DATA   0x3B5
8 #define VGA_FEAT_IS1    0x3BA   // Features / Input Status 1 (B/W Chips)
9 #define VGA_ATTR_WRITE  0x3C0
10 #define VGA_ATTR_READ   0x3C1
11 #define VGA_MISC_IS0    0x3C2   // Misc Output / Input Status 0
12 #define VGA_MBSLEEP     0x3C3   // "Motherboard Sleep"
13 #define VGA_SEQ_IDX     0x3C4
14 #define VGA_SEQ_DATA    0x3C5
15 #define VGA_DACMASK     0x3C6
16 #define VGA_PADR_DACST  0x3C7
17 #define VGA_PIXWRMODE   0x3C8
18 #define VGA_PIXDATA     0x3C9
19 #define VGA_FEATRD      0x3CA
20 //                      0x3CB
21 #define VGA_MISCOUT     0x3CC
22 //                      0x3CD
23 #define VGA_GRAPH_IDX   0x3CE
24 #define VGA_GRAPH_DATA  0x3CF
25 //                      0x3D0 -- 0x3D3
26 #define VGA_CRTC_IDX    0x3D4
27 #define VGA_CRTC_DATA   0x3D5
28 //                      0x3D6 -- 0x3D9
29 #define VGA_FEAT_IS1_C  0x3DA   // Features / Input Status 1 (Colour Chips)
30
31 // === CODE ===
32 void VGA_WriteAttr(Uint8 Index, Uint8 Data)
33 {
34         Index &= 0x1F;
35         SHORTLOCK(&glVGA_Attr);
36         inb(0x3DA);
37         outb(VGA_ATTR_WRITE, Index);
38         outb(VGA_ATTR_WRITE, Data);
39         SHORTREL(&glVGA_Attr);
40 }
41
42 Uint8 VGA_ReadAttr(Uint8 Index)
43 {
44         Uint8   ret;
45         SHORTLOCK(&glVGA_Attr);
46         inb(0x3DA);
47         outb(VGA_ATTR_WRITE, Index);
48         ret = inb(VGA_ATTR_READ);
49         SHORTREL(&glVGA_Attr);
50         return ret;
51 }
52
53 void VGA_WriteSeq(Uint8 Index, Uint8 Data)
54 {
55         outb(VGA_SEQ_IDX, Index);
56         outb(VGA_SEQ_DATA, Data);
57 }
58 Uint8 VGA_ReadSeq(Uint8 Index)
59 {
60         outb(VGA_SEQ_IDX, Index);
61         return inb(VGA_SEQ_DATA);
62 }
63 void VGA_WriteGraph(Uint8 Index, Uint8 Data)
64 {
65         outb(VGA_GRAPH_IDX, Index);
66         outb(VGA_GRAPH_DATA, Data);
67 }
68 Uint8 VGA_ReadGraph(Uint8 Index)
69 {
70         outb(VGA_GRAPH_IDX, Index);
71         return inb(VGA_GRAPH_DATA);
72 }
73
74 void VGA_WriteMiscOut(Uint8 Data)
75 {
76         outb(VGA_MISC_IS0, Data);
77 }
78 Uint8 VGA_ReadMiscOut(void)
79 {
80         return inb(VGA_MISCOUT);
81 }

UCC git Repository :: git.ucc.asn.au