Index: bootloader/SOURCES =================================================================== --- bootloader/SOURCES (revision 17054) +++ bootloader/SOURCES (working copy) @@ -27,4 +27,8 @@ mrobe500.c #elif defined(CPU_TCC77X) || defined(CPU_TCC780X) telechips.c +#elif defined(CREATIVE_ZVM) +creativezvm.c +#else +main.c #endif Index: apps/SOURCES =================================================================== --- apps/SOURCES (revision 17054) +++ apps/SOURCES (working copy) @@ -175,4 +175,6 @@ keymaps/keymap-mr100.c #elif CONFIG_KEYPAD == COWOND2_PAD keymaps/keymap-cowond2.c +#elif CONFIG_KEYPAD == CREATIVEZVM_PAD +keymaps/keymap-creativezvm.c #endif Index: firmware/export/config-creativezvm.h =================================================================== --- firmware/export/config-creativezvm.h (revision 17054) +++ firmware/export/config-creativezvm.h (working copy) @@ -65,16 +65,13 @@ /* Define this if your LCD can be enabled/disabled */ #define HAVE_LCD_ENABLE -#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING +#define CONFIG_KEYPAD CREATIVEZVM_PAD +#define HAS_BUTTON_HOLD +#define HAVE_HEADPHONE_DETECTION +//#define HAVE_TOUCHPAD -#define MIN_REMOTE_CONTRAST_SETTING 0 -#define MAX_REMOTE_CONTRAST_SETTING 15 -#define DEFAULT_REMOTE_CONTRAST_SETTING 7 +#define CONFIG_I2C I2C_DM320 -#define CONFIG_KEYPAD MROBE500_PAD -//#define HAVE_TOUCHPAD -#define HAVE_BUTTON_DATA - /* Define this if you do software codec */ #define CONFIG_CODEC SWCODEC @@ -84,16 +81,17 @@ /* Define this for LCD backlight available */ //#define HAVE_BACKLIGHT -#define HAVE_BACKLIGHT_BRIGHTNESS +//#define HAVE_BACKLIGHT_BRIGHTNESS /* Main LCD backlight brightness range and defaults */ -#define MIN_BRIGHTNESS_SETTING 0 -#define MAX_BRIGHTNESS_SETTING 127 -#define DEFAULT_BRIGHTNESS_SETTING 85 /* OF "full brightness" */ -#define DEFAULT_DIMNESS_SETTING 22 /* OF "most dim" */ +//#define MIN_BRIGHTNESS_SETTING 0 +//#define MAX_BRIGHTNESS_SETTING 127 +//#define DEFAULT_BRIGHTNESS_SETTING 85 /* OF "full brightness" */ +//#define DEFAULT_DIMNESS_SETTING 22 /* OF "most dim" */ /* Define this if you have a software controlled poweroff */ -#define HAVE_SW_POWEROFF +//#define HAVE_SW_POWEROFF +//TODO: enable this back /* The number of bytes reserved for loadable codecs */ #define CODEC_SIZE 0x80000 @@ -104,11 +102,11 @@ /* Define this if you have the TLV320 audio codec */ //#define HAVE_TLV320 -/* Define this if you want to use the adaptive bass capibility of the 8751 */ -/* #define USE_ADAPTIVE_BASS */ +/* TLV320 has no tone controls, so we use the software ones */ +//#define HAVE_SW_TONE_CONTROLS -#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \ - SAMPR_CAP_11) +/*#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | \ + SAMPR_CAP_11)*/ #define BATTERY_CAPACITY_DEFAULT 1100 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ @@ -117,7 +115,7 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ /* Hardware controlled charging with monitoring */ -#define CONFIG_CHARGING CHARGING_MONITOR +//#define CONFIG_CHARGING CHARGING_MONITOR #ifndef SIMULATOR @@ -127,8 +125,7 @@ /* Define this if you have a Texas Instruments TSC2100 touch screen */ //#define HAVE_TSC2100 -/* Define this if you want to use coldfire's i2c interface */ -//#define CONFIG_I2C I2C_S3C2440 +#define CONFIG_USBOTG USBOTG_ISP1583 /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING @@ -161,4 +158,23 @@ #define BOOTFILE "rockbox." BOOTFILE_EXT #define BOOTDIR "/.rockbox" +#define HAVE_USBSTACK +#define USB_VENDOR_ID 0x041e +#define USB_PRODUCT_ID 0x4133 + +#define USB_SERIAL + +//DEBUGGING! +#ifdef BOOTLOADER +#define THREAD_EXTRA_CHECKS 1 +#define DEBUG 1 +#define debug(msg) printf(msg) +#define BUTTON_DEBUG + +#define DO_THREAD_TEST #endif + + +//Uncomment next line to make this build Zen Vision compatible +//#define ZEN_VISION +#endif Index: firmware/export/config.h =================================================================== --- firmware/export/config.h (revision 17054) +++ firmware/export/config.h (working copy) @@ -79,6 +79,7 @@ #define IAUDIO67_PAD 21 #define COWOND2_PAD 22 #define IAUDIO_M3_PAD 23 +#define CREATIVEZVM_PAD 24 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -143,6 +144,7 @@ #define I2C_IMX31L 9 #define I2C_TCC77X 10 #define I2C_TCC780X 11 +#define I2C_DM320 12 /* CONFIG_LED */ #define LED_REAL 1 /* SW controlled LED (Archos recorders, player) */ @@ -168,6 +170,7 @@ /* USB On-the-go */ #define USBOTG_ISP1362 1362 /* iriver H300 */ +#define USBOTG_ISP1538 1538 /* Creative Zen Vision:M */ #define USBOTG_M5636 5636 /* iAudio X5 */ #define USBOTG_ARC 5020 /* PortalPlayer 502x */ Index: firmware/kernel.c =================================================================== --- firmware/kernel.c (revision 17054) +++ firmware/kernel.c (working copy) @@ -432,6 +432,10 @@ unsigned stop = USEC_TIMER + ticks * (1000000/HZ); while (TIME_BEFORE(USEC_TIMER, stop)) switch_thread(); +#elif defined(CREATIVE_ZVM) && defined(BOOTLOADER) + long sleep_ticks = current_tick + ticks + 1; + while (sleep_ticks > current_tick) + yield(); #else disable_irq(); sleep_thread(ticks); Index: firmware/panic.c =================================================================== --- firmware/panic.c (revision 17054) +++ firmware/panic.c (working copy) @@ -126,6 +126,8 @@ #elif CONFIG_KEYPAD == ONDIO_PAD if (!(PCDR & 0x0008)) #endif /* CONFIG_KEYPAD */ +#elif defined(CREATIVE_ZVM) + if(false) #endif /* CPU */ system_reboot(); #endif /* !SIMULATOR */ Index: firmware/usbstack/usb_core.c =================================================================== --- firmware/usbstack/usb_core.c (revision 17054) +++ firmware/usbstack/usb_core.c (working copy) @@ -21,8 +21,13 @@ #include "kernel.h" #include "string.h" //#define LOGF_ENABLE -#include "logf.h" +//#include "logf.h" +#define USB_SERIAL +#undef USB_CHARGING_ONLY + +#define logf printf + #include "usb.h" #include "usb_ch9.h" #include "usb_drv.h" Index: firmware/usbstack/usb_serial.c =================================================================== --- firmware/usbstack/usb_serial.c (revision 17054) +++ firmware/usbstack/usb_serial.c (working copy) @@ -23,8 +23,11 @@ #include "kernel.h" //#define LOGF_ENABLE -#include "logf.h" +//#include "logf.h" +#define logf printf +#define USB_SERIAL + #ifdef USB_SERIAL /* serial interface */ Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 17054) +++ firmware/SOURCES (working copy) @@ -235,10 +235,12 @@ usbstack/usb_serial.c #ifdef CPU_PP502x target/arm/usb-drv-pp502x.c +#elif CONFIG_USBOTG == USBOTG_ISP1583 +drivers/isp1583.c #endif #else /* !defined(HAVE_USBSTACK) */ #if CONFIG_USBOTG == USBOTG_ISP1362 -drivers/isp1362.c +drivers/isp1362.c #elif CONFIG_USBOTG == USBOTG_M5636 drivers/m5636.c #endif @@ -665,6 +667,17 @@ #endif /* SIMULATOR */ #endif /* GIGABEAT_S */ +#if CONFIG_CPU == DM320 +target/arm/tms320dm320/debug-dm320.c +target/arm/tms320dm320/dsp-dm320.c +target/arm/tms320dm320/i2c-dm320.c +target/arm/tms320dm320/kernel-dm320.c +target/arm/tms320dm320/spi-dm320.c +target/arm/tms320dm320/system-dm320.c +target/arm/tms320dm320/timer-dm320.c +target/arm/tms320dm320/uart-dm320.c +#endif /* CONFIG_CPU == DM320 */ + #ifdef MROBE_500 #ifndef SIMULATOR target/arm/lcd-as-memframe.S @@ -682,17 +695,25 @@ target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c target/arm/tms320dm320/mrobe-500/power-mr500.c target/arm/tms320dm320/mrobe-500/usb-mr500.c -target/arm/tms320dm320/debug-dm320.c -target/arm/tms320dm320/i2c-dm320.c -target/arm/tms320dm320/kernel-dm320.c -target/arm/tms320dm320/spi-dm320.c -target/arm/tms320dm320/system-dm320.c -target/arm/tms320dm320/timer-dm320.c -target/arm/tms320dm320/uart-dm320.c -target/arm/tms320dm320/dsp-dm320.c #endif /* SIMULATOR */ #endif /* MROBE_500 */ +#ifdef CREATIVE_ZVM +#ifndef SIMULATOR +target/arm/lcd-as-memframe.S +target/arm/mmu-arm.c +target/arm/tms320dm320/creative-zvm/adc-creativezvm.c +target/arm/tms320dm320/creative-zvm/audio-creativezvm.c +target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c +target/arm/tms320dm320/creative-zvm/ata-creativezvm.c +target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c +target/arm/tms320dm320/creative-zvm/pic-creativezvm.c +target/arm/tms320dm320/creative-zvm/power-creativezvm.c +target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c +target/arm/tms320dm320/creative-zvm/usb-creativezvm.c +#endif /* SIMULATOR */ +#endif /* CREATIVE_ZVM */ + #ifdef MROBE_100 #ifndef SIMULATOR drivers/sw_i2c.c Index: firmware/target/arm/tms320dm320/uart-dm320.c =================================================================== --- firmware/target/arm/tms320dm320/uart-dm320.c (revision 17054) +++ firmware/target/arm/tms320dm320/uart-dm320.c (working copy) @@ -50,7 +50,7 @@ uart1_recieve_write=0; /* Enable the interrupt */ - IO_INTC_EINT0 |= (1<>2)-1](); + unsigned short addr = IO_INTC_IRQENTRY0>>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 */ @@ -130,18 +136,33 @@ "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 r0, [r0, #0x518] \r\n" + "sub r0, r0, #1 \r\n" "ldr r1, =irqvector \r\n" "ldr r1, [r1, r0, lsl #2] \r\n" - "mov lr, pc \r\n" - "bx r1 \r\n" + "blx r1 \r\n" "ldmfd sp!, {r0-r3, ip, pc}^ \r\n" ); } void system_reboot(void) { - + /* Code taken from linux/include/asm-arm/arch-itdm320-20/system.h at NeuroSVN */ + __asm__ __volatile__( + "mov ip, #0 \n" + "mcr p15, 0, ip, c7, c7, 0 @ invalidate cache \n" + "mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4) \n" + "mrc p15, 0, ip, c1, c0, 0 @ get ctrl register\n" + "bic ip, ip, #0x000f @ ............wcam \n" + "bic ip, ip, #0x2100 @ ..v....s........ \n" + "mcr p15, 0, ip, c1, c0, 0 @ ctrl register \n" + "mov ip, #0xFF000000 \n" + "orr ip, ip, #0xFF0000 @ ip = 0xFFFF0000 \n" + "mov pc, ip \n" + : + : + : "cc" + ); } void system_init(void) @@ -167,16 +188,28 @@ IO_INTC_FISEL1 = 0; IO_INTC_FISEL2 = 0; + /* IRQENTRY only reflects enabled interrupts */ + IO_INTC_RAW = 0; + IO_INTC_ENTRY_TBA0 = 0; IO_INTC_ENTRY_TBA1 = 0; - /* Turn off other timers */ + unsigned short i; + /* Reset interrupt priorities to default values */ + for(i = 0; i < 23; i++) + DM320_REG(0x0540+i*2) = ( (i*2+1) << 8 ) | i*2 ;//IO_INTC_PRIORITYx + + /* 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; +#ifndef CREATIVE_ZVM /* set GIO26 (reset pin) to output and low */ IO_GIO_BITCLR1=(1<<10); IO_GIO_DIR1&=~(1<<10); +#endif uart_init(); spi_init(); @@ -186,9 +219,18 @@ /* Make sure everything is mapped on itself */ map_section(0, 0, 0x1000, CACHE_NONE); /* Enable caching for RAM */ - map_section(0x00900000, 0x00900000, 64, CACHE_ALL); + map_section(CONFIG_SDRAM_START, CONFIG_SDRAM_START, MEM, CACHE_ALL); /* enable buffered writing for the framebuffer */ map_section((int)FRAME, (int)FRAME, 1, BUFFERED); +#ifdef CREATIVE_ZVM + //mimic OF + map_section(0x00100000, 0x00100000, 4, CACHE_NONE); + map_section(0x04700000, 0x04700000, 2, BUFFERED); + map_section(0x40000000, 0x40000000, 16, CACHE_NONE); + map_section(0x50000000, 0x50000000, 16, CACHE_NONE); + map_section(0x60000000, 0x60000000, 16, CACHE_NONE); + map_section(0x80000000, 0x80000000, 1, CACHE_NONE); +#endif enable_mmu(); } Index: firmware/target/arm/tms320dm320/dsp-dm320.c =================================================================== --- firmware/target/arm/tms320dm320/dsp-dm320.c (revision 17054) +++ firmware/target/arm/tms320dm320/dsp-dm320.c (working copy) @@ -23,27 +23,22 @@ #include "string.h" #include "dsp-target.h" -/* A "DSP image" is an array of these, terminated by raw_data_size_half = 0. */ -struct dsp_section { - const unsigned short *raw_data; - unsigned short physical_addr; - unsigned short raw_data_size_half; -}; - /* Must define struct dsp_section before including the image. */ #include "dsp_image_helloworld.h" #ifdef DEBUG -static void dsp_status(void) +void dsp_status(void) { unsigned short hpib_ctl = IO_DSPC_HPIB_CONTROL; unsigned short hpib_stat = IO_DSPC_HPIB_STATUS; char buffer1[80], buffer2[80]; - DEBUGF("dsp_status(): clkc_hpib=%u clkc_dsp=%u", - !!(IO_CLK_MOD0 & (1 << 11)), !!(IO_CLK_MOD0 & (1 << 10))); + DEBUGF("[dsp_status()]"); - DEBUGF("dsp_status(): irq_dsphint=%u 7fff=%04x scratch_status=%04x" + DEBUGF("clkc_hpib=%u clkc_dsp=%u", + !!(IO_CLK_MOD0 & CLK_MOD0_HPIB), !!(IO_CLK_MOD0 & CLK_MOD0_DSP)); + + DEBUGF("irq_dsphint=%u 7fff=%04x scratch_status=%04x" " acked=%04x", (IO_INTC_IRQ0 >> IRQ_DSPHINT) & 1, DSP_(0x7fff), DSP_(_status), DSP_(_acked)); @@ -63,8 +58,26 @@ B(buffer2, hpib_stat, 8, HOLDA); B(buffer2, hpib_stat, 12, DXF); - DEBUGF("dsp_status(): hpib: ctl=%s stat=%s", buffer1, buffer2); + DEBUGF("hpib: ctl=%s stat=%s", buffer1, buffer2); #undef B + DEBUGF("scratch_status=%04x" + " acked=%04x", + DSP_(_status), + DSP_(_acked)); + DSP_(_status) = 0x01; + hpib_ctl = DSP_(_acked); + while(DSP_(_acked) == hpib_ctl) + DEBUGF("scratch_status=%04x" + " acked=%04x", + DSP_(_status), + DSP_(_acked)); + DSP_(_status) = 0x02; + hpib_ctl = DSP_(_acked); + while(DSP_(_acked) == hpib_ctl); + DEBUGF("scratch_status=%04x" + " acked=%04x", + DSP_(_status), + DSP_(_acked)); } #endif @@ -72,10 +85,10 @@ { DSP_(0x7fff) = 0xdead; - IO_DSPC_HPIB_CONTROL &= ~(1 << 8); + IO_DSPC_HPIB_CONTROL &= ~HPIB_CTL_DRST; /* HPIB bus cycles will lock up the ARM in here. Don't touch DSP RAM. */ nop; nop; - IO_DSPC_HPIB_CONTROL |= 1 << 8; + IO_DSPC_HPIB_CONTROL |= HPIB_CTL_DRST; /* TODO: Timeout. */ while (DSP_(0x7fff) != 0); @@ -89,9 +102,9 @@ /* The first time you INT0 the DSP, the ROM loader will branch to your RST handler. Subsequent times, your INT0 handler will get executed. */ - IO_DSPC_HPIB_CONTROL &= ~(1 << 7); + IO_DSPC_HPIB_CONTROL &= ~HPIB_CTL_DINT0; nop; nop; - IO_DSPC_HPIB_CONTROL |= 1 << 7; + IO_DSPC_HPIB_CONTROL |= HPIB_CTL_DINT0; restore_irq(old_level); } @@ -127,13 +140,16 @@ void dsp_init(void) { - IO_INTC_IRQ0 = 1 << 11; - IO_INTC_EINT0 |= 1 << 11; + IO_INTC_IRQ0 = INTR_IRQ0_IMGBUF; + IO_INTC_EINT0 |= INTR_EINT0_IMGBUF; - IO_DSPC_HPIB_CONTROL = 1 << 10 | 1 << 9 | 1 << 8 | 1 << 7 | 1 << 3 | 1 << 0; + IO_CLK_MOD0 |= CLK_MOD0_DSP | CLK_MOD0_HPIB; + + IO_DSPC_HPIB_CONTROL = HPIB_CTL_DBIO | HPIB_CTL_DHOLD | HPIB_CTL_DRST | HPIB_CTL_DINT0 | HPIB_CTL_HPNMI | HPIB_CTL_HPIEN; dsp_reset(); dsp_load(dsp_image_helloworld); + dsp_wake(); } void DSPHINT(void) @@ -141,7 +157,7 @@ unsigned int i; char buffer[80]; - IO_INTC_IRQ0 = 1 << 11; + IO_INTC_IRQ0 = INTR_IRQ0_IMGBUF; /* DSP stores one character per word. */ for (i = 0; i < sizeof(buffer); i++) { Index: firmware/target/arm/tms320dm320/debug-dm320.c =================================================================== --- firmware/target/arm/tms320dm320/debug-dm320.c (revision 17054) +++ firmware/target/arm/tms320dm320/debug-dm320.c (working copy) @@ -8,6 +8,7 @@ * $Id$ * * Copyright (C) 2007 by Karl Kurbjun + * Copyright (C) 2008 by Maurus Cuelenaere * * 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. @@ -33,12 +34,17 @@ return false; } +#ifndef CREATIVE_ZVM extern char r_buffer[5]; extern int r_button; +#endif bool __dbg_hw_info(void) { - int line = 0, button, oldline; + int line = 0, oldline; +#ifndef CREATIVE_ZVM + int button; int *address=0x0; +#endif bool done=false; char buf[100]; @@ -58,12 +64,25 @@ IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf); + + lcd_puts(0, line++, "Board revision:"); + switch (IO_BUSC_REVR) { + case 0x0010: + lcd_puts(0, line++, "DM320 Rev. A"); + break; + case 0x0011: + lcd_puts(0, line++, "DM320 Rev. B/C"); + break; + default: + lcd_puts(0, line++, "Unknown DM320 Chip ID"); + } line++; oldline=line; while(!done) { line = oldline; +#ifndef CREATIVE_ZVM button = button_get(false); button&=~BUTTON_REPEAT; if (button == BUTTON_POWER) @@ -81,14 +100,17 @@ r_buffer[0], r_buffer[1], r_buffer[2], r_buffer[3],r_buffer[4] ); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "Button: 0x%08x, HWread: 0x%08x", (unsigned int)button, r_button); lcd_puts(0, line++, buf); +#endif snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); +#ifndef CREATIVE_ZVM snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)address, *address); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); +#endif lcd_update(); } Index: firmware/target/arm/tms320dm320/system-target.h =================================================================== --- firmware/target/arm/tms320dm320/system-target.h (revision 17054) +++ firmware/target/arm/tms320dm320/system-target.h (working copy) @@ -26,4 +26,6 @@ #define CPUFREQ_NORMAL 30000000 #define CPUFREQ_MAX 80000000 +#define UNCACHED_ADDR(a) a + #endif /* SYSTEM_TARGET_H */ Index: firmware/target/arm/tms320dm320/spi-dm320.c =================================================================== --- firmware/target/arm/tms320dm320/spi-dm320.c (revision 17054) +++ firmware/target/arm/tms320dm320/spi-dm320.c (working copy) @@ -31,6 +31,7 @@ #define GIO_TS_ENABLE (1<<2) #define GIO_RTC_ENABLE (1<<12) #define GIO_BL_ENABLE (1<<13) +#define GIO_LCD_ENABLE (1<<5) struct mutex spi_mtx; @@ -42,9 +43,12 @@ #define reg(a) ((volatile unsigned short *)(PHY_IO_BASE+a)) struct SPI_info spi_targets[] = { +#ifndef CREATIVE_ZVM [SPI_target_TSC2100] = { &IO_GIO_BITCLR1, &IO_GIO_BITSET1, GIO_TS_ENABLE }, - [SPI_target_RX5X348AB] = { &IO_GIO_BITSET0, &IO_GIO_BITCLR0, GIO_RTC_ENABLE }, + [SPI_target_RX5X348AB] = { &IO_GIO_BITSET0, &IO_GIO_BITCLR0, GIO_RTC_ENABLE}, [SPI_target_BACKLIGHT] = { &IO_GIO_BITCLR1, &IO_GIO_BITSET1, GIO_BL_ENABLE }, +#endif + [SPI_target_LTV250QV] = { &IO_GIO_BITCLR2, &IO_GIO_BITSET2, GIO_LCD_ENABLE}, }; static void spi_disable_all_targets(void) @@ -98,11 +102,12 @@ IO_SERIAL0_MODE |= 1<<10; /* Enable TX */ IO_SERIAL0_TX_ENABLE = 0x0001; - +#ifndef CREATIVE_ZVM /* Set GIO 18 to output for touch screen slave enable */ IO_GIO_DIR1 &= ~GIO_TS_ENABLE; /* Set GIO 12 to output for rtc slave enable */ IO_GIO_DIR0 &= ~GIO_RTC_ENABLE; - +#endif spi_disable_all_targets(); /* make sure only one is ever enabled at a time */ + } Index: firmware/target/arm/tms320dm320/dsp-target.h =================================================================== --- firmware/target/arm/tms320dm320/dsp-target.h (revision 17054) +++ firmware/target/arm/tms320dm320/dsp-target.h (working copy) @@ -23,6 +23,21 @@ /* DSP memory is mapped into ARM space via HPIB. */ #define DSP_(addr) (*(volatile unsigned short *)(0x40000 + ((addr) << 1))) +/* A "DSP image" is an array of these, terminated by raw_data_size_half = 0. */ +struct dsp_section { + const unsigned short *raw_data; + unsigned short physical_addr; + unsigned short raw_data_size_half; +}; + +#define HPIB_CTL_DBIO (1 << 10) +#define HPIB_CTL_DHOLD (1 << 9) +#define HPIB_CTL_DRST (1 << 8) +#define HPIB_CTL_DINT0 (1 << 7) +#define HPIB_CTL_EXCHG (1 << 5) +#define HPIB_CTL_HPNMI (1 << 3) +#define HPIB_CTL_HPIEN (1 << 0) + void dsp_init(void); void dsp_wake(void); Index: firmware/target/arm/tms320dm320/spi-target.h =================================================================== --- firmware/target/arm/tms320dm320/spi-target.h (revision 17054) +++ firmware/target/arm/tms320dm320/spi-target.h (working copy) @@ -27,6 +27,7 @@ SPI_target_TSC2100 = 0, SPI_target_RX5X348AB, SPI_target_BACKLIGHT, + SPI_target_LTV250QV, SPI_MAX_TARGETS, }; Index: firmware/target/arm/tms320dm320/dsp_image_helloworld.h =================================================================== --- firmware/target/arm/tms320dm320/dsp_image_helloworld.h (revision 17054) +++ firmware/target/arm/tms320dm320/dsp_image_helloworld.h (working copy) @@ -19,13 +19,20 @@ * MA 02111-1307 USA * */ +static const unsigned short helloworld_data[] = { +0x4A11, 0x7711, 0x0200, 0x7681, 0xDEAD, 0x6081, 0xDEAD, 0xF820, 0x0021, 0x6081, 0xDEAD, 0xF830, 0x0009, 0xF073, 0x0021, 0x7711, +0x0300, 0xF273, 0x0001, 0x7681, 0x0001, 0x7711, 0x0300, 0xF273, 0x0001, 0x7681, 0x0002, 0x7711, 0x0300, 0xF273, 0x0001, 0x7681, +0x00FF, 0x1181, 0x7711, 0x0001, 0x10F8, 0x000B, 0x08F8, 0x0011, 0xF845, 0x000F, 0x7711, 0x0002, 0x10F8, 0x000B, 0x08F8, 0x0011, +0xF845, 0x0015, 0xF073, 0x001B +}; static const struct dsp_section dsp_image_helloworld[] = { - {NULL, 0, 0} + {helloworld_data, 0x07F80, sizeof(helloworld_data)/sizeof(unsigned short)}, + {NULL, 0, 0} }; /* Symbol table, usable with the DSP_() macro (see dsp-target.h). */ -#define _status 0x0000 -#define _acked 0x0000 +#define _status 0x0200 +#define _acked 0x0300 #endif Index: firmware/target/arm/tms320dm320/crt0.S =================================================================== --- firmware/target/arm/tms320dm320/crt0.S (revision 17054) +++ firmware/target/arm/tms320dm320/crt0.S (working copy) @@ -159,7 +159,7 @@ and r4, pc, r2 /* Copy bootloader to safe area - 0x01900000 */ - mov r5, #0x01900000 + mov r5, #0x1900000 ldr r6, = _dataend sub r0, r6, r5 /* length of loader */ add r0, r4, r0 /* r0 points to start of loader */ Index: firmware/thread.c =================================================================== --- firmware/thread.c (revision 17054) +++ firmware/thread.c (working copy) @@ -820,6 +820,16 @@ ); enable_irq(); } +#elif CONFIG_CPU == DM320 +static inline void core_sleep(void) +{ + asm volatile ( + "mov r0, #0 \n" + "mcr p15, 0, r0, c7, c0, 4 \n" /* Wait for interrupt */ + : : : "r0" + ); + enable_irq(); +} #else static inline void core_sleep(void) { @@ -2036,7 +2046,10 @@ cores[core].running = thread; } #endif /* HAVE_PRIORITY_SCHEDULING */ - +#ifdef DEBUG + lcd_putsxy(280, 0, thread->name); + lcd_update(); +#endif RTR_UNLOCK(core); enable_irq(); break; Index: firmware/timer.c =================================================================== --- firmware/timer.c (revision 17054) +++ firmware/timer.c (working copy) @@ -313,7 +313,7 @@ #elif CONFIG_CPU == PNX0101 TIMER1.ctrl &= ~0x80; /* disable timer 1 */ irq_disable_int(IRQ_TIMER1); -#elif CONFIG_CPU == S3C2440 +#else __TIMER_UNREGISTER(); #endif pfn_timer = NULL; Index: firmware/usb.c =================================================================== --- firmware/usb.c (revision 17054) +++ firmware/usb.c (working copy) @@ -65,11 +65,11 @@ /* FIXME: The extra 0x800 is consumed by fat_mount() when the fsinfo needs updating */ -#ifndef BOOTLOADER +//#ifndef BOOTLOADER static long usb_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)]; static const char usb_thread_name[] = "usb"; static struct thread_entry *usb_thread_entry; -#endif +//#endif static struct event_queue usb_queue; static int last_usb_status; static bool usb_monitor_enabled; @@ -86,7 +86,7 @@ -#ifndef BOOTLOADER +//#ifndef BOOTLOADER #ifndef HAVE_USBSTACK static void usb_slave_mode(bool on) { @@ -174,7 +174,7 @@ break; #endif case USB_INSERTED: -#ifdef HAVE_LCD_BITMAP +#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER) if(do_screendump_instead_of_usb) { screen_dump(); @@ -368,16 +368,16 @@ } } } -#endif +//#endif /* BOOTLOADER */ #ifdef HAVE_USBSTACK void usb_signal_transfer_completion(struct usb_transfer_completion_event_data* event_data) { queue_post(&usb_queue, USB_TRANSFER_COMPLETION, (intptr_t)event_data); } -#endif +#endif -#ifndef BOOTLOADER +//#ifndef BOOTLOADER static void usb_tick(void) { int current_status; @@ -438,7 +438,7 @@ } #endif } -#endif +//#endif /* BOOTLOADER */ void usb_acknowledge(long id) { @@ -468,7 +468,7 @@ /* We assume that the USB cable is extracted */ last_usb_status = USB_EXTRACTED; -#ifndef BOOTLOADER +//#ifndef BOOTLOADER queue_init(&usb_queue, true); usb_thread_entry = create_thread(usb_thread, usb_stack, @@ -476,7 +476,7 @@ IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU)); tick_add_task(usb_tick); -#endif +//#endif }