summaryrefslogtreecommitdiffstats
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-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
8 files changed, 72 insertions, 46 deletions
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)
{
/* Enable REW, FF, Play, Left, Right, Hold buttons */
GPIO_SET_BITWISE(GPIOA_ENABLE, 0xfc);
-
+
/* Enable POWER button */
GPIO_SET_BITWISE(GPIOB_ENABLE, 0x01);
-
+
/* We need to output to pin 6 of GPIOD when reading the scroll pad value */
GPIO_SET_BITWISE(GPIOD_ENABLE, 0x40);
GPIO_SET_BITWISE(GPIOD_OUTPUT_EN, 0x40);
@@ -64,13 +64,18 @@ int button_read_device(void)
int btn = BUTTON_NONE;
int data;
unsigned char state;
+
static bool hold_button = false;
static bool remote_hold_button = false;
+#ifndef BOOTLOADER
bool hold_button_old;
bool remote_hold_button_old;
+#endif
/* Hold */
+#ifndef BOOTLOADER
hold_button_old = hold_button;
+#endif
hold_button = button_hold();
#ifndef BOOTLOADER
@@ -91,10 +96,10 @@ int button_read_device(void)
if ((state & 0x20) == 0) btn |= BUTTON_REW;
if ((state & 0x40) == 0) btn |= BUTTON_RIGHT;
if ((state & 0x80) == 0) btn |= BUTTON_LEFT;
-
+
/* Read power button */
if (GPIOB_INPUT_VAL & 0x1) btn |= BUTTON_POWER;
-
+
/* Read scroller */
if ( GPIOD_INPUT_VAL & 0x20 )
{
@@ -102,7 +107,7 @@ int button_read_device(void)
udelay(250);
data = adc_scan(ADC_SCROLLPAD);
GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x40);
-
+
if(data < 0x224)
{
btn |= BUTTON_SCROLL_DOWN;
@@ -111,9 +116,11 @@ int button_read_device(void)
}
}
}
-
+
+#ifndef BOOTLOADER
/* remote buttons */
remote_hold_button_old = remote_hold_button;
+#endif
data = adc_scan(ADC_REMOTE);
remote_hold_button = data < 0x2B;
@@ -143,6 +150,6 @@ int button_read_device(void)
/* remote play button should be dead if hold */
if (!remote_hold_button && !(GPIOA_INPUT_VAL & 0x1))
btn |= BUTTON_RC_PLAY;
-
+
return btn;
}
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)
static int lastbutton;
unsigned short remote_adc;
int btn = BUTTON_NONE;
+#ifndef BOOTLOADER
bool hold_button_old;
+#endif
/* normal buttons */
+#ifndef BOOTLOADER
hold_button_old = hold_button;
+#endif
hold_button = button_hold();
#ifndef BOOTLOADER
@@ -121,7 +125,7 @@ int button_read_device(void)
{
btn |= buttons;
}
-
+
/* the touchpad - only watch the lines we actually read */
touchpad = GPJDAT & touchpad_mask;
@@ -151,7 +155,7 @@ int button_read_device(void)
btn |= BUTTON_LEFT;
}
-
+
/* the cradle buttons */
buttons = ~GPFDAT & 0xc0;
if (buttons)
@@ -163,7 +167,7 @@ int button_read_device(void)
btn |= BUTTON_POWER;
buttonlight_on();
}
-
+
return btn;
}
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)
void* dummy = VIC0ADDRESS;
dummy = VIC1ADDRESS;
+ (void)dummy;
uint32_t irqs0 = VIC0IRQSTATUS;
uint32_t irqs1 = VIC1IRQSTATUS;
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)
static int old_data = 0;
static bool hold_button = false;
+#ifndef BOOTLOADER
bool hold_button_old;
+#endif
*data = old_data;
+#ifndef BOOTLOADER
hold_button_old = hold_button;
+#endif
hold_button = button_hold();
#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] =
{
4000, 4105, 4210, 4315, 4420, 4525, 4630, 4735, 4840, 4945, 5050,
};
-
+
/* Returns battery voltage from ADC [millivolts] */
int _battery_voltage(void)
{
short bat1, bat2, aux;
- static unsigned last_tick = 0;
+// static unsigned last_tick = 0;
short tsadc;
-
+
tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS);
-
+
/* Set the TSC2100 to read voltages if not busy with pen */
if(!(tsadc & TSADC_PSTCM))
{
tsc2100_set_mode(true, 0x0B);
- last_tick = current_tick;
+// last_tick = current_tick;
}
-
+
if(tsc2100_read_volt(&bat1, &bat2, &aux))
- {
+ {
/* Calculation was:
- * (val << 10) / 4096 * 6 * 2.5
+ * (val << 10) / 4096 * 6 * 2.5
*/
current_voltage = (short)( (int) (bat1 * 15) >> 2 );
current_bat2 = (short)( (bat2 * 15) >> 2 );
current_aux = (short)( (aux * 15) >> 2 );
}
-
+
return current_voltage;
}
-
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);
* change the offset for the interrupt in the entry table.
*/
-static const unsigned short const irqpriority[] =
+static const unsigned short const irqpriority[] =
{
IRQ_TIMER0,IRQ_TIMER1,IRQ_TIMER2,IRQ_TIMER3,IRQ_CCD_VD0,IRQ_CCD_VD1,
IRQ_CCD_WEN,IRQ_VENC,IRQ_SERIAL0,IRQ_SERIAL1,IRQ_EXT_HOST,IRQ_DSPHINT,
@@ -165,7 +165,7 @@ void fiq_handler(void)
void system_reboot(void)
{
/* Code taken from linux/include/asm-arm/arch-itdm320-20/system.h at NeuroSVN */
- __asm__ __volatile__(
+ __asm__ __volatile__(
"mov ip, #0 \n"
"mcr p15, 0, ip, c7, c7, 0 @ invalidate cache \n"
"mcr p15, 0, ip, c7, c10,4 @ drain WB \n"
@@ -175,7 +175,7 @@ void system_reboot(void)
"bic ip, ip, #0x2100 @ ..v....s........ \n"
"mcr p15, 0, ip, c1, c0, 0 @ ctrl register \n"
"mov ip, #0xFF000000 \n"
- "orr pc, ip, #0xFF0000 @ ip = 0xFFFF0000 \n"
+ "orr pc, ip, #0xFF0000 @ ip = 0xFFFF0000 \n"
:
:
: "cc"
@@ -198,8 +198,8 @@ void system_exception_wait(void)
void system_init(void)
{
- unsigned int vector_addr;
- /* Pin 33 is connected to a buzzer, for an annoying sound set
+// unsigned int vector_addr;
+ /* Pin 33 is connected to a buzzer, for an annoying sound set
* PWM0C == 0x3264
* PWM0H == 0x1932
* Function to 1
@@ -228,8 +228,8 @@ void system_init(void)
IO_INTC_FISEL2 = 0;
/* Only initially needed clocks should be turned on */
- IO_CLK_MOD0 = CLK_MOD0_HPIB | CLK_MOD0_DSP | CLK_MOD0_SDRAMC |
- CLK_MOD0_EMIF | CLK_MOD0_INTC | CLK_MOD0_AIM |
+ IO_CLK_MOD0 = CLK_MOD0_HPIB | CLK_MOD0_DSP | CLK_MOD0_SDRAMC |
+ CLK_MOD0_EMIF | CLK_MOD0_INTC | CLK_MOD0_AIM |
CLK_MOD0_AHB | CLK_MOD0_BUSC | CLK_MOD0_ARM;
IO_CLK_MOD1 = CLK_MOD1_CPBUS;
IO_CLK_MOD2 = CLK_MOD2_GIO;
@@ -258,17 +258,17 @@ void system_init(void)
* IO_EMIF_CS4CTRL2 = 0x4220;
*
* More agressive numbers may be possible, but it depends on the clocking
- * setup.
+ * setup.
*/
IO_EMIF_CS4CTRL1 = 0x66AB;
- IO_EMIF_CS4CTRL2 = 0x4220;
+ IO_EMIF_CS4CTRL2 = 0x4220;
/* 27 MHz input clock:
* PLLA: 27 * 15 / 2 = 202.5 MHz
* PLLB: 27 * 9 / 2 = 121.5 MHz (off: bit 12)
*/
IO_CLK_PLLA = (14 << 4) | 1;
- IO_CLK_PLLB = ( 1 << 12) | ( 8 << 4) | 1;
+ IO_CLK_PLLB = ( 1 << 12) | ( 8 << 4) | 1;
/* Set the slow and fast clock speeds used for boosting
* Slow Setup:
@@ -282,31 +282,31 @@ void system_init(void)
clock_arm_fast = (1 << 8) | 0;
IO_CLK_DIV0 = clock_arm_slow;
-
+
/* SDRAM div= 2 ( 101.25 MHz )
* AXL div = 1 ( 202.5 MHz )
*/
IO_CLK_DIV1 = (0 << 8) | 1;
-
+
/* MS div = 15 ( 13.5 MHz )
* DSP div = 4 ( 50.625 MHz - could be double, but this saves power)
- */
+ */
IO_CLK_DIV2 = (3 << 8) | 14;
-
+
/* MMC div = 256 ( slow )
* VENC div = 32 ( 843.75 KHz )
*/
IO_CLK_DIV3 = (31 << 8) | 255;
-
+
/* I2C div = 1 ( 48 MHz if M48XI is running )
* VLNQ div = 32
*/
IO_CLK_DIV4 = (31 << 8) | 0;
-
+
/* Feed everything from PLLA */
IO_CLK_SEL0=0x007E;
IO_CLK_SEL1=0x1000;
- IO_CLK_SEL2=0x0000;
+ IO_CLK_SEL2=0x0000;
}
else
#endif
@@ -335,16 +335,16 @@ void system_init(void)
/* IRQENTRY only reflects enabled interrupts */
IO_INTC_RAW = 0;
- vector_addr = (unsigned int) irqvector;
+ // vector_addr = (unsigned int) irqvector;
IO_INTC_ENTRY_TBA0 = 0;//(short) vector_addr & ~0x000F;
IO_INTC_ENTRY_TBA1 = 0;//(short) (vector_addr >> 16);
int i;
/* Set interrupt priorities to predefined values */
for(i = 0; i < 23; i++)
- DM320_REG(0x0540+i*2) = ((irqpriority[i*2+1] & 0x3F) << 8) |
+ DM320_REG(0x0540+i*2) = ((irqpriority[i*2+1] & 0x3F) << 8) |
(irqpriority[i*2] & 0x3F); /* IO_INTC_PRIORITYx */
-
+
/* Turn off all timers */
IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP;
IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP;
@@ -410,12 +410,12 @@ void set_cpu_frequency(long frequency)
return;
}
- if (frequency == CPUFREQ_MAX)
+ if (frequency == CPUFREQ_MAX)
{
IO_CLK_DIV0 = clock_arm_fast;
FREQ = CPUFREQ_MAX;
- }
- else
+ }
+ else
{
IO_CLK_DIV0 = clock_arm_slow;
FREQ = CPUFREQ_NORMAL;
@@ -477,7 +477,7 @@ void udelay(int usec) {
* can lead to lockup.
* Interrupt status bit check below is used to prevent this lockup.
*/
-
+
if (stop < count)
{
/* udelay will end after counter reset (tick) */
@@ -503,4 +503,3 @@ void system_prepare_fw_start(void)
IO_INTC_EINT2 = 0;
}
#endif
-
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)
int button_read_device(void)
{
int btn = BUTTON_NONE;
+#ifndef BOOTLOADER
bool hold_button_old;
bool remote_hold_button_old;
+#endif
int data;
/* normal buttons */
+#ifndef BOOTLOADER
hold_button_old = hold_button;
+#endif
hold_button = button_hold();
if (!hold_button)
@@ -87,7 +91,9 @@ int button_read_device(void)
/* remote buttons */
data = remote_detect() ? adc_read(ADC_REMOTE) : 0xff;
+#ifndef BOOTLOADER
remote_hold_button_old = remote_hold_button;
+#endif
remote_hold_button = data < 0x14;
#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)
int button_read_device(void)
{
int btn = BUTTON_NONE;
+#ifndef BOOTLOADER
bool hold_button_old;
bool remote_hold_button_old;
+#endif
static int prev_data = 0xff;
static int last_valid = 0xff;
int data;
/* normal buttons */
+#ifndef BOOTLOADER
hold_button_old = hold_button;
+#endif
hold_button = button_hold();
#ifndef BOOTLOADER
@@ -86,7 +90,7 @@ int button_read_device(void)
last_valid = data;
prev_data = data;
data = last_valid;
-
+
if (data < 0xf0)
{
if(data < 0x7c)
@@ -114,7 +118,9 @@ int button_read_device(void)
/* remote buttons */
data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
+#ifndef BOOTLOADER
remote_hold_button_old = remote_hold_button;
+#endif
remote_hold_button = data < 0x17;
#ifndef BOOTLOADER