From 463b3ed8b2630d1b9d656dd2a52bbcbd429b4c08 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sat, 27 Aug 2011 16:21:19 +0000 Subject: Initial framework for the Sandisk Sansa Clip Zip git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30365 a1c6a512-1295-4272-9138-f99709370657 --- apps/bitmaps/native/SOURCES | 2 + apps/bitmaps/native/rockboxlogo.96x30x16.bmp | Bin 0 -> 8814 bytes bootloader/sansa_as3525.c | 2 +- firmware/SOURCES | 14 ++ firmware/export/config.h | 3 + firmware/export/config/sansaclipzip.h | 202 +++++++++++++++++++++ firmware/target/arm/as3525/fmradio-i2c-as3525.c | 3 +- firmware/target/arm/as3525/memory-init.S | 3 +- firmware/target/arm/as3525/powermgmt-target.h | 9 + .../arm/as3525/sansa-clipzip/backlight-clipzip.c | 42 +++++ .../arm/as3525/sansa-clipzip/backlight-target.h | 30 +++ .../arm/as3525/sansa-clipzip/button-clipzip.c | 103 +++++++++++ .../arm/as3525/sansa-clipzip/button-target.h | 55 ++++++ .../target/arm/as3525/sansa-clipzip/lcd-clipzip.c | 103 +++++++++++ rbutil/mkamsboot/mkamsboot.c | 3 + rbutil/mkamsboot/mkamsboot.h | 1 + tools/configure | 36 +++- tools/scramble.c | 4 +- 18 files changed, 603 insertions(+), 12 deletions(-) create mode 100644 apps/bitmaps/native/rockboxlogo.96x30x16.bmp create mode 100644 firmware/export/config/sansaclipzip.h create mode 100644 firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c create mode 100644 firmware/target/arm/as3525/sansa-clipzip/backlight-target.h create mode 100644 firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c create mode 100644 firmware/target/arm/as3525/sansa-clipzip/button-target.h create mode 100644 firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES index 9ce7d89cff..1124543802 100644 --- a/apps/bitmaps/native/SOURCES +++ b/apps/bitmaps/native/SOURCES @@ -9,6 +9,8 @@ rockboxlogo.128x42x1.bmp #else rockboxlogo.112x30x1.bmp #endif +#elif (LCD_WIDTH == 96) && (LCD_DEPTH == 16) +rockboxlogo.96x30x16.bmp #elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2) rockboxlogo.128x42x2.bmp #elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16) diff --git a/apps/bitmaps/native/rockboxlogo.96x30x16.bmp b/apps/bitmaps/native/rockboxlogo.96x30x16.bmp new file mode 100644 index 0000000000..02e64e52a2 Binary files /dev/null and b/apps/bitmaps/native/rockboxlogo.96x30x16.bmp differ diff --git a/bootloader/sansa_as3525.c b/bootloader/sansa_as3525.c index 109d6db919..e402eadd17 100644 --- a/bootloader/sansa_as3525.c +++ b/bootloader/sansa_as3525.c @@ -93,7 +93,7 @@ void main(void) int btn = button_read_device(); #if !defined(SANSA_FUZE) && !defined(SANSA_CLIP) && !defined(SANSA_CLIPV2) \ - && !defined(SANSA_CLIPPLUS) + && !defined(SANSA_CLIPPLUS) && !defined(SANSA_CLIPZIP) if (button_hold()) { verbose = true; diff --git a/firmware/SOURCES b/firmware/SOURCES index 21917de72d..f685ed7dc7 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -1475,6 +1475,20 @@ target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c #endif /* SIMULATOR */ #endif +#ifdef SANSA_CLIPZIP +#ifndef SIMULATOR +target/arm/as3525/sansa-clipzip/lcd-clipzip.c +target/arm/as3525/sansa-clipzip/button-clipzip.c +target/arm/as3525/sansa-clipzip/backlight-clipzip.c +#ifndef BOOTLOADER +target/arm/powermgmt-ascodec.c +target/arm/as3525/sansa-clipzip/powermgmt-clipzip.c +//target/arm/as3525/sansa-clipzip/lcd-as-clip-plus.S +target/arm/as3525/tuner-as3525v2.c +#endif /* !BOOTLOADER */ +#endif /* !SIMULATOR */ +#endif /* SANSA_CLIPZIP */ + #ifdef IAUDIO_7 #ifndef SIMULATOR drivers/nand_id.c diff --git a/firmware/export/config.h b/firmware/export/config.h index 036354180c..57e6bb8a59 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -224,6 +224,7 @@ #define LCD_IPOD6G 40 /* as used by the iPod Nano 2nd Generation */ #define LCD_FUZEPLUS 41 #define LCD_SPFD5420A 42 /* rk27xx */ +#define LCD_CLIPZIP 43 /* as used by the Sandisk Sansa Clip Zip */ /* LCD_PIXELFORMAT */ #define HORIZONTAL_PACKING 1 @@ -430,6 +431,8 @@ Lyre prototype 1 */ #include "config/sansafuzev2.h" #elif defined(SANSA_FUZEPLUS) #include "config/sansafuzeplus.h" +#elif defined(SANSA_CLIPZIP) +#include "config/sansaclipzip.h" #elif defined(SANSA_C200V2) #include "config/sansac200v2.h" #elif defined(SANSA_VIEW) diff --git a/firmware/export/config/sansaclipzip.h b/firmware/export/config/sansaclipzip.h new file mode 100644 index 0000000000..749439c668 --- /dev/null +++ b/firmware/export/config/sansaclipzip.h @@ -0,0 +1,202 @@ +/* + * This config file is for the Sandisk Sansa Clip Zip + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 79 +#define MODEL_NAME "Sandisk Sansa Zip" +#define FIRMWARE_OFFSET_FILE_DATA 8 +#define FIRMWARE_OFFSET_FILE_CRC 0 + + +#ifndef BOOTLOADER +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 +#define HAVE_HOTSWAP +#endif + +#define HW_SAMPR_CAPS SAMPR_CAP_ALL + +/* define this if you have recording possibility */ +#define HAVE_RECORDING + +#define REC_SAMPR_CAPS SAMPR_CAP_ALL + +/* 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 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 96 +#define LCD_HEIGHT 96 +#define LCD_DEPTH 16 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 swapped */ + +/* define this if you have LCD enable function */ +//#define HAVE_LCD_ENABLE + +#ifndef BOOTLOADER +/* 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 pixels */ +#define HAVE_LCD_INVERT + +/* Define this if your LCD can set contrast */ +#define HAVE_LCD_CONTRAST + +#define MIN_CONTRAST_SETTING 0 +#define MAX_CONTRAST_SETTING 50 +#define DEFAULT_CONTRAST_SETTING 30 + +#define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */ + +#define CONFIG_KEYPAD SANSA_CLIP_PAD + +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC +/* There is no hardware tone control */ +#define HAVE_SW_TONE_CONTROLS + +/* AS3514 or newer */ +#define HAVE_AS3514 +#define HAVE_AS3543 + +#ifndef BOOTLOADER +/* define this if you have a real-time clock */ +#define CONFIG_RTC RTC_AS3514 + +/* Define if the device can wake from an RTC alarm */ +#define HAVE_RTC_ALARM +#endif + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +#define HAVE_FAT16SUPPORT + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE (0x100000-0x8000) + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +#define AB_REPEAT_ENABLE + +/* FM Tuner */ +#define CONFIG_TUNER SI4700 /* in fact SI4702 */ +//#define HAVE_TUNER_PWR_CTRL + +/* Define this for LCD backlight available */ +#define HAVE_BACKLIGHT + +/* 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 290 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 290 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 290 /* 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_TARGET + +/* 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 AMS AS3525v2 SoC */ +#define CONFIG_CPU AS3525v2 + +/* Define this if you want to use the AS3525 i2c interface */ +#define CONFIG_I2C I2C_AS3525 + +/* define this if the hardware can be powered off while charging */ +/* Sansa can't be powered off while charging */ +/* #define HAVE_POWEROFF_WHILE_CHARGING */ + +/* define current usage levels (based on battery bench) */ +#define CURRENT_NORMAL 19 /* TODO copied from clipplus */ +#define CURRENT_BACKLIGHT 15 /* TODO copied from clipplus */ +#define CURRENT_RECORD CURRENT_NORMAL /* TODO */ + +/* maximum charging current */ +#define CURRENT_MAX_CHG 150 + +/* Define this to the CPU frequency */ +#define CPU_FREQ 240000000 + +/* Type of LCD */ +#define CONFIG_LCD LCD_CLIPZIP + +/* USB On-the-go */ +#define CONFIG_USBOTG USBOTG_AS3525v2 + +/* enable these for the experimental usb stack */ +#define HAVE_USBSTACK +#define USB_HANDLED_BY_OF +//#define USE_ROCKBOX_USB +#define USB_VENDOR_ID 0x0781 /* TODO */ +#define USB_PRODUCT_ID 0x74d1 /* TODO */ + + +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + +/* Define this if you have adjustable CPU frequency */ +//#define HAVE_ADJUSTABLE_CPU_FREQ + +#define BOOTFILE_EXT "sansa" +#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 /* TODO */ +#define MAX_BRIGHTNESS_SETTING 12 /* TODO */ +#define DEFAULT_BRIGHTNESS_SETTING 6 /* TODO */ + +/* Default recording levels */ +#define DEFAULT_REC_MIC_GAIN 23 +#define DEFAULT_REC_LEFT_GAIN 23 +#define DEFAULT_REC_RIGHT_GAIN 23 + +/* Define this if a programmable hotkey is mapped */ +//#define HAVE_HOTKEY diff --git a/firmware/target/arm/as3525/fmradio-i2c-as3525.c b/firmware/target/arm/as3525/fmradio-i2c-as3525.c index 70287c38b8..1dbf2fde24 100644 --- a/firmware/target/arm/as3525/fmradio-i2c-as3525.c +++ b/firmware/target/arm/as3525/fmradio-i2c-as3525.c @@ -40,7 +40,8 @@ #define I2C_SCL_PIN 4 #define I2C_SDA_PIN 5 -#elif defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) +#elif defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) \ + || defined(SANSA_CLIPZIP) #define I2C_SCL_GPIO(x) GPIOB_PIN(x) #define I2C_SDA_GPIO(x) GPIOB_PIN(x) #define I2C_SCL_GPIO_DIR GPIOB_DIR diff --git a/firmware/target/arm/as3525/memory-init.S b/firmware/target/arm/as3525/memory-init.S index e45e28a608..49b05463e7 100644 --- a/firmware/target/arm/as3525/memory-init.S +++ b/firmware/target/arm/as3525/memory-init.S @@ -30,7 +30,8 @@ #define MEMORY_MODEL 0x21 #elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_CLIPV2) \ - || defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2) + || defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2) \ + || defined(SANSA_CLIPZIP) /* 16 bits external bus, high performance SDRAM, 64 Mbits = 8 Mbytes */ #define MEMORY_MODEL 0x5 diff --git a/firmware/target/arm/as3525/powermgmt-target.h b/firmware/target/arm/as3525/powermgmt-target.h index fd13ec6c7f..f2762f3e47 100644 --- a/firmware/target/arm/as3525/powermgmt-target.h +++ b/firmware/target/arm/as3525/powermgmt-target.h @@ -78,6 +78,15 @@ #define BATT_CHG_I CHG_I_200MA #define CHARGER_TOTAL_TIMER (4*3600*2) +#elif defined(SANSA_CLIPZIP) + +/* Check if topped-off and monitor voltage while plugged. */ +#define BATT_FULL_VOLTAGE 4160 +#define BATT_VAUTO_RECHARGE 4100 +#define BATT_CHG_V CHG_V_4_20V +#define BATT_CHG_I CHG_I_150MA +#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ + #elif defined(SANSA_C200V2) /* Check if topped-off and monitor voltage while plugged. */ diff --git a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c new file mode 100644 index 0000000000..a592715c90 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c @@ -0,0 +1,42 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2011 Bertrik Sikken + * + * 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 "backlight-target.h" +#include "lcd.h" +#include "as3525v2.h" +#include "ascodec-target.h" + +void _backlight_init() +{ + /* GPIO B2 controls backlight */ + GPIOB_DIR |= (1 << 2); +} + +void _backlight_on(void) +{ + /* TODO */ +} + +void _backlight_off(void) +{ + /* TODO */ +} + diff --git a/firmware/target/arm/as3525/sansa-clipzip/backlight-target.h b/firmware/target/arm/as3525/sansa-clipzip/backlight-target.h new file mode 100644 index 0000000000..e19334b5c5 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipzip/backlight-target.h @@ -0,0 +1,30 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2011 Bertrik Sikken + * + * 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 + +void _backlight_init(void); +void _backlight_on(void); +void _backlight_off(void); + +#define _backlight_panic_on() _backlight_on() + +#endif diff --git a/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c new file mode 100644 index 0000000000..104c227378 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c @@ -0,0 +1,103 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 François Dinel + * Copyright © 2008-2009 Rafaël Carré + * + * 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 "button-target.h" +#include "as3525v2.h" +#include "kernel.h" +#include "system-target.h" + +void button_init_device(void) +{ + /* GPIO A6, A7 and D6 are direct button inputs */ + GPIOA_DIR &= ~(1 << 6); + GPIOA_DIR &= ~(1 << 7); + GPIOD_DIR &= ~(1 << 6); + + /* GPIO C1, C2, C3, C4, C5 are used in a column/row key scan matrix */ + GPIOC_DIR |= ((1 << 1) | (1 << 2)); + GPIOC_DIR &= ~((1 << 3) | (1 << 4) | (1 << 5)); +} + +/* TODO: + Instead of using udelay to wait for buttons to settle, we could use a + simple state machine to alternate between key matrix rows (like we do on + the clip) and this way avoid burning cycles in the udelay. + + TODO: + Figure out the real mappings from GPIOs to buttons. + The current mapping is just an educated guess. +*/ +int button_read_device(void) +{ + int buttons = 0; + + /* power */ + if (GPIOD_PIN(6)) { + buttons |= BUTTON_POWER; + } + + /* volume */ + if (GPIOA_PIN(6)) { + buttons |= BUTTON_VOL_DOWN; + } + if (GPIOA_PIN(7)) { + buttons |= BUTTON_VOL_UP; + } + + /* key matrix buttons, first row */ + GPIOC_PIN(1) = (1 << 1); + GPIOC_PIN(2) = 0; + udelay(500); + + if (GPIOC_PIN(3)) { + buttons |= BUTTON_LEFT; + } + if (GPIOC_PIN(4)) { + buttons |= BUTTON_SELECT; + } + if (GPIOC_PIN(5)) { + buttons |= BUTTON_RIGHT; + } + + /* key matrix buttons, second row */ + GPIOC_PIN(1) = 0; + GPIOC_PIN(2) = (1 << 2); + udelay(500); + + if (GPIOC_PIN(3)) { + buttons |= BUTTON_UP; + } + if (GPIOC_PIN(4)) { + buttons |= BUTTON_HOME; + } + if (GPIOC_PIN(5)) { + buttons |= BUTTON_DOWN; + } + + /* deselect scan rows */ + GPIOC_PIN(2) = 0; + + return buttons; +} + diff --git a/firmware/target/arm/as3525/sansa-clipzip/button-target.h b/firmware/target/arm/as3525/sansa-clipzip/button-target.h new file mode 100644 index 0000000000..8a93d45daa --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipzip/button-target.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 François Dinel + * + * 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 "config.h" + +void button_init_device(void); +int button_read_device(void); + +/* Main unit's buttons */ +#define BUTTON_HOME 0x00000001 + +#define BUTTON_VOL_UP 0x00000002 +#define BUTTON_VOL_DOWN 0x00000004 + +#define BUTTON_UP 0x00000008 +#define BUTTON_DOWN 0x00000010 +#define BUTTON_LEFT 0x00000020 +#define BUTTON_RIGHT 0x00000040 + +#define BUTTON_SELECT 0x00000080 + +#define BUTTON_POWER 0x00000100 + +#define BUTTON_MAIN (BUTTON_HOME|BUTTON_VOL_UP|BUTTON_VOL_DOWN\ + |BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT|BUTTON_RIGHT\ + |BUTTON_SELECT|BUTTON_POWER) + +#define BUTTON_REMOTE 0 + +/* Software power-off */ +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c new file mode 100644 index 0000000000..8efbdf77b9 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c @@ -0,0 +1,103 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 François Dinel + * Copyright (C) 2008-2009 Rafaël Carré + * + * 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 "lcd.h" +#include "lcd-clip.h" +#include "system.h" +#include "cpu.h" + +static int display_type; + +int lcd_hw_init(void) +{ + bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE); + + SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */ + SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */ + SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */ + SSP_IMSC = 0; /* No interrupts */ + + /* configure GPIO B2 (display D/C#) as output */ + GPIOB_DIR |= (1<<2); + + /* configure GPIO B3 (display type detect) as input */ + GPIOB_DIR &= ~(1<<3); + + /* set GPIO A5 (display RESET# ?) */ + GPIOA_DIR |= (1<<5); + GPIOA_PIN(5) = (1<<5); + + /* detect display type on GPIO B3 */ + return GPIOB_PIN(3) ? 1 : 0; +} + +void lcd_write_command(int byte) +{ + while(SSP_SR & (1<<4)) /* BSY flag */ + ; + + /* LCD command mode */ + GPIOB_PIN(2) = 0; + + SSP_DATA = byte; + while(SSP_SR & (1<<4)) /* BSY flag */ + ; +} + +void lcd_write_data(const fb_data* p_bytes, int count) +{ + /* LCD data mode */ + GPIOB_PIN(2) = (1<<2); + + while (count--) + { + while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */ + ; + + SSP_DATA = *p_bytes++; + } +} + +void lcd_update(void) +{ + /* TODO */ +} + +void lcd_init_device(void) +{ + /* TODO */ + display_type = lcd_hw_init(); +} + +/* 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; + + /* TODO not implemented yet, do a full update instead */ + lcd_update(); +} + diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c index 715e11d0d5..2682b7b19b 100644 --- a/rbutil/mkamsboot/mkamsboot.c +++ b/rbutil/mkamsboot/mkamsboot.c @@ -122,6 +122,7 @@ const struct ams_models ams_identity[] = { [MODEL_FUZEV2] = { 2, 2, "Fuze", dualboot_fuzev2, sizeof(dualboot_fuzev2), "fuz2", 68 }, [MODEL_FUZE] = { 1, 1, "Fuze", dualboot_fuze, sizeof(dualboot_fuze), "fuze", 43 }, [MODEL_M200V4] = { 4, 1, "m200", dualboot_m200v4, sizeof(dualboot_m200v4), "m2v4", 42 }, + [MODEL_CLIPZIP] = { 1, 2, "ClipZip", NULL, 0, "clzp", 79 }, /* TODO */ }; @@ -169,6 +170,8 @@ static struct md5sums sansasums[] = { { MODEL_FUZEV2, "2.02.26", "d4f6f85c3e4a8ea8f2e5acc421641801" }, { MODEL_FUZEV2, "2.03.31", "74fb197ccd51707388f3b233402186a6" }, { MODEL_FUZEV2, "2.03.33", "1599cc73d02ea7fe53fe2d4379c24b66" }, + + { MODEL_CLIPZIP, "1.01.12", "45adea0873326b5af34f096e5c402f78" }, }; #define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0])) diff --git a/rbutil/mkamsboot/mkamsboot.h b/rbutil/mkamsboot/mkamsboot.h index 156315e4e4..263fe9e9c1 100644 --- a/rbutil/mkamsboot/mkamsboot.h +++ b/rbutil/mkamsboot/mkamsboot.h @@ -43,6 +43,7 @@ enum { MODEL_C200V2, MODEL_CLIPPLUS, MODEL_FUZEV2, + MODEL_CLIPZIP, /* new models go here */ NUM_MODELS diff --git a/tools/configure b/tools/configure index b28d3c4c97..3c4145f3da 100755 --- a/tools/configure +++ b/tools/configure @@ -1276,14 +1276,14 @@ cat <