summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-13 13:06:18 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-13 13:37:21 -0400
commit4a3d04654580b1771fcda3492491843d5eac10ad (patch)
treec93aef6dda1960d357e0da146164b0f459c389b3
parentb4865b05b0a3cc45f2873599c6411bef92f40b1c (diff)
downloadrockbox-4a3d04654580b1771fcda3492491843d5eac10ad.tar.gz
rockbox-4a3d04654580b1771fcda3492491843d5eac10ad.zip
Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
-rw-r--r--firmware/drivers/rtc/rtc_e8564.c27
-rw-r--r--firmware/target/arm/iriver/h10/button-h10.c21
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c10
-rw-r--r--firmware/target/arm/s5l8702/system-s5l8702.c1
-rw-r--r--firmware/target/arm/tcc780x/cowond2/button-cowond2.c4
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c19
-rw-r--r--firmware/target/arm/tms320dm320/system-dm320.c49
-rw-r--r--firmware/target/coldfire/iaudio/m3/button-m3.c6
-rw-r--r--firmware/target/coldfire/iaudio/m5/button-m5.c8
9 files changed, 87 insertions, 58 deletions
diff --git a/firmware/drivers/rtc/rtc_e8564.c b/firmware/drivers/rtc/rtc_e8564.c
index 7837bbaa83..ee2449ffb8 100644
--- a/firmware/drivers/rtc/rtc_e8564.c
+++ b/firmware/drivers/rtc/rtc_e8564.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum, 10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum,
11 * Przemyslaw Holubowski 11 * Przemyslaw Holubowski
12 * 12 *
13 * This program is free software; you can redistribute it and/or 13 * This program is free software; you can redistribute it and/or
@@ -59,13 +59,14 @@ void rtc_init(void)
59{ 59{
60 unsigned char tmp; 60 unsigned char tmp;
61 int rv; 61 int rv;
62 62
63 /* initialize Control 1 register */ 63 /* initialize Control 1 register */
64 tmp = 0; 64 tmp = 0;
65 pp_i2c_send(RTC_ADDR, RTC_CTRL1, tmp); 65 pp_i2c_send(RTC_ADDR, RTC_CTRL1, tmp);
66 66
67 /* read value of the Control 2 register - we'll need it to preserve alarm and timer interrupt assertion flags */ 67 /* read value of the Control 2 register - we'll need it to preserve alarm and timer interrupt assertion flags */
68 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp); 68 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
69 (void)rv;
69 /* preserve alarm and timer interrupt flags */ 70 /* preserve alarm and timer interrupt flags */
70 tmp &= (RTC_TF | RTC_AF | RTC_TIE | RTC_AIE); 71 tmp &= (RTC_TF | RTC_AF | RTC_TIE | RTC_AIE);
71 pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp); 72 pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
@@ -119,6 +120,7 @@ void rtc_set_alarm(int h, int m)
119 120
120 /* clear alarm interrupt */ 121 /* clear alarm interrupt */
121 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, buf); 122 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, buf);
123 (void)rv;
122 buf[0] &= RTC_AF; 124 buf[0] &= RTC_AF;
123 pp_i2c_send(RTC_ADDR, RTC_CTRL2, buf[0]); 125 pp_i2c_send(RTC_ADDR, RTC_CTRL2, buf[0]);
124 126
@@ -128,7 +130,7 @@ void rtc_set_alarm(int h, int m)
128 else 130 else
129 /* ignore minutes comparison query */ 131 /* ignore minutes comparison query */
130 buf[0] = RTC_AE; 132 buf[0] = RTC_AE;
131 133
132 if( h >= 0 ) 134 if( h >= 0 )
133 buf[1] = DEC2BCD(h); 135 buf[1] = DEC2BCD(h);
134 else 136 else
@@ -172,7 +174,7 @@ void rtc_enable_alarm(bool enable)
172 } 174 }
173 else 175 else
174 { 176 {
175 /* disable alarm interrupt */ 177 /* disable alarm interrupt */
176 if(rtc_lock_alarm_clear) 178 if(rtc_lock_alarm_clear)
177 /* lock disabling alarm before it was checked whether or not the unit was started by RTC alarm */ 179 /* lock disabling alarm before it was checked whether or not the unit was started by RTC alarm */
178 return; 180 return;
@@ -180,6 +182,7 @@ void rtc_enable_alarm(bool enable)
180 tmp &= ~(RTC_AIE | RTC_AF); 182 tmp &= ~(RTC_AIE | RTC_AF);
181 pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp); 183 pp_i2c_send(RTC_ADDR, RTC_CTRL2, tmp);
182 } 184 }
185 (void)rv;
183} 186}
184 187
185bool rtc_check_alarm_started(bool release_alarm) 188bool rtc_check_alarm_started(bool release_alarm)
@@ -193,14 +196,14 @@ bool rtc_check_alarm_started(bool release_alarm)
193 { 196 {
194 started = alarm_state; 197 started = alarm_state;
195 alarm_state &= ~release_alarm; 198 alarm_state &= ~release_alarm;
196 } 199 }
197 else 200 else
198 { 201 {
199 /* read Control 2 register which contains alarm flag */ 202 /* read Control 2 register which contains alarm flag */
200 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp); 203 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
201 204
202 alarm_state = started = ( (tmp & RTC_AF) && (tmp & RTC_AIE) ); 205 alarm_state = started = ( (tmp & RTC_AF) && (tmp & RTC_AIE) );
203 206
204 if(release_alarm && started) 207 if(release_alarm && started)
205 { 208 {
206 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp); 209 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
@@ -211,7 +214,8 @@ bool rtc_check_alarm_started(bool release_alarm)
211 run_before = true; 214 run_before = true;
212 rtc_lock_alarm_clear = false; 215 rtc_lock_alarm_clear = false;
213 } 216 }
214 217 (void)rv;
218
215 return started; 219 return started;
216} 220}
217 221
@@ -219,11 +223,10 @@ bool rtc_check_alarm_flag(void)
219{ 223{
220 unsigned char tmp=0; 224 unsigned char tmp=0;
221 int rv=0; 225 int rv=0;
222 226
223 /* read Control 2 register which contains alarm flag */ 227 /* read Control 2 register which contains alarm flag */
224 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp); 228 rv = i2c_readbytes(RTC_ADDR, RTC_CTRL2, 1, &tmp);
225 229
226 return (tmp & RTC_AF); 230 return (tmp & RTC_AF);
227} 231}
228#endif /* HAVE_RTC_ALARM */ 232#endif /* HAVE_RTC_ALARM */
229
diff --git a/firmware/target/arm/iriver/h10/button-h10.c b/firmware/target/arm/iriver/h10/button-h10.c
index 6710f39281..4fd7d3df38 100644
--- a/firmware/target/arm/iriver/h10/button-h10.c
+++ b/firmware/target/arm/iriver/h10/button-h10.c
@@ -36,10 +36,10 @@ void button_init_device(void)
36{ 36{
37 /* Enable REW, FF, Play, Left, Right, Hold buttons */ 37 /* Enable REW, FF, Play, Left, Right, Hold buttons */
38 GPIO_SET_BITWISE(GPIOA_ENABLE, 0xfc); 38 GPIO_SET_BITWISE(GPIOA_ENABLE, 0xfc);
39 39
40 /* Enable POWER button */ 40 /* Enable POWER button */
41 GPIO_SET_BITWISE(GPIOB_ENABLE, 0x01); 41 GPIO_SET_BITWISE(GPIOB_ENABLE, 0x01);
42 42
43 /* We need to output to pin 6 of GPIOD when reading the scroll pad value */ 43 /* We need to output to pin 6 of GPIOD when reading the scroll pad value */
44 GPIO_SET_BITWISE(GPIOD_ENABLE, 0x40); 44 GPIO_SET_BITWISE(GPIOD_ENABLE, 0x40);
45 GPIO_SET_BITWISE(GPIOD_OUTPUT_EN, 0x40); 45 GPIO_SET_BITWISE(GPIOD_OUTPUT_EN, 0x40);
@@ -64,13 +64,18 @@ int button_read_device(void)
64 int btn = BUTTON_NONE; 64 int btn = BUTTON_NONE;
65 int data; 65 int data;
66 unsigned char state; 66 unsigned char state;
67
67 static bool hold_button = false; 68 static bool hold_button = false;
68 static bool remote_hold_button = false; 69 static bool remote_hold_button = false;
70#ifndef BOOTLOADER
69 bool hold_button_old; 71 bool hold_button_old;
70 bool remote_hold_button_old; 72 bool remote_hold_button_old;
73#endif
71 74
72 /* Hold */ 75 /* Hold */
76#ifndef BOOTLOADER
73 hold_button_old = hold_button; 77 hold_button_old = hold_button;
78#endif
74 hold_button = button_hold(); 79 hold_button = button_hold();
75 80
76#ifndef BOOTLOADER 81#ifndef BOOTLOADER
@@ -91,10 +96,10 @@ int button_read_device(void)
91 if ((state & 0x20) == 0) btn |= BUTTON_REW; 96 if ((state & 0x20) == 0) btn |= BUTTON_REW;
92 if ((state & 0x40) == 0) btn |= BUTTON_RIGHT; 97 if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
93 if ((state & 0x80) == 0) btn |= BUTTON_LEFT; 98 if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
94 99
95 /* Read power button */ 100 /* Read power button */
96 if (GPIOB_INPUT_VAL & 0x1) btn |= BUTTON_POWER; 101 if (GPIOB_INPUT_VAL & 0x1) btn |= BUTTON_POWER;
97 102
98 /* Read scroller */ 103 /* Read scroller */
99 if ( GPIOD_INPUT_VAL & 0x20 ) 104 if ( GPIOD_INPUT_VAL & 0x20 )
100 { 105 {
@@ -102,7 +107,7 @@ int button_read_device(void)
102 udelay(250); 107 udelay(250);
103 data = adc_scan(ADC_SCROLLPAD); 108 data = adc_scan(ADC_SCROLLPAD);
104 GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x40); 109 GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x40);
105 110
106 if(data < 0x224) 111 if(data < 0x224)
107 { 112 {
108 btn |= BUTTON_SCROLL_DOWN; 113 btn |= BUTTON_SCROLL_DOWN;
@@ -111,9 +116,11 @@ int button_read_device(void)
111 } 116 }
112 } 117 }
113 } 118 }
114 119
120#ifndef BOOTLOADER
115 /* remote buttons */ 121 /* remote buttons */
116 remote_hold_button_old = remote_hold_button; 122 remote_hold_button_old = remote_hold_button;
123#endif
117 124
118 data = adc_scan(ADC_REMOTE); 125 data = adc_scan(ADC_REMOTE);
119 remote_hold_button = data < 0x2B; 126 remote_hold_button = data < 0x2B;
@@ -143,6 +150,6 @@ int button_read_device(void)
143 /* remote play button should be dead if hold */ 150 /* remote play button should be dead if hold */
144 if (!remote_hold_button && !(GPIOA_INPUT_VAL & 0x1)) 151 if (!remote_hold_button && !(GPIOA_INPUT_VAL & 0x1))
145 btn |= BUTTON_RC_PLAY; 152 btn |= BUTTON_RC_PLAY;
146 153
147 return btn; 154 return btn;
148} 155}
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
index 1d13a21b22..0185186008 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
@@ -77,10 +77,14 @@ int button_read_device(void)
77 static int lastbutton; 77 static int lastbutton;
78 unsigned short remote_adc; 78 unsigned short remote_adc;
79 int btn = BUTTON_NONE; 79 int btn = BUTTON_NONE;
80#ifndef BOOTLOADER
80 bool hold_button_old; 81 bool hold_button_old;
82#endif
81 83
82 /* normal buttons */ 84 /* normal buttons */
85#ifndef BOOTLOADER
83 hold_button_old = hold_button; 86 hold_button_old = hold_button;
87#endif
84 hold_button = button_hold(); 88 hold_button = button_hold();
85 89
86#ifndef BOOTLOADER 90#ifndef BOOTLOADER
@@ -121,7 +125,7 @@ int button_read_device(void)
121 { 125 {
122 btn |= buttons; 126 btn |= buttons;
123 } 127 }
124 128
125 /* the touchpad - only watch the lines we actually read */ 129 /* the touchpad - only watch the lines we actually read */
126 touchpad = GPJDAT & touchpad_mask; 130 touchpad = GPJDAT & touchpad_mask;
127 131
@@ -151,7 +155,7 @@ int button_read_device(void)
151 btn |= BUTTON_LEFT; 155 btn |= BUTTON_LEFT;
152 156
153 } 157 }
154 158
155 /* the cradle buttons */ 159 /* the cradle buttons */
156 buttons = ~GPFDAT & 0xc0; 160 buttons = ~GPFDAT & 0xc0;
157 if (buttons) 161 if (buttons)
@@ -163,7 +167,7 @@ int button_read_device(void)
163 btn |= BUTTON_POWER; 167 btn |= BUTTON_POWER;
164 buttonlight_on(); 168 buttonlight_on();
165 } 169 }
166 170
167 return btn; 171 return btn;
168} 172}
169 173
diff --git a/firmware/target/arm/s5l8702/system-s5l8702.c b/firmware/target/arm/s5l8702/system-s5l8702.c
index 54042f1b7a..814a723f22 100644
--- a/firmware/target/arm/s5l8702/system-s5l8702.c
+++ b/firmware/target/arm/s5l8702/system-s5l8702.c
@@ -159,6 +159,7 @@ void irq_handler(void)
159 159
160 void* dummy = VIC0ADDRESS; 160 void* dummy = VIC0ADDRESS;
161 dummy = VIC1ADDRESS; 161 dummy = VIC1ADDRESS;
162 (void)dummy;
162 uint32_t irqs0 = VIC0IRQSTATUS; 163 uint32_t irqs0 = VIC0IRQSTATUS;
163 uint32_t irqs1 = VIC1IRQSTATUS; 164 uint32_t irqs1 = VIC1IRQSTATUS;
164 for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1) 165 for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1)
diff --git a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
index df2ea1f307..8968c4f908 100644
--- a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c
@@ -50,11 +50,15 @@ int button_read_device(int *data)
50 static int old_data = 0; 50 static int old_data = 0;
51 51
52 static bool hold_button = false; 52 static bool hold_button = false;
53#ifndef BOOTLOADER
53 bool hold_button_old; 54 bool hold_button_old;
55#endif
54 56
55 *data = old_data; 57 *data = old_data;
56 58
59#ifndef BOOTLOADER
57 hold_button_old = hold_button; 60 hold_button_old = hold_button;
61#endif
58 hold_button = button_hold(); 62 hold_button = button_hold();
59 63
60#ifndef BOOTLOADER 64#ifndef BOOTLOADER
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c
index 78f9bbb9c2..6e428ac01f 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c
@@ -58,33 +58,32 @@ const unsigned short percent_to_volt_charge[11] =
58{ 58{
59 4000, 4105, 4210, 4315, 4420, 4525, 4630, 4735, 4840, 4945, 5050, 59 4000, 4105, 4210, 4315, 4420, 4525, 4630, 4735, 4840, 4945, 5050,
60}; 60};
61 61
62/* Returns battery voltage from ADC [millivolts] */ 62/* Returns battery voltage from ADC [millivolts] */
63int _battery_voltage(void) 63int _battery_voltage(void)
64{ 64{
65 short bat1, bat2, aux; 65 short bat1, bat2, aux;
66 static unsigned last_tick = 0; 66// static unsigned last_tick = 0;
67 short tsadc; 67 short tsadc;
68 68
69 tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); 69 tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS);
70 70
71 /* Set the TSC2100 to read voltages if not busy with pen */ 71 /* Set the TSC2100 to read voltages if not busy with pen */
72 if(!(tsadc & TSADC_PSTCM)) 72 if(!(tsadc & TSADC_PSTCM))
73 { 73 {
74 tsc2100_set_mode(true, 0x0B); 74 tsc2100_set_mode(true, 0x0B);
75 last_tick = current_tick; 75// last_tick = current_tick;
76 } 76 }
77 77
78 if(tsc2100_read_volt(&bat1, &bat2, &aux)) 78 if(tsc2100_read_volt(&bat1, &bat2, &aux))
79 { 79 {
80 /* Calculation was: 80 /* Calculation was:
81 * (val << 10) / 4096 * 6 * 2.5 81 * (val << 10) / 4096 * 6 * 2.5
82 */ 82 */
83 current_voltage = (short)( (int) (bat1 * 15) >> 2 ); 83 current_voltage = (short)( (int) (bat1 * 15) >> 2 );
84 current_bat2 = (short)( (bat2 * 15) >> 2 ); 84 current_bat2 = (short)( (bat2 * 15) >> 2 );
85 current_aux = (short)( (aux * 15) >> 2 ); 85 current_aux = (short)( (aux * 15) >> 2 );
86 } 86 }
87 87
88 return current_voltage; 88 return current_voltage;
89} 89}
90
diff --git a/firmware/target/arm/tms320dm320/system-dm320.c b/firmware/target/arm/tms320dm320/system-dm320.c
index a918d99064..93cf3c51c4 100644
--- a/firmware/target/arm/tms320dm320/system-dm320.c
+++ b/firmware/target/arm/tms320dm320/system-dm320.c
@@ -100,7 +100,7 @@ default_interrupt(RESERVED);
100 * change the offset for the interrupt in the entry table. 100 * change the offset for the interrupt in the entry table.
101 */ 101 */
102 102
103static const unsigned short const irqpriority[] = 103static const unsigned short const irqpriority[] =
104{ 104{
105 IRQ_TIMER0,IRQ_TIMER1,IRQ_TIMER2,IRQ_TIMER3,IRQ_CCD_VD0,IRQ_CCD_VD1, 105 IRQ_TIMER0,IRQ_TIMER1,IRQ_TIMER2,IRQ_TIMER3,IRQ_CCD_VD0,IRQ_CCD_VD1,
106 IRQ_CCD_WEN,IRQ_VENC,IRQ_SERIAL0,IRQ_SERIAL1,IRQ_EXT_HOST,IRQ_DSPHINT, 106 IRQ_CCD_WEN,IRQ_VENC,IRQ_SERIAL0,IRQ_SERIAL1,IRQ_EXT_HOST,IRQ_DSPHINT,
@@ -165,7 +165,7 @@ void fiq_handler(void)
165void system_reboot(void) 165void system_reboot(void)
166{ 166{
167 /* Code taken from linux/include/asm-arm/arch-itdm320-20/system.h at NeuroSVN */ 167 /* Code taken from linux/include/asm-arm/arch-itdm320-20/system.h at NeuroSVN */
168 __asm__ __volatile__( 168 __asm__ __volatile__(
169 "mov ip, #0 \n" 169 "mov ip, #0 \n"
170 "mcr p15, 0, ip, c7, c7, 0 @ invalidate cache \n" 170 "mcr p15, 0, ip, c7, c7, 0 @ invalidate cache \n"
171 "mcr p15, 0, ip, c7, c10,4 @ drain WB \n" 171 "mcr p15, 0, ip, c7, c10,4 @ drain WB \n"
@@ -175,7 +175,7 @@ void system_reboot(void)
175 "bic ip, ip, #0x2100 @ ..v....s........ \n" 175 "bic ip, ip, #0x2100 @ ..v....s........ \n"
176 "mcr p15, 0, ip, c1, c0, 0 @ ctrl register \n" 176 "mcr p15, 0, ip, c1, c0, 0 @ ctrl register \n"
177 "mov ip, #0xFF000000 \n" 177 "mov ip, #0xFF000000 \n"
178 "orr pc, ip, #0xFF0000 @ ip = 0xFFFF0000 \n" 178 "orr pc, ip, #0xFF0000 @ ip = 0xFFFF0000 \n"
179 : 179 :
180 : 180 :
181 : "cc" 181 : "cc"
@@ -198,8 +198,8 @@ void system_exception_wait(void)
198 198
199void system_init(void) 199void system_init(void)
200{ 200{
201 unsigned int vector_addr; 201// unsigned int vector_addr;
202 /* Pin 33 is connected to a buzzer, for an annoying sound set 202 /* Pin 33 is connected to a buzzer, for an annoying sound set
203 * PWM0C == 0x3264 203 * PWM0C == 0x3264
204 * PWM0H == 0x1932 204 * PWM0H == 0x1932
205 * Function to 1 205 * Function to 1
@@ -228,8 +228,8 @@ void system_init(void)
228 IO_INTC_FISEL2 = 0; 228 IO_INTC_FISEL2 = 0;
229 229
230 /* Only initially needed clocks should be turned on */ 230 /* Only initially needed clocks should be turned on */
231 IO_CLK_MOD0 = CLK_MOD0_HPIB | CLK_MOD0_DSP | CLK_MOD0_SDRAMC | 231 IO_CLK_MOD0 = CLK_MOD0_HPIB | CLK_MOD0_DSP | CLK_MOD0_SDRAMC |
232 CLK_MOD0_EMIF | CLK_MOD0_INTC | CLK_MOD0_AIM | 232 CLK_MOD0_EMIF | CLK_MOD0_INTC | CLK_MOD0_AIM |
233 CLK_MOD0_AHB | CLK_MOD0_BUSC | CLK_MOD0_ARM; 233 CLK_MOD0_AHB | CLK_MOD0_BUSC | CLK_MOD0_ARM;
234 IO_CLK_MOD1 = CLK_MOD1_CPBUS; 234 IO_CLK_MOD1 = CLK_MOD1_CPBUS;
235 IO_CLK_MOD2 = CLK_MOD2_GIO; 235 IO_CLK_MOD2 = CLK_MOD2_GIO;
@@ -258,17 +258,17 @@ void system_init(void)
258 * IO_EMIF_CS4CTRL2 = 0x4220; 258 * IO_EMIF_CS4CTRL2 = 0x4220;
259 * 259 *
260 * More agressive numbers may be possible, but it depends on the clocking 260 * More agressive numbers may be possible, but it depends on the clocking
261 * setup. 261 * setup.
262 */ 262 */
263 IO_EMIF_CS4CTRL1 = 0x66AB; 263 IO_EMIF_CS4CTRL1 = 0x66AB;
264 IO_EMIF_CS4CTRL2 = 0x4220; 264 IO_EMIF_CS4CTRL2 = 0x4220;
265 265
266 /* 27 MHz input clock: 266 /* 27 MHz input clock:
267 * PLLA: 27 * 15 / 2 = 202.5 MHz 267 * PLLA: 27 * 15 / 2 = 202.5 MHz
268 * PLLB: 27 * 9 / 2 = 121.5 MHz (off: bit 12) 268 * PLLB: 27 * 9 / 2 = 121.5 MHz (off: bit 12)
269 */ 269 */
270 IO_CLK_PLLA = (14 << 4) | 1; 270 IO_CLK_PLLA = (14 << 4) | 1;
271 IO_CLK_PLLB = ( 1 << 12) | ( 8 << 4) | 1; 271 IO_CLK_PLLB = ( 1 << 12) | ( 8 << 4) | 1;
272 272
273 /* Set the slow and fast clock speeds used for boosting 273 /* Set the slow and fast clock speeds used for boosting
274 * Slow Setup: 274 * Slow Setup:
@@ -282,31 +282,31 @@ void system_init(void)
282 clock_arm_fast = (1 << 8) | 0; 282 clock_arm_fast = (1 << 8) | 0;
283 283
284 IO_CLK_DIV0 = clock_arm_slow; 284 IO_CLK_DIV0 = clock_arm_slow;
285 285
286 /* SDRAM div= 2 ( 101.25 MHz ) 286 /* SDRAM div= 2 ( 101.25 MHz )
287 * AXL div = 1 ( 202.5 MHz ) 287 * AXL div = 1 ( 202.5 MHz )
288 */ 288 */
289 IO_CLK_DIV1 = (0 << 8) | 1; 289 IO_CLK_DIV1 = (0 << 8) | 1;
290 290
291 /* MS div = 15 ( 13.5 MHz ) 291 /* MS div = 15 ( 13.5 MHz )
292 * DSP div = 4 ( 50.625 MHz - could be double, but this saves power) 292 * DSP div = 4 ( 50.625 MHz - could be double, but this saves power)
293 */ 293 */
294 IO_CLK_DIV2 = (3 << 8) | 14; 294 IO_CLK_DIV2 = (3 << 8) | 14;
295 295
296 /* MMC div = 256 ( slow ) 296 /* MMC div = 256 ( slow )
297 * VENC div = 32 ( 843.75 KHz ) 297 * VENC div = 32 ( 843.75 KHz )
298 */ 298 */
299 IO_CLK_DIV3 = (31 << 8) | 255; 299 IO_CLK_DIV3 = (31 << 8) | 255;
300 300
301 /* I2C div = 1 ( 48 MHz if M48XI is running ) 301 /* I2C div = 1 ( 48 MHz if M48XI is running )
302 * VLNQ div = 32 302 * VLNQ div = 32
303 */ 303 */
304 IO_CLK_DIV4 = (31 << 8) | 0; 304 IO_CLK_DIV4 = (31 << 8) | 0;
305 305
306 /* Feed everything from PLLA */ 306 /* Feed everything from PLLA */
307 IO_CLK_SEL0=0x007E; 307 IO_CLK_SEL0=0x007E;
308 IO_CLK_SEL1=0x1000; 308 IO_CLK_SEL1=0x1000;
309 IO_CLK_SEL2=0x0000; 309 IO_CLK_SEL2=0x0000;
310 } 310 }
311 else 311 else
312#endif 312#endif
@@ -335,16 +335,16 @@ void system_init(void)
335 /* IRQENTRY only reflects enabled interrupts */ 335 /* IRQENTRY only reflects enabled interrupts */
336 IO_INTC_RAW = 0; 336 IO_INTC_RAW = 0;
337 337
338 vector_addr = (unsigned int) irqvector; 338 // vector_addr = (unsigned int) irqvector;
339 IO_INTC_ENTRY_TBA0 = 0;//(short) vector_addr & ~0x000F; 339 IO_INTC_ENTRY_TBA0 = 0;//(short) vector_addr & ~0x000F;
340 IO_INTC_ENTRY_TBA1 = 0;//(short) (vector_addr >> 16); 340 IO_INTC_ENTRY_TBA1 = 0;//(short) (vector_addr >> 16);
341 341
342 int i; 342 int i;
343 /* Set interrupt priorities to predefined values */ 343 /* Set interrupt priorities to predefined values */
344 for(i = 0; i < 23; i++) 344 for(i = 0; i < 23; i++)
345 DM320_REG(0x0540+i*2) = ((irqpriority[i*2+1] & 0x3F) << 8) | 345 DM320_REG(0x0540+i*2) = ((irqpriority[i*2+1] & 0x3F) << 8) |
346 (irqpriority[i*2] & 0x3F); /* IO_INTC_PRIORITYx */ 346 (irqpriority[i*2] & 0x3F); /* IO_INTC_PRIORITYx */
347 347
348 /* Turn off all timers */ 348 /* Turn off all timers */
349 IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; 349 IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP;
350 IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP; 350 IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP;
@@ -410,12 +410,12 @@ void set_cpu_frequency(long frequency)
410 return; 410 return;
411 } 411 }
412 412
413 if (frequency == CPUFREQ_MAX) 413 if (frequency == CPUFREQ_MAX)
414 { 414 {
415 IO_CLK_DIV0 = clock_arm_fast; 415 IO_CLK_DIV0 = clock_arm_fast;
416 FREQ = CPUFREQ_MAX; 416 FREQ = CPUFREQ_MAX;
417 } 417 }
418 else 418 else
419 { 419 {
420 IO_CLK_DIV0 = clock_arm_slow; 420 IO_CLK_DIV0 = clock_arm_slow;
421 FREQ = CPUFREQ_NORMAL; 421 FREQ = CPUFREQ_NORMAL;
@@ -477,7 +477,7 @@ void udelay(int usec) {
477 * can lead to lockup. 477 * can lead to lockup.
478 * Interrupt status bit check below is used to prevent this lockup. 478 * Interrupt status bit check below is used to prevent this lockup.
479 */ 479 */
480 480
481 if (stop < count) 481 if (stop < count)
482 { 482 {
483 /* udelay will end after counter reset (tick) */ 483 /* udelay will end after counter reset (tick) */
@@ -503,4 +503,3 @@ void system_prepare_fw_start(void)
503 IO_INTC_EINT2 = 0; 503 IO_INTC_EINT2 = 0;
504} 504}
505#endif 505#endif
506
diff --git a/firmware/target/coldfire/iaudio/m3/button-m3.c b/firmware/target/coldfire/iaudio/m3/button-m3.c
index 3c31c962c8..53d02ec449 100644
--- a/firmware/target/coldfire/iaudio/m3/button-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/button-m3.c
@@ -49,12 +49,16 @@ bool remote_button_hold(void)
49int button_read_device(void) 49int button_read_device(void)
50{ 50{
51 int btn = BUTTON_NONE; 51 int btn = BUTTON_NONE;
52#ifndef BOOTLOADER
52 bool hold_button_old; 53 bool hold_button_old;
53 bool remote_hold_button_old; 54 bool remote_hold_button_old;
55#endif
54 int data; 56 int data;
55 57
56 /* normal buttons */ 58 /* normal buttons */
59#ifndef BOOTLOADER
57 hold_button_old = hold_button; 60 hold_button_old = hold_button;
61#endif
58 hold_button = button_hold(); 62 hold_button = button_hold();
59 63
60 if (!hold_button) 64 if (!hold_button)
@@ -87,7 +91,9 @@ int button_read_device(void)
87 /* remote buttons */ 91 /* remote buttons */
88 data = remote_detect() ? adc_read(ADC_REMOTE) : 0xff; 92 data = remote_detect() ? adc_read(ADC_REMOTE) : 0xff;
89 93
94#ifndef BOOTLOADER
90 remote_hold_button_old = remote_hold_button; 95 remote_hold_button_old = remote_hold_button;
96#endif
91 remote_hold_button = data < 0x14; 97 remote_hold_button = data < 0x14;
92 98
93#ifndef BOOTLOADER 99#ifndef BOOTLOADER
diff --git a/firmware/target/coldfire/iaudio/m5/button-m5.c b/firmware/target/coldfire/iaudio/m5/button-m5.c
index 6dbd2023f2..3a9b973402 100644
--- a/firmware/target/coldfire/iaudio/m5/button-m5.c
+++ b/firmware/target/coldfire/iaudio/m5/button-m5.c
@@ -60,14 +60,18 @@ bool remote_button_hold(void)
60int button_read_device(void) 60int button_read_device(void)
61{ 61{
62 int btn = BUTTON_NONE; 62 int btn = BUTTON_NONE;
63#ifndef BOOTLOADER
63 bool hold_button_old; 64 bool hold_button_old;
64 bool remote_hold_button_old; 65 bool remote_hold_button_old;
66#endif
65 static int prev_data = 0xff; 67 static int prev_data = 0xff;
66 static int last_valid = 0xff; 68 static int last_valid = 0xff;
67 int data; 69 int data;
68 70
69 /* normal buttons */ 71 /* normal buttons */
72#ifndef BOOTLOADER
70 hold_button_old = hold_button; 73 hold_button_old = hold_button;
74#endif
71 hold_button = button_hold(); 75 hold_button = button_hold();
72 76
73#ifndef BOOTLOADER 77#ifndef BOOTLOADER
@@ -86,7 +90,7 @@ int button_read_device(void)
86 last_valid = data; 90 last_valid = data;
87 prev_data = data; 91 prev_data = data;
88 data = last_valid; 92 data = last_valid;
89 93
90 if (data < 0xf0) 94 if (data < 0xf0)
91 { 95 {
92 if(data < 0x7c) 96 if(data < 0x7c)
@@ -114,7 +118,9 @@ int button_read_device(void)
114 /* remote buttons */ 118 /* remote buttons */
115 data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff; 119 data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
116 120
121#ifndef BOOTLOADER
117 remote_hold_button_old = remote_hold_button; 122 remote_hold_button_old = remote_hold_button;
123#endif
118 remote_hold_button = data < 0x17; 124 remote_hold_button = data < 0x17;
119 125
120#ifndef BOOTLOADER 126#ifndef BOOTLOADER