This source file includes following definitions.
- fontram
- textram
- vga_loadchars
- vga_setfontset
- vga_setscreentype
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/device.h>
33 #include <sys/queue.h>
34 #include <machine/bus.h>
35
36 #include <dev/ic/mc6845reg.h>
37 #include <dev/ic/pcdisplayvar.h>
38 #include <dev/ic/vgareg.h>
39 #include <dev/ic/vgavar.h>
40
41 #include <dev/wscons/wsdisplayvar.h>
42
43 static void fontram(struct vga_handle *);
44 static void textram(struct vga_handle *);
45
46 static void
47 fontram(vh)
48 struct vga_handle *vh;
49 {
50
51
52 vga_ts_write(vh, syncreset, 0x01);
53 vga_ts_write(vh, wrplmask, 0x04);
54 vga_ts_write(vh, memmode, 0x07);
55 vga_ts_write(vh, syncreset, 0x03);
56
57
58
59 vga_gdc_write(vh, rdplanesel, 0x02);
60 vga_gdc_write(vh, mode, 0x00);
61 vga_gdc_write(vh, misc, 0x04);
62 }
63
64 static void
65 textram(vh)
66 struct vga_handle *vh;
67 {
68
69
70 vga_ts_write(vh, syncreset, 0x01);
71 vga_ts_write(vh, wrplmask, 0x03);
72 vga_ts_write(vh, memmode, 0x03);
73 vga_ts_write(vh, syncreset, 0x03);
74
75
76
77 vga_gdc_write(vh, rdplanesel, 0x00);
78 vga_gdc_write(vh, mode, 0x10);
79
80 vga_gdc_write(vh, misc, (vh->vh_mono ? 0x0a : 0x0e));
81 }
82
83 void
84 vga_loadchars(vh, fontset, first, num, lpc, data)
85 struct vga_handle *vh;
86 int fontset, first, num;
87 int lpc;
88 char *data;
89 {
90 int offset, i, j, s;
91
92
93 offset = (fontset << 13) | (first << 5);
94
95 s = splhigh();
96 fontram(vh);
97
98 for (i = 0; i < num; i++)
99 for (j = 0; j < lpc; j++)
100 bus_space_write_1(vh->vh_memt, vh->vh_allmemh,
101 offset + (i << 5) + j,
102 data[i * lpc + j]);
103
104 textram(vh);
105 splx(s);
106 }
107
108 void
109 vga_setfontset(vh, fontset1, fontset2)
110 struct vga_handle *vh;
111 int fontset1, fontset2;
112 {
113 u_int8_t cmap;
114 static u_int8_t cmaptaba[] = {
115 0x00, 0x10, 0x01, 0x11,
116 0x02, 0x12, 0x03, 0x13
117 };
118 static u_int8_t cmaptabb[] = {
119 0x00, 0x20, 0x04, 0x24,
120 0x08, 0x28, 0x0c, 0x2c
121 };
122
123
124 cmap = cmaptaba[fontset1] | cmaptabb[fontset2];
125
126 vga_ts_write(vh, fontsel, cmap);
127 }
128
129 void
130 vga_setscreentype(vh, type)
131 struct vga_handle *vh;
132 const struct wsscreen_descr *type;
133 {
134 vga_6845_write(vh, maxrow, type->fontheight - 1);
135
136
137 vga_6845_write(vh, vde, type->fontheight * type->nrows - 1);
138
139 #ifndef PCDISPLAY_SOFTCURSOR
140
141 vga_6845_write(vh, curstart, type->fontheight - 2);
142 vga_6845_write(vh, curend, type->fontheight - 1);
143 #endif
144
145
146
147 if (type->capabilities & WSSCREEN_HILIT) {
148
149
150
151
152 vga_attr_write(vh, colplen, 0x0f);
153 } else
154 vga_attr_write(vh, colplen, 0x07);
155 }