summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2011-08-27 16:21:19 +0000
committerBertrik Sikken <bertrik@sikken.nl>2011-08-27 16:21:19 +0000
commit463b3ed8b2630d1b9d656dd2a52bbcbd429b4c08 (patch)
tree622e101cddcdad0360625efc647cecbd538fb7dd
parent3aeb7fad9a31666f5762644ebcf2725b15b9241f (diff)
downloadrockbox-463b3ed8b2630d1b9d656dd2a52bbcbd429b4c08.tar.gz
rockbox-463b3ed8b2630d1b9d656dd2a52bbcbd429b4c08.zip
Initial framework for the Sandisk Sansa Clip Zip
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30365 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/bitmaps/native/SOURCES2
-rw-r--r--apps/bitmaps/native/rockboxlogo.96x30x16.bmpbin0 -> 8814 bytes
-rw-r--r--bootloader/sansa_as3525.c2
-rw-r--r--firmware/SOURCES14
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/export/config/sansaclipzip.h202
-rw-r--r--firmware/target/arm/as3525/fmradio-i2c-as3525.c3
-rw-r--r--firmware/target/arm/as3525/memory-init.S3
-rw-r--r--firmware/target/arm/as3525/powermgmt-target.h9
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c42
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/backlight-target.h30
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/button-clipzip.c103
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/button-target.h55
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c103
-rw-r--r--rbutil/mkamsboot/mkamsboot.c3
-rw-r--r--rbutil/mkamsboot/mkamsboot.h1
-rwxr-xr-xtools/configure36
-rw-r--r--tools/scramble.c4
18 files changed, 603 insertions, 12 deletions
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
9#else 9#else
10rockboxlogo.112x30x1.bmp 10rockboxlogo.112x30x1.bmp
11#endif 11#endif
12#elif (LCD_WIDTH == 96) && (LCD_DEPTH == 16)
13rockboxlogo.96x30x16.bmp
12#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2) 14#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2)
13rockboxlogo.128x42x2.bmp 15rockboxlogo.128x42x2.bmp
14#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16) 16#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
--- /dev/null
+++ b/apps/bitmaps/native/rockboxlogo.96x30x16.bmp
Binary files 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)
93 int btn = button_read_device(); 93 int btn = button_read_device();
94 94
95#if !defined(SANSA_FUZE) && !defined(SANSA_CLIP) && !defined(SANSA_CLIPV2) \ 95#if !defined(SANSA_FUZE) && !defined(SANSA_CLIP) && !defined(SANSA_CLIPV2) \
96 && !defined(SANSA_CLIPPLUS) 96 && !defined(SANSA_CLIPPLUS) && !defined(SANSA_CLIPZIP)
97 if (button_hold()) 97 if (button_hold())
98 { 98 {
99 verbose = true; 99 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
1475#endif /* SIMULATOR */ 1475#endif /* SIMULATOR */
1476#endif 1476#endif
1477 1477
1478#ifdef SANSA_CLIPZIP
1479#ifndef SIMULATOR
1480target/arm/as3525/sansa-clipzip/lcd-clipzip.c
1481target/arm/as3525/sansa-clipzip/button-clipzip.c
1482target/arm/as3525/sansa-clipzip/backlight-clipzip.c
1483#ifndef BOOTLOADER
1484target/arm/powermgmt-ascodec.c
1485target/arm/as3525/sansa-clipzip/powermgmt-clipzip.c
1486//target/arm/as3525/sansa-clipzip/lcd-as-clip-plus.S
1487target/arm/as3525/tuner-as3525v2.c
1488#endif /* !BOOTLOADER */
1489#endif /* !SIMULATOR */
1490#endif /* SANSA_CLIPZIP */
1491
1478#ifdef IAUDIO_7 1492#ifdef IAUDIO_7
1479#ifndef SIMULATOR 1493#ifndef SIMULATOR
1480drivers/nand_id.c 1494drivers/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 @@
224#define LCD_IPOD6G 40 /* as used by the iPod Nano 2nd Generation */ 224#define LCD_IPOD6G 40 /* as used by the iPod Nano 2nd Generation */
225#define LCD_FUZEPLUS 41 225#define LCD_FUZEPLUS 41
226#define LCD_SPFD5420A 42 /* rk27xx */ 226#define LCD_SPFD5420A 42 /* rk27xx */
227#define LCD_CLIPZIP 43 /* as used by the Sandisk Sansa Clip Zip */
227 228
228/* LCD_PIXELFORMAT */ 229/* LCD_PIXELFORMAT */
229#define HORIZONTAL_PACKING 1 230#define HORIZONTAL_PACKING 1
@@ -430,6 +431,8 @@ Lyre prototype 1 */
430#include "config/sansafuzev2.h" 431#include "config/sansafuzev2.h"
431#elif defined(SANSA_FUZEPLUS) 432#elif defined(SANSA_FUZEPLUS)
432#include "config/sansafuzeplus.h" 433#include "config/sansafuzeplus.h"
434#elif defined(SANSA_CLIPZIP)
435#include "config/sansaclipzip.h"
433#elif defined(SANSA_C200V2) 436#elif defined(SANSA_C200V2)
434#include "config/sansac200v2.h" 437#include "config/sansac200v2.h"
435#elif defined(SANSA_VIEW) 438#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 @@
1/*
2 * This config file is for the Sandisk Sansa Clip Zip
3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
6/* For Rolo and boot loader */
7#define MODEL_NUMBER 79
8#define MODEL_NAME "Sandisk Sansa Zip"
9#define FIRMWARE_OFFSET_FILE_DATA 8
10#define FIRMWARE_OFFSET_FILE_CRC 0
11
12
13#ifndef BOOTLOADER
14#define HAVE_MULTIDRIVE
15#define NUM_DRIVES 2
16#define HAVE_HOTSWAP
17#endif
18
19#define HW_SAMPR_CAPS SAMPR_CAP_ALL
20
21/* define this if you have recording possibility */
22#define HAVE_RECORDING
23
24#define REC_SAMPR_CAPS SAMPR_CAP_ALL
25
26/* Define bitmask of input sources - recordable bitmask can be defined
27 explicitly if different */
28#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
29
30/* define this if you have a bitmap LCD display */
31#define HAVE_LCD_BITMAP
32/* define this if you have a colour LCD */
33#define HAVE_LCD_COLOR
34
35/* define this if you have access to the quickscreen */
36#define HAVE_QUICKSCREEN
37
38/* define this if you have access to the pitchscreen */
39#define HAVE_PITCHSCREEN
40
41/* define this if you would like tagcache to build on this target */
42#define HAVE_TAGCACHE
43
44/* LCD dimensions */
45#define LCD_WIDTH 96
46#define LCD_HEIGHT 96
47#define LCD_DEPTH 16 /* 65536 colours */
48#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 swapped */
49
50/* define this if you have LCD enable function */
51//#define HAVE_LCD_ENABLE
52
53#ifndef BOOTLOADER
54/* Define this if your LCD can be put to sleep.
55 * HAVE_LCD_ENABLE should be defined as well. */
56//#define HAVE_LCD_SLEEP
57//#define HAVE_LCD_SLEEP_SETTING
58#endif
59
60/* define this if you can flip your LCD */
61#define HAVE_LCD_FLIP
62
63/* define this if you can invert the pixels */
64#define HAVE_LCD_INVERT
65
66/* Define this if your LCD can set contrast */
67#define HAVE_LCD_CONTRAST
68
69#define MIN_CONTRAST_SETTING 0
70#define MAX_CONTRAST_SETTING 50
71#define DEFAULT_CONTRAST_SETTING 30
72
73#define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */
74
75#define CONFIG_KEYPAD SANSA_CLIP_PAD
76
77/* define this if the target has volume keys which can be used in the lists */
78#define HAVE_VOLUME_IN_LIST
79
80/* Define this if you do software codec */
81#define CONFIG_CODEC SWCODEC
82/* There is no hardware tone control */
83#define HAVE_SW_TONE_CONTROLS
84
85/* AS3514 or newer */
86#define HAVE_AS3514
87#define HAVE_AS3543
88
89#ifndef BOOTLOADER
90/* define this if you have a real-time clock */
91#define CONFIG_RTC RTC_AS3514
92
93/* Define if the device can wake from an RTC alarm */
94#define HAVE_RTC_ALARM
95#endif
96
97/* Define this if you have a software controlled poweroff */
98#define HAVE_SW_POWEROFF
99
100#define HAVE_FAT16SUPPORT
101
102/* The number of bytes reserved for loadable codecs */
103#define CODEC_SIZE (0x100000-0x8000)
104
105/* The number of bytes reserved for loadable plugins */
106#define PLUGIN_BUFFER_SIZE 0x80000
107
108#define AB_REPEAT_ENABLE
109
110/* FM Tuner */
111#define CONFIG_TUNER SI4700 /* in fact SI4702 */
112//#define HAVE_TUNER_PWR_CTRL
113
114/* Define this for LCD backlight available */
115#define HAVE_BACKLIGHT
116
117/* define this if you have a flash memory storage */
118#define HAVE_FLASH_STORAGE
119
120/* define this if the flash memory uses the SecureDigital Memory Card protocol */
121#define CONFIG_STORAGE STORAGE_SD
122
123#define BATTERY_CAPACITY_DEFAULT 290 /* default battery capacity */
124#define BATTERY_CAPACITY_MIN 290 /* min. capacity selectable */
125#define BATTERY_CAPACITY_MAX 290 /* max. capacity selectable */
126#define BATTERY_CAPACITY_INC 0 /* capacity increment */
127#define BATTERY_TYPES_COUNT 1 /* only one type */
128
129/* Charging implemented in a target-specific algorithm */
130#define CONFIG_CHARGING CHARGING_TARGET
131
132/* define this if the unit can be powered or charged via USB */
133#define HAVE_USB_POWER
134
135/** Non-simulator section **/
136#ifndef SIMULATOR
137
138/* Define this if you have a AMS AS3525v2 SoC */
139#define CONFIG_CPU AS3525v2
140
141/* Define this if you want to use the AS3525 i2c interface */
142#define CONFIG_I2C I2C_AS3525
143
144/* define this if the hardware can be powered off while charging */
145/* Sansa can't be powered off while charging */
146/* #define HAVE_POWEROFF_WHILE_CHARGING */
147
148/* define current usage levels (based on battery bench) */
149#define CURRENT_NORMAL 19 /* TODO copied from clipplus */
150#define CURRENT_BACKLIGHT 15 /* TODO copied from clipplus */
151#define CURRENT_RECORD CURRENT_NORMAL /* TODO */
152
153/* maximum charging current */
154#define CURRENT_MAX_CHG 150
155
156/* Define this to the CPU frequency */
157#define CPU_FREQ 240000000
158
159/* Type of LCD */
160#define CONFIG_LCD LCD_CLIPZIP
161
162/* USB On-the-go */
163#define CONFIG_USBOTG USBOTG_AS3525v2
164
165/* enable these for the experimental usb stack */
166#define HAVE_USBSTACK
167#define USB_HANDLED_BY_OF
168//#define USE_ROCKBOX_USB
169#define USB_VENDOR_ID 0x0781 /* TODO */
170#define USB_PRODUCT_ID 0x74d1 /* TODO */
171
172
173/* Virtual LED (icon) */
174#define CONFIG_LED LED_VIRTUAL
175
176/* Define this if you have adjustable CPU frequency */
177//#define HAVE_ADJUSTABLE_CPU_FREQ
178
179#define BOOTFILE_EXT "sansa"
180#define BOOTFILE "rockbox." BOOTFILE_EXT
181#define BOOTDIR "/.rockbox"
182
183#define ICODE_ATTR_TREMOR_NOT_MDCT
184
185#define INCLUDE_TIMEOUT_API
186
187#endif /* SIMULATOR */
188
189/** Port-specific settings **/
190
191/* Main LCD backlight brightness range and defaults */
192#define MIN_BRIGHTNESS_SETTING 1 /* TODO */
193#define MAX_BRIGHTNESS_SETTING 12 /* TODO */
194#define DEFAULT_BRIGHTNESS_SETTING 6 /* TODO */
195
196/* Default recording levels */
197#define DEFAULT_REC_MIC_GAIN 23
198#define DEFAULT_REC_LEFT_GAIN 23
199#define DEFAULT_REC_RIGHT_GAIN 23
200
201/* Define this if a programmable hotkey is mapped */
202//#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 @@
40#define I2C_SCL_PIN 4 40#define I2C_SCL_PIN 4
41#define I2C_SDA_PIN 5 41#define I2C_SDA_PIN 5
42 42
43#elif defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) 43#elif defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) \
44 || defined(SANSA_CLIPZIP)
44#define I2C_SCL_GPIO(x) GPIOB_PIN(x) 45#define I2C_SCL_GPIO(x) GPIOB_PIN(x)
45#define I2C_SDA_GPIO(x) GPIOB_PIN(x) 46#define I2C_SDA_GPIO(x) GPIOB_PIN(x)
46#define I2C_SCL_GPIO_DIR GPIOB_DIR 47#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 @@
30#define MEMORY_MODEL 0x21 30#define MEMORY_MODEL 0x21
31 31
32#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_CLIPV2) \ 32#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_CLIPV2) \
33 || defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2) 33 || defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2) \
34 || defined(SANSA_CLIPZIP)
34/* 16 bits external bus, high performance SDRAM, 64 Mbits = 8 Mbytes */ 35/* 16 bits external bus, high performance SDRAM, 64 Mbits = 8 Mbytes */
35#define MEMORY_MODEL 0x5 36#define MEMORY_MODEL 0x5
36 37
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 @@
78#define BATT_CHG_I CHG_I_200MA 78#define BATT_CHG_I CHG_I_200MA
79#define CHARGER_TOTAL_TIMER (4*3600*2) 79#define CHARGER_TOTAL_TIMER (4*3600*2)
80 80
81#elif defined(SANSA_CLIPZIP)
82
83/* Check if topped-off and monitor voltage while plugged. */
84#define BATT_FULL_VOLTAGE 4160
85#define BATT_VAUTO_RECHARGE 4100
86#define BATT_CHG_V CHG_V_4_20V
87#define BATT_CHG_I CHG_I_150MA
88#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */
89
81#elif defined(SANSA_C200V2) 90#elif defined(SANSA_C200V2)
82 91
83/* Check if topped-off and monitor voltage while plugged. */ 92/* 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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2011 Bertrik Sikken
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "backlight-target.h"
23#include "lcd.h"
24#include "as3525v2.h"
25#include "ascodec-target.h"
26
27void _backlight_init()
28{
29 /* GPIO B2 controls backlight */
30 GPIOB_DIR |= (1 << 2);
31}
32
33void _backlight_on(void)
34{
35 /* TODO */
36}
37
38void _backlight_off(void)
39{
40 /* TODO */
41}
42
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2011 Bertrik Sikken
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24void _backlight_init(void);
25void _backlight_on(void);
26void _backlight_off(void);
27
28#define _backlight_panic_on() _backlight_on()
29
30#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 François Dinel
11 * Copyright © 2008-2009 Rafaël Carré
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22
23#include "config.h"
24
25#include "button-target.h"
26#include "as3525v2.h"
27#include "kernel.h"
28#include "system-target.h"
29
30void button_init_device(void)
31{
32 /* GPIO A6, A7 and D6 are direct button inputs */
33 GPIOA_DIR &= ~(1 << 6);
34 GPIOA_DIR &= ~(1 << 7);
35 GPIOD_DIR &= ~(1 << 6);
36
37 /* GPIO C1, C2, C3, C4, C5 are used in a column/row key scan matrix */
38 GPIOC_DIR |= ((1 << 1) | (1 << 2));
39 GPIOC_DIR &= ~((1 << 3) | (1 << 4) | (1 << 5));
40}
41
42/* TODO:
43 Instead of using udelay to wait for buttons to settle, we could use a
44 simple state machine to alternate between key matrix rows (like we do on
45 the clip) and this way avoid burning cycles in the udelay.
46
47 TODO:
48 Figure out the real mappings from GPIOs to buttons.
49 The current mapping is just an educated guess.
50*/
51int button_read_device(void)
52{
53 int buttons = 0;
54
55 /* power */
56 if (GPIOD_PIN(6)) {
57 buttons |= BUTTON_POWER;
58 }
59
60 /* volume */
61 if (GPIOA_PIN(6)) {
62 buttons |= BUTTON_VOL_DOWN;
63 }
64 if (GPIOA_PIN(7)) {
65 buttons |= BUTTON_VOL_UP;
66 }
67
68 /* key matrix buttons, first row */
69 GPIOC_PIN(1) = (1 << 1);
70 GPIOC_PIN(2) = 0;
71 udelay(500);
72
73 if (GPIOC_PIN(3)) {
74 buttons |= BUTTON_LEFT;
75 }
76 if (GPIOC_PIN(4)) {
77 buttons |= BUTTON_SELECT;
78 }
79 if (GPIOC_PIN(5)) {
80 buttons |= BUTTON_RIGHT;
81 }
82
83 /* key matrix buttons, second row */
84 GPIOC_PIN(1) = 0;
85 GPIOC_PIN(2) = (1 << 2);
86 udelay(500);
87
88 if (GPIOC_PIN(3)) {
89 buttons |= BUTTON_UP;
90 }
91 if (GPIOC_PIN(4)) {
92 buttons |= BUTTON_HOME;
93 }
94 if (GPIOC_PIN(5)) {
95 buttons |= BUTTON_DOWN;
96 }
97
98 /* deselect scan rows */
99 GPIOC_PIN(2) = 0;
100
101 return buttons;
102}
103
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 François Dinel
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _BUTTON_TARGET_H_
23#define _BUTTON_TARGET_H_
24
25#include "config.h"
26
27void button_init_device(void);
28int button_read_device(void);
29
30/* Main unit's buttons */
31#define BUTTON_HOME 0x00000001
32
33#define BUTTON_VOL_UP 0x00000002
34#define BUTTON_VOL_DOWN 0x00000004
35
36#define BUTTON_UP 0x00000008
37#define BUTTON_DOWN 0x00000010
38#define BUTTON_LEFT 0x00000020
39#define BUTTON_RIGHT 0x00000040
40
41#define BUTTON_SELECT 0x00000080
42
43#define BUTTON_POWER 0x00000100
44
45#define BUTTON_MAIN (BUTTON_HOME|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
46 |BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT|BUTTON_RIGHT\
47 |BUTTON_SELECT|BUTTON_POWER)
48
49#define BUTTON_REMOTE 0
50
51/* Software power-off */
52#define POWEROFF_BUTTON BUTTON_POWER
53#define POWEROFF_COUNT 10
54
55#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 François Dinel
11 * Copyright (C) 2008-2009 Rafaël Carré
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22#include "config.h"
23
24#include "lcd.h"
25#include "lcd-clip.h"
26#include "system.h"
27#include "cpu.h"
28
29static int display_type;
30
31int lcd_hw_init(void)
32{
33 bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE);
34
35 SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */
36 SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */
37 SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */
38 SSP_IMSC = 0; /* No interrupts */
39
40 /* configure GPIO B2 (display D/C#) as output */
41 GPIOB_DIR |= (1<<2);
42
43 /* configure GPIO B3 (display type detect) as input */
44 GPIOB_DIR &= ~(1<<3);
45
46 /* set GPIO A5 (display RESET# ?) */
47 GPIOA_DIR |= (1<<5);
48 GPIOA_PIN(5) = (1<<5);
49
50 /* detect display type on GPIO B3 */
51 return GPIOB_PIN(3) ? 1 : 0;
52}
53
54void lcd_write_command(int byte)
55{
56 while(SSP_SR & (1<<4)) /* BSY flag */
57 ;
58
59 /* LCD command mode */
60 GPIOB_PIN(2) = 0;
61
62 SSP_DATA = byte;
63 while(SSP_SR & (1<<4)) /* BSY flag */
64 ;
65}
66
67void lcd_write_data(const fb_data* p_bytes, int count)
68{
69 /* LCD data mode */
70 GPIOB_PIN(2) = (1<<2);
71
72 while (count--)
73 {
74 while(!(SSP_SR & (1<<1))) /* wait until transmit FIFO is not full */
75 ;
76
77 SSP_DATA = *p_bytes++;
78 }
79}
80
81void lcd_update(void)
82{
83 /* TODO */
84}
85
86void lcd_init_device(void)
87{
88 /* TODO */
89 display_type = lcd_hw_init();
90}
91
92/* Update a fraction of the display. */
93void lcd_update_rect(int x, int y, int width, int height)
94{
95 (void) x;
96 (void) y;
97 (void) width;
98 (void) height;
99
100 /* TODO not implemented yet, do a full update instead */
101 lcd_update();
102}
103
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[] = {
122 [MODEL_FUZEV2] = { 2, 2, "Fuze", dualboot_fuzev2, sizeof(dualboot_fuzev2), "fuz2", 68 }, 122 [MODEL_FUZEV2] = { 2, 2, "Fuze", dualboot_fuzev2, sizeof(dualboot_fuzev2), "fuz2", 68 },
123 [MODEL_FUZE] = { 1, 1, "Fuze", dualboot_fuze, sizeof(dualboot_fuze), "fuze", 43 }, 123 [MODEL_FUZE] = { 1, 1, "Fuze", dualboot_fuze, sizeof(dualboot_fuze), "fuze", 43 },
124 [MODEL_M200V4] = { 4, 1, "m200", dualboot_m200v4, sizeof(dualboot_m200v4), "m2v4", 42 }, 124 [MODEL_M200V4] = { 4, 1, "m200", dualboot_m200v4, sizeof(dualboot_m200v4), "m2v4", 42 },
125 [MODEL_CLIPZIP] = { 1, 2, "ClipZip", NULL, 0, "clzp", 79 }, /* TODO */
125}; 126};
126 127
127 128
@@ -169,6 +170,8 @@ static struct md5sums sansasums[] = {
169 { MODEL_FUZEV2, "2.02.26", "d4f6f85c3e4a8ea8f2e5acc421641801" }, 170 { MODEL_FUZEV2, "2.02.26", "d4f6f85c3e4a8ea8f2e5acc421641801" },
170 { MODEL_FUZEV2, "2.03.31", "74fb197ccd51707388f3b233402186a6" }, 171 { MODEL_FUZEV2, "2.03.31", "74fb197ccd51707388f3b233402186a6" },
171 { MODEL_FUZEV2, "2.03.33", "1599cc73d02ea7fe53fe2d4379c24b66" }, 172 { MODEL_FUZEV2, "2.03.33", "1599cc73d02ea7fe53fe2d4379c24b66" },
173
174 { MODEL_CLIPZIP, "1.01.12", "45adea0873326b5af34f096e5c402f78" },
172}; 175};
173 176
174#define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0])) 177#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 {
43 MODEL_C200V2, 43 MODEL_C200V2,
44 MODEL_CLIPPLUS, 44 MODEL_CLIPPLUS,
45 MODEL_FUZEV2, 45 MODEL_FUZEV2,
46 MODEL_CLIPZIP,
46 /* new models go here */ 47 /* new models go here */
47 48
48 NUM_MODELS 49 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 <<EOF
1276 123) VX777 112) M3 62) Sansa Clip+ 1276 123) VX777 112) M3 62) Sansa Clip+
1277 63) Sansa Fuze v2 1277 63) Sansa Fuze v2
1278 ==Samsung== ==Tatung== 64) Sansa Fuze+ 1278 ==Samsung== ==Tatung== 64) Sansa Fuze+
1279 140) YH-820 150) Elio TPJ-1022 1279 140) YH-820 150) Elio TPJ-1022 65) Sansa Clip Zip
1280 141) YH-920 ==Logik== 1280 141) YH-920
1281 142) YH-925 ==Packard Bell== 80) DAX 1GB MP3/DAB 1281 142) YH-925 ==Packard Bell== ==Logik==
1282 143) YP-S3 160) Vibe 500 1282 143) YP-S3 160) Vibe 500 80) DAX 1GB MP3/DAB
1283 ==Lyre project== 1283
1284==Application== ==MPIO== 130) Lyre proto 1 1284==Application== ==MPIO== ==Lyre project==
1285 200) SDL 170) HD200 131) Mini2440 1285 200) SDL 170) HD200 130) Lyre proto 1
1286 201) Android 171) HD300 1286 201) Android 171) HD300 131) Mini2440
1287 202) Nokia N8xx 1287 202) Nokia N8xx
1288 203) Nokia N900 ==ROCKCHIP== 1288 203) Nokia N900 ==ROCKCHIP==
1289 204) Pandora 180) rk27xx generic 1289 204) Pandora 180) rk27xx generic
@@ -2525,6 +2525,26 @@ fi
2525 arm926ejscc 2525 arm926ejscc
2526 ;; 2526 ;;
2527 2527
2528 65|sansaclipzip)
2529 target_id=68
2530 modelname="sansaclipzip"
2531 target="-DSANSA_CLIPZIP"
2532 memory=8 # not sure
2533 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2534 bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
2535 tool="$rootdir/tools/scramble -add=clzp"
2536 output="rockbox.sansa"
2537 bootoutput="bootloader-clipzip.sansa"
2538 appextra="recorder:gui:radio"
2539 plugins="yes"
2540 swcodec="yes"
2541 toolset=$scramblebitmaptools
2542 t_cpu="arm"
2543 t_manufacturer="as3525"
2544 t_model="sansa-clipzip"
2545 arm926ejscc
2546 ;;
2547
2528 150|tatungtpj1022) 2548 150|tatungtpj1022)
2529 target_id=25 2549 target_id=25
2530 modelname="tatungtpj1022" 2550 modelname="tatungtpj1022"
diff --git a/tools/scramble.c b/tools/scramble.c
index 683973321c..126fa7baa7 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -126,7 +126,7 @@ void usage(void)
126 printf("\t 9200, 1630, 6330, ldax, m200, c100, clip, e2v2,\n" 126 printf("\t 9200, 1630, 6330, ldax, m200, c100, clip, e2v2,\n"
127 "\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n" 127 "\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n"
128 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n" 128 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n"
129 "\t ip6g, rk27)\n"); 129 "\t ip6g, rk27, clzp)\n");
130 printf("\nNo option results in Archos standard player/recorder format.\n"); 130 printf("\nNo option results in Archos standard player/recorder format.\n");
131 131
132 exit(1); 132 exit(1);
@@ -339,6 +339,8 @@ int main (int argc, char** argv)
339 modelnum = 72; 339 modelnum = 72;
340 else if (!strcmp(&argv[1][5], "rk27")) /* rockchip 27xx generic */ 340 else if (!strcmp(&argv[1][5], "rk27")) /* rockchip 27xx generic */
341 modelnum = 73; 341 modelnum = 73;
342 else if (!strcmp(&argv[1][5], "clzp")) /* Sansa Clip Zip */
343 modelnum = 79;
342 else { 344 else {
343 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); 345 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
344 return 2; 346 return 2;