diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2007-09-30 16:29:21 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2007-09-30 16:29:21 +0000 |
commit | a56b65342f1c1021472eb2899ab46e69a666f7f8 (patch) | |
tree | c4a0fcb647db0b7e9983ce5f11bdab0d945b895f /firmware/target/arm/tms320dm320/mrobe-500 | |
parent | 5be5674b066b63ac8994db86f34c83c2c7f956ed (diff) |
Move some more files around and get the main build compiling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14919 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500')
-rwxr-xr-x | firmware/target/arm/tms320dm320/mrobe-500/crt0.S | 206 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/mrobe-500/dm320codec-mr500.c (renamed from firmware/target/arm/tms320dm320/mrobe-500/system-target.h) | 29 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c (renamed from firmware/target/arm/tms320dm320/mrobe-500/kernel-mr500.c) | 82 | ||||
-rwxr-xr-x[-rw-r--r--] | firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c (renamed from firmware/target/arm/tms320dm320/mrobe-500/spi-target.h) | 40 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/spi-mr500.c | 77 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/system-mr500.c | 210 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/timer-mr500.c | 106 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/timer-target.h | 39 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/uart-mr500.c | 172 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/uart-target.h | 33 |
11 files changed, 103 insertions, 894 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/crt0.S b/firmware/target/arm/tms320dm320/mrobe-500/crt0.S deleted file mode 100755 index 193470fd4a..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/crt0.S +++ /dev/null @@ -1,206 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Linus Nielsen Feltzing - * - * Arm bootloader and startup code based on startup.s from the iPodLinux loader - * - * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org) - * Copyright (c) 2005, Bernard Leach <leachbj@bouncycastle.org> - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include "config.h" -#include "cpu.h" - - .section .init.text,"ax",%progbits - - .global start -start: - msr cpsr, #0xd3 /* enter supervisor mode, disable IRQ */ - -#if !defined(DEBUG) - /* Copy exception handler code to address 0 */ - ldr r2, =_vectorsstart - ldr r3, =_vectorsend - ldr r4, =_vectorscopy -1: - cmp r3, r2 - ldrhi r5, [r4], #4 - strhi r5, [r2], #4 - bhi 1b -#else - ldr r1, =vectors - ldr r0, =irq_handler - str r0, [r1, #24] - ldr r0, =fiq_handler - str r0, [r1, #28] -#endif - - /* Disable high vectors (at 0xffff0000 instead of 0x00000000) */ - mrc p15, 0, r0, c1, c0 - and r0, r0, #~(1<<13) - mcr p15, 0, r0, c1, c0 - -#if !defined(BOOTLOADER) - -#if !defined(STUB) - /* Zero out IBSS */ - ldr r2, =_iedata - ldr r3, =_iend - mov r4, #0 -1: - cmp r3, r2 - strhi r4, [r2], #4 - bhi 1b - - /* Copy the IRAM */ - ldr r2, =_iramcopy - ldr r3, =_iramstart - ldr r4, =_iramend -1: - cmp r4, r3 - ldrhi r5, [r2], #4 - strhi r5, [r3], #4 - bhi 1b -#endif /* !STUB */ -#endif /* !BOOTLOADER */ - - /* Initialise bss section to zero */ - ldr r2, =_edata - ldr r3, =_end - mov r4, #0 -1: - cmp r3, r2 - strhi r4, [r2], #4 - bhi 1b - - /* Set up some stack and munge it with 0xdeadbeef */ - ldr r3, =stackend - ldr r2, =stackbegin - ldr r4, =0xdeadbeef -1: - cmp r3, r2 - strhi r4, [r2], #4 - bhi 1b - - /* Set up stack for IRQ mode */ - msr cpsr_c, #0xd2 - ldr sp, =irq_stack - /* Set up stack for FIQ mode */ - msr cpsr_c, #0xd1 - ldr sp, =fiq_stack - - /* Let abort and undefined modes use IRQ stack */ - msr cpsr_c, #0xd7 - ldr sp, =irq_stack - msr cpsr_c, #0xdb - ldr sp, =irq_stack - /* Switch to supervisor mode (no IRQ) */ - msr cpsr_c, #0xd3 - ldr sp, =stackend - -#ifdef BOOTLOADER - /* get the high part of our execute address */ - ldr r2, =0xffffff00 - and r4, pc, r2 - - /* Copy bootloader to safe area - 0x01900000 */ - mov r5, #0x00900000 - add r5, r5, #0x01000000 - ldr r6, = _dataend - sub r0, r6, r5 /* length of loader */ - add r0, r4, r0 /* r0 points to start of loader */ -1: - cmp r5, r6 - ldrcc r2, [r4], #4 - strcc r2, [r5], #4 - bcc 1b - - ldr pc, =start_loc /* jump to the relocated start_loc: */ - -#endif - -start_loc: - bl main - /* main() should never return */ - -/* Exception handlers. Will be copied to address 0 after memory remapping */ - .section .vectors,"aw" - ldr pc, [pc, #24] - ldr pc, [pc, #24] - ldr pc, [pc, #24] - ldr pc, [pc, #24] - ldr pc, [pc, #24] - ldr pc, [pc, #24] - ldr pc, [pc, #24] - ldr pc, [pc, #24] - - /* Exception vectors */ - .global vectors -vectors: - .word start - .word undef_instr_handler - .word software_int_handler - .word prefetch_abort_handler - .word data_abort_handler - .word reserved_handler - .word irq_handler - .word fiq_handler - - .text - -#if !defined(STUB) - .global irq - .global fiq - .global UIE -#endif - -/* All illegal exceptions call into UIE with exception address as first - parameter. This is calculated differently depending on which exception - we're in. Second parameter is exception number, used for a string lookup - in UIE. - */ -undef_instr_handler: - mov r0, lr - mov r1, #0 - b UIE - -/* We run supervisor mode most of the time, and should never see a software - exception being thrown. Perhaps make it illegal and call UIE? - */ -software_int_handler: -reserved_handler: - movs pc, lr - -prefetch_abort_handler: - sub r0, lr, #4 - mov r1, #1 - b UIE - -data_abort_handler: - sub r0, lr, #8 - mov r1, #2 - b UIE - -UIE: - b UIE - -/* 256 words of IRQ stack */ - .space 256*4 -irq_stack: - -/* 256 words of FIQ stack */ - .space 256*4 -fiq_stack: diff --git a/firmware/target/arm/tms320dm320/mrobe-500/system-target.h b/firmware/target/arm/tms320dm320/mrobe-500/dm320codec-mr500.c index 7adfda6f7d..eed1f8d3a0 100755 --- a/firmware/target/arm/tms320dm320/mrobe-500/system-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/dm320codec-mr500.c @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2002 by Karl Kurbjun + * Copyright (c) 2007 by Karl Kurbjun * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -16,17 +16,24 @@ * KIND, either express or implied. * ****************************************************************************/ -#ifndef SYSTEM_TARGET_H -#define SYSTEM_TARGET_H +#include "cpu.h" +#include "kernel.h" +#include "sound.h" -#include "system-arm.h" +const struct sound_settings_info audiohw_settings[] = { + [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, + [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0}, + [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0}, + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, + [SOUND_STEREO_WIDTH] = {"%", 0, 1, 0, 255, 100}, +}; -#define CPUFREQ_SLEEP 32768 -#define CPUFREQ_DEFAULT 24000000 -#define CPUFREQ_NORMAL 30000000 -#define CPUFREQ_MAX 80000000 -#define inw(p) (*((volatile unsigned short*)((p) + PHY_IO_BASE))) -#define outw(v,p) (*((volatile unsigned short*)((p) + PHY_IO_BASE)) = (v)) +void audiohw_init(void) +{ +} -#endif /* SYSTEM_TARGET_H */ +void audiohw_close(void) +{ +} diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index 6c06e070f9..aad7733154 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c @@ -167,8 +167,9 @@ void lcd_yuv_blit(unsigned char * const src[3], do { - lcd_write_yuv420_lines(dst, chroma_buf, yuv_src, width, +/* lcd_write_yuv420_lines(dst, chroma_buf, yuv_src, width, stride); + */ yuv_src[0] += stride << 1; /* Skip down two luma lines */ yuv_src[1] += stride >> 1; /* Skip down one chroma line */ yuv_src[2] += stride >> 1; diff --git a/firmware/target/arm/tms320dm320/mrobe-500/kernel-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c index be2b14b3cb..3bc9124674 100644..100755 --- a/firmware/target/arm/tms320dm320/mrobe-500/kernel-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c @@ -16,48 +16,70 @@ * KIND, either express or implied. * ****************************************************************************/ - -#include "config.h" +#include <stdlib.h> #include "system.h" #include "kernel.h" -#include "timer.h" -#include "thread.h" +#include "logf.h" +#include "audio.h" +#include "sound.h" +#include "file.h" -extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); +static void _pcm_apply_settings(void) +{ +} -void tick_start(unsigned int interval_in_ms) +void pcm_apply_settings(void) { - IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP; - - /* Setup the Prescalar (Divide by 10) - * Based on linux/include/asm-arm/arch-integrator/timex.h - */ - IO_TIMER1_TMPRSCL = 0x000A; +} - /* Setup the Divisor */ - IO_TIMER1_TMDIV = (TIMER_FREQ / (10*1000))*interval_in_ms; +void pcm_init(void) +{ +} - /* Turn Timer1 to Free Run mode */ - IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_FREE_RUN; +void pcm_postinit(void) +{ +} + +void pcm_play_dma_start(const void *addr, size_t size) +{ - /* Enable the interrupt */ - IO_INTC_EINT0 |= 1<<IRQ_TIMER1; } -void TIMER1(void) +static void pcm_play_dma_stop_fiq(void) { - int i; - /* Run through the list of tick tasks */ - for(i = 0; i < MAX_NUM_TICK_TASKS; i++) - { - if(tick_funcs[i]) - { - tick_funcs[i](); - } - } +} - current_tick++; +void pcm_play_dma_stop(void) +{ - IO_INTC_IRQ0 = 1<<IRQ_TIMER1; } + +void pcm_play_pause_pause(void) +{ +} + +void pcm_play_pause_unpause(void) +{ +} + +void pcm_set_frequency(unsigned int frequency) +{ +} + +size_t pcm_get_bytes_waiting(void) +{ +} + +void pcm_mute(bool mute) +{ +} + +/** + * Return playback peaks - Peaks ahead in the DMA buffer based upon the + * calling period to attempt to compensate for + * delay. + */ +void pcm_calculate_peaks(int *left, int *right) +{ +} /* pcm_calculate_peaks */ diff --git a/firmware/target/arm/tms320dm320/mrobe-500/spi-target.h b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c index 866919dc27..20ca4bb509 100644..100755 --- a/firmware/target/arm/tms320dm320/mrobe-500/spi-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2007 by Catalin Patulea + * Copyright (C) 2007 by Karl Kurbjun * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -16,14 +16,36 @@ * KIND, either express or implied. * ****************************************************************************/ - -#ifndef SPI_TARGET_H -#define SPI_TARGET_H -#include <inttypes.h> +#include "config.h" +#include "adc.h" +#include "powermgmt.h" -void spi_init(void); -int spi_block_transfer(const uint8_t *tx_bytes, unsigned int tx_size, - uint8_t *rx_bytes, unsigned int rx_size); +const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = +{ + 3450 +}; + +const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = +{ + 3400 +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ +const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = +{ + { 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 }, +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +const unsigned short percent_to_volt_charge[11] = +{ + 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 +}; + +/* Returns battery voltage from ADC [millivolts] */ +unsigned int battery_adc_voltage(void) +{ + return 3500; +} -#endif diff --git a/firmware/target/arm/tms320dm320/mrobe-500/spi-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/spi-mr500.c deleted file mode 100644 index c47ab8f6ed..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/spi-mr500.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SPI interface driver for the DM320 SoC - * - * Copyright (C) 2007 shirour <mrobefan@gmail.com> - * Copyright (C) 2007 Catalin Patulea <cat@vv.carleton.ca> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "system.h" - -#define GIO_TS_ENABLE (1<<2) -#define clr_gio_enable() IO_GIO_BITSET1=GIO_TS_ENABLE -#define set_gio_enable() IO_GIO_BITCLR1=GIO_TS_ENABLE - -int spi_block_transfer(const uint8_t *tx_bytes, unsigned int tx_size, - uint8_t *rx_bytes, unsigned int rx_size) -{ - /* Activate the slave select pin */ - set_gio_enable(); - - while (tx_size--) - { - /* Send one byte */ - IO_SERIAL0_TX_DATA = *tx_bytes++; - - /* Wait until transfer finished */ - while (IO_SERIAL0_RX_DATA & 0x100); - } - - while (rx_size--) - { - /* Make the clock tick */ - IO_SERIAL0_TX_DATA = 0; - - /* Wait until transfer finished */ - unsigned short data; - while ((data = IO_SERIAL0_RX_DATA) & 0x100); - - *rx_bytes++ = data & 0xff; - } - - clr_gio_enable(); - - return 0; -} - -void spi_init(void) -{ - /* Set SCLK idle level = 0 */ - IO_SERIAL0_MODE |= (1<<10); - - /* Enable TX */ - IO_SERIAL0_TX_ENABLE = 0x0001; - - /* Set GIO 18 to output for touch screen slave enable */ - IO_GIO_DIR1&=~GIO_TS_ENABLE; - clr_gio_enable(); -} diff --git a/firmware/target/arm/tms320dm320/mrobe-500/system-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/system-mr500.c deleted file mode 100644 index fad2d4331e..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/system-mr500.c +++ /dev/null @@ -1,210 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 by Karl Kurbjun - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "kernel.h" -#include "system.h" -#include "panic.h" - -#define default_interrupt(name) \ - extern __attribute__((weak,alias("UIRQ"))) void name (void) - -default_interrupt(TIMER0); -default_interrupt(TIMER1); -default_interrupt(TIMER2); -default_interrupt(TIMER3); -default_interrupt(CCD_VD0); -default_interrupt(CCD_VD1); -default_interrupt(CCD_WEN); -default_interrupt(VENC); -default_interrupt(SERIAL0); -default_interrupt(SERIAL1); -default_interrupt(EXT_HOST); -default_interrupt(DSPHINT); -default_interrupt(UART0); -default_interrupt(UART1); -default_interrupt(USB_DMA); -default_interrupt(USB_CORE); -default_interrupt(VLYNQ); -default_interrupt(MTC0); -default_interrupt(MTC1); -default_interrupt(SD_MMC); -default_interrupt(SDIO_MS); -default_interrupt(GIO0); -default_interrupt(GIO1); -default_interrupt(GIO2); -default_interrupt(GIO3); -default_interrupt(GIO4); -default_interrupt(GIO5); -default_interrupt(GIO6); -default_interrupt(GIO7); -default_interrupt(GIO8); -default_interrupt(GIO9); -default_interrupt(GIO10); -default_interrupt(GIO11); -default_interrupt(GIO12); -default_interrupt(GIO13); -default_interrupt(GIO14); -default_interrupt(GIO15); -default_interrupt(PREVIEW0); -default_interrupt(PREVIEW1); -default_interrupt(WATCHDOG); -default_interrupt(I2C); -default_interrupt(CLKC); -default_interrupt(ICE); -default_interrupt(ARMCOM_RX); -default_interrupt(ARMCOM_TX); -default_interrupt(RESERVED); - -static void (* const irqvector[])(void) = -{ - TIMER0,TIMER1,TIMER2,TIMER3,CCD_VD0,CCD_VD1, - CCD_WEN,VENC,SERIAL0,SERIAL1,EXT_HOST,DSPHINT, - UART0,UART1,USB_DMA,USB_CORE,VLYNQ,MTC0,MTC1, - SD_MMC,SDIO_MS,GIO0,GIO1,GIO2,GIO3,GIO4,GIO5, - GIO6,GIO7,GIO8,GIO9,GIO10,GIO11,GIO12,GIO13, - GIO14,GIO15,PREVIEW0,PREVIEW1,WATCHDOG,I2C,CLKC, - ICE,ARMCOM_RX,ARMCOM_TX,RESERVED -}; - -static const char * const irqname[] = -{ - "TIMER0","TIMER1","TIMER2","TIMER3","CCD_VD0","CCD_VD1", - "CCD_WEN","VENC","SERIAL0","SERIAL1","EXT_HOST","DSPHINT", - "UART0","UART1","USB_DMA","USB_CORE","VLYNQ","MTC0","MTC1", - "SD_MMC","SDIO_MS","GIO0","GIO1","GIO2","GIO3","GIO4","GIO5", - "GIO6","GIO7","GIO8","GIO9","GIO10","GIO11","GIO12","GIO13", - "GIO14","GIO15","PREVIEW0","PREVIEW1","WATCHDOG","I2C","CLKC", - "ICE","ARMCOM_RX","ARMCOM_TX","RESERVED" -}; - -static void UIRQ(void) -{ - unsigned int offset = (IO_INTC_IRQENTRY0>>2)-1; - panicf("Unhandled IRQ %02X: %s", offset, irqname[offset]); -} - -void irq_handler(void) __attribute__((interrupt ("IRQ"), naked)); -void irq_handler(void) -{ - /* - * Based on: linux/arch/arm/kernel/entry-armv.S and system-meg-fx.c - */ - - asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */ - "sub sp, sp, #8 \n"); /* Reserve stack */ - irqvector[(IO_INTC_IRQENTRY0>>2)-1](); - 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 fiq_handler(void) __attribute__((interrupt ("FIQ"), naked)); -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, #0x518] \r\n" - "ldr r1, =irqvector \r\n" - "ldr r1, [r1, r0, lsl #2] \r\n" - "mov lr, pc \r\n" - "bx r1 \r\n" - "ldmfd sp!, {r0-r3, ip, pc}^ \r\n" - ); -} - -void system_reboot(void) -{ - -} - -void enable_interrupts (void) -{ - asm volatile ("msr cpsr_c, #0x13" ); -} - -void system_init(void) -{ - /* taken from linux/arch/arm/mach-itdm320-20/irq.c */ - - /* Clearing all FIQs and IRQs. */ - IO_INTC_IRQ0 = 0xFFFF; - IO_INTC_IRQ1 = 0xFFFF; - IO_INTC_IRQ2 = 0xFFFF; - - IO_INTC_FIQ0 = 0xFFFF; - IO_INTC_FIQ1 = 0xFFFF; - IO_INTC_FIQ2 = 0xFFFF; - - /* Masking all Interrupts. */ - IO_INTC_EINT0 = 0; - IO_INTC_EINT1 = 0; - IO_INTC_EINT2 = 0; - - /* Setting INTC to all IRQs. */ - IO_INTC_FISEL0 = 0; - IO_INTC_FISEL1 = 0; - IO_INTC_FISEL2 = 0; - - IO_INTC_ENTRY_TBA0 = - IO_INTC_ENTRY_TBA1 = 0; - - /* set GIO26 (reset pin) to output and low */ - IO_GIO_BITCLR1=(1<<10); - IO_GIO_DIR1&=~(1<<10); - - enable_interrupts(); -} - -int system_memory_guard(int newmode) -{ - (void)newmode; - return 0; -} - -#ifdef HAVE_ADJUSTABLE_CPU_FREQ - -void set_cpu_frequency(long frequency) -{ - if (frequency == CPUFREQ_MAX) - { - asm volatile("mov r0, #0\n" - "mrc p15, 0, r0, c1, c0, 0\n" - "orr r0, r0, #3<<30\n" /* set to Asynchronous mode*/ - "mcr p15, 0, r0, c1, c0, 0" : : : "r0"); - - FREQ = CPUFREQ_MAX; - } - else - { - asm volatile("mov r0, #0\n" - "mrc p15, 0, r0, c1, c0, 0\n" - "bic r0, r0, #3<<30\n" /* set to FastBus mode*/ - "mcr p15, 0, r0, c1, c0, 0" : : : "r0"); - - FREQ = CPUFREQ_NORMAL; - } -} - -#endif diff --git a/firmware/target/arm/tms320dm320/mrobe-500/timer-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/timer-mr500.c deleted file mode 100644 index 21449ed19f..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/timer-mr500.c +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** -* __________ __ ___. -* Open \______ \ ____ ____ | | _\_ |__ _______ ___ -* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -* \/ \/ \/ \/ \/ -* $Id$ -* -* Copyright (C) 2007 by Karl Kurbjun -* -* All files in this archive are subject to the GNU General Public License. -* See the file COPYING in the source tree root for full license agreement. -* -* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -* KIND, either express or implied. -* -****************************************************************************/ - -#include "config.h" -#include "cpu.h" -#include "system.h" -#include "timer.h" -#include "logf.h" - -/* GPB0/TOUT0 should already have been configured as output so that pin - should not be a functional pin and TIMER0 output unseen there */ -void TIMER0(void) -{ - if (pfn_timer != NULL) - pfn_timer(); - IO_INTC_IRQ0 |= 1<<IRQ_TIMER0; -} - -static void stop_timer(void) -{ - IO_INTC_EINT0 &= ~(1<<IRQ_TIMER0); - - IO_INTC_IRQ0 |= 1<<IRQ_TIMER0; - - IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; -} - -bool __timer_set(long cycles, bool start) -{ - int oldlevel; - unsigned int divider; - /* taken from linux/arch/arm/mach-itdm320-20/time.c and timer-meg-fx.c */ - - /* Turn off all timers */ - IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_STOP; - IO_TIMER1_TMMD = CONFIG_TIMER1_TMMD_STOP; - IO_TIMER2_TMMD = CONFIG_TIMER2_TMMD_STOP; - IO_TIMER3_TMMD = CONFIG_TIMER3_TMMD_STOP; - - /* Find the minimum factor that puts the counter in range 1-65535 */ - unsigned int prescaler = (cycles + 65534) / 65535; - - /* Test this by writing 1's to registers to see how many bits we have */ - /* Maximum divider setting is x / 1024 / 65536 = x / 67108864 */ - if (start && pfn_unregister != NULL) - { - pfn_unregister(); - pfn_unregister = NULL; - } - - oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); - - /* Max prescale is 1023+1 */ - for (divider = 0; prescaler > 1024; prescaler >>= 1, divider++); - - /* Setup the Prescalar */ - IO_TIMER0_TMPRSCL = prescaler; - - /* Setup the Divisor */ - IO_TIMER0_TMDIV = divider; - - set_irq_level(oldlevel); - - return true; -} - -bool __timer_register(void) -{ - bool retval = true; - - int oldstatus = set_interrupt_status(IRQ_FIQ_DISABLED, IRQ_FIQ_STATUS); - - stop_timer(); - - /* Turn Timer0 to Free Run mode */ - IO_TIMER0_TMMD = CONFIG_TIMER0_TMMD_FREE_RUN; - - IO_INTC_EINT0 |= 1<<IRQ_TIMER0; - - set_interrupt_status(oldstatus, IRQ_FIQ_STATUS); - - return retval; -} - -void __timer_unregister(void) -{ - int oldstatus = set_interrupt_status(IRQ_FIQ_DISABLED, IRQ_FIQ_STATUS); - stop_timer(); - set_interrupt_status(oldstatus, IRQ_FIQ_STATUS); -} diff --git a/firmware/target/arm/tms320dm320/mrobe-500/timer-target.h b/firmware/target/arm/tms320dm320/mrobe-500/timer-target.h deleted file mode 100644 index 4abe75ad82..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/timer-target.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** -* __________ __ ___. -* Open \______ \ ____ ____ | | _\_ |__ _______ ___ -* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -* \/ \/ \/ \/ \/ -* $Id$ -* -* Copyright (C) 2007 by Karl Kurbjun -* -* All files in this archive are subject to the GNU General Public License. -* See the file COPYING in the source tree root for full license agreement. -* -* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -* KIND, either express or implied. -* -****************************************************************************/ -#ifndef TIMER_TARGET_H -#define TIMER_TARGET_H - -/* timer is based on PCLK and minimum division is 2 */ -#define TIMER_FREQ (27000000) - -bool __timer_set(long cycles, bool set); -bool __timer_register(void); -void __timer_unregister(void); - -#define __TIMER_SET(cycles, set) \ - __timer_set(cycles, set) - -#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \ - int_prio, timer_callback) \ - __timer_register() - -#define __TIMER_UNREGISTER(...) \ - __timer_unregister() - -#endif /* TIMER_TARGET_H */ diff --git a/firmware/target/arm/tms320dm320/mrobe-500/uart-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/uart-mr500.c deleted file mode 100644 index 66e59eaaac..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/uart-mr500.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * (C) Copyright 2007 Catalin Patulea <cat@vv.carleton.ca> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - */ -#include "config.h" -#include "cpu.h" -#include "system.h" - -/* UART 0/1 */ - -#define CONFIG_UART_BRSR 87 -#define MAX_UART_BUFFER 32 -static unsigned char uart1buffer[MAX_UART_BUFFER]; -int uart1read = 0, uart1write = 0, uart1count = 0; - -void do_checksums(char *data, int len, char *xor, char *add) -{ - int i; - *xor = data[0]; - *add = data[0]; - for(i=1;i<len;i++) - { - *xor ^= data[i]; - *add += data[i]; - } -} - -void uart_init(void) -{ - // 8-N-1 - IO_UART1_MSR=0x8000; - IO_UART1_BRSR=CONFIG_UART_BRSR; - IO_UART1_RFCR = 0x8000; - /* gio 27 is input, uart1 rx - gio 28 is output, uart1 tx */ - IO_GIO_DIR1 |= (1<<11); /* gio 27 */ - IO_GIO_DIR1 &= ~(1<<12); /* gio 28 */ - - /* init the recieve buffer */ - uart1read = 0; - uart1write = 0; - uart1count = 0; - - /* Enable the interrupt */ - IO_INTC_EINT0 |= (1<<IRQ_UART1); -} - -void uartPutc(char ch) { - // Wait for room in FIFO - while ((IO_UART1_TFCR & 0x3f) >= 0x20); - - // Write character - IO_UART1_DTRR=ch; -} - -// Unsigned integer to ASCII hexadecimal conversion -void uartPutHex(unsigned int n) { - unsigned int i; - - for (i = 8; i != 0; i--) { - unsigned int digit = n >> 28; - uartPutc(digit >= 10 ? digit - 10 + 'A' : digit + '0'); - n <<= 4; - } -} - -void uartPuts(const char *str) { - char ch; - while ((ch = *str++) != '\0') { - uartPutc(ch); - } -} - -void uartGets(char *str, unsigned int size) { - for (;;) { - char ch; - - // Wait for FIFO to contain something - while ((IO_UART1_RFCR & 0x3f) == 0); - - // Read character - ch = (char)IO_UART1_DTRR; - - // Echo character back - IO_UART1_DTRR=ch; - - // If CR, also echo LF, null-terminate, and return - if (ch == '\r') { - IO_UART1_DTRR='\n'; - if (size) { - *str++ = '\0'; - } - return; - } - - // Append to buffer - if (size) { - *str++ = ch; - --size; - } - } -} - -int uartPollch(unsigned int ticks) { - while (ticks--) { - if (IO_UART1_RFCR & 0x3f) { - return IO_UART1_DTRR & 0xff; - } - } - - return -1; -} - -bool uartAvailable(void) -{ - return uart1count > 0; -} - -void uart1_heartbeat(void) -{ - char data[5] = {0x11, 0x30, 0x11^0x30, 0x11+0x30, '\0'}; - uartPuts(data); -} - -void uartSendData(char* data, int len) -{ - int i; - for(i=0;i<len;i++) - uartPutc(data[i]); -} - -bool uart1_getch(char *c) -{ - if (uart1count > 0) - { - *c = uart1buffer[uart1read]; - uart1read = (uart1read+1) % MAX_UART_BUFFER; - uart1count--; - return true; - } - return false; -} - -/* UART1 receive intterupt handler */ -void UART1(void) -{ - if (IO_UART1_RFCR & 0x3f) - { - if (uart1count >= MAX_UART_BUFFER) - panicf("UART1 buffer overflow"); - uart1buffer[uart1write] = IO_UART1_DTRR & 0xff; - uart1write = (uart1write+1) % MAX_UART_BUFFER; - uart1count++; - } - - IO_INTC_IRQ0 = (1<<IRQ_UART1); -} diff --git a/firmware/target/arm/tms320dm320/mrobe-500/uart-target.h b/firmware/target/arm/tms320dm320/mrobe-500/uart-target.h deleted file mode 100644 index f077dc1025..0000000000 --- a/firmware/target/arm/tms320dm320/mrobe-500/uart-target.h +++ /dev/null @@ -1,33 +0,0 @@ -/*
- * (C) Copyright 2007 Catalin Patulea <cat@vv.carleton.ca>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-#ifndef UART_H
-#define UART_H
-
-void uart_init(void);
-bool uart1_getch(char *c);
-void uart1_heartbeat(void);
-
-void uartPuts(const char *str);
-void uartGets(char *str, unsigned int size);
-int uartPollch(unsigned int ticks);
-void uartPutc(char ch);
-void uartPutHex(unsigned int n);
-
-#endif
|