summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320')
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c4
-rw-r--r--firmware/target/arm/tms320dm320/debug-dm320.c26
-rw-r--r--firmware/target/arm/tms320dm320/dsp/arm.c40
-rw-r--r--firmware/target/arm/tms320dm320/dsp/dma.c330
-rw-r--r--firmware/target/arm/tms320dm320/dsp/dsp-image.h14
-rw-r--r--firmware/target/arm/tms320dm320/dsp_image_helloworld.h2
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c192
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/power-mr500.c10
8 files changed, 309 insertions, 309 deletions
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
index d3f7789ab0..a70f260b85 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
@@ -66,7 +66,7 @@ void IRAM_ATTR GIO7(void)
66#ifdef DEBUG 66#ifdef DEBUG
67 //printf("GIO7 interrupt... [%d]", current_tick); 67 //printf("GIO7 interrupt... [%d]", current_tick);
68#endif 68#endif
69 usb_drv_int(); 69 usb_drv_int();
70 70
71 IO_INTC_IRQ1 = INTR_IRQ1_EXT7; 71 IO_INTC_IRQ1 = INTR_IRQ1_EXT7;
72} 72}
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c
index 9563a13302..8be21065d6 100644
--- a/firmware/target/arm/tms320dm320/debug-dm320.c
+++ b/firmware/target/arm/tms320dm320/debug-dm320.c
@@ -41,7 +41,7 @@ bool __dbg_ports(void)
41#if defined(MROBE_500) 41#if defined(MROBE_500)
42 int line = 0; 42 int line = 0;
43 int i; 43 int i;
44 int button; 44 int button;
45 bool done=false; 45 bool done=false;
46 46
47 lcd_setfont(FONT_SYSFIXED); 47 lcd_setfont(FONT_SYSFIXED);
@@ -124,7 +124,7 @@ bool __dbg_ports(void)
124bool __dbg_hw_info(void) 124bool __dbg_hw_info(void)
125{ 125{
126 int line = 0, oldline; 126 int line = 0, oldline;
127 int button; 127 int button;
128#if defined(MROBE_500) 128#if defined(MROBE_500)
129 int *address=0x0; 129 int *address=0x0;
130#endif 130#endif
@@ -175,18 +175,18 @@ bool __dbg_hw_info(void)
175 IO_INTC_EINT2, IO_INTC_IRQ0); 175 IO_INTC_EINT2, IO_INTC_IRQ0);
176 lcd_putsf(0, line++, " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", 176 lcd_putsf(0, line++, " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ",
177 IO_INTC_IRQ1, IO_INTC_IRQ2); 177 IO_INTC_IRQ1, IO_INTC_IRQ2);
178 178
179 lcd_puts(0, line++, "Board revision:"); 179 lcd_puts(0, line++, "Board revision:");
180 switch (IO_BUSC_REVR) { 180 switch (IO_BUSC_REVR) {
181 case 0x0010: 181 case 0x0010:
182 lcd_puts(0, line++, " DM320 Rev. A"); 182 lcd_puts(0, line++, " DM320 Rev. A");
183 break; 183 break;
184 case 0x0011: 184 case 0x0011:
185 lcd_puts(0, line++, " DM320 Rev. B/C"); 185 lcd_puts(0, line++, " DM320 Rev. B/C");
186 break; 186 break;
187 default: 187 default:
188 lcd_puts(0, line++, " Unknown DM320 Chip ID"); 188 lcd_puts(0, line++, " Unknown DM320 Chip ID");
189 } 189 }
190 190
191#if defined(MROBE_500) 191#if defined(MROBE_500)
192 line++; 192 line++;
diff --git a/firmware/target/arm/tms320dm320/dsp/arm.c b/firmware/target/arm/tms320dm320/dsp/arm.c
index e0df31c7a1..9d886ffede 100644
--- a/firmware/target/arm/tms320dm320/dsp/arm.c
+++ b/firmware/target/arm/tms320dm320/dsp/arm.c
@@ -42,24 +42,24 @@ interrupt void handle_int0(void) {
42 waiting = 0; 42 waiting = 0;
43 43
44 if(dma0_stopped==0) 44 if(dma0_stopped==0)
45 { 45 {
46 if(!(DMPREC&0x01)) 46 if(!(DMPREC&0x01))
47 { 47 {
48 /* Give the HPIB access to refill first */ 48 /* Give the HPIB access to refill first */
49 rebuffer(); 49 rebuffer();
50 50
51 /* Start the MCBSP DMA */ 51 /* Start the MCBSP DMA */
52 DMPREC |= 1; 52 DMPREC |= 1;
53 audiohw_start(); 53 audiohw_start();
54 } 54 }
55 else 55 else
56 { 56 {
57 rebuffer(); 57 rebuffer();
58 } 58 }
59 } 59 }
60 else 60 else
61 { 61 {
62 rebuffer(); 62 rebuffer();
63 } 63 }
64} 64}
65 65
@@ -88,8 +88,8 @@ void debugf(const char *fmt, ...) {
88 vsnprintf((char *)status.payload.debugf.buffer, sizeof(status), fmt, args); 88 vsnprintf((char *)status.payload.debugf.buffer, sizeof(status), fmt, args);
89 va_end(args); 89 va_end(args);
90 90
91 startack(); 91 startack();
92 waitack(); 92 waitack();
93 93
94 acked = 2; 94 acked = 2;
95} 95}
diff --git a/firmware/target/arm/tms320dm320/dsp/dma.c b/firmware/target/arm/tms320dm320/dsp/dma.c
index 590b35de80..3048d294b1 100644
--- a/firmware/target/arm/tms320dm320/dsp/dma.c
+++ b/firmware/target/arm/tms320dm320/dsp/dma.c
@@ -8,13 +8,13 @@
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2008 by Catalin Patulea 10 * Copyright (C) 2008 by Catalin Patulea
11 * Copyright (C) 2008 by Maurus Cuelenaere 11 * Copyright (C) 2008 by Maurus Cuelenaere
12 * Copyright (C) 2009 by Karl Kurbjun 12 * Copyright (C) 2009 by Karl Kurbjun
13 * 13 *
14 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2 16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version. 17 * of the License, or (at your option) any later version.
18 * 18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied. 20 * KIND, either express or implied.
@@ -23,139 +23,139 @@
23 23
24#include "registers.h" 24#include "registers.h"
25#include "arm.h" 25#include "arm.h"
26#include "ipc.h" 26#include "ipc.h"
27
28/* Size of data buffer in words (16 bit) */
29#define DSP_BUFFER_SIZE (0x1000)
30 27
31/* Put the "data" buffer in it's own .dma section so that it can 28/* Size of data buffer in words (16 bit) */
29#define DSP_BUFFER_SIZE (0x1000)
30
31/* Put the "data" buffer in it's own .dma section so that it can
32 * be handled in the linker.cmd. */ 32 * be handled in the linker.cmd. */
33#pragma DATA_SECTION (data, ".dma") 33#pragma DATA_SECTION (data, ".dma")
34 34
35/* This is the "data" buffer on the DSP side used for SARAM to McBSP (IIS) */ 35/* This is the "data" buffer on the DSP side used for SARAM to McBSP (IIS) */
36static signed short data[DSP_BUFFER_SIZE]; 36static signed short data[DSP_BUFFER_SIZE];
37 37
38/* These two describe the location of the buffer on the ARM (set in DSPHINT) */ 38/* These two describe the location of the buffer on the ARM (set in DSPHINT) */
39volatile unsigned short sdem_addrh; 39volatile unsigned short sdem_addrh;
40volatile unsigned short sdem_addrl; 40volatile unsigned short sdem_addrl;
41 41
42/* This is the size of the ARM buffer (set in DSPHINT) */ 42/* This is the size of the ARM buffer (set in DSPHINT) */
43volatile unsigned short sdem_dsp_size; 43volatile unsigned short sdem_dsp_size;
44 44
45/* These two variables keep track of the buffer level in the DSP, dsp_level, 45/* These two variables keep track of the buffer level in the DSP, dsp_level,
46 * (SARAM to McBSP) and the level on the ARM buffer (sdem_level). 46 * (SARAM to McBSP) and the level on the ARM buffer (sdem_level).
47 * sdem_level is used in the main firmware to keep track of the current 47 * sdem_level is used in the main firmware to keep track of the current
48 * playback status. dsp_level is only used in this function. */ 48 * playback status. dsp_level is only used in this function. */
49static unsigned short dsp_level; 49static unsigned short dsp_level;
50volatile unsigned short sdem_level; 50volatile unsigned short sdem_level;
51 51
52/* This is used to keep track of the last SDRAM to SARAM transfer */ 52/* This is used to keep track of the last SDRAM to SARAM transfer */
53static unsigned short last_size; 53static unsigned short last_size;
54 54
55/* This tells us which half of the DSP buffer (data) is free */ 55/* This tells us which half of the DSP buffer (data) is free */
56static unsigned short dma0_unlocked; 56static unsigned short dma0_unlocked;
57 57
58/* This is used by the ARM to flag playback status and start/stop the DMA 58/* This is used by the ARM to flag playback status and start/stop the DMA
59 * transfers. */ 59 * transfers. */
60volatile unsigned short dma0_stopped; 60volatile unsigned short dma0_stopped;
61 61
62/* This is used to effectively flag whether the ARM has new data ready or not */ 62/* This is used to effectively flag whether the ARM has new data ready or not */
63short waiting; 63short waiting;
64 64
65 65
66/* rebuffer sets up the next SDRAM to SARAM transfer and tells the ARM when DMA 66/* rebuffer sets up the next SDRAM to SARAM transfer and tells the ARM when DMA
67 * needs a new buffer. 67 * needs a new buffer.
68 * 68 *
69 * Note: The upper limit on larger buffers is the size of a short. If larger 69 * Note: The upper limit on larger buffers is the size of a short. If larger
70 * buffer sizes are needed the code on the ARM side needs to be changed to 70 * buffer sizes are needed the code on the ARM side needs to be changed to
71 * update a full long. 71 * update a full long.
72 */ 72 */
73void rebuffer(void) 73void rebuffer(void)
74{ 74{
75 unsigned long sdem_addr; 75 unsigned long sdem_addr;
76 76
77 if(dma0_stopped==1 || dma0_stopped==2) /* Stop / Pause */ 77 if(dma0_stopped==1 || dma0_stopped==2) /* Stop / Pause */
78 { 78 {
79 /* Stop MCBSP DMA0 */ 79 /* Stop MCBSP DMA0 */
80 DMPREC &= 0xFFFE; 80 DMPREC &= 0xFFFE;
81 /* Shut the transmitter down */ 81 /* Shut the transmitter down */
82 audiohw_stop(); 82 audiohw_stop();
83 83
84 /* Stop the HPIB transfer if it is running */ 84 /* Stop the HPIB transfer if it is running */
85 DMA_TRG = 0; 85 DMA_TRG = 0;
86 86
87 /* Reset the following variables for DMA restart */ 87 /* Reset the following variables for DMA restart */
88 sdem_level = 0; 88 sdem_level = 0;
89 dsp_level = 0; 89 dsp_level = 0;
90 last_size = 0; 90 last_size = 0;
91 91
92 return; 92 return;
93 } 93 }
94 94
95 /* If the sdem_level is equal to the buffer size the ARM code gave 95 /* If the sdem_level is equal to the buffer size the ARM code gave
96 * (sdem_dsp_size) then reset the size and ask the arm for another buffer 96 * (sdem_dsp_size) then reset the size and ask the arm for another buffer
97 */ 97 */
98 if(sdem_level == sdem_dsp_size) 98 if(sdem_level == sdem_dsp_size)
99 { 99 {
100 sdem_level=0; 100 sdem_level=0;
101 101
102 /* Get a new buffer (location and size) from ARM */ 102 /* Get a new buffer (location and size) from ARM */
103 status.msg = MSG_REFILL; 103 status.msg = MSG_REFILL;
104 waiting=1; 104 waiting=1;
105 105
106 /* trigger DSPHINT on the ARM */ 106 /* trigger DSPHINT on the ARM */
107 int_arm(); 107 int_arm();
108 } 108 }
109 109
110 if(!waiting) 110 if(!waiting)
111 { 111 {
112 /* Size is in bytes (but forced 32 bit transfers). Comparison is 112 /* Size is in bytes (but forced 32 bit transfers). Comparison is
113 * against DSP_BUFFER_SIZE because it is in words and this needs to 113 * against DSP_BUFFER_SIZE because it is in words and this needs to
114 * compare against half the total size in bytes. */ 114 * compare against half the total size in bytes. */
115 if( dsp_level + sdem_dsp_size - sdem_level > DSP_BUFFER_SIZE) 115 if( dsp_level + sdem_dsp_size - sdem_level > DSP_BUFFER_SIZE)
116 { 116 {
117 last_size = DSP_BUFFER_SIZE - dsp_level; 117 last_size = DSP_BUFFER_SIZE - dsp_level;
118 } 118 }
119 else 119 else
120 { 120 {
121 last_size = sdem_dsp_size - sdem_level; 121 last_size = sdem_dsp_size - sdem_level;
122 } 122 }
123 123
124 /* DSP addresses are 16 bit (word). dsp_level is in bytes so it needs to 124 /* DSP addresses are 16 bit (word). dsp_level is in bytes so it needs to
125 * be converted to words. */ 125 * be converted to words. */
126 DSP_ADDRL = (unsigned short)data + dma0_unlocked + (dsp_level >> 1); 126 DSP_ADDRL = (unsigned short)data + dma0_unlocked + (dsp_level >> 1);
127 DSP_ADDRH = 0; 127 DSP_ADDRH = 0;
128 128
129 /* SDRAM addresses are 8 bit (byte) 129 /* SDRAM addresses are 8 bit (byte)
130 * Warning: These addresses are forced to 32 bit alignment! 130 * Warning: These addresses are forced to 32 bit alignment!
131 */ 131 */
132 sdem_addr = ((unsigned long)sdem_addrh << 16 | sdem_addrl) + sdem_level; 132 sdem_addr = ((unsigned long)sdem_addrh << 16 | sdem_addrl) + sdem_level;
133 SDEM_ADDRL = sdem_addr & 0xffff; 133 SDEM_ADDRL = sdem_addr & 0xffff;
134 SDEM_ADDRH = sdem_addr >> 16; 134 SDEM_ADDRH = sdem_addr >> 16;
135 135
136 /* Set the size of the SDRAM to SARAM transfer (demac transfer) */ 136 /* Set the size of the SDRAM to SARAM transfer (demac transfer) */
137 DMA_SIZE = last_size; 137 DMA_SIZE = last_size;
138 138
139 DMA_CTRL = 0; 139 DMA_CTRL = 0;
140 140
141 /* These are just debug signals that are not used/needed right now */ 141 /* These are just debug signals that are not used/needed right now */
142 status.payload.refill._DMA_TRG = DMA_TRG; 142 status.payload.refill._DMA_TRG = DMA_TRG;
143 status.payload.refill._SDEM_ADDRH = SDEM_ADDRH; 143 status.payload.refill._SDEM_ADDRH = SDEM_ADDRH;
144 status.payload.refill._SDEM_ADDRL = SDEM_ADDRL; 144 status.payload.refill._SDEM_ADDRL = SDEM_ADDRL;
145 status.payload.refill._DSP_ADDRH = DSP_ADDRH; 145 status.payload.refill._DSP_ADDRH = DSP_ADDRH;
146 status.payload.refill._DSP_ADDRL = DSP_ADDRL; 146 status.payload.refill._DSP_ADDRL = DSP_ADDRL;
147 147
148 /* Start the demac transfer */ 148 /* Start the demac transfer */
149 DMA_TRG = 1; 149 DMA_TRG = 1;
150 } 150 }
151} 151}
152 152
153/* This interupt handler is for the SARAM (on DSP) to McBSP IIS DMA transfer. 153/* This interupt handler is for the SARAM (on DSP) to McBSP IIS DMA transfer.
154 * It interupts at 1/2 empty and empty so that we can start filling a new buffer 154 * It interupts at 1/2 empty and empty so that we can start filling a new buffer
155 * from SDRAM when a half is free. dsp_level should always be full when this 155 * from SDRAM when a half is free. dsp_level should always be full when this
156 * interupt occurs except for the initial start. */ 156 * interupt occurs except for the initial start. */
157interrupt void handle_dma0(void) 157interrupt void handle_dma0(void)
158{ 158{
159 /* Byte offset to half-buffer locked by DMA0. 159 /* Byte offset to half-buffer locked by DMA0.
160 0 for top, DSP_BUFFER_SIZE/2 for bottom */ 160 0 for top, DSP_BUFFER_SIZE/2 for bottom */
161 unsigned short dma0_locked; 161 unsigned short dma0_locked;
@@ -163,70 +163,70 @@ interrupt void handle_dma0(void)
163 IFR = 1 << 6; 163 IFR = 1 << 6;
164 164
165 /* DMSRC0 is the beginning of the DMA0-locked SARAM half-buffer. */ 165 /* DMSRC0 is the beginning of the DMA0-locked SARAM half-buffer. */
166 DMSA = 0x00 /* DMSRC0 (banked register, see page 133 of SPRU302B */; 166 DMSA = 0x00 /* DMSRC0 (banked register, see page 133 of SPRU302B */;
167 167
168 /* Note that these address offsets (dma0_locked and dma0_unlocked are in 168 /* Note that these address offsets (dma0_locked and dma0_unlocked are in
169 * words. */ 169 * words. */
170 dma0_locked = DMSDN & (DSP_BUFFER_SIZE>>1); 170 dma0_locked = DMSDN & (DSP_BUFFER_SIZE>>1);
171 dma0_unlocked = dma0_locked ^ (DSP_BUFFER_SIZE>>1); 171 dma0_unlocked = dma0_locked ^ (DSP_BUFFER_SIZE>>1);
172 172
173 dsp_level = 0; 173 dsp_level = 0;
174 174
175 /* Start the SDRAM to SARAM copy */ 175 /* Start the SDRAM to SARAM copy */
176 rebuffer(); 176 rebuffer();
177} 177}
178 178
179/* This interupt handler runs every time a DMA transfer is complete from SDRAM 179/* This interupt handler runs every time a DMA transfer is complete from SDRAM
180 * to the SARAM buffer. It is used to update the SARAM buffer level 180 * to the SARAM buffer. It is used to update the SARAM buffer level
181 * (dsp_level), the SDRAM buffer level (sdem_level) and to rebuffer if the dsp 181 * (dsp_level), the SDRAM buffer level (sdem_level) and to rebuffer if the dsp
182 * buffer is not full. */ 182 * buffer is not full. */
183interrupt void handle_dmac(void) { 183interrupt void handle_dmac(void) {
184 IFR = 1 << 11; /* Clear interrupt */ 184 IFR = 1 << 11; /* Clear interrupt */
185 185
186 /* dsp_level and sdem_level are in bytes */ 186 /* dsp_level and sdem_level are in bytes */
187 dsp_level += last_size; 187 dsp_level += last_size;
188 sdem_level += last_size; 188 sdem_level += last_size;
189 189
190 /* compare to DSP_BUFFER_SIZE without a divide because it is in words and 190 /* compare to DSP_BUFFER_SIZE without a divide because it is in words and
191 * we want half the total size in bytes. */ 191 * we want half the total size in bytes. */
192 if(dsp_level < DSP_BUFFER_SIZE) 192 if(dsp_level < DSP_BUFFER_SIZE)
193 { 193 {
194 rebuffer(); 194 rebuffer();
195 } 195 }
196} 196}
197 197
198void dma_init(void) { 198void dma_init(void) {
199 /* Initialize some of the global variables to known values avoiding the 199 /* Initialize some of the global variables to known values avoiding the
200 * .cinit section. */ 200 * .cinit section. */
201 dsp_level = 0; 201 dsp_level = 0;
202 sdem_level = 0; 202 sdem_level = 0;
203 203
204 last_size = 0; 204 last_size = 0;
205 dma0_unlocked = 0; 205 dma0_unlocked = 0;
206 dma0_stopped = 1; 206 dma0_stopped = 1;
207 207
208 waiting = 0; 208 waiting = 0;
209 209
210 /* Configure SARAM to McBSP DMA */ 210 /* Configure SARAM to McBSP DMA */
211 211
212 /* Event XEVT0, 32-bit transfers, 0 frame count */ 212 /* Event XEVT0, 32-bit transfers, 0 frame count */
213 DMSFC0 = 2 << 12 | 1 << 11; 213 DMSFC0 = 2 << 12 | 1 << 11;
214 214
215 /* Interrupts generated, Half and full buffer. 215 /* Interrupts generated, Half and full buffer.
216 * ABU mode, From data space with postincrement, to data space with no 216 * ABU mode, From data space with postincrement, to data space with no
217 * change 217 * change
218 */ 218 */
219 DMMCR0 = 1 << 14 | 1 << 13 | 219 DMMCR0 = 1 << 14 | 1 << 13 |
220 1 << 12 | 1 << 8 | 1 << 6 | 1; 220 1 << 12 | 1 << 8 | 1 << 6 | 1;
221 221
222 /* Set the source (incrementing) location */ 222 /* Set the source (incrementing) location */
223 DMSRC0 = (unsigned short)&data; 223 DMSRC0 = (unsigned short)&data;
224 224
225 /* Set the destination (static) location to the McBSP IIS interface */ 225 /* Set the destination (static) location to the McBSP IIS interface */
226 DMDST0 = (unsigned short)&DXR20; 226 DMDST0 = (unsigned short)&DXR20;
227 227
228 /* Set the size of the buffer */ 228 /* Set the size of the buffer */
229 DMCTR0 = sizeof(data); 229 DMCTR0 = sizeof(data);
230 230
231 /* Setup DMA0 interrupts and start the transfer */ 231 /* Setup DMA0 interrupts and start the transfer */
232 DMPREC = 2 << 6; 232 DMPREC = 2 << 6;
diff --git a/firmware/target/arm/tms320dm320/dsp/dsp-image.h b/firmware/target/arm/tms320dm320/dsp/dsp-image.h
index f7ec449a33..9f7ff65828 100644
--- a/firmware/target/arm/tms320dm320/dsp/dsp-image.h
+++ b/firmware/target/arm/tms320dm320/dsp/dsp-image.h
@@ -20,19 +20,19 @@
20 * 20 *
21 */ 21 */
22static const unsigned short _section_text[] = { 22static const unsigned short _section_text[] = {
23 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0001, 0x10f8, 0x031d, 0x76f8, 0x031e, 0x0000, 0xfa44, 0x00c2, 0xf495, 0xeeff, 0x7712, 0x0054, 0x960f, 0xf830, 0x00c2, 0xf074, 0x00fc, 0x7711, 0x0054, 0x6981, 0x0001, 0xf074, 0x02af, 0xf073, 0x00c4, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0026, 0x7712, 0x0001, 0x7713, 0x0001, 0x7681, 0x0010, 0x7711, 0x0000, 0x7681, 0xffff, 0xe501, 0xf495, 0xf6bb, 0xf074, 0x0284, 0xf074, 0x0243, 0xf4e1, 0xf495, 0xf073, 0x00f3, 0xe808, 0x75f8, 0x0008, 0x0280, 0xfc00, 0x4a11, 0x60f8, 0x031d, 0x0001, 0xfa30, 0x0109, 0xf495, 0xeefe, 0x60f8, 0x031d, 0x0002, 0xf820, 0x011e, 0x7711, 0x0054, 0x6881, 0xfffe, 0xf074, 0x02ba, 0xe800, 0x75f8, 0x0008, 0x8006, 0x76f8, 0x031b, 0x0000, 0x76f8, 0x0319, 0x0000, 0x76f8, 0x031a, 0x0000, 0xf073, 0x018b, 0x10f8, 0x031a, 0x08f8, 0x0318, 0xf844, 0x012f, 0x76f8, 0x031a, 0x0000, 0x76f8, 0x031e, 0x0001, 0x76f8, 0x02c5, 0x0003, 0xf074, 0x00f7, 0x10f8, 0x031e, 0xf844, 0x018b, 0x10f8, 0x0318, 0x00f8, 0x0319, 0x08f8, 0x031a, 0x8811, 0xf495, 0x7710, 0x1000, 0xf6a9, 0xf820, 0x0146, 0xf020, 0x1000, 0xf273, 0x014a, 0x08f8, 0x0319, 0x10f8, 0x0318, 0x08f8, 0x031a, 0x80f8, 0x031b, 0x10f8, 0x031c, 0xf6b8, 0xf000, 0x8000, 0x6ff8, 0x0319, 0x0c1f, 0x75f8, 0x0008, 0x8002, 0xe800, 0x75f8, 0x0008, 0x8003, 0x10f8, 0x0316, 0xf1ef, 0xf3e1, 0x10f8, 0x0317, 0xf2a0, 0x00f8, 0x031a, 0x4e00, 0xf020, 0xffff, 0x5700, 0xf280, 0x75f8, 0x0008, 0x8000, 0x5600, 0xf0f0, 0x75f8, 0x0008, 0x8001, 0xe800, 0x75f8, 0x031b, 0x8004, 0x75f8, 0x0008, 0x8005, 0x74f8, 0x02c7, 0x8006, 0x74f8, 0x02c8, 0x8001, 0x74f8, 0x02c9, 0x8000, 0x74f8, 0x02ca, 0x8003, 0xe801, 0x74f8, 0x02cb, 0x8002, 0x75f8, 0x0008, 0x8006, 0xee02, 0x8a11, 0xfc00, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0040, 0x7711, 0x0055, 0x7681, 0x0000, 0xf020, 0x0800, 0x7711, 0x0057, 0xeeff, 0x1881, 0x8000, 0xf020, 0x0800, 0x1c00, 0x76f8, 0x0319, 0x0000, 0x80f8, 0x031c, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0800, 0x10f8, 0x031b, 0x00f8, 0x0319, 0x80f8, 0x0319, 0x7710, 0x1000, 0x7211, 0x0319, 0x10f8, 0x031b, 0xf5a9, 0xeeff, 0x00f8, 0x031a, 0xfa20, 0x0228, 0x80f8, 0x031a, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0055, 0x76f8, 0x031a, 0x0000, 0x76f8, 0x0319, 0x0000, 0x76f8, 0x031b, 0x0000, 0x76f8, 0x031c, 0x0000, 0x76f8, 0x031e, 0x0000, 0x76f8, 0x031d, 0x0001, 0x7681, 0x0003, 0x7711, 0x0057, 0x7681, 0x2800, 0x7711, 0x0055, 0x7681, 0x0004, 0x7711, 0x0057, 0x7681, 0x7141, 0x7711, 0x0055, 0x7681, 0x0000, 0x7711, 0x0057, 0x7681, 0x8000, 0x7711, 0x0055, 0x7681, 0x0001, 0x7711, 0x0057, 0x7681, 0x0022, 0x7711, 0x0055, 0x7681, 0x0002, 0x7711, 0x0057, 0x7681, 0x1000, 0x7711, 0x0054, 0x7681, 0x0080, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0000, 0x7711, 0x0039, 0x7681, 0x0000, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x7681, 0x0030, 0x7711, 0x0038, 0x7681, 0x000e, 0x7711, 0x0039, 0x7681, 0x0002, 0x7711, 0x0038, 0x7681, 0x0004, 0x7711, 0x0039, 0x7681, 0x00a0, 0x7711, 0x0038, 0x7681, 0x0005, 0x7711, 0x0039, 0x7681, 0x0000, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6981, 0x0001, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6881, 0xfffe, 0x8a11, 0xfc00, 23 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0001, 0x10f8, 0x031d, 0x76f8, 0x031e, 0x0000, 0xfa44, 0x00c2, 0xf495, 0xeeff, 0x7712, 0x0054, 0x960f, 0xf830, 0x00c2, 0xf074, 0x00fc, 0x7711, 0x0054, 0x6981, 0x0001, 0xf074, 0x02af, 0xf073, 0x00c4, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0026, 0x7712, 0x0001, 0x7713, 0x0001, 0x7681, 0x0010, 0x7711, 0x0000, 0x7681, 0xffff, 0xe501, 0xf495, 0xf6bb, 0xf074, 0x0284, 0xf074, 0x0243, 0xf4e1, 0xf495, 0xf073, 0x00f3, 0xe808, 0x75f8, 0x0008, 0x0280, 0xfc00, 0x4a11, 0x60f8, 0x031d, 0x0001, 0xfa30, 0x0109, 0xf495, 0xeefe, 0x60f8, 0x031d, 0x0002, 0xf820, 0x011e, 0x7711, 0x0054, 0x6881, 0xfffe, 0xf074, 0x02ba, 0xe800, 0x75f8, 0x0008, 0x8006, 0x76f8, 0x031b, 0x0000, 0x76f8, 0x0319, 0x0000, 0x76f8, 0x031a, 0x0000, 0xf073, 0x018b, 0x10f8, 0x031a, 0x08f8, 0x0318, 0xf844, 0x012f, 0x76f8, 0x031a, 0x0000, 0x76f8, 0x031e, 0x0001, 0x76f8, 0x02c5, 0x0003, 0xf074, 0x00f7, 0x10f8, 0x031e, 0xf844, 0x018b, 0x10f8, 0x0318, 0x00f8, 0x0319, 0x08f8, 0x031a, 0x8811, 0xf495, 0x7710, 0x1000, 0xf6a9, 0xf820, 0x0146, 0xf020, 0x1000, 0xf273, 0x014a, 0x08f8, 0x0319, 0x10f8, 0x0318, 0x08f8, 0x031a, 0x80f8, 0x031b, 0x10f8, 0x031c, 0xf6b8, 0xf000, 0x8000, 0x6ff8, 0x0319, 0x0c1f, 0x75f8, 0x0008, 0x8002, 0xe800, 0x75f8, 0x0008, 0x8003, 0x10f8, 0x0316, 0xf1ef, 0xf3e1, 0x10f8, 0x0317, 0xf2a0, 0x00f8, 0x031a, 0x4e00, 0xf020, 0xffff, 0x5700, 0xf280, 0x75f8, 0x0008, 0x8000, 0x5600, 0xf0f0, 0x75f8, 0x0008, 0x8001, 0xe800, 0x75f8, 0x031b, 0x8004, 0x75f8, 0x0008, 0x8005, 0x74f8, 0x02c7, 0x8006, 0x74f8, 0x02c8, 0x8001, 0x74f8, 0x02c9, 0x8000, 0x74f8, 0x02ca, 0x8003, 0xe801, 0x74f8, 0x02cb, 0x8002, 0x75f8, 0x0008, 0x8006, 0xee02, 0x8a11, 0xfc00, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0040, 0x7711, 0x0055, 0x7681, 0x0000, 0xf020, 0x0800, 0x7711, 0x0057, 0xeeff, 0x1881, 0x8000, 0xf020, 0x0800, 0x1c00, 0x76f8, 0x0319, 0x0000, 0x80f8, 0x031c, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0xf495, 0x4a08, 0x4a09, 0x4a0a, 0x4a0b, 0x4a0c, 0x4a0d, 0x4a10, 0x4a11, 0x4a12, 0x4a13, 0x4a14, 0x4a15, 0x4a16, 0x4a17, 0x4a17, 0x4a19, 0x4a0e, 0x4a06, 0x4a07, 0x4a1a, 0x4a1d, 0x4a1b, 0x4a1c, 0x68f8, 0x0007, 0x7d3f, 0x69f8, 0x0007, 0x4000, 0x68f8, 0x001d, 0xfffc, 0x4818, 0x68f8, 0x0018, 0xfffe, 0x7711, 0x0001, 0x4a08, 0x7681, 0x0800, 0x10f8, 0x031b, 0x00f8, 0x0319, 0x80f8, 0x0319, 0x7710, 0x1000, 0x7211, 0x0319, 0x10f8, 0x031b, 0xf5a9, 0xeeff, 0x00f8, 0x031a, 0xfa20, 0x0228, 0x80f8, 0x031a, 0xf074, 0x00fc, 0xee01, 0x8a18, 0xf495, 0x8a1c, 0x8a1b, 0x8a1d, 0x8a1a, 0x8a07, 0x8a06, 0x8a0e, 0x8a19, 0x8a17, 0x8a17, 0x8a16, 0x8a15, 0x8a14, 0x8a13, 0x8a12, 0x8a11, 0x8a10, 0x8a0d, 0x8a0c, 0x8a0b, 0x8a0a, 0x8a09, 0x8a08, 0xf4eb, 0x4a11, 0x7711, 0x0055, 0x76f8, 0x031a, 0x0000, 0x76f8, 0x0319, 0x0000, 0x76f8, 0x031b, 0x0000, 0x76f8, 0x031c, 0x0000, 0x76f8, 0x031e, 0x0000, 0x76f8, 0x031d, 0x0001, 0x7681, 0x0003, 0x7711, 0x0057, 0x7681, 0x2800, 0x7711, 0x0055, 0x7681, 0x0004, 0x7711, 0x0057, 0x7681, 0x7141, 0x7711, 0x0055, 0x7681, 0x0000, 0x7711, 0x0057, 0x7681, 0x8000, 0x7711, 0x0055, 0x7681, 0x0001, 0x7711, 0x0057, 0x7681, 0x0022, 0x7711, 0x0055, 0x7681, 0x0002, 0x7711, 0x0057, 0x7681, 0x1000, 0x7711, 0x0054, 0x7681, 0x0080, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0000, 0x7711, 0x0039, 0x7681, 0x0000, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x7681, 0x0030, 0x7711, 0x0038, 0x7681, 0x000e, 0x7711, 0x0039, 0x7681, 0x0002, 0x7711, 0x0038, 0x7681, 0x0004, 0x7711, 0x0039, 0x7681, 0x00a0, 0x7711, 0x0038, 0x7681, 0x0005, 0x7711, 0x0039, 0x7681, 0x0000, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6981, 0x0001, 0x8a11, 0xfc00, 0x4a11, 0x7711, 0x0038, 0x7681, 0x0001, 0x7711, 0x0039, 0x6881, 0xfffe, 0x8a11, 0xfc00,
24}; 24};
25static const unsigned short _section_vectors[] = { 25static const unsigned short _section_vectors[] = {
26 0xf273, 0x00df, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xf273, 0x0080, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf273, 0x018e, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf273, 0x01e8, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 26 0xf273, 0x00df, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xf273, 0x0080, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf273, 0x018e, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495, 0xf273, 0x01e8, 0xf495, 0xf495, 0xf4eb, 0xf495, 0xf495, 0xf495,
27}; 27};
28 28
29 29
30static const struct dsp_section dsp_image[] = { 30static const struct dsp_section dsp_image[] = {
31 {_section_text, 0x0080, 0x0245}, 31 {_section_text, 0x0080, 0x0245},
32 {NULL /* .bss */, 0x02c5, 0x005a}, 32 {NULL /* .bss */, 0x02c5, 0x005a},
33 {_section_vectors, 0x7f80, 0x0080}, 33 {_section_vectors, 0x7f80, 0x0080},
34 {NULL /* .dma */, 0x8000, 0x1000}, 34 {NULL /* .dma */, 0x8000, 0x1000},
35 {NULL, 0, 0} 35 {NULL, 0, 0}
36}; 36};
37 37
38/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */ 38/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */
diff --git a/firmware/target/arm/tms320dm320/dsp_image_helloworld.h b/firmware/target/arm/tms320dm320/dsp_image_helloworld.h
index 6cd3352cea..b98efc85d1 100644
--- a/firmware/target/arm/tms320dm320/dsp_image_helloworld.h
+++ b/firmware/target/arm/tms320dm320/dsp_image_helloworld.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23static const struct dsp_section dsp_image_helloworld[] = { 23static const struct dsp_section dsp_image_helloworld[] = {
24 {NULL, 0, 0} 24 {NULL, 0, 0}
25}; 25};
26 26
27/* Symbol table, usable with the DSP_() macro (see dsp-target.h). */ 27/* Symbol table, usable with the DSP_() macro (see dsp-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 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)
580void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, 580void 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")));
582void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y, 582void 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
628void lcd_pal256_update_pal(fb_data *palette) 628void 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
653void lcd_blit_yuv(unsigned char * const src[3], 653void 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;
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/power-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/power-mr500.c
index f24be5b74f..fa8a74d880 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/power-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/power-mr500.c
@@ -51,11 +51,11 @@ void power_init(void)
51 51
52unsigned int power_input_status(void) 52unsigned int power_input_status(void)
53{ 53{
54 /* Charger is active low */ 54 /* Charger is active low */
55 if(!(IO_GIO_BITSET1&(1<<9))) 55 if(!(IO_GIO_BITSET1&(1<<9)))
56 { 56 {
57 return POWER_INPUT_MAIN_CHARGER; 57 return POWER_INPUT_MAIN_CHARGER;
58 } 58 }
59 return POWER_INPUT_NONE; 59 return POWER_INPUT_NONE;
60} 60}
61 61