diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | 1 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 157 |
2 files changed, 81 insertions, 77 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index a2729adacd..d64a9cd958 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include "kernel.h" | 28 | #include "kernel.h" |
29 | #include "backlight.h" | 29 | #include "backlight.h" |
30 | #include "adc.h" | 30 | #include "adc.h" |
31 | #include "system.h" | ||
32 | #include "backlight-target.h" | 31 | #include "backlight-target.h" |
33 | #include "lcd-remote-target.h" | 32 | #include "lcd-remote-target.h" |
34 | #include "uart-target.h" | 33 | #include "uart-target.h" |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index ec85821649..e26a88704d 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -209,6 +209,8 @@ void lcd_init_device(void) | |||
209 | 209 | ||
210 | IO_OSD_VIDWINMD=0x0002; | 210 | IO_OSD_VIDWINMD=0x0002; |
211 | 211 | ||
212 | addr = ((int)FRAME2-CONFIG_SDRAM_START) / 32; | ||
213 | |||
212 | /* This is a bit messy, the LCD transfers appear to happen in chunks of 32 | 214 | /* This is a bit messy, the LCD transfers appear to happen in chunks of 32 |
213 | * pixels. (based on OF) | 215 | * pixels. (based on OF) |
214 | */ | 216 | */ |
@@ -242,6 +244,40 @@ void lcd_init_device(void) | |||
242 | IO_VID_ENC_VMOD|=0x01; | 244 | IO_VID_ENC_VMOD|=0x01; |
243 | } | 245 | } |
244 | 246 | ||
247 | #if defined(HAVE_LCD_MODES) | ||
248 | void lcd_set_mode(int mode) | ||
249 | { | ||
250 | if(mode==LCD_MODE_YUV) | ||
251 | { | ||
252 | /* Turn off the RGB buffer and enable the YUV buffer */ | ||
253 | IO_OSD_OSDWINMD0 |=0x04; | ||
254 | IO_OSD_VIDWINMD |=0x01; | ||
255 | memset16(FRAME2, 0x0080, LCD_NATIVE_HEIGHT*(LCD_NATIVE_WIDTH+LCD_FUDGE)); | ||
256 | } | ||
257 | else if(mode==LCD_MODE_RGB565) | ||
258 | { | ||
259 | /* Turn on the RGB window, set it to 16 bit and turn YUV window off */ | ||
260 | IO_OSD_VIDWINMD &=~(0x01); | ||
261 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 16; | ||
262 | IO_OSD_OSDWINMD0 |=(1<<13); | ||
263 | IO_OSD_OSDWINMD0 &=~0x04; | ||
264 | lcd_clear_display(); | ||
265 | } | ||
266 | else if(mode==LCD_MODE_PAL256) | ||
267 | { | ||
268 | #if LCD_NATIVE_WIDTH%32!=0 | ||
269 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32+1; | ||
270 | #else | ||
271 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32; | ||
272 | #endif | ||
273 | |||
274 | IO_OSD_VIDWINMD &=~(0x01); | ||
275 | IO_OSD_OSDWINMD0 &=~(1<<13); | ||
276 | IO_OSD_OSDWINMD0 |=0x01; | ||
277 | } | ||
278 | } | ||
279 | #endif | ||
280 | |||
245 | /* Update a fraction of the display. */ | 281 | /* Update a fraction of the display. */ |
246 | void lcd_update_rect(int x, int y, int width, int height) | 282 | void lcd_update_rect(int x, int y, int width, int height) |
247 | { | 283 | { |
@@ -317,39 +353,6 @@ void lcd_update(void) | |||
317 | #endif | 353 | #endif |
318 | } | 354 | } |
319 | 355 | ||
320 | #if defined(HAVE_LCD_MODES) | ||
321 | void lcd_set_mode(int mode) | ||
322 | { | ||
323 | if(mode==LCD_MODE_YUV) | ||
324 | { | ||
325 | /* Turn off the RGB buffer and enable the YUV buffer */ | ||
326 | IO_OSD_OSDWINMD0 &=~(0x01); | ||
327 | IO_OSD_VIDWINMD |=0x01; | ||
328 | memset16(FRAME, 0x0080, LCD_NATIVE_HEIGHT*(LCD_NATIVE_WIDTH+LCD_FUDGE)); | ||
329 | } | ||
330 | else if(mode==LCD_MODE_RGB565) | ||
331 | { | ||
332 | /* Turn on the RGB window, set it to 16 bit and turn YUV window off */ | ||
333 | IO_OSD_VIDWINMD &=~(0x01); | ||
334 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 16; | ||
335 | IO_OSD_OSDWINMD0 |=(1<<13)|0x01; | ||
336 | lcd_clear_display(); | ||
337 | } | ||
338 | else if(mode==LCD_MODE_PAL256) | ||
339 | { | ||
340 | #if LCD_NATIVE_WIDTH%32!=0 | ||
341 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32+1; | ||
342 | #else | ||
343 | IO_OSD_OSDWIN0OFST=LCD_NATIVE_WIDTH / 32; | ||
344 | #endif | ||
345 | |||
346 | IO_OSD_VIDWINMD &=~(0x01); | ||
347 | IO_OSD_OSDWINMD0 &=~(1<<13); | ||
348 | IO_OSD_OSDWINMD0 |=0x01; | ||
349 | } | ||
350 | } | ||
351 | #endif | ||
352 | |||
353 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) | 356 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) |
354 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | 357 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, |
355 | int width, int height) | 358 | int width, int height) |
@@ -362,7 +365,7 @@ void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | |||
362 | { | 365 | { |
363 | memcpy ( dst, src, width); | 366 | memcpy ( dst, src, width); |
364 | 367 | ||
365 | dst=dst+width+(LCD_NATIVE_WIDTH-x-width)+LCD_FUDGE; | 368 | dst=dst+(LCD_NATIVE_WIDTH-x+LCD_FUDGE); |
366 | src+=width; | 369 | src+=width; |
367 | } | 370 | } |
368 | 371 | ||
@@ -425,10 +428,7 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
425 | int src_x, int src_y, int stride, | 428 | int src_x, int src_y, int stride, |
426 | int x, int y, int width, int height) | 429 | int x, int y, int width, int height) |
427 | { | 430 | { |
428 | /* Caches for chroma data so it only need be recaculated every other | 431 | register unsigned char const * yuv_src[3]; |
429 | line */ | ||
430 | unsigned char const * yuv_src[3]; | ||
431 | off_t z; | ||
432 | 432 | ||
433 | if (!lcd_on) | 433 | if (!lcd_on) |
434 | return; | 434 | return; |
@@ -455,50 +455,55 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
455 | width &= ~1; | 455 | width &= ~1; |
456 | height>>=1; | 456 | height>>=1; |
457 | 457 | ||
458 | fb_data * dst = FRAME + ((LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1)) | 458 | fb_data * dst = FRAME2 |
459 | + ((LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1)) | ||
459 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y ; | 460 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y ; |
460 | 461 | ||
461 | z = stride*src_y; | 462 | /* Scope z */ |
462 | yuv_src[0] = src[0] + z + src_x; | 463 | { |
463 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | 464 | off_t z; |
464 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | 465 | z = stride*src_y; |
466 | yuv_src[0] = src[0] + z + src_x; | ||
467 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
468 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
469 | } | ||
465 | 470 | ||
471 | register int cbcr_remain=(stride>>1)-(width>>1); | ||
472 | register int y_remain=(stride<<1)-width; | ||
473 | do | ||
466 | { | 474 | { |
467 | do | 475 | register fb_data *c_dst=dst; |
468 | { | 476 | register int c_width=width; |
469 | register fb_data *c_dst=dst; | 477 | |
470 | register int c_width=width; | 478 | do |
471 | unsigned char const * c_yuv_src[3]; | 479 | { |
472 | c_yuv_src[0] = yuv_src[0]; | 480 | /* This needs to be done in a block of 4 pixels */ |
473 | c_yuv_src[1] = yuv_src[1]; | 481 | |
474 | c_yuv_src[2] = yuv_src[2]; | 482 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; |
475 | 483 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; | |
476 | do | 484 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); |
477 | { | ||
478 | /* This needs to be done in a block of 4 pixels */ | ||
479 | *c_dst=*c_yuv_src[0]<<8 | *c_yuv_src[1]; | ||
480 | *(c_dst+1)=*(c_yuv_src[0]+stride)<<8 | *c_yuv_src[2]; | ||
481 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | ||
482 | c_yuv_src[0]++; | ||
483 | *c_dst=*c_yuv_src[0]<<8 | *c_yuv_src[1]; | ||
484 | *(c_dst+1)=*(c_yuv_src[0]+stride)<<8 | *c_yuv_src[2]; | ||
485 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | ||
486 | c_yuv_src[0]++; | ||
487 | |||
488 | c_yuv_src[1]++; | ||
489 | c_yuv_src[2]++; | ||
490 | |||
491 | c_width -= 2; | ||
492 | } | ||
493 | while (c_width > 0); | ||
494 | 485 | ||
495 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | 486 | yuv_src[0]++; |
496 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | 487 | |
497 | yuv_src[2] += stride >> 1; | 488 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; |
498 | dst+=2; | 489 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; |
499 | } | 490 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); |
500 | while (--height > 0); | 491 | |
492 | yuv_src[0]++; | ||
493 | |||
494 | yuv_src[1]++; | ||
495 | yuv_src[2]++; | ||
496 | |||
497 | c_width -= 2; | ||
498 | } | ||
499 | while (c_width > 0); | ||
500 | |||
501 | yuv_src[0] += y_remain; /* Skip down two luma lines-width */ | ||
502 | yuv_src[1] += cbcr_remain; /* Skip down one chroma line-width/2 */ | ||
503 | yuv_src[2] += cbcr_remain; | ||
504 | dst+=2; | ||
501 | } | 505 | } |
506 | while (--height > 0); | ||
502 | } | 507 | } |
503 | 508 | ||
504 | void lcd_set_contrast(int val) { | 509 | void lcd_set_contrast(int val) { |