Commit 8f47d917c6b863fa9c7df3114775fde4670f62b6
Committed by
Anatolij Gustschin
1 parent
211e47549b
Exists in
master
and in
54 other branches
common lcd: minor coding style changes
No functional changes Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Showing 1 changed file with 124 additions and 121 deletions Side-by-side Diff
common/lcd.c
... | ... | @@ -76,42 +76,42 @@ |
76 | 76 | |
77 | 77 | ulong lcd_setmem (ulong addr); |
78 | 78 | |
79 | -static void lcd_drawchars (ushort x, ushort y, uchar *str, int count); | |
80 | -static inline void lcd_puts_xy (ushort x, ushort y, uchar *s); | |
81 | -static inline void lcd_putc_xy (ushort x, ushort y, uchar c); | |
79 | +static void lcd_drawchars(ushort x, ushort y, uchar *str, int count); | |
80 | +static inline void lcd_puts_xy(ushort x, ushort y, uchar *s); | |
81 | +static inline void lcd_putc_xy(ushort x, ushort y, uchar c); | |
82 | 82 | |
83 | -static int lcd_init (void *lcdbase); | |
83 | +static int lcd_init(void *lcdbase); | |
84 | 84 | |
85 | 85 | static void *lcd_logo (void); |
86 | 86 | |
87 | -static int lcd_getbgcolor (void); | |
88 | -static void lcd_setfgcolor (int color); | |
89 | -static void lcd_setbgcolor (int color); | |
87 | +static int lcd_getbgcolor(void); | |
88 | +static void lcd_setfgcolor(int color); | |
89 | +static void lcd_setbgcolor(int color); | |
90 | 90 | |
91 | 91 | char lcd_is_enabled = 0; |
92 | 92 | |
93 | 93 | #ifdef NOT_USED_SO_FAR |
94 | -static void lcd_getcolreg (ushort regno, | |
94 | +static void lcd_getcolreg(ushort regno, | |
95 | 95 | ushort *red, ushort *green, ushort *blue); |
96 | -static int lcd_getfgcolor (void); | |
96 | +static int lcd_getfgcolor(void); | |
97 | 97 | #endif /* NOT_USED_SO_FAR */ |
98 | 98 | |
99 | 99 | /************************************************************************/ |
100 | 100 | |
101 | 101 | /*----------------------------------------------------------------------*/ |
102 | 102 | |
103 | -static void console_scrollup (void) | |
103 | +static void console_scrollup(void) | |
104 | 104 | { |
105 | 105 | /* Copy up rows ignoring the first one */ |
106 | - memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE); | |
106 | + memcpy(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE); | |
107 | 107 | |
108 | 108 | /* Clear the last one */ |
109 | - memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE); | |
109 | + memset(CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE); | |
110 | 110 | } |
111 | 111 | |
112 | 112 | /*----------------------------------------------------------------------*/ |
113 | 113 | |
114 | -static inline void console_back (void) | |
114 | +static inline void console_back(void) | |
115 | 115 | { |
116 | 116 | if (--console_col < 0) { |
117 | 117 | console_col = CONSOLE_COLS-1 ; |
118 | 118 | |
... | ... | @@ -120,14 +120,13 @@ |
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - lcd_putc_xy (console_col * VIDEO_FONT_WIDTH, | |
124 | - console_row * VIDEO_FONT_HEIGHT, | |
125 | - ' '); | |
123 | + lcd_putc_xy(console_col * VIDEO_FONT_WIDTH, | |
124 | + console_row * VIDEO_FONT_HEIGHT, ' '); | |
126 | 125 | } |
127 | 126 | |
128 | 127 | /*----------------------------------------------------------------------*/ |
129 | 128 | |
130 | -static inline void console_newline (void) | |
129 | +static inline void console_newline(void) | |
131 | 130 | { |
132 | 131 | ++console_row; |
133 | 132 | console_col = 0; |
134 | 133 | |
135 | 134 | |
136 | 135 | |
137 | 136 | |
138 | 137 | |
139 | 138 | |
140 | 139 | |
141 | 140 | |
142 | 141 | |
143 | 142 | |
144 | 143 | |
145 | 144 | |
146 | 145 | |
... | ... | @@ -135,61 +134,62 @@ |
135 | 134 | /* Check if we need to scroll the terminal */ |
136 | 135 | if (console_row >= CONSOLE_ROWS) { |
137 | 136 | /* Scroll everything up */ |
138 | - console_scrollup () ; | |
137 | + console_scrollup(); | |
139 | 138 | --console_row; |
140 | 139 | } |
141 | 140 | } |
142 | 141 | |
143 | 142 | /*----------------------------------------------------------------------*/ |
144 | 143 | |
145 | -void lcd_putc (const char c) | |
144 | +void lcd_putc(const char c) | |
146 | 145 | { |
147 | 146 | if (!lcd_is_enabled) { |
148 | 147 | serial_putc(c); |
148 | + | |
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | 152 | switch (c) { |
153 | - case '\r': console_col = 0; | |
154 | - return; | |
153 | + case '\r': | |
154 | + console_col = 0; | |
155 | 155 | |
156 | - case '\n': console_newline(); | |
157 | - return; | |
156 | + return; | |
157 | + case '\n': | |
158 | + console_newline(); | |
158 | 159 | |
160 | + return; | |
159 | 161 | case '\t': /* Tab (8 chars alignment) */ |
160 | - console_col += 8; | |
161 | - console_col &= ~7; | |
162 | + console_col += 8; | |
163 | + console_col &= ~7; | |
162 | 164 | |
163 | - if (console_col >= CONSOLE_COLS) { | |
164 | - console_newline(); | |
165 | - } | |
166 | - return; | |
165 | + if (console_col >= CONSOLE_COLS) | |
166 | + console_newline(); | |
167 | 167 | |
168 | - case '\b': console_back(); | |
169 | - return; | |
168 | + return; | |
169 | + case '\b': | |
170 | + console_back(); | |
170 | 171 | |
171 | - default: lcd_putc_xy (console_col * VIDEO_FONT_WIDTH, | |
172 | - console_row * VIDEO_FONT_HEIGHT, | |
173 | - c); | |
174 | - if (++console_col >= CONSOLE_COLS) { | |
175 | - console_newline(); | |
176 | - } | |
177 | - return; | |
172 | + return; | |
173 | + default: | |
174 | + lcd_putc_xy(console_col * VIDEO_FONT_WIDTH, | |
175 | + console_row * VIDEO_FONT_HEIGHT, c); | |
176 | + if (++console_col >= CONSOLE_COLS) | |
177 | + console_newline(); | |
178 | 178 | } |
179 | - /* NOTREACHED */ | |
180 | 179 | } |
181 | 180 | |
182 | 181 | /*----------------------------------------------------------------------*/ |
183 | 182 | |
184 | -void lcd_puts (const char *s) | |
183 | +void lcd_puts(const char *s) | |
185 | 184 | { |
186 | 185 | if (!lcd_is_enabled) { |
187 | - serial_puts (s); | |
186 | + serial_puts(s); | |
187 | + | |
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
191 | 191 | while (*s) { |
192 | - lcd_putc (*s++); | |
192 | + lcd_putc(*s++); | |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
... | ... | @@ -211,7 +211,7 @@ |
211 | 211 | /* ** Low-Level Graphics Routines */ |
212 | 212 | /************************************************************************/ |
213 | 213 | |
214 | -static void lcd_drawchars (ushort x, ushort y, uchar *str, int count) | |
214 | +static void lcd_drawchars(ushort x, ushort y, uchar *str, int count) | |
215 | 215 | { |
216 | 216 | uchar *dest; |
217 | 217 | ushort row; |
... | ... | @@ -226,7 +226,7 @@ |
226 | 226 | |
227 | 227 | dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8); |
228 | 228 | |
229 | - for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) { | |
229 | + for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) { | |
230 | 230 | uchar *s = str; |
231 | 231 | int i; |
232 | 232 | #if LCD_BPP == LCD_COLOR16 |
... | ... | @@ -239,7 +239,7 @@ |
239 | 239 | uchar rest = *d & -(1 << (8-off)); |
240 | 240 | uchar sym; |
241 | 241 | #endif |
242 | - for (i=0; i<count; ++i) { | |
242 | + for (i = 0; i < count; ++i) { | |
243 | 243 | uchar c, bits; |
244 | 244 | |
245 | 245 | c = *s++; |
246 | 246 | |
247 | 247 | |
... | ... | @@ -247,18 +247,18 @@ |
247 | 247 | |
248 | 248 | #if LCD_BPP == LCD_MONOCHROME |
249 | 249 | sym = (COLOR_MASK(lcd_color_fg) & bits) | |
250 | - (COLOR_MASK(lcd_color_bg) & ~bits); | |
250 | + (COLOR_MASK(lcd_color_bg) & ~bits); | |
251 | 251 | |
252 | 252 | *d++ = rest | (sym >> off); |
253 | 253 | rest = sym << (8-off); |
254 | 254 | #elif LCD_BPP == LCD_COLOR8 |
255 | - for (c=0; c<8; ++c) { | |
255 | + for (c = 0; c < 8; ++c) { | |
256 | 256 | *d++ = (bits & 0x80) ? |
257 | 257 | lcd_color_fg : lcd_color_bg; |
258 | 258 | bits <<= 1; |
259 | 259 | } |
260 | 260 | #elif LCD_BPP == LCD_COLOR16 |
261 | - for (c=0; c<8; ++c) { | |
261 | + for (c = 0; c < 8; ++c) { | |
262 | 262 | *d++ = (bits & 0x80) ? |
263 | 263 | lcd_color_fg : lcd_color_bg; |
264 | 264 | bits <<= 1; |
265 | 265 | |
... | ... | @@ -273,14 +273,14 @@ |
273 | 273 | |
274 | 274 | /*----------------------------------------------------------------------*/ |
275 | 275 | |
276 | -static inline void lcd_puts_xy (ushort x, ushort y, uchar *s) | |
276 | +static inline void lcd_puts_xy(ushort x, ushort y, uchar *s) | |
277 | 277 | { |
278 | 278 | lcd_drawchars(x, y, s, strlen((char *)s)); |
279 | 279 | } |
280 | 280 | |
281 | 281 | /*----------------------------------------------------------------------*/ |
282 | 282 | |
283 | -static inline void lcd_putc_xy (ushort x, ushort y, uchar c) | |
283 | +static inline void lcd_putc_xy(ushort x, ushort y, uchar c) | |
284 | 284 | { |
285 | 285 | lcd_drawchars(x, y, &c, 1); |
286 | 286 | } |
... | ... | @@ -298,7 +298,7 @@ |
298 | 298 | CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN, |
299 | 299 | }; |
300 | 300 | |
301 | -static void test_pattern (void) | |
301 | +static void test_pattern(void) | |
302 | 302 | { |
303 | 303 | ushort v_max = panel_info.vl_row; |
304 | 304 | ushort h_max = panel_info.vl_col; |
305 | 305 | |
306 | 306 | |
... | ... | @@ -307,13 +307,13 @@ |
307 | 307 | ushort v, h; |
308 | 308 | uchar *pix = (uchar *)lcd_base; |
309 | 309 | |
310 | - printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n", | |
310 | + printf("[LCD] Test Pattern: %d x %d [%d x %d]\n", | |
311 | 311 | h_max, v_max, h_step, v_step); |
312 | 312 | |
313 | 313 | /* WARNING: Code silently assumes 8bit/pixel */ |
314 | - for (v=0; v<v_max; ++v) { | |
314 | + for (v = 0; v < v_max; ++v) { | |
315 | 315 | uchar iy = v / v_step; |
316 | - for (h=0; h<h_max; ++h) { | |
316 | + for (h = 0; h < h_max; ++h) { | |
317 | 317 | uchar ix = N_BLK_HOR * iy + (h/h_step); |
318 | 318 | *pix++ = test_colors[ix]; |
319 | 319 | } |
320 | 320 | |
321 | 321 | |
... | ... | @@ -335,12 +335,12 @@ |
335 | 335 | |
336 | 336 | lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8; |
337 | 337 | |
338 | - lcd_init (lcd_base); /* LCD initialization */ | |
338 | + lcd_init(lcd_base); /* LCD initialization */ | |
339 | 339 | |
340 | 340 | /* Device initialization */ |
341 | - memset (&lcddev, 0, sizeof (lcddev)); | |
341 | + memset(&lcddev, 0, sizeof(lcddev)); | |
342 | 342 | |
343 | - strcpy (lcddev.name, "lcd"); | |
343 | + strcpy(lcddev.name, "lcd"); | |
344 | 344 | lcddev.ext = 0; /* No extensions */ |
345 | 345 | lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */ |
346 | 346 | lcddev.putc = lcd_putc; /* 'putc' function */ |
347 | 347 | |
348 | 348 | |
349 | 349 | |
350 | 350 | |
... | ... | @@ -367,35 +367,35 @@ |
367 | 367 | |
368 | 368 | #elif LCD_BPP == LCD_COLOR8 |
369 | 369 | /* Setting the palette */ |
370 | - lcd_setcolreg (CONSOLE_COLOR_BLACK, 0, 0, 0); | |
371 | - lcd_setcolreg (CONSOLE_COLOR_RED, 0xFF, 0, 0); | |
372 | - lcd_setcolreg (CONSOLE_COLOR_GREEN, 0, 0xFF, 0); | |
373 | - lcd_setcolreg (CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0); | |
374 | - lcd_setcolreg (CONSOLE_COLOR_BLUE, 0, 0, 0xFF); | |
375 | - lcd_setcolreg (CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF); | |
376 | - lcd_setcolreg (CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF); | |
377 | - lcd_setcolreg (CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA); | |
378 | - lcd_setcolreg (CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF); | |
370 | + lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0); | |
371 | + lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0); | |
372 | + lcd_setcolreg(CONSOLE_COLOR_GREEN, 0, 0xFF, 0); | |
373 | + lcd_setcolreg(CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0); | |
374 | + lcd_setcolreg(CONSOLE_COLOR_BLUE, 0, 0, 0xFF); | |
375 | + lcd_setcolreg(CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF); | |
376 | + lcd_setcolreg(CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF); | |
377 | + lcd_setcolreg(CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA); | |
378 | + lcd_setcolreg(CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF); | |
379 | 379 | #endif |
380 | 380 | |
381 | 381 | #ifndef CONFIG_SYS_WHITE_ON_BLACK |
382 | - lcd_setfgcolor (CONSOLE_COLOR_BLACK); | |
383 | - lcd_setbgcolor (CONSOLE_COLOR_WHITE); | |
382 | + lcd_setfgcolor(CONSOLE_COLOR_BLACK); | |
383 | + lcd_setbgcolor(CONSOLE_COLOR_WHITE); | |
384 | 384 | #else |
385 | - lcd_setfgcolor (CONSOLE_COLOR_WHITE); | |
386 | - lcd_setbgcolor (CONSOLE_COLOR_BLACK); | |
385 | + lcd_setfgcolor(CONSOLE_COLOR_WHITE); | |
386 | + lcd_setbgcolor(CONSOLE_COLOR_BLACK); | |
387 | 387 | #endif /* CONFIG_SYS_WHITE_ON_BLACK */ |
388 | 388 | |
389 | 389 | #ifdef LCD_TEST_PATTERN |
390 | 390 | test_pattern(); |
391 | 391 | #else |
392 | 392 | /* set framebuffer to background color */ |
393 | - memset ((char *)lcd_base, | |
393 | + memset((char *)lcd_base, | |
394 | 394 | COLOR_MASK(lcd_getbgcolor()), |
395 | 395 | lcd_line_length*panel_info.vl_row); |
396 | 396 | #endif |
397 | 397 | /* Paint the logo and retrieve LCD base address */ |
398 | - debug ("[LCD] Drawing the logo...\n"); | |
398 | + debug("[LCD] Drawing the logo...\n"); | |
399 | 399 | lcd_console_address = lcd_logo (); |
400 | 400 | |
401 | 401 | console_col = 0; |
402 | 402 | |
403 | 403 | |
... | ... | @@ -410,12 +410,12 @@ |
410 | 410 | |
411 | 411 | /*----------------------------------------------------------------------*/ |
412 | 412 | |
413 | -static int lcd_init (void *lcdbase) | |
413 | +static int lcd_init(void *lcdbase) | |
414 | 414 | { |
415 | 415 | /* Initialize the lcd controller */ |
416 | - debug ("[LCD] Initializing LCD frambuffer at %p\n", lcdbase); | |
416 | + debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase); | |
417 | 417 | |
418 | - lcd_ctrl_init (lcdbase); | |
418 | + lcd_ctrl_init(lcdbase); | |
419 | 419 | lcd_is_enabled = 1; |
420 | 420 | lcd_clear(); |
421 | 421 | lcd_enable (); |
422 | 422 | |
423 | 423 | |
... | ... | @@ -442,13 +442,13 @@ |
442 | 442 | * |
443 | 443 | * Note that this is running from ROM, so no write access to global data. |
444 | 444 | */ |
445 | -ulong lcd_setmem (ulong addr) | |
445 | +ulong lcd_setmem(ulong addr) | |
446 | 446 | { |
447 | 447 | ulong size; |
448 | - int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8; | |
448 | + int line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8; | |
449 | 449 | |
450 | - debug ("LCD panel info: %d x %d, %d bit/pix\n", | |
451 | - panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) ); | |
450 | + debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col, | |
451 | + panel_info.vl_row, NBITS(panel_info.vl_bpix)); | |
452 | 452 | |
453 | 453 | size = line_length * panel_info.vl_row; |
454 | 454 | |
455 | 455 | |
456 | 456 | |
457 | 457 | |
... | ... | @@ -458,21 +458,21 @@ |
458 | 458 | /* Allocate pages for the frame buffer. */ |
459 | 459 | addr -= size; |
460 | 460 | |
461 | - debug ("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr); | |
461 | + debug("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr); | |
462 | 462 | |
463 | - return (addr); | |
463 | + return addr; | |
464 | 464 | } |
465 | 465 | |
466 | 466 | /*----------------------------------------------------------------------*/ |
467 | 467 | |
468 | -static void lcd_setfgcolor (int color) | |
468 | +static void lcd_setfgcolor(int color) | |
469 | 469 | { |
470 | 470 | lcd_color_fg = color; |
471 | 471 | } |
472 | 472 | |
473 | 473 | /*----------------------------------------------------------------------*/ |
474 | 474 | |
475 | -static void lcd_setbgcolor (int color) | |
475 | +static void lcd_setbgcolor(int color) | |
476 | 476 | { |
477 | 477 | lcd_color_bg = color; |
478 | 478 | } |
... | ... | @@ -480,7 +480,7 @@ |
480 | 480 | /*----------------------------------------------------------------------*/ |
481 | 481 | |
482 | 482 | #ifdef NOT_USED_SO_FAR |
483 | -static int lcd_getfgcolor (void) | |
483 | +static int lcd_getfgcolor(void) | |
484 | 484 | { |
485 | 485 | return lcd_color_fg; |
486 | 486 | } |
... | ... | @@ -488,7 +488,7 @@ |
488 | 488 | |
489 | 489 | /*----------------------------------------------------------------------*/ |
490 | 490 | |
491 | -static int lcd_getbgcolor (void) | |
491 | +static int lcd_getbgcolor(void) | |
492 | 492 | { |
493 | 493 | return lcd_color_bg; |
494 | 494 | } |
... | ... | @@ -499,7 +499,7 @@ |
499 | 499 | /* ** Chipset depending Bitmap / Logo stuff... */ |
500 | 500 | /************************************************************************/ |
501 | 501 | #ifdef CONFIG_LCD_LOGO |
502 | -void bitmap_plot (int x, int y) | |
502 | +void bitmap_plot(int x, int y) | |
503 | 503 | { |
504 | 504 | #ifdef CONFIG_ATMEL_LCD |
505 | 505 | uint *cmap; |
... | ... | @@ -517,7 +517,7 @@ |
517 | 517 | volatile cpm8xx_t *cp = &(immr->im_cpm); |
518 | 518 | #endif |
519 | 519 | |
520 | - debug ("Logo: width %d height %d colors %d cmap %d\n", | |
520 | + debug("Logo: width %d height %d colors %d cmap %d\n", | |
521 | 521 | BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS, |
522 | 522 | ARRAY_SIZE(bmp_logo_palette)); |
523 | 523 | |
524 | 524 | |
... | ... | @@ -527,9 +527,9 @@ |
527 | 527 | if (NBITS(panel_info.vl_bpix) < 12) { |
528 | 528 | /* Leave room for default color map */ |
529 | 529 | #if defined(CONFIG_CPU_PXA) |
530 | - cmap = (ushort *)fbi->palette; | |
530 | + cmap = (ushort *) fbi->palette; | |
531 | 531 | #elif defined(CONFIG_MPC823) |
532 | - cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]); | |
532 | + cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]); | |
533 | 533 | #elif defined(CONFIG_ATMEL_LCD) |
534 | 534 | cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0)); |
535 | 535 | #else |
536 | 536 | |
... | ... | @@ -550,12 +550,12 @@ |
550 | 550 | uint lut_entry; |
551 | 551 | #ifdef CONFIG_ATMEL_LCD_BGR555 |
552 | 552 | lut_entry = ((colreg & 0x000F) << 11) | |
553 | - ((colreg & 0x00F0) << 2) | | |
554 | - ((colreg & 0x0F00) >> 7); | |
553 | + ((colreg & 0x00F0) << 2) | | |
554 | + ((colreg & 0x0F00) >> 7); | |
555 | 555 | #else /* CONFIG_ATMEL_LCD_RGB565 */ |
556 | 556 | lut_entry = ((colreg & 0x000F) << 1) | |
557 | - ((colreg & 0x00F0) << 3) | | |
558 | - ((colreg & 0x0F00) << 4); | |
557 | + ((colreg & 0x00F0) << 3) | | |
558 | + ((colreg & 0x0F00) << 4); | |
559 | 559 | #endif |
560 | 560 | *(cmap + BMP_LOGO_OFFSET) = lut_entry; |
561 | 561 | cmap++; |
... | ... | @@ -570,8 +570,8 @@ |
570 | 570 | |
571 | 571 | WATCHDOG_RESET(); |
572 | 572 | |
573 | - for (i=0; i<BMP_LOGO_HEIGHT; ++i) { | |
574 | - memcpy (fb, bmap, BMP_LOGO_WIDTH); | |
573 | + for (i = 0; i < BMP_LOGO_HEIGHT; ++i) { | |
574 | + memcpy(fb, bmap, BMP_LOGO_WIDTH); | |
575 | 575 | bmap += BMP_LOGO_WIDTH; |
576 | 576 | fb += panel_info.vl_col; |
577 | 577 | } |
... | ... | @@ -579,8 +579,8 @@ |
579 | 579 | else { /* true color mode */ |
580 | 580 | u16 col16; |
581 | 581 | fb16 = (ushort *)(lcd_base + y * lcd_line_length + x); |
582 | - for (i=0; i<BMP_LOGO_HEIGHT; ++i) { | |
583 | - for (j=0; j<BMP_LOGO_WIDTH; j++) { | |
582 | + for (i = 0; i < BMP_LOGO_HEIGHT; ++i) { | |
583 | + for (j = 0; j < BMP_LOGO_WIDTH; j++) { | |
584 | 584 | col16 = bmp_logo_palette[(bmap[j]-16)]; |
585 | 585 | fb16[j] = |
586 | 586 | ((col16 & 0x000F) << 1) | |
587 | 587 | |
... | ... | @@ -630,14 +630,15 @@ |
630 | 630 | volatile cpm8xx_t *cp = &(immr->im_cpm); |
631 | 631 | #endif |
632 | 632 | |
633 | - if (!((bmp->header.signature[0]=='B') && | |
634 | - (bmp->header.signature[1]=='M'))) { | |
635 | - printf ("Error: no valid bmp image at %lx\n", bmp_image); | |
633 | + if (!((bmp->header.signature[0] == 'B') && | |
634 | + (bmp->header.signature[1] == 'M'))) { | |
635 | + printf("Error: no valid bmp image at %lx\n", bmp_image); | |
636 | + | |
636 | 637 | return 1; |
637 | 638 | } |
638 | 639 | |
639 | - width = le32_to_cpu (bmp->header.width); | |
640 | - height = le32_to_cpu (bmp->header.height); | |
640 | + width = le32_to_cpu(bmp->header.width); | |
641 | + height = le32_to_cpu(bmp->header.height); | |
641 | 642 | bmp_bpix = le16_to_cpu(bmp->header.bit_count); |
642 | 643 | colors = 1 << bmp_bpix; |
643 | 644 | |
... | ... | @@ -646,6 +647,7 @@ |
646 | 647 | if ((bpix != 1) && (bpix != 8) && (bpix != 16) && (bpix != 32)) { |
647 | 648 | printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n", |
648 | 649 | bpix, bmp_bpix); |
650 | + | |
649 | 651 | return 1; |
650 | 652 | } |
651 | 653 | |
652 | 654 | |
... | ... | @@ -654,10 +656,11 @@ |
654 | 656 | printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n", |
655 | 657 | bpix, |
656 | 658 | le16_to_cpu(bmp->header.bit_count)); |
659 | + | |
657 | 660 | return 1; |
658 | 661 | } |
659 | 662 | |
660 | - debug ("Display-bmp: %d x %d with %d colors\n", | |
663 | + debug("Display-bmp: %d x %d with %d colors\n", | |
661 | 664 | (int)width, (int)height, (int)colors); |
662 | 665 | |
663 | 666 | #if !defined(CONFIG_MCC200) |
... | ... | @@ -674,7 +677,7 @@ |
674 | 677 | cmap_base = cmap; |
675 | 678 | |
676 | 679 | /* Set color map */ |
677 | - for (i=0; i<colors; ++i) { | |
680 | + for (i = 0; i < colors; ++i) { | |
678 | 681 | bmp_color_table_entry_t cte = bmp->color_table[i]; |
679 | 682 | #if !defined(CONFIG_ATMEL_LCD) |
680 | 683 | ushort colreg = |
... | ... | @@ -709,8 +712,7 @@ |
709 | 712 | * specific. |
710 | 713 | */ |
711 | 714 | #if defined(CONFIG_MCC200) |
712 | - if (bpix==1) | |
713 | - { | |
715 | + if (bpix == 1) { | |
714 | 716 | width = ((width + 7) & ~7) >> 3; |
715 | 717 | x = ((x + 7) & ~7) >> 3; |
716 | 718 | pwidth= ((pwidth + 7) & ~7) >> 3; |
717 | 719 | |
718 | 720 | |
... | ... | @@ -731,12 +733,12 @@ |
731 | 733 | y = max(0, panel_info.vl_row - height + y + 1); |
732 | 734 | #endif /* CONFIG_SPLASH_SCREEN_ALIGN */ |
733 | 735 | |
734 | - if ((x + width)>pwidth) | |
736 | + if ((x + width) > pwidth) | |
735 | 737 | width = pwidth - x; |
736 | - if ((y + height)>panel_info.vl_row) | |
738 | + if ((y + height) > panel_info.vl_row) | |
737 | 739 | height = panel_info.vl_row - y; |
738 | 740 | |
739 | - bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset); | |
741 | + bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset); | |
740 | 742 | fb = (uchar *) (lcd_base + |
741 | 743 | (y + height - 1) * lcd_line_length + x * bpix / 8); |
742 | 744 | |
743 | 745 | |
... | ... | @@ -806,11 +808,11 @@ |
806 | 808 | break; |
807 | 809 | }; |
808 | 810 | |
809 | - return (0); | |
811 | + return 0; | |
810 | 812 | } |
811 | 813 | #endif |
812 | 814 | |
813 | -static void *lcd_logo (void) | |
815 | +static void *lcd_logo(void) | |
814 | 816 | { |
815 | 817 | #ifdef CONFIG_SPLASH_SCREEN |
816 | 818 | char *s; |
817 | 819 | |
818 | 820 | |
... | ... | @@ -823,13 +825,15 @@ |
823 | 825 | |
824 | 826 | addr = simple_strtoul (s, NULL, 16); |
825 | 827 | #ifdef CONFIG_SPLASH_SCREEN_ALIGN |
826 | - if ((s = getenv ("splashpos")) != NULL) { | |
828 | + s = getenv("splashpos"); | |
829 | + if (s != NULL) { | |
827 | 830 | if (s[0] == 'm') |
828 | 831 | x = BMP_ALIGN_CENTER; |
829 | 832 | else |
830 | - x = simple_strtol (s, NULL, 0); | |
833 | + x = simple_strtol(s, NULL, 0); | |
831 | 834 | |
832 | - if ((s = strchr (s + 1, ',')) != NULL) { | |
835 | + s = strchr(s + 1, ','); | |
836 | + if (s != NULL) { | |
833 | 837 | if (s[1] == 'm') |
834 | 838 | y = BMP_ALIGN_CENTER; |
835 | 839 | else |
836 | 840 | |
... | ... | @@ -842,15 +846,14 @@ |
842 | 846 | bmp_image_t *bmp = (bmp_image_t *)addr; |
843 | 847 | unsigned long len; |
844 | 848 | |
845 | - if (!((bmp->header.signature[0]=='B') && | |
846 | - (bmp->header.signature[1]=='M'))) { | |
849 | + if (!((bmp->header.signature[0] == 'B') && | |
850 | + (bmp->header.signature[1] == 'M'))) { | |
847 | 851 | addr = (ulong)gunzip_bmp(addr, &len); |
848 | 852 | } |
849 | 853 | #endif |
850 | 854 | |
851 | - if (lcd_display_bitmap (addr, x, y) == 0) { | |
852 | - return ((void *)lcd_base); | |
853 | - } | |
855 | + if (lcd_display_bitmap(addr, x, y) == 0) | |
856 | + return (void *)lcd_base; | |
854 | 857 | } |
855 | 858 | #endif /* CONFIG_SPLASH_SCREEN */ |
856 | 859 | |
857 | 860 | |
... | ... | @@ -863,9 +866,9 @@ |
863 | 866 | #endif /* CONFIG_LCD_INFO */ |
864 | 867 | |
865 | 868 | #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) |
866 | - return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length)); | |
869 | + return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length); | |
867 | 870 | #else |
868 | - return ((void *)lcd_base); | |
871 | + return (void *)lcd_base; | |
869 | 872 | #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */ |
870 | 873 | } |
871 | 874 |