From eea149bd1399e749a6dae8b3a6fe5ff076ead985 Mon Sep 17 00:00:00 2001 From: Robert Keevil Date: Mon, 13 Jul 2009 21:09:39 +0000 Subject: FS#10436 - add the Sansa View to the build system. The bootloader builds but doesn't do anything useful yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21848 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 3 +- bootloader/SOURCES | 3 +- bootloader/main-pp.c | 6 +- firmware/SOURCES | 19 + firmware/export/config-view.h | 207 ++++++++++ firmware/export/config.h | 11 +- firmware/export/cpu.h | 3 + firmware/export/pp6100.h | 31 ++ firmware/target/arm/sandisk/boot.lds | 5 + firmware/target/arm/sandisk/sansa-view/adc-view.c | 33 ++ .../arm/sandisk/sansa-view/backlight-target.h | 34 ++ .../target/arm/sandisk/sansa-view/backlight-view.c | 50 +++ .../target/arm/sandisk/sansa-view/button-target.h | 62 +++ .../target/arm/sandisk/sansa-view/button-view.c | 37 ++ firmware/target/arm/sandisk/sansa-view/i2c-view.c | 26 ++ firmware/target/arm/sandisk/sansa-view/lcd-view.c | 428 +++++++++++++++++++++ .../target/arm/sandisk/sansa-view/power-view.c | 28 ++ .../target/arm/sandisk/sansa-view/powermgmt-view.c | 55 +++ firmware/target/arm/sandisk/sansa-view/usb-view.c | 36 ++ tools/configure | 40 +- tools/rockboxdev.sh | 2 +- 21 files changed, 1108 insertions(+), 11 deletions(-) create mode 100644 firmware/export/config-view.h create mode 100644 firmware/export/pp6100.h create mode 100644 firmware/target/arm/sandisk/sansa-view/adc-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/backlight-target.h create mode 100644 firmware/target/arm/sandisk/sansa-view/backlight-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/button-target.h create mode 100644 firmware/target/arm/sandisk/sansa-view/button-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/i2c-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/lcd-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/power-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/powermgmt-view.c create mode 100644 firmware/target/arm/sandisk/sansa-view/usb-view.c diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 0e4eab1a44..60594b677c 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1024,7 +1024,8 @@ static bool dbg_spdif(void) # define DEBUG_CANCEL BUTTON_MENU #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ - (CONFIG_KEYPAD == SANSA_C200_PAD) + (CONFIG_KEYPAD == SANSA_C200_PAD) || \ + (CONFIG_KEYPAD == SANSA_FUZE_PAD) # define DEBUG_CANCEL BUTTON_LEFT /* This is temporary until the SA9200 touchpad works */ diff --git a/bootloader/SOURCES b/bootloader/SOURCES index f748403a85..459a1a27bf 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES @@ -11,7 +11,8 @@ gigabeat-s.c defined(SANSA_E200) || defined(SANSA_C200) || \ defined(MROBE_100) || defined(PHILIPS_SA9200) || \ defined(PHILIPS_HDD1630) || defined(SAMSUNG_YH820) || \ - defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) + defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) || \ + defined(SANSA_VIEW) #ifdef E200R_INSTALLER main-e200r-installer.c #elif defined(C240_ERASE) diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c index b79ca30ea4..c213a65121 100644 --- a/bootloader/main-pp.c +++ b/bootloader/main-pp.c @@ -73,6 +73,9 @@ extern int show_logo(void); #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD #define BOOTLOADER_BOOT_OF BUTTON_LEFT +#elif CONFIG_KEYPAD == SANSA_FUZE_PAD +#define BOOTLOADER_BOOT_OF BUTTON_LEFT + #endif /* Maximum allowed firmware image size. 10MB is more than enough */ @@ -447,7 +450,8 @@ void* main(void) int rc; int num_partitions; struct partinfo* pinfo; -#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) +#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \ + || defined (SANSA_VIEW) #if !defined(USE_ROCKBOX_USB) int usb_retry = 0; #endif diff --git a/firmware/SOURCES b/firmware/SOURCES index 0ad0d5ebfe..50c57e3323 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -561,6 +561,25 @@ target/arm/sandisk/audio-c200_e200.c #endif /* SIMULATOR */ #endif /* SANSA_C200 */ +#ifdef SANSA_VIEW +#ifndef SIMULATOR +/* target/arm/ascodec-pp.c */ +target/arm/ata-sd-pp.c +target/arm/lcd-as-memframe.S +target/arm/i2s-pp.c +/* target/arm/usb-fw-pp502x.c */ +target/arm/sandisk/sansa-view/backlight-view.c +target/arm/sandisk/sansa-view/adc-view.c +target/arm/sandisk/sansa-view/power-view.c +target/arm/sandisk/sansa-view/lcd-view.c +target/arm/sandisk/sansa-view/button-view.c +target/arm/sandisk/sansa-view/powermgmt-view.c +#ifndef BOOTLOADER +/* target/arm/sandisk/audio-view.c */ +#endif /* BOOTLOADER */ +#endif /* SIMULATOR */ +#endif /* SANSA_VIEW */ + #ifdef PHILIPS_SA9200 #ifndef SIMULATOR #ifndef BOOTLOADER diff --git a/firmware/export/config-view.h b/firmware/export/config-view.h new file mode 100644 index 0000000000..81706844d2 --- /dev/null +++ b/firmware/export/config-view.h @@ -0,0 +1,207 @@ +/* + * This config file is for the Sandisk Sansa View + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 63 +#define MODEL_NAME "Sandisk View" + +#define HW_SAMPR_CAPS (SAMPR_CAP_44) + +/* define this if you have recording possibility */ +/* #define HAVE_RECORDING */ + +#define REC_SAMPR_CAPS (SAMPR_CAP_22) +#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ +#define REC_SAMPR_DEFAULT SAMPR_22 + +/* Define bitmask of input sources - recordable bitmask can be defined + explicitly if different */ +#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) + +/* 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 + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you have a light associated with the buttons */ +#define HAVE_BUTTON_LIGHT + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you have access to the pitchscreen */ +#define HAVE_PITCHSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +/* LCD dimensions */ +#define LCD_WIDTH 240 +#define LCD_HEIGHT 320 +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565 /* rgb565 */ + +#ifndef BOOTLOADER +/* define this if you have LCD enable function */ +/* #define HAVE_LCD_ENABLE */ + +/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE + should be defined as well. */ +/* #define HAVE_LCD_SLEEP */ +/* #define HAVE_LCD_SLEEP_SETTING */ +#endif + +/* define this if you can flip your LCD */ +#define HAVE_LCD_FLIP + +/* define this if you can invert the colours on your LCD */ +#define HAVE_LCD_INVERT + +/* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ + +/* The only difference is that the power/hold is on the left instead of right on Fuze */ +#define CONFIG_KEYPAD SANSA_FUZE_PAD + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC +/* There is no hardware tone control */ +#define HAVE_SW_TONE_CONTROLS + +/* define this if you have a real-time clock */ +#ifndef BOOTLOADER +/* #define CONFIG_RTC RTC_ */ +#endif + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* Required for MicroSD cards */ +#define HAVE_FAT16SUPPORT + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x100000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +#define AB_REPEAT_ENABLE 1 + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT +/* #define HAVE_BACKLIGHT_BRIGHTNESS */ + +/* define this if the unit uses a scrollwheel for navigation */ +#define HAVE_SCROLLWHEEL +/* define to activate advanced wheel acceleration code */ +#define HAVE_WHEEL_ACCELERATION +/* define from which rotation speed [degree/sec] on the acceleration starts */ +#define WHEEL_ACCEL_START 540 +/* define type of acceleration (1 = ^2, 2 = ^3, 3 = ^4) */ +#define WHEEL_ACCELERATION 1 + +/* define this if you have a flash memory storage */ +#define HAVE_FLASH_STORAGE + +/* define this if the flash memory uses the SecureDigital Memory Card protocol */ +#define CONFIG_STORAGE STORAGE_SD + +#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 0 /* capacity increment */ +#define BATTERY_TYPES_COUNT 1 /* only one type */ + +/* Charging implemented in a target-specific algorithm */ +#define CONFIG_CHARGING CHARGING_SIMPLE +#define HAVE_POWEROFF_WHILE_CHARGING + +/* define current usage levels */ +#define CURRENT_NORMAL 30 /* Toni's measurements in Nov 2008 */ +#define CURRENT_BACKLIGHT 40 /* Screen is about 20, blue LEDs are another 20, so 40 if both */ +#define CURRENT_RECORD 30 /* flash player, so this is just unboosted current*/ + +/* define this if the unit can be powered or charged via USB */ +#define HAVE_USB_POWER + +/** Non-simulator section **/ +#ifndef SIMULATOR + +/* Define this if you have a PortalPlayer PP5024 */ +#define CONFIG_CPU PP6100 + +/* Define this if you want to use the PP5024 i2c interface */ +#define CONFIG_I2C I2C_PP5024 + +/* define this if the hardware can be powered off while charging */ +/* Sansa can't be powered off while charging */ +/* #define HAVE_POWEROFF_WHILE_CHARGING */ + +/* The start address index for ROM builds */ +#define ROM_START 0x00000000 + +/* Define this to the CPU frequency */ +#define CPU_FREQ 250000000 + +/* Type of LCD TODO: hopefully the same as the x5 but check this*/ +#define CONFIG_LCD LCD_VIEW + +/* Offset ( in the firmware file's header ) to the file CRC and data. These are + only used when loading the old format rockbox.e200 file + Required for bootloader/common.c to compile */ +#define FIRMWARE_OFFSET_FILE_CRC 0x0 +#define FIRMWARE_OFFSET_FILE_DATA 0x8 + +#ifndef BOOTLOADER +#define HAVE_MULTIVOLUME +#define HAVE_HOTSWAP +#endif + +/* USB On-the-go */ +/* #define CONFIG_USBOTG USBOTG_ARC */ + +/* enable these for the experimental usb stack */ +#define HAVE_USBSTACK +#define USE_ROCKBOX_USB +#define USB_VENDOR_ID 0x0781 +#define USB_PRODUCT_ID 0x74b1 + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +/* Define this if you have adjustable CPU frequency */ +/* #define HAVE_ADJUSTABLE_CPU_FREQ */ + +#define MI4_FORMAT +#define BOOTFILE_EXT "mi4" +#define BOOTFILE "rockbox." BOOTFILE_EXT +#define BOOTDIR "/.rockbox" + +#define ICODE_ATTR_TREMOR_NOT_MDCT + +#define INCLUDE_TIMEOUT_API + +#endif /* SIMULATOR */ + +/** Port-specific settings **/ + +/* Main LCD backlight brightness range and defaults */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 12 +#define DEFAULT_BRIGHTNESS_SETTING 6 + +/* Default recording levels */ +#define DEFAULT_REC_MIC_GAIN 23 +#define DEFAULT_REC_LEFT_GAIN 23 +#define DEFAULT_REC_RIGHT_GAIN 23 diff --git a/firmware/export/config.h b/firmware/export/config.h index 22d7090f96..aa3f4f8d40 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -57,6 +57,7 @@ #define PP5020 5020 #define PP5022 5022 #define PP5024 5024 +#define PP6100 6100 #define PNX0101 101 #define S3C2440 2440 #define DSC25 25 @@ -188,7 +189,8 @@ #define LCD_FUZE 32 /* as used by the Sansa Fuze */ #define LCD_LYRE_PROTO1 33 /* as used by the Lyre */ #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 */ + /* LCD_PIXELFORMAT */ #define HORIZONTAL_PACKING 1 #define VERTICAL_PACKING 2 @@ -368,6 +370,8 @@ Lyre prototype 1*/ #include "config-fuze.h" #elif defined(SANSA_C200V2) #include "config-c200v2.h" +#elif defined(SANSA_VIEW) +#include "config-view.h" #elif defined(LYRE_PROTO1) #include "config-lyre_proto1.h" #elif defined(SAMSUNG_YH820) @@ -576,7 +580,8 @@ Lyre prototype 1*/ /* define for all cpus from PP family */ #if (CONFIG_CPU == PP5002) #define CPU_PP -#elif (CONFIG_CPU == PP5020) || (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) +#elif (CONFIG_CPU == PP5020) || (CONFIG_CPU == PP5022) \ + || (CONFIG_CPU == PP5024) || (CONFIG_CPU == PP6100) #define CPU_PP #define CPU_PP502x #endif @@ -682,7 +687,7 @@ Lyre prototype 1*/ /* Change this if you want to build a single-core firmware for a multicore * target for debugging */ -#if defined(BOOTLOADER) +#if defined(BOOTLOADER) || (CONFIG_CPU == PP6100) #define FORCE_SINGLE_CORE #endif diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h index 4623f57004..6041b388b4 100644 --- a/firmware/export/cpu.h +++ b/firmware/export/cpu.h @@ -38,6 +38,9 @@ #if CONFIG_CPU == PP5024 #include "pp5024.h" #endif +#if CONFIG_CPU == PP6100 +#include "pp6100.h" +#endif #if CONFIG_CPU == PNX0101 #include "pnx0101.h" #endif diff --git a/firmware/export/pp6100.h b/firmware/export/pp6100.h new file mode 100644 index 0000000000..0894affdd2 --- /dev/null +++ b/firmware/export/pp6100.h @@ -0,0 +1,31 @@ +#ifndef __PP6100_H__ +#define __PP6100_H__ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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. + * + ****************************************************************************/ + +/* We believe this is quite similar to the 5020 and for now we just use that + completely and redefine any minor differences */ +#include "pp5020.h" + +#undef DRAM_START +#define DRAM_START 0x10f00000 + +#endif diff --git a/firmware/target/arm/sandisk/boot.lds b/firmware/target/arm/sandisk/boot.lds index f2178651cd..622695f5b6 100644 --- a/firmware/target/arm/sandisk/boot.lds +++ b/firmware/target/arm/sandisk/boot.lds @@ -7,7 +7,12 @@ STARTUP(target/arm/crt0-pp-bl.o) #define DRAMSIZE (MEMORYSIZE * 0x100000) +#ifdef SANSA_VIEW +#define DRAMORIG 0x10f00000 +#else #define DRAMORIG 0x10000000 +#endif + #ifndef IRAMORIG #define IRAMORIG 0x40000000 #endif diff --git a/firmware/target/arm/sandisk/sansa-view/adc-view.c b/firmware/target/arm/sandisk/sansa-view/adc-view.c new file mode 100644 index 0000000000..deb8de2471 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/adc-view.c @@ -0,0 +1,33 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 "adc-target.h" + +void adc_init(void) +{ +} + +/* Called to get the recent ADC reading */ +inline unsigned short adc_read(int channel) +{ + (void)channel; + return 0; +} diff --git a/firmware/target/arm/sandisk/sansa-view/backlight-target.h b/firmware/target/arm/sandisk/sansa-view/backlight-target.h new file mode 100644 index 0000000000..a2282ba316 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/backlight-target.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 + +#include + +#define _backlight_init() true +void _backlight_on(void); +void _backlight_off(void); + +void _buttonlight_on(void); +void _buttonlight_off(void); + +#endif diff --git a/firmware/target/arm/sandisk/sansa-view/backlight-view.c b/firmware/target/arm/sandisk/sansa-view/backlight-view.c new file mode 100644 index 0000000000..20932c8607 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/backlight-view.c @@ -0,0 +1,50 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 "backlight-target.h" +#include "system.h" +#include "lcd.h" +#include "backlight.h" + +void _backlight_set_brightness(int brightness) +{ + (void)brightness; +} + +void _backlight_off(void) +{ + GPIO_SET_BITWISE(GPIOD_ENABLE, 1<<8); +} + +void _backlight_on(void) +{ + GPIO_SET_BITWISE(GPIOD_ENABLE, 1); +} + +void _buttonlight_on(void) +{ + GPIO_CLEAR_BITWISE(GPIOA_ENABLE, 0x2); +} + +void _buttonlight_off(void) +{ + GPIO_SET_BITWISE(GPIOA_ENABLE, 0x2); +} diff --git a/firmware/target/arm/sandisk/sansa-view/button-target.h b/firmware/target/arm/sandisk/sansa-view/button-target.h new file mode 100644 index 0000000000..18931da700 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/button-target.h @@ -0,0 +1,62 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 by Barry Wardell + * + * 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" + +#define HAS_BUTTON_HOLD + +void button_init_device(void); +bool button_hold(void); +int button_read_device(void); +/* Sandisk Sansa View button codes */ + +/* Main unit's buttons */ +#define BUTTON_HOME 0x00000001 + +#define BUTTON_DOWN 0x00000002 +#define BUTTON_RIGHT 0x00000004 + +#define BUTTON_LEFT 0x00000008 +#define BUTTON_SELECT 0x00000010 +#define BUTTON_UP 0x00000020 +#define BUTTON_POWER 0x00000040 + +#define BUTTON_SCROLL_BACK 0x00000080 +#define BUTTON_SCROLL_FWD 0x00000100 + +#define BUTTON_HOLD 0x00000400 + +#define BUTTON_MAIN (BUTTON_HOME|BUTTON_DOWN|BUTTON_RIGHT|BUTTON_LEFT \ + |BUTTON_SELECT|BUTTON_UP|BUTTON_POWER \ + |BUTTON_SCROLL_BACK|BUTTON_SCROLL_FWD \ + |BUTTON_HOLD) + +/* No Remote control */ +#define BUTTON_REMOTE 0 + +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/sandisk/sansa-view/button-view.c b/firmware/target/arm/sandisk/sansa-view/button-view.c new file mode 100644 index 0000000000..e1a0bbbcaf --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/button-view.c @@ -0,0 +1,37 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 "button.h" + +void button_init_device(void) +{ + +} + +bool button_hold(void) +{ + return false; +} + +int button_read_device(void) +{ + return 0; +} diff --git a/firmware/target/arm/sandisk/sansa-view/i2c-view.c b/firmware/target/arm/sandisk/sansa-view/i2c-view.c new file mode 100644 index 0000000000..a8ded7d2bf --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/i2c-view.c @@ -0,0 +1,26 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 "i2c.h" + +void i2c_init(void) +{ +} diff --git a/firmware/target/arm/sandisk/sansa-view/lcd-view.c b/firmware/target/arm/sandisk/sansa-view/lcd-view.c new file mode 100644 index 0000000000..39b0d574eb --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/lcd-view.c @@ -0,0 +1,428 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Rockbox driver for Sansa View LCDs + * + * Copyright (c) 2009 Robert Keevil + * + * 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 +#include "cpu.h" +#include "system.h" +#include "backlight-target.h" +#include "lcd.h" + +#include "bitmaps/rockboxlogo.h" + +/* Power and display status */ +static bool power_on = false; /* Is the power turned on? */ +static bool display_on SHAREDBSS_ATTR = false; /* Is the display turned on? */ +static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; + +#define LCD_DATA_OUT_GPIO GPIOH_OUTPUT_VAL +#define LCD_DATA_OUT_PIN 4 + +#define LCD_CLOCK_GPIO GPIOH_OUTPUT_VAL +#define LCD_CLOCK_PIN 6 + +#define LCD_CS_GPIO GPIOH_OUTPUT_VAL +#define LCD_CS_PIN 7 + +#ifdef BOOTLOADER +static void lcd_init_gpio(void) +{ + // OF: 0x5CC8 + + outl(inl(0x70000010) | 0xFC000000, 0x70000010); + outl(inl(0x70000014) | 0xC300000, 0x70000014); + + GPIOE_ENABLE = 0; +/* TODO: check GPIOM exists and isn't just atomic access */ +/* GPIOM_ENABLE &= ~0x3; */ + GPIOJ_ENABLE &= ~0x1a; + GPIOB_ENABLE &= ~0x8; + GPIOH_OUTPUT_VAL |= 0x80; + GPIOH_OUTPUT_EN |= 0x80; + GPIOH_ENABLE |= 0x80; + GPIOH_OUTPUT_VAL |= 0x40; + GPIOH_OUTPUT_EN |= 0x40; + GPIOH_ENABLE |= 0x40; + GPIOH_OUTPUT_VAL |= 0x20; + GPIOH_OUTPUT_EN |= 0x20; + GPIOH_ENABLE |= 0x20; + GPIOH_OUTPUT_VAL |= 0x10; + GPIOH_OUTPUT_EN |= 0x10; + GPIOH_ENABLE |= 0x10; +// GPIOD_OUTOUT_VAL &= ~0x1; //backlight on +// GPIOD_ENABLE |= 0x1; + GPIOB_OUTPUT_VAL |= 0x4; + GPIOB_ENABLE |= 0x4; + GPIOB_OUTPUT_EN |= 0x4; + GPIOG_ENABLE |= 0x8; + GPIOG_OUTPUT_EN &= ~0x8; + +// more to add here... +} +#endif + +static void lcd_send_msg(unsigned char count, unsigned int data) +{ + // OF: 0x645C + int i; + + LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); + LCD_CS_GPIO &= ~(1 << LCD_CS_PIN); + + for (i = count - 1; i >= 0; i--) + { + if (data & (1 << count)) + { +// LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); + LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); + } else { +// LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); + LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); + } + LCD_CLOCK_GPIO &= ~(1 << LCD_CLOCK_PIN); + udelay(1); + LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); + udelay(2); + } + + LCD_CS_GPIO |= (1 << LCD_CS_PIN); + LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); + udelay(1); +} + +/* +static void lcd_write_reg(unsigned int reg, unsigned int data) +{ +// OF: 0x6278 - referenced from 0x62840 + +// So far this function is always called with shift = 0x0 ? +// If so can remove and simplify + + unsigned int cmd; + unsigned int shift = 0; + + cmd = shift << 0x2; + cmd |= 0x70; + cmd = cmd << 0x10; + cmd |= reg; + lcd_send_msg(0x18, cmd); + + cmd = shift << 0x2; + cmd |= 0x72; + cmd = cmd << 0x10; + cmd |= data; + lcd_send_msg(0x18, cmd); + +// lcd_send_msg(0x70, reg); +// lcd_send_msg(0x72, data); +} +*/ + +static void lcd_write_cmd(unsigned int cmd) +{ + lcd_send_msg(0x18, (0x700000 | cmd)); +} + +static void lcd_write_info(unsigned int data) +{ + lcd_send_msg(0x18, (0x720000 | data)); +} + +static void lcd_write_reg(unsigned int cmd, unsigned int data) +{ + lcd_write_cmd(cmd); + lcd_write_info(data); +} + +/* Run the powerup sequence for the driver IC */ +static void lcd_power_on(void) +{ + /* OF: 0x5DC0 * + * r2: cmd * + * r3: data */ + lcd_write_reg(0xE5, 0x8000); + lcd_write_reg(0x0, 0x1); + lcd_write_reg(0x1, 0x100); + lcd_write_reg(0x2, 0x700); + lcd_write_reg(0x3, 0x1230); + lcd_write_reg(0x4, 0x0); + lcd_write_reg(0x8, 0x408); + lcd_write_reg(0x9, 0x0); + lcd_write_reg(0xa, 0x0); + lcd_write_reg(0xd, 0x0); + lcd_write_reg(0xf, 0x2); + lcd_write_reg(0x10, 0x0); + lcd_write_reg(0x11, 0x0); + lcd_write_reg(0x12, 0x0); + lcd_write_reg(0x13, 0x0); + sleep(HZ/5); + lcd_write_reg(0x10, 0x17B0); + lcd_write_reg(0x11, 0x7); + sleep(HZ/20); + lcd_write_reg(0x12, 0x13c); + sleep(HZ/20); + + // OF: BNE 0x5fb2 + + // two different models in use?!? + if (1) + { + lcd_write_reg(0x13, 0x1800); + lcd_write_reg(0x29, 0x13); + sleep(HZ/10); + lcd_write_reg(0x20, 0x0); + lcd_write_reg(0x21, 0x0); + + lcd_write_reg(0x30, 0x2); + lcd_write_reg(0x31, 0xF07); // 0x37 option in other controller + lcd_write_reg(0x32, 0x403); // 0x31 option in other controller + lcd_write_reg(0x35, 0x206); + lcd_write_reg(0x36, 0x504); + lcd_write_reg(0x37, 0x707); + lcd_write_reg(0x38, 0x403); + } + else + { + // OF: last func continues, 0x5EFC + lcd_write_reg(0x13, 0x1700); + lcd_write_reg(0x29, 0x10); + sleep(HZ/10); + lcd_write_reg(0x20, 0x0); + lcd_write_reg(0x21, 0x0); + + lcd_write_reg(0x30, 0x7); + lcd_write_reg(0x31, 0x403); + lcd_write_reg(0x32, 0x400); + lcd_write_reg(0x35, 0x3); + lcd_write_reg(0x36, 0xF07); + lcd_write_reg(0x37, 0x403); + lcd_write_reg(0x37, 0x106); + } + + // OF: b 0x6066 + lcd_write_reg(0x39, 0x7); + lcd_write_reg(0x3c, 0x700); + lcd_write_reg(0x3d, 0x700); + + lcd_write_reg(0x50, 0x0); + lcd_write_reg(0x51, 0xef); // 239 - LCD_WIDTH + lcd_write_reg(0x52, 0x0); + lcd_write_reg(0x53, 0x13f); // 319 - LCD_HEIGHT + + // OF: b 0x6114 + lcd_write_reg(0x60, 0x2700); + lcd_write_reg(0x61, 0x1); + lcd_write_reg(0x6a, 0x0); + + lcd_write_reg(0x80, 0x0); + lcd_write_reg(0x81, 0x0); + lcd_write_reg(0x82, 0x0); + lcd_write_reg(0x83, 0x0); + lcd_write_reg(0x84, 0x0); + lcd_write_reg(0x85, 0x0); + + // OF: 0x61A8 + lcd_write_reg(0x90, 0x10); + lcd_write_reg(0x92, 0x0); + lcd_write_reg(0x93, 0x3); + lcd_write_reg(0x95, 0x110); + lcd_write_reg(0x97, 0x0); + lcd_write_reg(0x98, 0x0); + + lcd_write_reg(0xc, 0x110); + lcd_write_reg(0x7, 0x173); + sleep(HZ/10); + lcd_write_cmd(0x22); + + power_on = true; +} + +void unknown01(void) +{ + // OF: 0x62C4 + + lcd_write_reg(0x10, 0x17B0); + udelay(100); + lcd_write_reg(0x7, 0x173); +} + +void unknown02(void) +{ + // OF: 0x6308 + + lcd_write_reg(0x7, 0x160); + lcd_write_reg(0x10, 0x17B1); +} + +void unknown03(void) +{ + // OF: 0x6410 + GPIOJ_ENABLE |= 0x2; + GPIOJ_OUTPUT_EN |= 0x2; + GPIOJ_OUTPUT_VAL &= ~0x02; +} + +void unknown04(void) +{ + // OF: 0x623C + + GPIOB_OUTPUT_VAL |= 0x4; + udelay(1000); + GPIOB_OUTPUT_VAL &= ~0x4; + sleep(HZ/10); + GPIOB_OUTPUT_VAL |= 0x4; + udelay(1000); +} + +/* Run the display on sequence for the driver IC */ +static void lcd_display_on(void) +{ + display_on = true; +} + + +#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) +bool lcd_active(void) +{ + return display_on; +} + +/* Turn off visible display operations */ +static void lcd_display_off(void) +{ + display_on = false; +} +#endif + +void lcd_init_device(void) +{ + +#ifdef BOOTLOADER /* Bother at all to do this again? */ +//#if 0 +/* Init GPIO ports */ + lcd_init_gpio(); + lcd_power_on(); + lcd_display_on(); +#else + + power_on = true; + display_on = true; + + lcd_set_invert_display(false); + lcd_set_flip(false); +#endif +} + +#if defined(HAVE_LCD_ENABLE) +void lcd_enable(bool on) +{ + (void)on; +} +#endif + +#if defined(HAVE_LCD_SLEEP) +void lcd_sleep(void) +{ + +} +#endif + +void lcd_update(void) +{ + const fb_data *addr; + + addr = &lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; + + lcd_write_reg(0x20, 0x0); + lcd_write_reg(0x21, 0x0); + + int i,j; + for(i=0; i < LCD_HEIGHT; i++) + { + for(j=0; j < LCD_WIDTH; j++) + { + lcd_write_reg(0x22, *addr); + addr++; + } + } +} + +/* Update a fraction of the display. */ +void lcd_update_rect(int x, int y, int width, int height) +{ + (void)x; + (void)y; + (void)width; + (void)height; + lcd_update(); +} + + +/*** hardware configuration ***/ + +void lcd_set_contrast(int val) +{ + (void)val; +} + +void lcd_set_invert_display(bool yesno) +{ + (void)yesno; +} + +/* turn the display upside down (call lcd_update() afterwards) */ +void lcd_set_flip(bool yesno) +{ + (void)yesno; +} + +/* Blitting functions */ + +void lcd_yuv_set_options(unsigned options) +{ + lcd_yuv_options = options; +} + +/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ +extern void lcd_write_yuv420_lines(fb_data *dst, + unsigned char const * const src[3], + int width, + int stride); +extern void lcd_write_yuv420_lines_odither(fb_data *dst, + unsigned char const * const src[3], + int width, + int stride, + int x_screen, /* To align dither pattern */ + int y_screen); + +void lcd_blit_yuv(unsigned char * const src[3], + int src_x, int src_y, int stride, + int x, int y, int width, int height) +{ + (void)src; + (void)src_x; + (void)src_y; + (void)stride; + (void)x; + (void)y; + (void)width; + (void)height; +} diff --git a/firmware/target/arm/sandisk/sansa-view/power-view.c b/firmware/target/arm/sandisk/sansa-view/power-view.c new file mode 100644 index 0000000000..7df7296718 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/power-view.c @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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. + * + ****************************************************************************/ + +void power_init(void) +{ +} + +void power_off(void) +{ +} diff --git a/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c b/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c new file mode 100644 index 0000000000..459b60dd45 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 "adc.h" +#include "powermgmt.h" + +unsigned int battery_adc_voltage(void) +{ + return 0; +} + +/* FIXME - next 4 functions taken from e200 - last 2 will need + to be updated */ +const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = +{ + 3400 +}; + +const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = +{ + 3300 +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ +const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = +{ + /* Sansa Li Ion 750mAH FIXME */ + { 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 }, +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +const unsigned short percent_to_volt_charge[11] = +{ + /* Sansa Li Ion 750mAH FIXME */ + 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 +}; diff --git a/firmware/target/arm/sandisk/sansa-view/usb-view.c b/firmware/target/arm/sandisk/sansa-view/usb-view.c new file mode 100644 index 0000000000..6356ee6ffd --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-view/usb-view.c @@ -0,0 +1,36 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Robert Keevil + * + * 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 "usb.h" + +int usb_detect(void) +{ + return.0; +} + +void usb_enable(bool on) +{ + (void)on; +} + +void usb_init_device(void) +{ +} diff --git a/tools/configure b/tools/configure index 42854fba79..6d65f648cf 100755 --- a/tools/configure +++ b/tools/configure @@ -310,6 +310,14 @@ arm1136jfscc () { gccchoice="4.0.3" } +arm1176jzscc () { + prefixtools arm-elf- + GCCOPTS="$CCOPTS -mcpu=arm1176jz-s -mlong-calls" + GCCOPTIMIZE="-fomit-frame-pointer" + endian="little" + gccchoice="4.0.3" +} + mipselcc () { prefixtools mipsel-elf- GCCOPTS="$CCOPTS -march=mips32 -mtune=r4600 -mno-mips16 -mno-long-calls" @@ -791,10 +799,10 @@ cat <