summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio/m3/lcd-m3.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-24 00:35:53 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-24 00:35:53 +0000
commit68a21689aef3a81335456476d4d10860ef5bc6b3 (patch)
treea57b6c31e4edd13e178da276344d33b172796456 /firmware/target/coldfire/iaudio/m3/lcd-m3.c
parent99c0978faa94b0e2fabe5d06000a10c8d48e7a0c (diff)
downloadrockbox-68a21689aef3a81335456476d4d10860ef5bc6b3.tar.gz
rockbox-68a21689aef3a81335456476d4d10860ef5bc6b3.zip
Consistent naming scheme the various blit functions. * Removed lcd_blit_mono() for colour targets. Plugin API became incompatible, so sort, clean up & bump. * Implemented lcd_blit_mono() for M3.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16775 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iaudio/m3/lcd-m3.c')
-rw-r--r--firmware/target/coldfire/iaudio/m3/lcd-m3.c66
1 files changed, 52 insertions, 14 deletions
diff --git a/firmware/target/coldfire/iaudio/m3/lcd-m3.c b/firmware/target/coldfire/iaudio/m3/lcd-m3.c
index b1e81f91ba..ae72832a82 100644
--- a/firmware/target/coldfire/iaudio/m3/lcd-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/lcd-m3.c
@@ -289,6 +289,35 @@ void lcd_write_data(const fb_data *p_words, int count)
289 CS_HI; 289 CS_HI;
290} 290}
291 291
292static void lcd_mono_data(const unsigned char *p_words, int count)
293{
294 unsigned data;
295 const unsigned char *p_bytes = p_words;
296 const unsigned char *p_end = p_words + count;
297
298 RS_HI;
299 CS_LO;
300 if (cpu_frequency < 50000000)
301 {
302 while (p_bytes < p_end)
303 {
304 data = *p_bytes++;
305 _write_fast(data);
306 _write_fast(data);
307 }
308 }
309 else
310 {
311 while (p_bytes < p_end)
312 {
313 data = *p_bytes++;
314 _write_byte(data);
315 _write_byte(data);
316 }
317 }
318 CS_HI;
319}
320
292int lcd_default_contrast(void) 321int lcd_default_contrast(void)
293{ 322{
294 return DEFAULT_CONTRAST_SETTING; 323 return DEFAULT_CONTRAST_SETTING;
@@ -341,7 +370,7 @@ void lcd_on(void)
341 lcd_write_command_e(LCD_SET_GRAY | 6, 0xcc); 370 lcd_write_command_e(LCD_SET_GRAY | 6, 0xcc);
342 lcd_write_command_e(LCD_SET_GRAY | 7, 0x0c); 371 lcd_write_command_e(LCD_SET_GRAY | 7, 0x0c);
343 372
344 lcd_write_command(LCD_SET_PWM_FRC | 6); /* 4FRC + 12PWM */ 373 lcd_write_command(LCD_SET_PWM_FRC | 6); /* 3FRC + 12PWM */
345 374
346 lcd_write_command(LCD_DISPLAY_ON | 1); /* display on */ 375 lcd_write_command(LCD_DISPLAY_ON | 1); /* display on */
347 376
@@ -428,24 +457,31 @@ void lcd_init_device(void)
428#endif 457#endif
429} 458}
430 459
431/* TODO: implement blit functions */
432
433/* Performance function that works with an external buffer 460/* Performance function that works with an external buffer
434 note that by and bheight are in 8-pixel units! */ 461 note that by and bheight are in 8-pixel units! */
435void lcd_blit(const fb_data *data, int x, int by, int width, 462void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
436 int bheight, int stride) 463 int bheight, int stride)
437{ 464{
438 (void)data; 465 if (initialized)
439 (void)x; 466 {
440 (void)by; 467 /* COM48-COM63 are not connected, so we need to skip those */
441 (void)width; 468 while (bheight--)
442 (void)bheight; 469 {
443 (void)stride; 470 lcd_write_command(LCD_SET_PAGE | ((by > 5 ? by + 2 : by) & 0xf));
471 lcd_write_command_e(LCD_SET_COLUMN | ((x >> 4) & 0xf), x & 0xf);
472
473 lcd_mono_data(data, width);
474 data += stride;
475 by++;
476 }
477 }
444} 478}
445 479
480/* TODO: implement grey blit function */
481
446/* Performance function that works with an external buffer 482/* Performance function that works with an external buffer
447 note that by and bheight are in 8-pixel units! */ 483 note that by and bheight are in 8-pixel units! */
448void lcd_grey_phase_blit(unsigned char *values, unsigned char *phases, 484void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
449 int x, int by, int width, int bheight, int stride) 485 int x, int by, int width, int bheight, int stride)
450{ 486{
451 (void)values; 487 (void)values;
@@ -463,7 +499,8 @@ void lcd_update(void) ICODE_ATTR;
463void lcd_update(void) 499void lcd_update(void)
464{ 500{
465 int y; 501 int y;
466 if(initialized) { 502 if (initialized)
503 {
467 for(y = 0;y < LCD_FBHEIGHT;y++) { 504 for(y = 0;y < LCD_FBHEIGHT;y++) {
468 /* Copy display bitmap to hardware. 505 /* Copy display bitmap to hardware.
469 The COM48-COM63 lines are not connected so we have to skip 506 The COM48-COM63 lines are not connected so we have to skip
@@ -480,7 +517,8 @@ void lcd_update(void)
480void lcd_update_rect(int, int, int, int) ICODE_ATTR; 517void lcd_update_rect(int, int, int, int) ICODE_ATTR;
481void lcd_update_rect(int x, int y, int width, int height) 518void lcd_update_rect(int x, int y, int width, int height)
482{ 519{
483 if(initialized) { 520 if (initialized)
521 {
484 int ymax; 522 int ymax;
485 523
486 /* The Y coordinates have to work on even 8 pixel rows */ 524 /* The Y coordinates have to work on even 8 pixel rows */