From 41c497025f40615373817498606fabd0fcd41dd6 Mon Sep 17 00:00:00 2001 From: Dominik Wenger Date: Mon, 19 Oct 2009 18:14:27 +0000 Subject: [PATCH] Initial mini2440 port. Flyspray: FS#10627 Author: Bob Cousins git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23265 a1c6a512-1295-4272-9138-f99709370657 --- bootloader/SOURCES | 3 + bootloader/mini2440.c | 145 +++++++++ docs/CREDITS | 1 + firmware/SOURCES | 35 ++- firmware/export/config-mini2440.h | 150 +++++++++ firmware/export/config.h | 10 +- firmware/export/s3c2440.h | 57 +++- firmware/target/arm/s3c2440/crt0.S | 291 +++++++++++------- firmware/target/arm/s3c2440/debug-target.h | 5 + .../arm/s3c2440/gigabeat-fx/lcd-target.h | 22 ++ .../kernel-meg-fx.c => kernel-s3c2440.c} | 0 .../lcd-meg-fx.c => lcd-s3c2440.c} | 88 ++++-- .../target/arm/s3c2440/mini2440/adc-target.h | 42 +++ .../arm/s3c2440/mini2440/backlight-mini2440.c | 151 +++++++++ .../arm/s3c2440/mini2440/backlight-target.h | 31 ++ .../arm/s3c2440/mini2440/button-mini2440.c | 80 +++++ .../arm/s3c2440/mini2440/button-target.h | 70 +++++ .../target/arm/s3c2440/mini2440/lcd-target.h | 43 +++ .../arm/s3c2440/mini2440/led-mini2440.c | 66 ++++ .../arm/s3c2440/mini2440/led-mini2440.h | 46 +++ .../arm/s3c2440/mini2440/power-mini2440.c | 55 ++++ .../system-meg-fx.c => system-s3c2440.c} | 8 +- .../s3c2440/{gigabeat-fx => }/system-target.h | 114 ++++--- tools/configure | 24 +- 24 files changed, 1353 insertions(+), 184 deletions(-) create mode 100644 bootloader/mini2440.c create mode 100644 firmware/export/config-mini2440.h rename firmware/target/arm/s3c2440/{gigabeat-fx/kernel-meg-fx.c => kernel-s3c2440.c} (100%) rename firmware/target/arm/s3c2440/{gigabeat-fx/lcd-meg-fx.c => lcd-s3c2440.c} (90%) create mode 100644 firmware/target/arm/s3c2440/mini2440/adc-target.h create mode 100644 firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c create mode 100644 firmware/target/arm/s3c2440/mini2440/backlight-target.h create mode 100644 firmware/target/arm/s3c2440/mini2440/button-mini2440.c create mode 100644 firmware/target/arm/s3c2440/mini2440/button-target.h create mode 100644 firmware/target/arm/s3c2440/mini2440/lcd-target.h create mode 100644 firmware/target/arm/s3c2440/mini2440/led-mini2440.c create mode 100644 firmware/target/arm/s3c2440/mini2440/led-mini2440.h create mode 100644 firmware/target/arm/s3c2440/mini2440/power-mini2440.c rename firmware/target/arm/s3c2440/{gigabeat-fx/system-meg-fx.c => system-s3c2440.c} (97%) rename firmware/target/arm/s3c2440/{gigabeat-fx => }/system-target.h (66%) diff --git a/bootloader/SOURCES b/bootloader/SOURCES index a512064ffd..de902e2a4b 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES @@ -57,4 +57,7 @@ show_logo.c #elif defined(LYRE_PROTO1) lyre_proto1.c show_logo.c +#elif defined(MINI2440) +mini2440.c +show_logo.c #endif diff --git a/bootloader/mini2440.c b/bootloader/mini2440.c new file mode 100644 index 0000000000..c17f386b5b --- /dev/null +++ b/bootloader/mini2440.c @@ -0,0 +1,145 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * + * Copyright (C) 2009 by Bob Cousins, Lyre Project + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* Include Standard files */ +#include +#include +#include "inttypes.h" +#include "string.h" +#include "cpu.h" +#include "system.h" +#include "lcd.h" +#include "kernel.h" +#include "thread.h" +#include "storage.h" +#include "fat.h" +#include "disk.h" +#include "font.h" +#include "backlight.h" +#include "button.h" +#include "panic.h" +#include "power.h" +#include "file.h" +#include "common.h" +#include "sd.h" +#include "backlight-target.h" +#include "lcd-target.h" +#include "debug-target.h" +#if 0 +#include "dma-target.h" +#include "uart-s3c2440.h" +#endif +#include "led-mini2440.h" + +/* Show the Rockbox logo - in show_logo.c */ +extern int show_logo(void); + + +int main(void) +{ +#if 0 + /* required later */ + unsigned char* loadbuffer; + int buffer_size; + int rc; + int(*kernel_entry)(void); +#endif + int start, elapsed; + + led_init(); + clear_leds(LED_ALL); + /* NB: something in system_init() prevents H-JTAG from downloading */ +/* system_init(); */ + kernel_init(); +/* enable_interrupt(IRQ_FIQ_STATUS); */ + backlight_init(); + lcd_init(); + lcd_setfont(FONT_SYSFIXED); + button_init(); +#if 0 + dma_init(); + uart_init_device(UART_DEBUG); +#endif +/* mini2440_test(); */ + +#if 1 + show_logo(); + /* pause here for now */ + led_flash(LED1|LED4, LED2|LED3); +#endif + + +#if 0 + /* TODO */ + + /* Show debug messages if button is pressed */ + if(button_read_device() & BUTTON_MENU) + verbose = true; + + printf("Rockbox boot loader"); + printf("Version %s", APPSVERSION); + + rc = storage_init(); + if(rc) + { + reset_screen(); + error(EATA, rc); + } + + disk_init(IF_MD(0)); + rc = disk_mount_all(); + if (rc<=0) + { + error(EDISK,rc); + } + + printf("Loading firmware"); + + /* Flush out anything pending first */ + cpucache_invalidate(); + + loadbuffer = (unsigned char*) 0x31000000; + buffer_size = (unsigned char*)0x31400000 - loadbuffer; + + rc = load_firmware(loadbuffer, BOOTFILE, buffer_size); + if(rc < 0) + error(EBOOTFILE, rc); + + printf("Loaded firmware %d\n", rc); + +/* storage_close(); */ + system_prepare_fw_start(); + + if (rc == EOK) + { + uart_printf ("entering kernel\n"); + cpucache_invalidate(); + kernel_entry = (void*) loadbuffer; + rc = kernel_entry(); + } + + uart_printf ("stopping %d\n", rc); +#endif + + /* end stop - should not get here */ + led_flash(LED_ALL, LED_NONE); + while (1); /* avoid warning */ +} diff --git a/docs/CREDITS b/docs/CREDITS index 093ee194eb..4555877bc2 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -499,6 +499,7 @@ Michael Sparmann Seth Opgenorth Jonas Aaberg Junio C Hamano +Bob Cousins The libmad team The wavpack team diff --git a/firmware/SOURCES b/firmware/SOURCES index e31231c9ec..b91d49b7f7 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -274,6 +274,8 @@ drivers/audio/tlv320.c drivers/audio/mas35xx.c #elif defined(HAVE_AK4537) drivers/audio/ak4537.c +#elif defined(HAVE_UDA1341) +drivers/audio/uda1341.c #endif /* defined(HAVE_*) */ #endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */ @@ -808,15 +810,15 @@ target/arm/usb-fw-pp502x.c target/arm/lcd-as-memframe.S target/arm/mmu-arm.S target/arm/s3c2440/debug-s3c2440.c +target/arm/s3c2440/kernel-s3c2440.c +target/arm/s3c2440/lcd-s3c2440.c +target/arm/s3c2440/system-s3c2440.c target/arm/s3c2440/gigabeat-fx/adc-meg-fx.c target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c target/arm/s3c2440/gigabeat-fx/button-meg-fx.c -target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c -target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c target/arm/s3c2440/gigabeat-fx/power-meg-fx.c target/arm/s3c2440/gigabeat-fx/sc606-meg-fx.c -target/arm/s3c2440/gigabeat-fx/system-meg-fx.c target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c #ifndef BOOTLOADER target/arm/s3c2440/gigabeat-fx/i2c-meg-fx.c @@ -1392,6 +1394,33 @@ target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c #endif #endif /* SIMULATOR */ +#if defined(MINI2440) +#ifndef SIMULATOR +target/arm/lcd-as-memframe.S +target/arm/mmu-arm.S +target/arm/s3c2440/debug-s3c2440.c +target/arm/s3c2440/kernel-s3c2440.c +target/arm/s3c2440/lcd-s3c2440.c +target/arm/s3c2440/system-s3c2440.c +target/arm/s3c2440/mini2440/backlight-mini2440.c +target/arm/s3c2440/mini2440/button-mini2440.c +target/arm/s3c2440/mini2440/led-mini2440.c +target/arm/s3c2440/mini2440/power-mini2440.c +#ifdef BOOTLOADER +/*target/arm/s3c2440/mini2440/mini2440_test.c*/ +#endif +#ifndef BOOTLOADER +target/arm/s3c2440/mini2440/adc-mini2440.c +target/arm/s3c2440/mini2440/i2c-mini2440.c +target/arm/s3c2440/mini2440/pcm-mini2440.c +target/arm/s3c2440/mini2440/powermgmt-mini2440.c +target/arm/s3c2440/mini2440/power-mini2440.c +target/arm/s3c2440/mini2440/timer-mini2440.c +target/arm/s3c2440/mini2440/usb-mini2440.c +#endif +#endif /* SIMULATOR */ +#endif /* MINI2440 */ + #ifdef SAMSUNG_YH820 #ifndef SIMULATOR target/arm/ata-as-arm.S diff --git a/firmware/export/config-mini2440.h b/firmware/export/config-mini2440.h new file mode 100644 index 0000000000..0db027c7a0 --- /dev/null +++ b/firmware/export/config-mini2440.h @@ -0,0 +1,150 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2009 by Bob Cousins, Lyre Project + * Copyright (C) 2009 by Jorge Pinto, Lyre Project + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* + * This config file is for the Mini2440 + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 131 +#define MODEL_NAME "Mini2440" + +/***************************************************************************/ +/* Hardware Config */ + +/* TODO: ??? */ +#define CONFIG_SDRAM_START 0x30000000 + +/* Flash storage */ +#define HAVE_FLASH_STORAGE +/* define the storage type */ +#define CONFIG_STORAGE STORAGE_SD + +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 +#define HAVE_HOTSWAP + +/* Disk storage */ +/* define this if you have a disk storage, i.e. something + that needs spinups and can cause skips when shaked */ +/* #define HAVE_DISK_STORAGE */ + +/* Display */ +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR +/* The LCD is assumed to be 3.5" TFT touch screen, others are possible */ +#define CONFIG_LCD LCD_MINI2440 +/* LCD dimensions */ +#define LCD_WIDTH 240 +#define LCD_HEIGHT 320 +/* The LCD is configured for RGB565 */ +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ +/* Define this for LCD backlight available */ +/* The Mini2440 supports backight brightness depending on LCD type */ +/* But the 3.5" LCD touch screen does not support brightness*/ +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS + +/* Keypad */ +#define CONFIG_KEYPAD MINI2440_PAD + +/* I2C */ +/* Do not use I2C */ +#define CONFIG_I2C I2C_NONE + +/* Define DAC/Codec */ +/*#define HAVE_UDA1341*/ +#define HAVE_TLV320 +/* ... tone controls, use the software ones */ +#define HAVE_SW_TONE_CONTROLS + +/* Battery */ +#define BATTERY_CAPACITY_DEFAULT 1100 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 100 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +/* USB */ +/* TODO:#define HAVE_USBSTACK */ + +/***************************************************************************/ +/* Application Config */ + +#define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING +/* define this to enable JPEG decoding */ +#define HAVE_JPEG +/* RMC TODO: what is this for?? */ +/* define this if you have access to the pitchscreen */ +#define HAVE_PITCHSCREEN + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x100000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x100000 + + +/***************************************************************************/ +#ifndef SIMULATOR + +#define CONFIG_CPU S3C2440 + +/* Define this to the CPU frequency */ +#define CPU_FREQ 405000000 +#define MCK_FREQ (CPU_FREQ/4) +#define SLOW_CLOCK 32768 + +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 /* 0.5 mA */ +#define MAX_BRIGHTNESS_SETTING 12 /* 32 mA */ +#define DEFAULT_BRIGHTNESS_SETTING 10 /* 16 mA */ +/* Define this if your LCD can set contrast */ +#define HAVE_LCD_CONTRAST +#define MIN_CONTRAST_SETTING 0 +#define MAX_CONTRAST_SETTING 63 +#define DEFAULT_CONTRAST_SETTING 47 /* Match boot contrast */ + +/* Hardware controlled charging with monitoring */ +#define CONFIG_CHARGING CHARGING_MONITOR +/*#define POWER_INPUT_BATTERY 0*/ + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 0 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 8 + +#define BOOTFILE_EXT "mini2440" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#define BOOTDIR "/.rockbox" + +#endif +/***************************************************************************/ diff --git a/firmware/export/config.h b/firmware/export/config.h index 70e2c792d0..8a1adeaac8 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -112,6 +112,7 @@ #define SAMSUNG_YH_PAD 38 #define ONDAVX777_PAD 39 #define SAMSUNG_YPS3_PAD 40 +#define MINI2440_PAD 41 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -192,10 +193,11 @@ #define LCD_ONDAVX767 30 /* as used by the Onda VX767 */ #define LCD_SSD1303 31 /* as used by the Sansa Clip */ #define LCD_FUZE 32 /* as used by the Sansa Fuze */ -#define LCD_LYRE_PROTO1 33 /* as used by the Lyre */ +#define LCD_LYRE_PROTO1 33 /* as used by the Lyre prototype 1 */ #define LCD_YH925 34 /* as used by Samsung YH-925 (similar to the H10 20GB) */ -#define LCD_VIEW 35 /* as used by the Sansa View */ +#define LCD_VIEW 35 /* as used by the Sansa View */ #define LCD_NANO2G 36 /* as used by the iPod Nano 2nd Generation */ +#define LCD_MINI2440 37 /* as used by the Mini2440 */ /* LCD_PIXELFORMAT */ #define HORIZONTAL_PACKING 1 @@ -216,7 +218,7 @@ /* CONFIG_I2C */ #define I2C_NONE 0 /* For targets that do not use I2C - as the -Lyre prototype 1*/ +Lyre prototype 1 */ #define I2C_PLAYREC 1 /* Archos Player/Recorder style */ #define I2C_ONDIO 2 /* Ondio style */ #define I2C_COLDFIRE 3 /* Coldfire style */ @@ -386,6 +388,8 @@ Lyre prototype 1*/ #include "config-view.h" #elif defined(LYRE_PROTO1) #include "config-lyre_proto1.h" +#elif defined(MINI2440) +#include "config-mini2440.h" #elif defined(SAMSUNG_YH820) #include "config-yh820.h" #elif defined(SAMSUNG_YH920) diff --git a/firmware/export/s3c2440.h b/firmware/export/s3c2440.h index 0589f3b6b0..5f595214a1 100644 --- a/firmware/export/s3c2440.h +++ b/firmware/export/s3c2440.h @@ -178,6 +178,41 @@ #define DCDST3 (*(volatile unsigned long *)0x4B0000DC) /* DMA 3 current destination */ #define DMASKTRIG3 (*(volatile unsigned long *)0x4B0000E0) /* DMA 3 mask trigger */ +#define DISRCC_LOC_AHB (0 << 1) +#define DISRCC_LOC_APB (1 << 1) +#define DISRCC_INC_AUTO (0 << 0) +#define DISRCC_INC_FIXED (1 << 0) + +#define DIDSTC_CHK_INT_TC_ZERO (0 << 2) +#define DIDSTC_CHK_INT_AFTER_RELOAD (1 << 2) +#define DIDSTC_LOC_AHB (0 << 1) +#define DIDSTC_LOC_APB (1 << 1) +#define DIDSTC_INC_AUTO (0 << 0) +#define DIDSTC_INC_FIXED (1 << 0) + +#define DCON_DMD_HS (1 << 31) +#define DCON_SYNC_APB (0 << 30) +#define DCON_SYNC_AHB (1 << 30) +#define DCON_INT (1 << 29) +#define DCON_TSZ (1 << 28) +#define DCON_SERVMODE_WHOLE (1 << 27) +#define DCON_HWSRCSEL (1 << 24) +#define DCON_HW_SEL (1 << 23) +#define DCON_NO_RELOAD (1 << 22) +#define DCON_DSZ_MASK (3 << 20) +#define DCON_DSZ_BYTE (0 << 20) +#define DCON_DSZ_HALF_WORD (1 << 20) +#define DCON_DSZ_WORD (2 << 20) +#define DCON_TC (1 << 0) + +#define DSTAT_STAT_BUSY (1 << 20) +#define DSTAT_CURR_TC (1 << 0) + +#define DMASKTRIG_STOP (1 << 2) +#define DMASKTRIG_ON (1 << 1) +#define DMASKTRIG_SW_TRIG (1 << 0) + + /* Clock & Power Management */ #define LOCKTIME (*(volatile unsigned long *)0x4C000000) /* PLL lock time counter */ @@ -499,7 +534,14 @@ #define SDIDSTA (*(volatile unsigned long *)0x5A000034) /* SDI data status */ #define SDIFSTA (*(volatile unsigned long *)0x5A000038) /* SDI FIFO status */ #define SDIIMSK (*(volatile unsigned long *)0x5A00003C) /* SDI interrupt mask */ -#define SDIDAT (*(volatile unsigned char *)0x5A000040) /* SDI data */ + +/* SDI data - LE = Little Endian, BE = Big Endian */ +#define SDIDAT_LLE (*(volatile unsigned long *)0x5A000040) /* 32 bit */ +#define SDIDAT_HLE (*(volatile unsigned short *)0x5A000044) /* 16 */ +#define SDIDAT_BLE (*(volatile unsigned char *)0x5A000048) /* 8 */ +#define SDIDAT_LBE (*(volatile unsigned long *)0x5A00004C) /* 32 */ +#define SDIDAT_HBE (*(volatile unsigned short *)0x5A000041) /* 16 */ +#define SDIDAT_BBE (*(volatile unsigned char *)0x5A000043) /* 8 */ /* AC97 Audio-CODEC Interface */ @@ -530,5 +572,18 @@ #define TIMER_FREQ (49156800/2) #define TIMER234_PRESCALE 21 +/* I/O Port macros */ + +#define GPIO_INPUT 0 +#define GPIO_OUTPUT 1 +#define GPIO_FUNCTION 2 +#define GPIO_ALT_FUNCTION 3 + +#define GPIO_PULLUP_DISABLE 1 +#define GPIO_PULLUP_ENABLE 0 + +#define S3C2440_GPIO_CONFIG(port,pin,function) port = ( (port & ~(3<<(pin*2)) ) | (function<<(pin*2)) ) +#define S3C2440_GPIO_PULLUP(port,pin,state) port = ( (port & ~(1<fg_pattern) ); } +#endif void lcd_yuv_set_options(unsigned options) { diff --git a/firmware/target/arm/s3c2440/mini2440/adc-target.h b/firmware/target/arm/s3c2440/mini2440/adc-target.h new file mode 100644 index 0000000000..24e878e735 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/adc-target.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _ADC_TARGET_H_ +#define _ADC_TARGET_H_ + +/* Channel 0 is connected to an on board pot for testing + Channels 0-3 are available via expansion connector CON4 + Channels 4-7 are routed to LCD connector for touchscreen operation if + supported by display panel. +*/ +#define NUM_ADC_CHANNELS 8 + +#define ADC_ONBOARD 0 +#define ADC_SPARE_1 1 +#define ADC_SPARE_2 2 +#define ADC_SPARE_3 3 +#define ADC_TSYM 4 +#define ADC_TSYP 5 +#define ADC_TSXM 6 +#define ADC_TSXP 7 + +#define ADC_READ_ERROR 0xFFFF + +#endif diff --git a/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c b/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c new file mode 100644 index 0000000000..88c0b5ce2c --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c @@ -0,0 +1,151 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 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 "backlight-target.h" +#include "backlight.h" +#include "lcd.h" +#include "power.h" + + +/* Dummy value at index 0, 1-12 used. */ +static const unsigned char log_brightness[13] = + {0,0,1,2,3,5,7,10,15,22,31,44,63}; + + +static enum backlight_states +{ + BACKLIGHT_CONTROL_IDLE, + BACKLIGHT_CONTROL_OFF, + BACKLIGHT_CONTROL_ON, + BACKLIGHT_CONTROL_SET, + BACKLIGHT_CONTROL_FADE +} backlight_control; + +static unsigned char _backlight_brightness; +static unsigned char backlight_target; + + +/* Assumes that the backlight has been initialized */ +void _backlight_set_brightness(int brightness) +{ + /* stop the interrupt from messing us up */ + backlight_control = BACKLIGHT_CONTROL_IDLE; + _backlight_brightness = log_brightness[brightness]; + backlight_control = BACKLIGHT_CONTROL_SET; +} + +void _backlight_set_state (unsigned int level) +{ + if (level == 0) + GPGDAT &= ~GPIO_LCD_PWR; + else + GPGDAT |= GPIO_LCD_PWR; +} + +/* led_control_service runs in interrupt context - be brief! + * This service is called once per interrupt timer tick - 100 times a second. + * + * There should be at most only one i2c operation per call - if more are need + * the calls should be spread across calls. + * + * Putting all led servicing in one thread means that we wont step on any + * i2c operations - they are all serialized here in the ISR tick. It also + * insures that we get called at equal timing for good visual effect. + */ +#ifndef BOOTLOADER +static void led_control_service(void) +{ + switch (backlight_control) + { + case BACKLIGHT_CONTROL_IDLE: + backlight_control = BACKLIGHT_CONTROL_IDLE; + break; + case BACKLIGHT_CONTROL_OFF: + _backlight_set_brightness(0); + backlight_control = BACKLIGHT_CONTROL_IDLE; + break; + case BACKLIGHT_CONTROL_ON: + _backlight_set_brightness(255); + backlight_control = BACKLIGHT_CONTROL_IDLE; + break; + case BACKLIGHT_CONTROL_SET: + _backlight_set_brightness(255); + backlight_control = BACKLIGHT_CONTROL_IDLE; + break; + case BACKLIGHT_CONTROL_FADE: + _backlight_set_brightness(0); + backlight_control = BACKLIGHT_CONTROL_IDLE; + break; + default: + backlight_control = BACKLIGHT_CONTROL_IDLE; + break; + } +} +#endif /* BOOTLOADER */ + +static void __backlight_dim(bool dim_now) +{ + /* dont let the interrupt tick happen */ + backlight_control = BACKLIGHT_CONTROL_IDLE; + backlight_target = dim_now ? 0 : _backlight_brightness; + if(backlight_target==0 && _backlight_brightness==0) + { + if(dim_now == false) + backlight_control = BACKLIGHT_CONTROL_ON; + else + backlight_control = BACKLIGHT_CONTROL_OFF; + } + else + backlight_control = BACKLIGHT_CONTROL_FADE; +} + +void _backlight_on(void) +{ +#ifdef HAVE_LCD_ENABLE + lcd_enable(true); /* power on lcd + visible display */ +#endif + __backlight_dim(false); +} + +void _backlight_off(void) +{ + __backlight_dim(true); +} + + +bool _backlight_init(void) +{ + unsigned char brightness = log_brightness[DEFAULT_BRIGHTNESS_SETTING]; + _backlight_brightness = brightness; + + backlight_control = BACKLIGHT_CONTROL_ON; + + _backlight_set_state (1); + S3C2440_GPIO_CONFIG (GPGCON, 4, GPIO_OUTPUT); + +#ifndef BOOTLOADER + /* put the led control on the tick list */ + tick_add_task(led_control_service); +#endif + return true; +} diff --git a/firmware/target/arm/s3c2440/mini2440/backlight-target.h b/firmware/target/arm/s3c2440/mini2440/backlight-target.h new file mode 100644 index 0000000000..c804f16bcc --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/backlight-target.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 by Linus Nielsen Feltzing + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef BACKLIGHT_TARGET_H +#define BACKLIGHT_TARGET_H + +#define GPIO_LCD_PWR (1 << 4) /* GPIO.G4 */ + +bool _backlight_init(void); +void _backlight_on(void); +void _backlight_off(void); +void _backlight_set_brightness(int brightness); + +#endif diff --git a/firmware/target/arm/s3c2440/mini2440/button-mini2440.c b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c new file mode 100644 index 0000000000..787c04d1ef --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c @@ -0,0 +1,80 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 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 "button.h" +#include "kernel.h" + +void button_init_device(void) +{ + /* Configure port directions and enable internal pullups on button inputs */ + + /* These are the standard 6 buttons on the Mini2440 */ + S3C2440_GPIO_CONFIG (GPGCON, 0, GPIO_INPUT); + S3C2440_GPIO_CONFIG (GPGCON, 3, GPIO_INPUT); + S3C2440_GPIO_CONFIG (GPGCON, 5, GPIO_INPUT); + S3C2440_GPIO_CONFIG (GPGCON, 6, GPIO_INPUT); + S3C2440_GPIO_CONFIG (GPGCON, 7, GPIO_INPUT); + S3C2440_GPIO_CONFIG (GPGCON, 11, GPIO_INPUT); + + S3C2440_GPIO_PULLUP (GPGUP, 0, GPIO_PULLUP_ENABLE); + S3C2440_GPIO_PULLUP (GPGUP, 3, GPIO_PULLUP_ENABLE); + S3C2440_GPIO_PULLUP (GPGUP, 5, GPIO_PULLUP_ENABLE); + S3C2440_GPIO_PULLUP (GPGUP, 6, GPIO_PULLUP_ENABLE); + S3C2440_GPIO_PULLUP (GPGUP, 7, GPIO_PULLUP_ENABLE); + S3C2440_GPIO_PULLUP (GPGUP, 11, GPIO_PULLUP_ENABLE); + + /* These are additional buttons on my add on keypad */ + S3C2440_GPIO_CONFIG (GPGCON, 9, GPIO_INPUT); + S3C2440_GPIO_CONFIG (GPGCON, 10, GPIO_INPUT); + S3C2440_GPIO_PULLUP (GPGUP, 9, GPIO_PULLUP_ENABLE); + S3C2440_GPIO_PULLUP (GPGUP, 10, GPIO_PULLUP_ENABLE); + +} + +inline bool button_hold(void) +{ + return 0; +} + +int button_read_device(void) +{ + int btn = BUTTON_NONE; + + /* Read the buttons - active low */ + btn = (GPGDAT & BUTTON_MAIN) ^ BUTTON_MAIN; + + return btn; +} + +void touchpad_set_sensitivity(int level) +{ + (void)level; + /* No touchpad */ +} + +bool headphones_inserted(void) +{ + /* No detect */ + return false; +} diff --git a/firmware/target/arm/s3c2440/mini2440/button-target.h b/firmware/target/arm/s3c2440/mini2440/button-target.h new file mode 100644 index 0000000000..4a84014462 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/button-target.h @@ -0,0 +1,70 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#include +#include "config.h" + + +bool button_hold(void); +void button_init_device(void); +int button_read_device(void); +void touchpad_set_sensitivity(int level); + +/* Mini2440 specific button codes */ + +#define BUTTON_ONE 0x0001 +#define BUTTON_TWO 0x0008 +#define BUTTON_THREE 0x0020 +#define BUTTON_FOUR 0x0040 +#define BUTTON_FIVE 0x0080 +#define BUTTON_SIX 0x0800 + +/* Add on buttons */ +#define BUTTON_SEVEN 0x0200 +#define BUTTON_EIGHT 0x0400 + +#define BUTTON_MENU BUTTON_ONE +#define BUTTON_UP BUTTON_TWO +#define BUTTON_SELECT BUTTON_THREE +#define BUTTON_DOWN BUTTON_FOUR +#define BUTTON_LEFT BUTTON_FIVE +#define BUTTON_RIGHT BUTTON_SIX + +/* Add on buttons */ +#define BUTTON_A BUTTON_SEVEN +#define BUTTON_POWER BUTTON_EIGHT + +/* TODO: bodge to keep keymap-mini2440 happy */ +#define BUTTON_VOL_DOWN 0x4000 +#define BUTTON_VOL_UP 0x8000 + +#define BUTTON_MAIN (BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT | \ + BUTTON_UP |BUTTON_DOWN|BUTTON_SELECT | \ + BUTTON_A |BUTTON_POWER ) + +#define BUTTON_REMOTE 0 + +#define POWEROFF_BUTTON BUTTON_MENU +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/s3c2440/mini2440/lcd-target.h b/firmware/target/arm/s3c2440/mini2440/lcd-target.h new file mode 100644 index 0000000000..b2882e2390 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/lcd-target.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins, Lyre Project + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +extern void lcd_enable(bool state); + +/* Setup for Mini2440, 3.5" TFT LCD Touchscreen */ + +/* Config values for LCDCON1 */ +#define LCD_CLKVAL 4 +#define LCD_MMODE 0 +#define LCD_PNRMODE 3 +#define LCD_BPPMODE 12 +#define LCD_ENVID 1 + +/* Config values for LCDCON2 */ +#define LCD_UPPER_MARGIN 1 +#define LCD_LOWER_MARGIN 4 +#define LCD_VSYNC_LEN 1 + +/* Config values for LCDCON3 */ +#define LCD_RIGHT_MARGIN 0 +#define LCD_LEFT_MARGIN 25 + +/* Config values for LCDCON4 */ +#define LCD_HSYNC_LEN 4 diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.c b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c new file mode 100644 index 0000000000..f541d75273 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c @@ -0,0 +1,66 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" +#include "kernel.h" + +/* LED functions for debug */ + +void led_init (void) +{ + S3C2440_GPIO_CONFIG (GPBCON, 5, GPIO_OUTPUT); + S3C2440_GPIO_CONFIG (GPBCON, 6, GPIO_OUTPUT); + S3C2440_GPIO_CONFIG (GPBCON, 7, GPIO_OUTPUT); + S3C2440_GPIO_CONFIG (GPBCON, 8, GPIO_OUTPUT); + + S3C2440_GPIO_PULLUP (GPBUP, 5, GPIO_PULLUP_DISABLE); + S3C2440_GPIO_PULLUP (GPBUP, 6, GPIO_PULLUP_DISABLE); + S3C2440_GPIO_PULLUP (GPBUP, 7, GPIO_PULLUP_DISABLE); + S3C2440_GPIO_PULLUP (GPBUP, 8, GPIO_PULLUP_DISABLE); +} + +/* Turn on one or more LEDS */ +void set_leds (int led_mask) +{ + GPBDAT &= ~led_mask; +} + +/* Turn off one or more LEDS */ +void clear_leds (int led_mask) +{ + GPBDAT |= led_mask; +} + +/* Alternate flash pattern1 and pattern2 */ +/* Never returns */ +void led_flash (int led_pattern1, int led_pattern2) +{ + while (1) + { + set_leds (led_pattern1); + sleep(HZ/2); + clear_leds (led_pattern1); + + set_leds(led_pattern2); + sleep(HZ/2); + clear_leds (led_pattern2); + } +} diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.h b/firmware/target/arm/s3c2440/mini2440/led-mini2440.h new file mode 100644 index 0000000000..0aaad1c9a4 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _LED_MINI2440_H_ +#define _LED_MINI2440_H_ + +/* LED functions for debug etc */ + +#define LED1 0x0020 /* GPB5 */ +#define LED2 0x0040 /* GPB6 */ +#define LED3 0x0080 /* GPB7 */ +#define LED4 0x0100 /* GPB8 */ + +#define LED_NONE 0x0000 +#define LED_ALL (LED1|LED2|LED3|LED4) + +void led_init (void); + +/* Turn on one or more LEDS */ +void set_leds (int led_mask); + +/* Turn off one or more LEDS */ +void clear_leds (int led_mask); + +/* Alternate flash of pattern1 and pattern2 - never returns */ +void led_flash (int led_pattern1, int led_pattern2); + +#endif /* _LED_MINI2440_H_ */ diff --git a/firmware/target/arm/s3c2440/mini2440/power-mini2440.c b/firmware/target/arm/s3c2440/mini2440/power-mini2440.c new file mode 100644 index 0000000000..d4b00751e0 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/power-mini2440.c @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Bob Cousins + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" +#include +#include +#include "kernel.h" +#include "system.h" +#include "power.h" +#include "led-mini2440.h" + +void power_init(void) +{ + /* Nothing to do */ +} + +unsigned int power_input_status(void) +{ + unsigned int status = 0; + + /* Always on*/ + status = POWER_INPUT_MAIN; + return status; +} + +/* Returns true if the unit is charging the batteries. */ +bool charging_state(void) +{ + return false; +} + +void power_off(void) +{ + /* we don't have any power control, user must do it */ + led_flash (LED_NONE, LED_ALL); + while (1); +} diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c b/firmware/target/arm/s3c2440/system-s3c2440.c similarity index 97% rename from firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c rename to firmware/target/arm/s3c2440/system-s3c2440.c index 79d592091e..6b7609b88b 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c +++ b/firmware/target/arm/s3c2440/system-s3c2440.c @@ -165,6 +165,7 @@ void system_prepare_fw_start(void) void system_init(void) { +#ifdef GIGABEAT_F INTMSK = 0xFFFFFFFF; INTMOD = 0; SRCPND = 0xFFFFFFFF; @@ -192,7 +193,7 @@ void system_init(void) GPGUP |= 0x70; GPHCON |= 0x4005; - GPHDAT |= 0x03; + GPHDAT |= 0x03; /* TODO: do something with PRIORITY */ @@ -208,6 +209,11 @@ void system_init(void) CLKCON &= ~0xFF1ED0; CLKSLOW |= 0x80; +#elif defined(MINI2440) + /* TODO: anything? */ +#else +#error Unknown target +#endif } int system_memory_guard(int newmode) diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h b/firmware/target/arm/s3c2440/system-target.h similarity index 66% rename from firmware/target/arm/s3c2440/gigabeat-fx/system-target.h rename to firmware/target/arm/s3c2440/system-target.h index f310b9ac26..9808d31255 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h +++ b/firmware/target/arm/s3c2440/system-target.h @@ -1,44 +1,70 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 by Greg White - * - * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef SYSTEM_TARGET_H -#define SYSTEM_TARGET_H - -#include "system-arm.h" -#include "mmu-arm.h" - -#define CPUFREQ_DEFAULT 98784000 -#define CPUFREQ_NORMAL 98784000 -#define CPUFREQ_MAX 296352000 - -void system_prepare_fw_start(void); -void tick_stop(void); - -/* Functions to set and clear regiser bits atomically */ - -/* Set and clear register bits */ -void s3c_regmod32(volatile unsigned long *reg, unsigned long bits, - unsigned long mask); -/* Set register bits */ -void s3c_regset32(volatile unsigned long *reg, unsigned long bits); -/* Clear register bits */ -void s3c_regclr32(volatile unsigned long *reg, unsigned long bits); - -#endif /* SYSTEM_TARGET_H */ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 by Greg White + * + * 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 distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef SYSTEM_TARGET_H +#define SYSTEM_TARGET_H + +#include "system-arm.h" +#include "mmu-arm.h" + +/* TODO: Needs checking/porting */ + +#ifdef GIGABEAT_F +#define CPUFREQ_DEFAULT 98784000 +#define CPUFREQ_NORMAL 98784000 +#define CPUFREQ_MAX 296352000 + +#ifdef BOOTLOADER +/* All addresses within rockbox are in IRAM in the bootloader so + are therefore uncached */ +#define UNCACHED_ADDR(a) (a) +#else /* !BOOTLOADER */ +#define UNCACHED_BASE_ADDR 0x30000000 +#define UNCACHED_ADDR(a) ((typeof(a))((unsigned int)(a) | UNCACHED_BASE_ADDR )) +#endif /* BOOTLOADER */ + +#elif defined(MINI2440) + +#define CPUFREQ_DEFAULT 101250000 +#define CPUFREQ_NORMAL 101250000 +#define CPUFREQ_MAX 405000000 + +#define UNCACHED_BASE_ADDR 0x30000000 +#define UNCACHED_ADDR(a) ((typeof(a))((unsigned int)(a) | UNCACHED_BASE_ADDR )) + +#else +#error Unknown target +#endif + + +void system_prepare_fw_start(void); +void tick_stop(void); + +/* Functions to set and clear register bits atomically */ + +/* Set and clear register bits */ +void s3c_regmod32(volatile unsigned long *reg, unsigned long bits, + unsigned long mask); +/* Set register bits */ +void s3c_regset32(volatile unsigned long *reg, unsigned long bits); +/* Clear register bits */ +void s3c_regclr32(volatile unsigned long *reg, unsigned long bits); + +#endif /* SYSTEM_TARGET_H */ diff --git a/tools/configure b/tools/configure index 3e54f818e5..6246c428a6 100755 --- a/tools/configure +++ b/tools/configure @@ -893,7 +893,7 @@ cat <