diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-12-12 18:36:52 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-12-12 18:36:52 +0000 |
commit | e087751b107982eeaa001e92c2dd1f24f1af6809 (patch) | |
tree | 05b984cc09e7e268d1885d9ee06c7274fbc4b4e2 /firmware/target/arm/tms320dm320/mrobe-500 | |
parent | de159ceb3d1b852ee97be15ae707056ec995bf2d (diff) |
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
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500')
4 files changed, 18 insertions, 35 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c index 5df764620d..2acce7a695 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c @@ -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); } diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 7d9a43f902..3aa6009c9e 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c @@ -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) { diff --git a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c index cdec2ab77c..02294100ac 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c @@ -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) { diff --git a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c index 6e361aac15..d0f1a0bf59 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c @@ -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; |