M:Robe 500: Fix FIQ's and make the audio DMA a FIQ, simplify the ADC code and make it more reliable. Fix ADC problems on initial boot.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23948 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Karl Kurbjun 2009-12-12 18:36:52 +00:00
parent de159ceb3d
commit e087751b10
7 changed files with 33 additions and 63 deletions

View file

@ -126,7 +126,7 @@ SECTIONS
.fiqstack (NOLOAD) :
{
*(.stack)
. += 0x100;
. += 0x400;
fiq_stack = .;
} > IRAM

View file

@ -42,6 +42,9 @@ void adc_init(void)
/* Enable the tsc2100 interrupt */
IO_INTC_EINT2 |= (1<<3); /* IRQ_GIO14 */
/* Read all registers to make sure they are clear */
tsc2100_read_data();
}
/* Touchscreen data available interupt */
@ -49,31 +52,11 @@ void GIO14(void)
{
/* Interrupts work properly when cleared first */
IO_INTC_IRQ2 = (1<<3); /* IRQ_GIO14 == 35 */
short tsadc = tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS);
short adscm = (tsadc&TSADC_ADSCM_MASK)>>TSADC_ADSCM_SHIFT;
/* Always read all registers in one go to clear any missed flags */
tsc2100_read_data();
switch (adscm)
{
case 0x01:
case 0x02:
case 0x03:
case 0x04:
case 0x05:
/* do a battery read - this will shutdown the adc till the next tick
*/
// tsc2100_set_mode(true, 0x0B);
break;
case 0x06:
case 0x07:
case 0x08:
case 0x09:
case 0x0B:
tsc2100_set_mode(true, 0x01);
break;
}
/* Stop the scan, firmware will initiate another scan with a mode set */
tsc2100_set_mode(true, 0x00);
}

View file

@ -128,7 +128,7 @@ int button_read_device(int *data)
button_read |= touchscreen_to_pixels(touch_x, touch_y, data);
}
tsc2100_set_mode(true, 0x01);
tsc2100_set_mode(true, 0x02);
/* Handle power button */
if ((IO_GIO_BITSET0&0x01) == 0) {

View file

@ -61,6 +61,9 @@ void pcm_play_dma_init(void)
IO_INTC_IRQ0 = 1 << 11;
IO_INTC_EINT0 |= 1 << 11;
/* Set this as a FIQ */
IO_INTC_FISEL0 |= 1 << 11;
IO_DSPC_HPIB_CONTROL = 1 << 10 | 1 << 9 | 1 << 8 | 1 << 7 | 1 << 3 | 1 << 0;
dsp_reset();
@ -133,7 +136,7 @@ void DSPHINT(void)
unsigned int i;
IO_INTC_IRQ0 = 1 << 11;
IO_INTC_FIQ0 = 1 << 11;
switch (dsp_message.msg)
{

View file

@ -68,17 +68,14 @@ unsigned int battery_adc_voltage(void)
current_bat2=((short)((int)(bat2<<10)/4096*6*2.5));
current_aux=((short)((int)(aux<<10)/4096*6*2.5));
}
if (TIME_BEFORE(last_tick+2*HZ, current_tick) || last_tick==0)
tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS);
/* Set the TSC2100 to read voltages if not busy with pen */
if(!(tsadc & TSADC_PSTCM))
{
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;
}
tsc2100_set_mode(true, 0x0B);
last_tick = current_tick;
}
return current_voltage;

View file

@ -155,17 +155,17 @@ void fiq_handler(void)
* Based on: linux/arch/arm/kernel/entry-armv.S and system-meg-fx.c
*/
asm volatile (
"sub lr, lr, #4 \r\n"
"stmfd sp!, {r0-r3, ip, lr} \r\n"
"mov r0, #0x00030000 \r\n"
"ldr r0, [r0, #0x510] \r\n" /* Fetch value from IO_INTC_FIQENTRY0 */
"sub r0, r0, #1 \r\n"
"ldr r1, =irqvector \r\n"
"ldr r1, [r1, r0, lsl #2] \r\n" /* Divide value by 4 (TBA0/TBA1 is set to 0) and load appropriate pointer from the vector list */
"blx r1 \r\n" /* Jump to handler */
"ldmfd sp!, {r0-r3, ip, pc}^ \r\n" /* Return from FIQ */
);
asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */
"sub sp, sp, #8 \n"); /* Reserve stack */
unsigned short addr = IO_INTC_FIQENTRY0>>2;
if(addr != 0)
{
addr--;
irqvector[addr]();
}
asm volatile( "add sp, sp, #8 \n" /* Cleanup stack */
"ldmfd sp!, {r0-r7, ip, lr} \n" /* Restore context */
"subs pc, lr, #4 \n"); /* Return from FIQ */
}
void system_reboot(void)