summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c')
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c88
1 files changed, 67 insertions, 21 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
index 317a764d3c..0551389f27 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
@@ -76,7 +76,7 @@ void lcd_sleep()
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; 79 IO_GIO_BITCLR2=1<<4; /* pin 36 */
80 } 80 }
81} 81}
82 82
@@ -103,6 +103,30 @@ void lcd_awake(void)
103} 103}
104#endif 104#endif
105 105
106void lcd_enable_composite(bool enable)
107{
108 /* Pin 39 appears to be related to the composite output */
109 /* 39: output, non-inverted, no-irq, falling edge, no-chat, normal */
110 dm320_set_io(39, false, false, false, false, false, 0x00);
111
112 short vidtemp = (IO_VID_ENC_VMOD & 0x7E8);
113
114 if(enable)
115 {
116 IO_GIO_BITSET2 = 0x80;
117 vidtemp |= 0x0003;
118 }
119 else
120 {
121 IO_GIO_BITCLR2 = 0x80;
122 vidtemp |= 0x2015;
123 IO_VID_ENC_DCLKCTL = 0x0800;
124 IO_VID_ENC_DCLKPTN0 = 0x0001;
125 }
126
127 IO_VID_ENC_VMOD = vidtemp;
128}
129
106/* Note this is expecting a screen size of 480x640 or 240x320, other screen 130/* Note this is expecting a screen size of 480x640 or 240x320, other screen
107 * sizes need to be considered for fudge factors 131 * sizes need to be considered for fudge factors
108 */ 132 */
@@ -115,14 +139,48 @@ void lcd_init_device(void)
115{ 139{
116 unsigned int addr; 140 unsigned int addr;
117 141
118 /* Pin 32 controls the LED above the LCD */ 142 /* LCD related pins:
119 IO_GIO_DIR2 &= ~(0x01); /* output */ 143 * 32 - LED above LCD
120 IO_GIO_INV2 &= ~(0x01); /* non-inverted */ 144 * 33 - ??
121 IO_GIO_FSEL2 &= ~(0x03<<14); /* normal pins */ 145 * 34 - R2 for 18 bit output
146 * 35 - Resolution (MO?)
147 * 36 - LCD power (INI?)
148 * 37 - Backlight and LCD power
149 * 38 - B2 for 18 bit output
150 */
151
152 /* Setup main LCD pins */
153 /* 32: output, non-inverted, no-irq, falling edge, no-chat, normal */
154 dm320_set_io(32, false, false, false, false, false, 0x00);
155 IO_GIO_BITCLR2 = 1; /* Turn the LED off */
156
157 /* 33: output, non-inverted, no-irq, falling edge, no-chat, normal */
158 dm320_set_io(33, false, false, false, false, false, 0x00);
159 /* To-do: figure out value from OF */
160
161 /* 34: output, non-inverted, no-irq, falling edge, no-chat, R2 */
162 dm320_set_io(34, false, false, false, false, false, 0x02);
122 163
123 /* Turn the LED off */ 164 /* 35: output, non-inverted, no-irq, falling edge, no-chat, normal */
124 IO_GIO_BITCLR2 = 1; 165 dm320_set_io(35, false, false, false, false, false, 0x00);
166#if LCD_NATIVE_HEIGHT > 320
167 IO_GIO_BITSET2 = 1<<3; /* Set LCD resolution to VGA */
168#else
169 IO_GIO_BITCLR2 = 1<<3; /* Set LCD resolution to QVGA */
170#endif
171
172 /* 36: output, non-inverted, no-irq, falling edge, no-chat, normal */
173 dm320_set_io(36, false, false, false, false, false, 0x00);
174 IO_GIO_BITSET2 = 0x10; /* LCD on */
125 175
176 /* 37: output, non-inverted, no-irq, falling edge, no-chat, normal */
177 dm320_set_io(37, false, false, false, false, false, 0x00);
178 IO_GIO_BITCLR2 = (1 << 5); /* output low (backlight/lcd on) */
179
180 /* 38: output, non-inverted, no-irq, falling edge, no-chat, B2 */
181 dm320_set_io(38, false, false, false, false, false, 0x02);
182
183
126 /* Clear the Frame */ 184 /* Clear the Frame */
127 memset16(FRAME, 0x0000, LCD_WIDTH*LCD_HEIGHT); 185 memset16(FRAME, 0x0000, LCD_WIDTH*LCD_HEIGHT);
128 186
@@ -158,8 +216,6 @@ void lcd_init_device(void)
158 IO_VID_ENC_ACCTL = 0x0000; 216 IO_VID_ENC_ACCTL = 0x0000;
159 IO_VID_ENC_PWMP = 0x0000; 217 IO_VID_ENC_PWMP = 0x0000;
160 IO_VID_ENC_PWMW = 0x0000; 218 IO_VID_ENC_PWMW = 0x0000;
161
162 IO_VID_ENC_DCLKPTN0 = 0x0001;
163 219
164 /* Setup the display */ 220 /* Setup the display */
165 IO_OSD_MODE = 0x00ff; 221 IO_OSD_MODE = 0x00ff;
@@ -230,19 +286,9 @@ void lcd_init_device(void)
230 IO_OSD_VIDWIN0XL = LCD_NATIVE_WIDTH; 286 IO_OSD_VIDWIN0XL = LCD_NATIVE_WIDTH;
231 IO_OSD_VIDWIN0YL = LCD_NATIVE_HEIGHT; 287 IO_OSD_VIDWIN0YL = LCD_NATIVE_HEIGHT;
232 288
233 /* Set pin 36 and 35 (LCD POWER and LCD RESOLUTION) to an output */
234 IO_GIO_DIR2 &= ~(3<<3);
235
236#if LCD_NATIVE_HEIGHT > 320
237 /* Set LCD resolution to VGA */
238 IO_GIO_BITSET2 = 1<<3;
239#else
240 /* Set LCD resolution to QVGA */
241 IO_GIO_BITCLR2 = 1<<3;
242#endif
243
244 IO_OSD_OSDWINMD0 |= 0x01; 289 IO_OSD_OSDWINMD0 |= 0x01;
245 IO_VID_ENC_VMOD |= 0x01; 290
291 lcd_enable_composite(false);
246} 292}
247 293
248#if defined(HAVE_LCD_MODES) 294#if defined(HAVE_LCD_MODES)