summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iaudio')
-rw-r--r--firmware/target/coldfire/iaudio/m3/lcd-m3.c66
-rw-r--r--firmware/target/coldfire/iaudio/m5/lcd-m5.c6
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-x5.c17
3 files changed, 56 insertions, 33 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 */
diff --git a/firmware/target/coldfire/iaudio/m5/lcd-m5.c b/firmware/target/coldfire/iaudio/m5/lcd-m5.c
index be9d5a39b8..71d49f544b 100644
--- a/firmware/target/coldfire/iaudio/m5/lcd-m5.c
+++ b/firmware/target/coldfire/iaudio/m5/lcd-m5.c
@@ -131,8 +131,8 @@ void lcd_init_device(void)
131 131
132/* Performance function that works with an external buffer 132/* Performance function that works with an external buffer
133 note that by and bheight are in 8-pixel units! */ 133 note that by and bheight are in 8-pixel units! */
134void lcd_blit(const unsigned char* data, int x, int by, int width, 134void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
135 int bheight, int stride) 135 int bheight, int stride)
136{ 136{
137 const unsigned char *src, *src_end; 137 const unsigned char *src, *src_end;
138 unsigned char *dst_u, *dst_l; 138 unsigned char *dst_u, *dst_l;
@@ -176,7 +176,7 @@ void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
176 176
177/* Performance function that works with an external buffer 177/* Performance function that works with an external buffer
178 note that by and bheight are in 4-pixel units! */ 178 note that by and bheight are in 4-pixel units! */
179void lcd_grey_phase_blit(unsigned char *values, unsigned char *phases, 179void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
180 int x, int by, int width, int bheight, int stride) 180 int x, int by, int width, int bheight, int stride)
181{ 181{
182 stride <<= 2; /* 4 pixels per block */ 182 stride <<= 2; /* 4 pixels per block */
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 5ca2cb508c..19faf0474d 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -407,21 +407,6 @@ void lcd_sleep(void)
407 407
408/*** update functions ***/ 408/*** update functions ***/
409 409
410/* Performance function that works with an external buffer
411 note that by and bheight are in 8-pixel units! */
412void lcd_blit(const fb_data* data, int x, int by, int width,
413 int bheight, int stride)
414{
415 /* TODO: Implement lcd_blit() */
416 (void)data;
417 (void)x;
418 (void)by;
419 (void)width;
420 (void)bheight;
421 (void)stride;
422 /*if(display_on)*/
423}
424
425/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. 410/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420.
426 * y should have two lines of Y back to back, 2nd line first. 411 * y should have two lines of Y back to back, 2nd line first.
427 * c should contain the Cb and Cr data for the two lines of Y back to back. 412 * c should contain the Cb and Cr data for the two lines of Y back to back.
@@ -434,7 +419,7 @@ extern void lcd_write_yuv420_lines(const unsigned char *y,
434 * src_x, src_y, width and height should be even and within the LCD's 419 * src_x, src_y, width and height should be even and within the LCD's
435 * boundaries. 420 * boundaries.
436 */ 421 */
437void lcd_yuv_blit(unsigned char * const src[3], 422void lcd_blit_yuv(unsigned char * const src[3],
438 int src_x, int src_y, int stride, 423 int src_x, int src_y, int stride,
439 int x, int y, int width, int height) 424 int x, int y, int width, int height)
440{ 425{