Commit 5a8c51cd5ef87195e05cdd9aaf2f1dcc753c9792
1 parent
04a85b3b36
Exists in
master
and in
54 other branches
* Patches by Pantelis Antoniou, 30 Mar 2004:
- add support for the Epson 156x series of graphical displays (These displays are serial and not suitable for using a normal framebuffer console on them) - add infrastructure needed in order to POST any DSPs in a board
Showing 8 changed files with 679 additions and 3 deletions Side-by-side Diff
CHANGELOG
... | ... | @@ -5,6 +5,10 @@ |
5 | 5 | * Patches by Pantelis Antoniou, 30 Mar 2004: |
6 | 6 | - add auto-complete support to the U-Boot CLI |
7 | 7 | - add support for NETTA and NETPHONE boards; fix NETVIA board |
8 | + - add support for the Epson 156x series of graphical displays | |
9 | + (These displays are serial and not suitable for using a normal | |
10 | + framebuffer console on them) | |
11 | + - add infrastructure needed in order to POST any DSPs in a board | |
8 | 12 | |
9 | 13 | * Patch by Yuli Barcohen, 28 Mar 2004: |
10 | 14 | - Add support for MPC8272 family including MPC8247/8248/8271/8272 |
drivers/Makefile
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | pcnet.o plb2800_eth.o \ |
39 | 39 | ps2ser.o ps2mult.o pc_keyb.o keyboard.o \ |
40 | 40 | rtl8019.o rtl8139.o \ |
41 | - s3c24x0_i2c.o sed13806.o \ | |
41 | + s3c24x0_i2c.o sed13806.o sed156x.o \ | |
42 | 42 | serial.o serial_max3100.o serial_pl011.o serial_pl010.o \ |
43 | 43 | smc91111.o smiLynxEM.o status_led.o sym53c8xx.o \ |
44 | 44 | ti_pci1410a.o tigon3.o w83c553f.o omap1510_i2c.o \ |
drivers/sed156x.c
1 | +/* | |
2 | + * (C) Copyright 2003 | |
3 | + * | |
4 | + * Pantelis Antoniou <panto@intracom.gr> | |
5 | + * Intracom S.A. | |
6 | + * | |
7 | + * See file CREDITS for list of people who contributed to this | |
8 | + * project. | |
9 | + * | |
10 | + * This program is free software; you can redistribute it and/or | |
11 | + * modify it under the terms of the GNU General Public License as | |
12 | + * published by the Free Software Foundation; either version 2 of | |
13 | + * the License, or (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program; if not, write to the Free Software | |
22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
23 | + * MA 02111-1307 USA | |
24 | + */ | |
25 | + | |
26 | +#include <common.h> | |
27 | +#include <watchdog.h> | |
28 | + | |
29 | +#include <sed156x.h> | |
30 | + | |
31 | +#ifdef CONFIG_SED156X | |
32 | + | |
33 | +/* configure according to the selected display */ | |
34 | +#if defined(CONFIG_SED156X_PG12864Q) | |
35 | +#define LCD_WIDTH 128 | |
36 | +#define LCD_HEIGHT 64 | |
37 | +#define LCD_LINES 64 | |
38 | +#define LCD_PAGES 9 | |
39 | +#define LCD_COLUMNS 132 | |
40 | +#else | |
41 | +#error Unsupported SED156x configuration | |
42 | +#endif | |
43 | + | |
44 | +/* include the font data */ | |
45 | +#include <video_font.h> | |
46 | + | |
47 | +#if VIDEO_FONT_WIDTH != 8 || VIDEO_FONT_HEIGHT != 16 | |
48 | +#error Expecting VIDEO_FONT_WIDTH == 8 && VIDEO_FONT_HEIGHT == 16 | |
49 | +#endif | |
50 | + | |
51 | +#define LCD_BYTE_WIDTH (LCD_WIDTH / 8) | |
52 | +#define VIDEO_FONT_BYTE_WIDTH (VIDEO_FONT_WIDTH / 8) | |
53 | + | |
54 | +#define LCD_TEXT_WIDTH (LCD_WIDTH / VIDEO_FONT_WIDTH) | |
55 | +#define LCD_TEXT_HEIGHT (LCD_HEIGHT / VIDEO_FONT_HEIGHT) | |
56 | + | |
57 | +#define LCD_BYTE_LINESZ (LCD_BYTE_WIDTH * VIDEO_FONT_HEIGHT) | |
58 | + | |
59 | +const int sed156x_text_width = LCD_TEXT_WIDTH; | |
60 | +const int sed156x_text_height = LCD_TEXT_HEIGHT; | |
61 | + | |
62 | +/**************************************************************************************/ | |
63 | + | |
64 | +#define SED156X_SPI_RXD() (SED156X_SPI_RXD_PORT & SED156X_SPI_RXD_MASK) | |
65 | + | |
66 | +#define SED156X_SPI_TXD(x) \ | |
67 | + do { \ | |
68 | + if (x) \ | |
69 | + SED156X_SPI_TXD_PORT |= SED156X_SPI_TXD_MASK; \ | |
70 | + else \ | |
71 | + SED156X_SPI_TXD_PORT &= ~SED156X_SPI_TXD_MASK; \ | |
72 | + } while(0) | |
73 | + | |
74 | +#define SED156X_SPI_CLK(x) \ | |
75 | + do { \ | |
76 | + if (x) \ | |
77 | + SED156X_SPI_CLK_PORT |= SED156X_SPI_CLK_MASK; \ | |
78 | + else \ | |
79 | + SED156X_SPI_CLK_PORT &= ~SED156X_SPI_CLK_MASK; \ | |
80 | + } while(0) | |
81 | + | |
82 | +#define SED156X_SPI_CLK_TOGGLE() (SED156X_SPI_CLK_PORT ^= SED156X_SPI_CLK_MASK) | |
83 | + | |
84 | +#define SED156X_SPI_BIT_DELAY() /* no delay */ | |
85 | + | |
86 | +#define SED156X_CS(x) \ | |
87 | + do { \ | |
88 | + if (x) \ | |
89 | + SED156X_CS_PORT |= SED156X_CS_MASK; \ | |
90 | + else \ | |
91 | + SED156X_CS_PORT &= ~SED156X_CS_MASK; \ | |
92 | + } while(0) | |
93 | + | |
94 | +#define SED156X_A0(x) \ | |
95 | + do { \ | |
96 | + if (x) \ | |
97 | + SED156X_A0_PORT |= SED156X_A0_MASK; \ | |
98 | + else \ | |
99 | + SED156X_A0_PORT &= ~SED156X_A0_MASK; \ | |
100 | + } while(0) | |
101 | + | |
102 | +/**************************************************************************************/ | |
103 | + | |
104 | +/*** LCD Commands ***/ | |
105 | + | |
106 | +#define LCD_ON 0xAF /* Display ON */ | |
107 | +#define LCD_OFF 0xAE /* Display OFF */ | |
108 | +#define LCD_LADDR 0x40 /* Display start line set + (6-bit) address */ | |
109 | +#define LCD_PADDR 0xB0 /* Page address set + (4-bit) page */ | |
110 | +#define LCD_CADRH 0x10 /* Column address set upper + (4-bit) column hi */ | |
111 | +#define LCD_CADRL 0x00 /* Column address set lower + (4-bit) column lo */ | |
112 | +#define LCD_ADC_NRM 0xA0 /* ADC select Normal */ | |
113 | +#define LCD_ADC_REV 0xA1 /* ADC select Reverse */ | |
114 | +#define LCD_DSP_NRM 0xA6 /* LCD display Normal */ | |
115 | +#define LCD_DSP_REV 0xA7 /* LCD display Reverse */ | |
116 | +#define LCD_DPT_NRM 0xA4 /* Display all points Normal */ | |
117 | +#define LCD_DPT_ALL 0xA5 /* Display all points ON */ | |
118 | +#define LCD_BIAS9 0xA2 /* LCD bias set 1/9 */ | |
119 | +#define LCD_BIAS7 0xA3 /* LCD bias set 1/7 */ | |
120 | +#define LCD_CAINC 0xE0 /* Read/modify/write */ | |
121 | +#define LCD_CAEND 0xEE /* End */ | |
122 | +#define LCD_RESET 0xE2 /* Reset */ | |
123 | +#define LCD_C_NRM 0xC0 /* Common output mode select Normal direction */ | |
124 | +#define LCD_C_RVS 0xC8 /* Common output mode select Reverse direction */ | |
125 | +#define LCD_PWRMD 0x28 /* Power control set + (3-bit) mode */ | |
126 | +#define LCD_RESRT 0x20 /* V5 v. reg. int. resistor ratio set + (3-bit) ratio */ | |
127 | +#define LCD_EVSET 0x81 /* Electronic volume mode set + byte = (6-bit) volume */ | |
128 | +#define LCD_SIOFF 0xAC /* Static indicator OFF */ | |
129 | +#define LCD_SION 0xAD /* Static indicator ON + byte = (2-bit) mode */ | |
130 | +#define LCD_NOP 0xE3 /* NOP */ | |
131 | +#define LCD_TEST 0xF0 /* Test/Test mode reset (Note: *DO NOT USE*) */ | |
132 | + | |
133 | +/*------------------------------------------------------------------------------- | |
134 | + Compound commands | |
135 | + ------------------------------------------------------------------------------- | |
136 | + Command Description Commands | |
137 | + ---------- ------------------------ ------------------------------------- | |
138 | + POWS_ON POWER SAVER ON command LCD_OFF, LCD_D_ALL | |
139 | + POWS_OFF POWER SAVER OFF command LCD_D_NRM | |
140 | + SLEEPON SLEEP mode LCD_SIOFF, POWS_ON | |
141 | + SLEEPOFF SLEEP mode cancel LCD_D_NRM, LCD_SION, LCD_SIS_??? | |
142 | + STDBYON STAND BY mode LCD_SION, POWS_ON | |
143 | + STDBYOFF STAND BY mode cancel LCD_D_NRM | |
144 | + -------------------------------------------------------------------------------*/ | |
145 | + | |
146 | +/*** LCD various parameters ***/ | |
147 | +#define LCD_PPB 8 /* Pixels per byte (display is B/W, 1 bit per pixel) */ | |
148 | + | |
149 | +/*** LCD Status byte masks ***/ | |
150 | +#define LCD_S_BUSY 0x80 /* Status Read - BUSY mask */ | |
151 | +#define LCD_S_ADC 0x40 /* Status Read - ADC mask */ | |
152 | +#define LCD_S_ONOFF 0x20 /* Status Read - ON/OFF mask */ | |
153 | +#define LCD_S_RESET 0x10 /* Status Read - RESET mask */ | |
154 | + | |
155 | +/*** LCD commands parameter masks ***/ | |
156 | +#define LCD_M_LADDR 0x3F /* Display start line (6-bit) address mask */ | |
157 | +#define LCD_M_PADDR 0x0F /* Page address (4-bit) page mask */ | |
158 | +#define LCD_M_CADRH 0x0F /* Column address upper (4-bit) column hi mask */ | |
159 | +#define LCD_M_CADRL 0x0F /* Column address lower (4-bit) column lo mask */ | |
160 | +#define LCD_M_PWRMD 0x07 /* Power control (3-bit) mode mask */ | |
161 | +#define LCD_M_RESRT 0x07 /* V5 v. reg. int. resistor ratio (3-bit) ratio mask */ | |
162 | +#define LCD_M_EVSET 0x3F /* Electronic volume mode byte (6-bit) volume mask */ | |
163 | +#define LCD_M_SION 0x03 /* Static indicator ON (2-bit) mode mask */ | |
164 | + | |
165 | +/*** LCD Power control cirquits control masks ***/ | |
166 | +#define LCD_PWRBSTR 0x04 /* Power control mode - Booster cirquit ON */ | |
167 | +#define LCD_PWRVREG 0x02 /* Power control mode - Voltage regulator cirquit ON */ | |
168 | +#define LCD_PWRVFOL 0x01 /* Power control mode - Voltage follower cirquit ON */ | |
169 | + | |
170 | +/*** LCD Static indicator states ***/ | |
171 | +#define LCD_SIS_OFF 0x00 /* Static indicator register set - OFF state */ | |
172 | +#define LCD_SIS_BL 0x01 /* Static indicator register set - 1s blink state */ | |
173 | +#define LCD_SIS_RBL 0x02 /* Static indicator register set - .5s rapid blink state */ | |
174 | +#define LCD_SIS_ON 0x03 /* Static indicator register set - constantly on state */ | |
175 | + | |
176 | +/*** LCD functions special parameters (commands) ***/ | |
177 | +#define LCD_PREVP 0x80 /* Page number for moving to previous */ | |
178 | +#define LCD_NEXTP 0x81 /* or next page */ | |
179 | +#define LCD_ERR_P 0xFF /* Error in page number */ | |
180 | + | |
181 | +/*** LCD initialization settings ***/ | |
182 | +#define LCD_BIAS LCD_BIAS9 /* Bias: 1/9 */ | |
183 | +#define LCD_ADCMODE LCD_ADC_NRM /* ADC mode: normal */ | |
184 | +#define LCD_COMDIR LCD_C_NRM /* Common output mode: normal */ | |
185 | +#define LCD_RRATIO 0 /* Resistor ratio: 0 */ | |
186 | +#define LCD_CNTRST 0x1C /* electronic volume: 1Ch */ | |
187 | +#define LCD_POWERM (LCD_PWRBSTR | LCD_PWRVREG | LCD_PWRVFOL) /* Power mode: All on */ | |
188 | + | |
189 | +/**************************************************************************************/ | |
190 | + | |
191 | +static inline unsigned int sed156x_transfer(unsigned int val) | |
192 | +{ | |
193 | + unsigned int rx; | |
194 | + int b; | |
195 | + | |
196 | + rx = 0; b = 8; | |
197 | + while (--b >= 0) { | |
198 | + SED156X_SPI_TXD(val & 0x80); | |
199 | + val <<= 1; | |
200 | + SED156X_SPI_CLK_TOGGLE(); | |
201 | + SED156X_SPI_BIT_DELAY(); | |
202 | + rx <<= 1; | |
203 | + if (SED156X_SPI_RXD()) | |
204 | + rx |= 1; | |
205 | + SED156X_SPI_CLK_TOGGLE(); | |
206 | + SED156X_SPI_BIT_DELAY(); | |
207 | + } | |
208 | + | |
209 | + return rx; | |
210 | +} | |
211 | + | |
212 | +unsigned int sed156x_data_transfer(unsigned int val) | |
213 | +{ | |
214 | + unsigned int rx; | |
215 | + | |
216 | + SED156X_SPI_CLK(1); | |
217 | + SED156X_CS(0); | |
218 | + SED156X_A0(1); | |
219 | + | |
220 | + rx = sed156x_transfer(val); | |
221 | + | |
222 | + SED156X_CS(1); | |
223 | + | |
224 | + return rx; | |
225 | +} | |
226 | + | |
227 | +void sed156x_data_block_transfer(const u8 *p, int size) | |
228 | +{ | |
229 | + SED156X_SPI_CLK(1); | |
230 | + SED156X_CS(0); | |
231 | + SED156X_A0(1); | |
232 | + | |
233 | + while (--size >= 0) | |
234 | + sed156x_transfer(*p++); | |
235 | + | |
236 | + SED156X_CS(1); | |
237 | +} | |
238 | + | |
239 | +unsigned int sed156x_cmd_transfer(unsigned int val) | |
240 | +{ | |
241 | + unsigned int rx; | |
242 | + | |
243 | + SED156X_SPI_CLK(1); | |
244 | + SED156X_CS(0); | |
245 | + SED156X_A0(0); | |
246 | + | |
247 | + rx = sed156x_transfer(val); | |
248 | + | |
249 | + SED156X_CS(1); | |
250 | + SED156X_A0(1); | |
251 | + | |
252 | + return rx; | |
253 | +} | |
254 | + | |
255 | +/******************************************************************************/ | |
256 | + | |
257 | +static u8 hw_screen[LCD_PAGES][LCD_COLUMNS]; | |
258 | +static u8 last_hw_screen[LCD_PAGES][LCD_COLUMNS]; | |
259 | +static u8 sw_screen[LCD_BYTE_WIDTH * LCD_HEIGHT]; | |
260 | + | |
261 | +void sed156x_sync(void) | |
262 | +{ | |
263 | + int i, j, last_page; | |
264 | + u8 *d; | |
265 | + const u8 *s, *e, *b, *r; | |
266 | + u8 v0, v1, v2, v3, v4, v5, v6, v7; | |
267 | + | |
268 | + /* copy and rotate sw_screen to hw_screen */ | |
269 | + for (i = 0; i < LCD_HEIGHT / 8; i++) { | |
270 | + | |
271 | + d = &hw_screen[i][0]; | |
272 | + s = &sw_screen[LCD_BYTE_WIDTH * 8 * i + LCD_BYTE_WIDTH - 1]; | |
273 | + | |
274 | + for (j = 0; j < LCD_WIDTH / 8; j++) { | |
275 | + | |
276 | + v0 = s[0 * LCD_BYTE_WIDTH]; | |
277 | + v1 = s[1 * LCD_BYTE_WIDTH]; | |
278 | + v2 = s[2 * LCD_BYTE_WIDTH]; | |
279 | + v3 = s[3 * LCD_BYTE_WIDTH]; | |
280 | + v4 = s[4 * LCD_BYTE_WIDTH]; | |
281 | + v5 = s[5 * LCD_BYTE_WIDTH]; | |
282 | + v6 = s[6 * LCD_BYTE_WIDTH]; | |
283 | + v7 = s[7 * LCD_BYTE_WIDTH]; | |
284 | + | |
285 | + d[0] = ((v7 & 0x01) << 7) | | |
286 | + ((v6 & 0x01) << 6) | | |
287 | + ((v5 & 0x01) << 5) | | |
288 | + ((v4 & 0x01) << 4) | | |
289 | + ((v3 & 0x01) << 3) | | |
290 | + ((v2 & 0x01) << 2) | | |
291 | + ((v1 & 0x01) << 1) | | |
292 | + (v0 & 0x01) ; | |
293 | + | |
294 | + d[1] = ((v7 & 0x02) << 6) | | |
295 | + ((v6 & 0x02) << 5) | | |
296 | + ((v5 & 0x02) << 4) | | |
297 | + ((v4 & 0x02) << 3) | | |
298 | + ((v3 & 0x02) << 2) | | |
299 | + ((v2 & 0x02) << 1) | | |
300 | + ((v1 & 0x02) << 0) | | |
301 | + ((v0 & 0x02) >> 1) ; | |
302 | + | |
303 | + d[2] = ((v7 & 0x04) << 5) | | |
304 | + ((v6 & 0x04) << 4) | | |
305 | + ((v5 & 0x04) << 3) | | |
306 | + ((v4 & 0x04) << 2) | | |
307 | + ((v3 & 0x04) << 1) | | |
308 | + (v2 & 0x04) | | |
309 | + ((v1 & 0x04) >> 1) | | |
310 | + ((v0 & 0x04) >> 2) ; | |
311 | + | |
312 | + d[3] = ((v7 & 0x08) << 4) | | |
313 | + ((v6 & 0x08) << 3) | | |
314 | + ((v5 & 0x08) << 2) | | |
315 | + ((v4 & 0x08) << 1) | | |
316 | + (v3 & 0x08) | | |
317 | + ((v2 & 0x08) >> 1) | | |
318 | + ((v1 & 0x08) >> 2) | | |
319 | + ((v0 & 0x08) >> 3) ; | |
320 | + | |
321 | + d[4] = ((v7 & 0x10) << 3) | | |
322 | + ((v6 & 0x10) << 2) | | |
323 | + ((v5 & 0x10) << 1) | | |
324 | + (v4 & 0x10) | | |
325 | + ((v3 & 0x10) >> 1) | | |
326 | + ((v2 & 0x10) >> 2) | | |
327 | + ((v1 & 0x10) >> 3) | | |
328 | + ((v0 & 0x10) >> 4) ; | |
329 | + | |
330 | + d[5] = ((v7 & 0x20) << 2) | | |
331 | + ((v6 & 0x20) << 1) | | |
332 | + (v5 & 0x20) | | |
333 | + ((v4 & 0x20) >> 1) | | |
334 | + ((v3 & 0x20) >> 2) | | |
335 | + ((v2 & 0x20) >> 3) | | |
336 | + ((v1 & 0x20) >> 4) | | |
337 | + ((v0 & 0x20) >> 5) ; | |
338 | + | |
339 | + d[6] = ((v7 & 0x40) << 1) | | |
340 | + (v6 & 0x40) | | |
341 | + ((v5 & 0x40) >> 1) | | |
342 | + ((v4 & 0x40) >> 2) | | |
343 | + ((v3 & 0x40) >> 3) | | |
344 | + ((v2 & 0x40) >> 4) | | |
345 | + ((v1 & 0x40) >> 5) | | |
346 | + ((v0 & 0x40) >> 6) ; | |
347 | + | |
348 | + d[7] = (v7 & 0x80) | | |
349 | + ((v6 & 0x80) >> 1) | | |
350 | + ((v5 & 0x80) >> 2) | | |
351 | + ((v4 & 0x80) >> 3) | | |
352 | + ((v3 & 0x80) >> 4) | | |
353 | + ((v2 & 0x80) >> 5) | | |
354 | + ((v1 & 0x80) >> 6) | | |
355 | + ((v0 & 0x80) >> 7) ; | |
356 | + | |
357 | + d += 8; | |
358 | + s--; | |
359 | + } | |
360 | + } | |
361 | + | |
362 | + /* and now output only the differences */ | |
363 | + for (i = 0; i < LCD_PAGES; i++) { | |
364 | + | |
365 | + b = &hw_screen[i][0]; | |
366 | + e = &hw_screen[i][LCD_COLUMNS]; | |
367 | + | |
368 | + d = &last_hw_screen[i][0]; | |
369 | + s = b; | |
370 | + | |
371 | + last_page = -1; | |
372 | + | |
373 | + /* update only the differences */ | |
374 | + do { | |
375 | + while (s < e && *s == *d) { | |
376 | + s++; | |
377 | + d++; | |
378 | + } | |
379 | + if (s == e) | |
380 | + break; | |
381 | + r = s; | |
382 | + while (s < e && *s != *d) | |
383 | + *d++ = *s++; | |
384 | + | |
385 | + j = r - b; | |
386 | + | |
387 | + if (i != last_page) { | |
388 | + sed156x_cmd_transfer(LCD_PADDR | i); | |
389 | + last_page = i; | |
390 | + } | |
391 | + | |
392 | + sed156x_cmd_transfer(LCD_CADRH | ((j >> 4) & 0x0F)); | |
393 | + sed156x_cmd_transfer(LCD_CADRL | (j & 0x0F)); | |
394 | + sed156x_data_block_transfer(r, s - r); | |
395 | + | |
396 | + } while (s < e); | |
397 | + } | |
398 | + | |
399 | +/******** | |
400 | + for (i = 0; i < LCD_PAGES; i++) { | |
401 | + sed156x_cmd_transfer(LCD_PADDR | i); | |
402 | + sed156x_cmd_transfer(LCD_CADRH | 0); | |
403 | + sed156x_cmd_transfer(LCD_CADRL | 0); | |
404 | + sed156x_data_block_transfer(&hw_screen[i][0], LCD_COLUMNS); | |
405 | + } | |
406 | + memcpy(last_hw_screen, hw_screen, sizeof(last_hw_screen)); | |
407 | +********/ | |
408 | +} | |
409 | + | |
410 | +void sed156x_clear(void) | |
411 | +{ | |
412 | + memset(sw_screen, 0, sizeof(sw_screen)); | |
413 | +} | |
414 | + | |
415 | +void sed156x_output_at(int x, int y, const char *str, int size) | |
416 | +{ | |
417 | + int i, j; | |
418 | + u8 *p; | |
419 | + const u8 *s; | |
420 | + | |
421 | + if ((unsigned int)y >= LCD_TEXT_HEIGHT || (unsigned int)x >= LCD_TEXT_WIDTH) | |
422 | + return; | |
423 | + | |
424 | + p = &sw_screen[y * VIDEO_FONT_HEIGHT * LCD_BYTE_WIDTH + x * VIDEO_FONT_BYTE_WIDTH]; | |
425 | + | |
426 | + while (--size >= 0) { | |
427 | + | |
428 | + s = &video_fontdata[((int)*str++ & 0xff) * VIDEO_FONT_BYTE_WIDTH * VIDEO_FONT_HEIGHT]; | |
429 | + for (i = 0; i < VIDEO_FONT_HEIGHT; i++) { | |
430 | + for (j = 0; j < VIDEO_FONT_BYTE_WIDTH; j++) | |
431 | + *p++ = *s++; | |
432 | + p += LCD_BYTE_WIDTH - VIDEO_FONT_BYTE_WIDTH; | |
433 | + } | |
434 | + p -= (LCD_BYTE_LINESZ - VIDEO_FONT_BYTE_WIDTH); | |
435 | + | |
436 | + if (x >= LCD_TEXT_WIDTH) | |
437 | + break; | |
438 | + x++; | |
439 | + } | |
440 | +} | |
441 | + | |
442 | +void sed156x_reverse_at(int x, int y, int size) | |
443 | +{ | |
444 | + int i, j; | |
445 | + u8 *p; | |
446 | + | |
447 | + if ((unsigned int)y >= LCD_TEXT_HEIGHT || (unsigned int)x >= LCD_TEXT_WIDTH) | |
448 | + return; | |
449 | + | |
450 | + p = &sw_screen[y * VIDEO_FONT_HEIGHT * LCD_BYTE_WIDTH + x * VIDEO_FONT_BYTE_WIDTH]; | |
451 | + | |
452 | + while (--size >= 0) { | |
453 | + | |
454 | + for (i = 0; i < VIDEO_FONT_HEIGHT; i++) { | |
455 | + for (j = 0; j < VIDEO_FONT_BYTE_WIDTH; j++, p++) | |
456 | + *p = ~*p; | |
457 | + p += LCD_BYTE_WIDTH - VIDEO_FONT_BYTE_WIDTH; | |
458 | + } | |
459 | + p -= (LCD_BYTE_LINESZ - VIDEO_FONT_BYTE_WIDTH); | |
460 | + | |
461 | + if (x >= LCD_TEXT_WIDTH) | |
462 | + break; | |
463 | + x++; | |
464 | + } | |
465 | +} | |
466 | + | |
467 | +void sed156x_scroll_line(void) | |
468 | +{ | |
469 | + memmove(&sw_screen[0], | |
470 | + &sw_screen[LCD_BYTE_LINESZ], | |
471 | + LCD_BYTE_WIDTH * (LCD_HEIGHT - VIDEO_FONT_HEIGHT)); | |
472 | +} | |
473 | + | |
474 | +void sed156x_scroll(int dx, int dy) | |
475 | +{ | |
476 | + u8 *p1 = NULL, *p2 = NULL, *p3 = NULL; /* pacify gcc */ | |
477 | + int adx, ady, i, sz; | |
478 | + | |
479 | + adx = dx > 0 ? dx : -dx; | |
480 | + ady = dy > 0 ? dy : -dy; | |
481 | + | |
482 | + /* overscroll? erase everything */ | |
483 | + if (adx >= LCD_TEXT_WIDTH || ady >= LCD_TEXT_HEIGHT) { | |
484 | + memset(sw_screen, 0, sizeof(sw_screen)); | |
485 | + return; | |
486 | + } | |
487 | + | |
488 | + sz = LCD_BYTE_LINESZ * ady; | |
489 | + if (dy > 0) { | |
490 | + p1 = &sw_screen[0]; | |
491 | + p2 = &sw_screen[sz]; | |
492 | + p3 = &sw_screen[LCD_BYTE_WIDTH * LCD_HEIGHT - sz]; | |
493 | + } else if (dy < 0) { | |
494 | + p1 = &sw_screen[sz]; | |
495 | + p2 = &sw_screen[0]; | |
496 | + p3 = &sw_screen[0]; | |
497 | + } | |
498 | + | |
499 | + if (ady > 0) { | |
500 | + memmove(p1, p2, LCD_BYTE_WIDTH * LCD_HEIGHT - sz); | |
501 | + memset(p3, 0, sz); | |
502 | + } | |
503 | + | |
504 | + sz = VIDEO_FONT_BYTE_WIDTH * adx; | |
505 | + if (dx > 0) { | |
506 | + p1 = &sw_screen[0]; | |
507 | + p2 = &sw_screen[0] + sz; | |
508 | + p3 = &sw_screen[0] + LCD_BYTE_WIDTH - sz; | |
509 | + } else if (dx < 0) { | |
510 | + p1 = &sw_screen[0] + sz; | |
511 | + p2 = &sw_screen[0]; | |
512 | + p3 = &sw_screen[0]; | |
513 | + } | |
514 | + | |
515 | + /* xscroll */ | |
516 | + if (adx > 0) { | |
517 | + for (i = 0; i < LCD_HEIGHT; i++) { | |
518 | + memmove(p1, p2, LCD_BYTE_WIDTH - sz); | |
519 | + memset(p3, 0, sz); | |
520 | + p1 += LCD_BYTE_WIDTH; | |
521 | + p2 += LCD_BYTE_WIDTH; | |
522 | + p3 += LCD_BYTE_WIDTH; | |
523 | + } | |
524 | + } | |
525 | +} | |
526 | + | |
527 | +void sed156x_init(void) | |
528 | +{ | |
529 | + int i; | |
530 | + | |
531 | + SED156X_CS(1); | |
532 | + SED156X_A0(1); | |
533 | + | |
534 | + /* Send initialization commands to the LCD */ | |
535 | + sed156x_cmd_transfer(LCD_OFF); /* Turn display OFF */ | |
536 | + sed156x_cmd_transfer(LCD_BIAS); /* set the LCD Bias, */ | |
537 | + sed156x_cmd_transfer(LCD_ADCMODE); /* ADC mode, */ | |
538 | + sed156x_cmd_transfer(LCD_COMDIR); /* common output mode, */ | |
539 | + sed156x_cmd_transfer(LCD_RESRT | LCD_RRATIO); /* resistor ratio, */ | |
540 | + sed156x_cmd_transfer(LCD_EVSET); /* electronic volume, */ | |
541 | + sed156x_cmd_transfer(LCD_CNTRST); | |
542 | + sed156x_cmd_transfer(LCD_PWRMD | LCD_POWERM); /* and power mode */ | |
543 | + sed156x_cmd_transfer(LCD_PADDR | 0); /* cursor home */ | |
544 | + sed156x_cmd_transfer(LCD_CADRH | 0); | |
545 | + sed156x_cmd_transfer(LCD_CADRL | 0); | |
546 | + sed156x_cmd_transfer(LCD_LADDR | 0); /* and display start line */ | |
547 | + sed156x_cmd_transfer(LCD_DSP_NRM); /* LCD display Normal */ | |
548 | + | |
549 | + /* clear everything */ | |
550 | + memset(sw_screen, 0, sizeof(sw_screen)); | |
551 | + memset(hw_screen, 0, sizeof(hw_screen)); | |
552 | + memset(last_hw_screen, 0, sizeof(last_hw_screen)); | |
553 | + | |
554 | + for (i = 0; i < LCD_PAGES; i++) { | |
555 | + sed156x_cmd_transfer(LCD_PADDR | i); | |
556 | + sed156x_cmd_transfer(LCD_CADRH | 0); | |
557 | + sed156x_cmd_transfer(LCD_CADRL | 0); | |
558 | + sed156x_data_block_transfer(&hw_screen[i][0], LCD_COLUMNS); | |
559 | + } | |
560 | + | |
561 | + sed156x_clear(); | |
562 | + sed156x_sync(); | |
563 | + sed156x_cmd_transfer(LCD_ON); /* Turn display ON */ | |
564 | +} | |
565 | + | |
566 | +#endif /* CONFIG_SED156X */ |
include/post.h
include/sed156x.h
1 | +/* | |
2 | + * (C) Copyright 2004 | |
3 | + * | |
4 | + * Pantelis Antoniou <panto@intracom.gr> | |
5 | + * Intracom S.A. | |
6 | + * | |
7 | + * See file CREDITS for list of people who contributed to this | |
8 | + * project. | |
9 | + * | |
10 | + * This program is free software; you can redistribute it and/or | |
11 | + * modify it under the terms of the GNU General Public License as | |
12 | + * published by the Free Software Foundation; either version 2 of | |
13 | + * the License, or (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program; if not, write to the Free Software | |
22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
23 | + * MA 02111-1307 USA | |
24 | + */ | |
25 | + | |
26 | +/* Video support for Epson SED156x chipset(s) */ | |
27 | + | |
28 | +#ifndef SED156X_H | |
29 | +#define SED156X_H | |
30 | + | |
31 | +void sed156x_init(void); | |
32 | +void sed156x_clear(void); | |
33 | +void sed156x_output_at(int x, int y, const char *str, int size); | |
34 | +void sed156x_reverse_at(int x, int y, int size); | |
35 | +void sed156x_sync(void); | |
36 | +void sed156x_scroll(int dx, int dy); | |
37 | + | |
38 | +/* export display */ | |
39 | +extern const int sed156x_text_width; | |
40 | +extern const int sed156x_text_height; | |
41 | + | |
42 | +#endif /* SED156X_H */ |
post/Makefile
... | ... | @@ -27,8 +27,10 @@ |
27 | 27 | LIB = libpost.a |
28 | 28 | |
29 | 29 | AOBJS = cache_8xx.o |
30 | -COBJS = post.o tests.o cpu.o rtc.o watchdog.o memory.o i2c.o cache.o sysmon.o | |
31 | -COBJS += uart.o ether.o usb.o spr.o | |
30 | +COBJS = cache.o cpu.o dsp.o ether.o | |
31 | +COBJS += i2c.o memory.o post.o rtc.o | |
32 | +COBJS += spr.o sysmon.o tests.o uart.o | |
33 | +COBJS += usb.o watchdog.o | |
32 | 34 | |
33 | 35 | include $(TOPDIR)/post/rules.mk |
post/dsp.c
1 | +/* | |
2 | + * (C) Copyright 2004 | |
3 | + * Pantelis Antoniou, Intracom S.A. , panto@intracom.gr | |
4 | + * | |
5 | + * See file CREDITS for list of people who contributed to this | |
6 | + * project. | |
7 | + * | |
8 | + * This program is free software; you can redistribute it and/or | |
9 | + * modify it under the terms of the GNU General Public License as | |
10 | + * published by the Free Software Foundation; either version 2 of | |
11 | + * the License, or (at your option) any later version. | |
12 | + * | |
13 | + * This program is distributed in the hope that it will be useful, | |
14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + * GNU General Public License for more details. | |
17 | + * | |
18 | + * You should have received a copy of the GNU General Public License | |
19 | + * along with this program; if not, write to the Free Software | |
20 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | + * MA 02111-1307 USA | |
22 | + */ | |
23 | + | |
24 | +#include <common.h> | |
25 | + | |
26 | +/* | |
27 | + * DSP test | |
28 | + * | |
29 | + * This test verifies the connection and performs a memory test | |
30 | + * on any connected DSP(s). The meat of the work is done | |
31 | + * in the board specific function. | |
32 | + */ | |
33 | + | |
34 | +#ifdef CONFIG_POST | |
35 | + | |
36 | +#include <post.h> | |
37 | + | |
38 | +#if CONFIG_POST & CFG_POST_DSP | |
39 | + | |
40 | +extern int board_post_dsp(int flags); | |
41 | + | |
42 | +int dsp_post_test (int flags) | |
43 | +{ | |
44 | + return board_post_dsp(flags); | |
45 | +} | |
46 | + | |
47 | +#endif /* CONFIG_POST & CFG_POST_DSP */ | |
48 | +#endif /* CONFIG_POST */ |
post/tests.c
... | ... | @@ -43,6 +43,7 @@ |
43 | 43 | extern int usb_post_test (int flags); |
44 | 44 | extern int spr_post_test (int flags); |
45 | 45 | extern int sysmon_post_test (int flags); |
46 | +extern int dsp_post_test (int flags); | |
46 | 47 | |
47 | 48 | extern int sysmon_init_f (void); |
48 | 49 | |
... | ... | @@ -194,6 +195,18 @@ |
194 | 195 | &sysmon_init_f, |
195 | 196 | &sysmon_reloc, |
196 | 197 | CFG_POST_SYSMON |
198 | + }, | |
199 | +#endif | |
200 | +#if CONFIG_POST & CFG_POST_DSP | |
201 | + { | |
202 | + "DSP test", | |
203 | + "dsp", | |
204 | + "This test checks any connected DSP(s).", | |
205 | + POST_RAM | POST_MANUAL, | |
206 | + &dsp_post_test, | |
207 | + NULL, | |
208 | + NULL, | |
209 | + CFG_POST_DSP | |
197 | 210 | }, |
198 | 211 | #endif |
199 | 212 | }; |