diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index 75e4b9e579..0debdaf098 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -69,14 +69,14 @@ void lcd_sleep() | |||
69 | if (lcd_on) | 69 | if (lcd_on) |
70 | { | 70 | { |
71 | lcd_on = false; | 71 | lcd_on = false; |
72 | memset16(FRAME, 0xFFFF, LCD_WIDTH*LCD_HEIGHT); | 72 | memset16(FRAME, 0xFFFF, LCD_WIDTH*LCD_HEIGHT); |
73 | sleep(HZ/5); | 73 | sleep(HZ/5); |
74 | /* Disabling these saves another ~15mA */ | 74 | /* Disabling these saves another ~15mA */ |
75 | IO_OSD_OSDWINMD0 &= ~(0x01); | 75 | IO_OSD_OSDWINMD0 &= ~(0x01); |
76 | IO_VID_ENC_VMOD &= ~(0x01); | 76 | IO_VID_ENC_VMOD &= ~(0x01); |
77 | 77 | ||
78 | /* Disabling the LCD saves ~50mA */ | 78 | /* Disabling the LCD saves ~50mA */ |
79 | IO_GIO_BITCLR2=1<<4; /* pin 36 */ | 79 | IO_GIO_BITCLR2=1<<4; /* pin 36 */ |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
@@ -85,11 +85,11 @@ void lcd_awake(void) | |||
85 | /* "enabled" implies "powered" */ | 85 | /* "enabled" implies "powered" */ |
86 | if (!lcd_on) | 86 | if (!lcd_on) |
87 | { | 87 | { |
88 | lcd_on=true; | 88 | lcd_on=true; |
89 | IO_OSD_OSDWINMD0 |= 0x01; | 89 | IO_OSD_OSDWINMD0 |= 0x01; |
90 | IO_VID_ENC_VMOD |= 0x01; | 90 | IO_VID_ENC_VMOD |= 0x01; |
91 | 91 | ||
92 | sleep(2); | 92 | sleep(2); |
93 | IO_GIO_BITSET2 = 1<<4; | 93 | IO_GIO_BITSET2 = 1<<4; |
94 | 94 | ||
95 | lcd_update(); | 95 | lcd_update(); |
@@ -120,8 +120,8 @@ void lcd_enable_composite(bool enable) | |||
120 | { | 120 | { |
121 | IO_GIO_BITCLR2 = 0x80; | 121 | IO_GIO_BITCLR2 = 0x80; |
122 | vidtemp |= 0x2015; | 122 | vidtemp |= 0x2015; |
123 | IO_VID_ENC_DCLKCTL = 0x0800; | 123 | IO_VID_ENC_DCLKCTL = 0x0800; |
124 | IO_VID_ENC_DCLKPTN0 = 0x0001; | 124 | IO_VID_ENC_DCLKPTN0 = 0x0001; |
125 | } | 125 | } |
126 | 126 | ||
127 | IO_VID_ENC_VMOD = vidtemp; | 127 | IO_VID_ENC_VMOD = vidtemp; |
@@ -179,40 +179,40 @@ void lcd_init_device(void) | |||
179 | /* Clear the Frame */ | 179 | /* Clear the Frame */ |
180 | memset16(FRAME, 0x0000, LCD_WIDTH*LCD_HEIGHT); | 180 | memset16(FRAME, 0x0000, LCD_WIDTH*LCD_HEIGHT); |
181 | 181 | ||
182 | IO_OSD_OSDWINMD0 &= ~(0x0001); | 182 | IO_OSD_OSDWINMD0 &= ~(0x0001); |
183 | IO_OSD_VIDWINMD &= ~(0x0001); | 183 | IO_OSD_VIDWINMD &= ~(0x0001); |
184 | 184 | ||
185 | /* Setup the LCD controller */ | 185 | /* Setup the LCD controller */ |
186 | IO_VID_ENC_VMOD = 0x2014; | 186 | IO_VID_ENC_VMOD = 0x2014; |
187 | IO_VID_ENC_VDCTL = 0x2000; | 187 | IO_VID_ENC_VDCTL = 0x2000; |
188 | IO_VID_ENC_VDPRO = 0x0000; | 188 | IO_VID_ENC_VDPRO = 0x0000; |
189 | IO_VID_ENC_SYNCTL = 0x100E; | 189 | IO_VID_ENC_SYNCTL = 0x100E; |
190 | IO_VID_ENC_HSPLS = 1; /* HSYNC pulse width */ | 190 | IO_VID_ENC_HSPLS = 1; /* HSYNC pulse width */ |
191 | IO_VID_ENC_VSPLS = 1; /* VSYNC pulse width */ | 191 | IO_VID_ENC_VSPLS = 1; /* VSYNC pulse width */ |
192 | 192 | ||
193 | /* These calculations support 640x480 and 320x240 (based on OF) */ | 193 | /* These calculations support 640x480 and 320x240 (based on OF) */ |
194 | IO_VID_ENC_HINT = LCD_NATIVE_WIDTH+LCD_NATIVE_WIDTH/3; | 194 | IO_VID_ENC_HINT = LCD_NATIVE_WIDTH+LCD_NATIVE_WIDTH/3; |
195 | IO_VID_ENC_HSTART = LCD_NATIVE_WIDTH/6; /* Back porch */ | 195 | IO_VID_ENC_HSTART = LCD_NATIVE_WIDTH/6; /* Back porch */ |
196 | IO_VID_ENC_HVALID = LCD_NATIVE_WIDTH; /* Data valid */ | 196 | IO_VID_ENC_HVALID = LCD_NATIVE_WIDTH; /* Data valid */ |
197 | IO_VID_ENC_VINT = LCD_NATIVE_HEIGHT+8; | 197 | IO_VID_ENC_VINT = LCD_NATIVE_HEIGHT+8; |
198 | IO_VID_ENC_VSTART = 2; | 198 | IO_VID_ENC_VSTART = 2; |
199 | IO_VID_ENC_VVALID = LCD_NATIVE_HEIGHT; | 199 | IO_VID_ENC_VVALID = LCD_NATIVE_HEIGHT; |
200 | 200 | ||
201 | IO_VID_ENC_HSDLY = 0x0000; | 201 | IO_VID_ENC_HSDLY = 0x0000; |
202 | IO_VID_ENC_VSDLY = 0x0000; | 202 | IO_VID_ENC_VSDLY = 0x0000; |
203 | IO_VID_ENC_YCCTL = 0x0000; | 203 | IO_VID_ENC_YCCTL = 0x0000; |
204 | IO_VID_ENC_RGBCTL = 0x0000; | 204 | IO_VID_ENC_RGBCTL = 0x0000; |
205 | IO_VID_ENC_RGBCLP = 0xFF00; | 205 | IO_VID_ENC_RGBCLP = 0xFF00; |
206 | IO_VID_ENC_LNECTL = 0x0000; | 206 | IO_VID_ENC_LNECTL = 0x0000; |
207 | IO_VID_ENC_CULLLNE = 0x0000; | 207 | IO_VID_ENC_CULLLNE = 0x0000; |
208 | IO_VID_ENC_LCDOUT = 0x0000; | 208 | IO_VID_ENC_LCDOUT = 0x0000; |
209 | IO_VID_ENC_BRTS = 0x0000; | 209 | IO_VID_ENC_BRTS = 0x0000; |
210 | IO_VID_ENC_BRTW = 0x0000; | 210 | IO_VID_ENC_BRTW = 0x0000; |
211 | IO_VID_ENC_ACCTL = 0x0000; | 211 | IO_VID_ENC_ACCTL = 0x0000; |
212 | IO_VID_ENC_PWMP = 0x0000; | 212 | IO_VID_ENC_PWMP = 0x0000; |
213 | IO_VID_ENC_PWMW = 0x0000; | 213 | IO_VID_ENC_PWMW = 0x0000; |
214 | 214 | ||
215 | /* Setup the display */ | 215 | /* Setup the display */ |
216 | IO_OSD_MODE = 0x00ff; | 216 | IO_OSD_MODE = 0x00ff; |
217 | 217 | ||
218 | IO_OSD_ATRMD = 0x0000; | 218 | IO_OSD_ATRMD = 0x0000; |
@@ -281,9 +281,9 @@ void lcd_init_device(void) | |||
281 | IO_OSD_VIDWIN0XL = LCD_NATIVE_WIDTH; | 281 | IO_OSD_VIDWIN0XL = LCD_NATIVE_WIDTH; |
282 | IO_OSD_VIDWIN0YL = LCD_NATIVE_HEIGHT; | 282 | IO_OSD_VIDWIN0YL = LCD_NATIVE_HEIGHT; |
283 | 283 | ||
284 | IO_OSD_OSDWINMD0 |= 0x01; | 284 | IO_OSD_OSDWINMD0 |= 0x01; |
285 | 285 | ||
286 | lcd_enable_composite(false); | 286 | lcd_enable_composite(false); |
287 | } | 287 | } |
288 | 288 | ||
289 | #if defined(HAVE_LCD_MODES) | 289 | #if defined(HAVE_LCD_MODES) |
@@ -578,9 +578,9 @@ void lcd_update(void) | |||
578 | 578 | ||
579 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) | 579 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) |
580 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | 580 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, |
581 | int width, int height) __attribute__ ((section(".icode"))); | 581 | int width, int height) __attribute__ ((section(".icode"))); |
582 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | 582 | void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, |
583 | int width, int height) | 583 | int width, int height) |
584 | { | 584 | { |
585 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT | 585 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT |
586 | #if defined(LCD_USE_DMA) | 586 | #if defined(LCD_USE_DMA) |
@@ -604,7 +604,7 @@ void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | |||
604 | char *dst=(char *)FRAME | 604 | char *dst=(char *)FRAME |
605 | + (LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1) | 605 | + (LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1) |
606 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y; | 606 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y; |
607 | 607 | ||
608 | src=src+src_x+src_y*width; | 608 | src=src+src_x+src_y*width; |
609 | 609 | ||
610 | while(height--) | 610 | while(height--) |
@@ -627,29 +627,29 @@ void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, | |||
627 | 627 | ||
628 | void lcd_pal256_update_pal(fb_data *palette) | 628 | void lcd_pal256_update_pal(fb_data *palette) |
629 | { | 629 | { |
630 | unsigned char i; | 630 | unsigned char i; |
631 | for(i=0; i< 255; i++) | 631 | for(i=0; i< 255; i++) |
632 | { | 632 | { |
633 | int y, cb, cr; | 633 | int y, cb, cr; |
634 | unsigned char r=RGB_UNPACK_RED_LCD(palette[i])<<3; | 634 | unsigned char r=RGB_UNPACK_RED_LCD(palette[i])<<3; |
635 | unsigned char g=RGB_UNPACK_GREEN_LCD(palette[i])<<2; | 635 | unsigned char g=RGB_UNPACK_GREEN_LCD(palette[i])<<2; |
636 | unsigned char b=RGB_UNPACK_BLUE_LCD(palette[i])<<3; | 636 | unsigned char b=RGB_UNPACK_BLUE_LCD(palette[i])<<3; |
637 | 637 | ||
638 | y = ((77 * r + 150 * g + 29 * b) >> 8); cb = ((-43 * r - 85 * g + 128 * b) >> 8) + 128; | 638 | y = ((77 * r + 150 * g + 29 * b) >> 8); cb = ((-43 * r - 85 * g + 128 * b) >> 8) + 128; |
639 | cr = ((128 * r - 107 * g - 21 * b) >> 8) + 128; | 639 | cr = ((128 * r - 107 * g - 21 * b) >> 8) + 128; |
640 | 640 | ||
641 | while(IO_OSD_MISCCTL&0x08) | 641 | while(IO_OSD_MISCCTL&0x08) |
642 | {}; | 642 | {}; |
643 | 643 | ||
644 | /* Write in y and cb */ | 644 | /* Write in y and cb */ |
645 | IO_OSD_CLUTRAMYCB= ((unsigned char)y << 8) | (unsigned char)cb; | 645 | IO_OSD_CLUTRAMYCB= ((unsigned char)y << 8) | (unsigned char)cb; |
646 | 646 | ||
647 | /* Write in the index and cr */ | 647 | /* Write in the index and cr */ |
648 | IO_OSD_CLUTRAMCR=((unsigned char)cr << 8) | i; | 648 | IO_OSD_CLUTRAMCR=((unsigned char)cr << 8) | i; |
649 | } | 649 | } |
650 | } | 650 | } |
651 | #endif | 651 | #endif |
652 | 652 | ||
653 | void lcd_blit_yuv(unsigned char * const src[3], | 653 | void lcd_blit_yuv(unsigned char * const src[3], |
654 | int src_x, int src_y, int stride, | 654 | int src_x, int src_y, int stride, |
655 | int x, int y, int width, | 655 | int x, int y, int width, |
@@ -665,7 +665,7 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
665 | 665 | ||
666 | if (!lcd_on) | 666 | if (!lcd_on) |
667 | return; | 667 | return; |
668 | 668 | ||
669 | /* y has to be on a 16 pixel boundary */ | 669 | /* y has to be on a 16 pixel boundary */ |
670 | y &= ~0xF; | 670 | y &= ~0xF; |
671 | 671 | ||
@@ -703,33 +703,33 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
703 | register int y_remain=(stride<<1)-width; | 703 | register int y_remain=(stride<<1)-width; |
704 | do | 704 | do |
705 | { | 705 | { |
706 | register fb_data *c_dst=dst; | 706 | register fb_data *c_dst=dst; |
707 | register int c_width=width; | 707 | register int c_width=width; |
708 | 708 | ||
709 | do | 709 | do |
710 | { | 710 | { |
711 | /* This needs to be done in a block of 4 pixels */ | 711 | /* This needs to be done in a block of 4 pixels */ |
712 | 712 | ||
713 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; | 713 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; |
714 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; | 714 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; |
715 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | 715 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); |
716 | 716 | ||
717 | yuv_src[0]++; | ||
718 | |||
719 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; | ||
720 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; | ||
721 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | ||
722 | |||
723 | yuv_src[0]++; | 717 | yuv_src[0]++; |
724 | 718 | ||
725 | yuv_src[1]++; | 719 | *c_dst=*yuv_src[0]<<8 | *yuv_src[1]; |
726 | yuv_src[2]++; | 720 | *(c_dst+1)=*(yuv_src[0]+stride)<<8 | *yuv_src[2]; |
727 | 721 | c_dst-=(LCD_NATIVE_WIDTH+LCD_FUDGE); | |
728 | c_width -= 2; | 722 | |
729 | } | 723 | yuv_src[0]++; |
730 | while (c_width > 0); | 724 | |
731 | 725 | yuv_src[1]++; | |
732 | yuv_src[0] += y_remain; /* Skip down two luma lines-width */ | 726 | yuv_src[2]++; |
727 | |||
728 | c_width -= 2; | ||
729 | } | ||
730 | while (c_width > 0); | ||
731 | |||
732 | yuv_src[0] += y_remain; /* Skip down two luma lines-width */ | ||
733 | yuv_src[1] += cbcr_remain; /* Skip down one chroma line-width/2 */ | 733 | yuv_src[1] += cbcr_remain; /* Skip down one chroma line-width/2 */ |
734 | yuv_src[2] += cbcr_remain; | 734 | yuv_src[2] += cbcr_remain; |
735 | dst+=2; | 735 | dst+=2; |