summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/boot.lds2
-rw-r--r--firmware/target/arm/as3525/clock-target.h8
-rw-r--r--firmware/target/arm/as3525/powermgmt-target.h4
-rw-r--r--firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c53
-rw-r--r--firmware/target/arm/as3525/sansa-clipplus/backlight-target.h32
-rw-r--r--firmware/target/arm/as3525/sansa-clipplus/button-clip.c33
-rw-r--r--firmware/target/arm/as3525/sansa-clipplus/button-target.h57
-rw-r--r--firmware/target/arm/as3525/system-as3525.c9
8 files changed, 188 insertions, 10 deletions
diff --git a/firmware/target/arm/as3525/boot.lds b/firmware/target/arm/as3525/boot.lds
index dcc291b54f..5bf75be789 100644
--- a/firmware/target/arm/as3525/boot.lds
+++ b/firmware/target/arm/as3525/boot.lds
@@ -6,7 +6,7 @@ OUTPUT_FORMAT(elf32-littlearm)
6OUTPUT_ARCH(arm) 6OUTPUT_ARCH(arm)
7STARTUP(target/arm/crt0.o) 7STARTUP(target/arm/crt0.o)
8 8
9#ifdef SANSA_CLIPV2 9#if CONFIG_CPU == AS3525v2
10#define RAMORIG 0x0 /* DRAM */ 10#define RAMORIG 0x0 /* DRAM */
11#define RAMSIZE (MEM*0x100000) 11#define RAMSIZE (MEM*0x100000)
12#else 12#else
diff --git a/firmware/target/arm/as3525/clock-target.h b/firmware/target/arm/as3525/clock-target.h
index fd3a1c7bf4..16f28429b8 100644
--- a/firmware/target/arm/as3525/clock-target.h
+++ b/firmware/target/arm/as3525/clock-target.h
@@ -56,7 +56,7 @@
56#define AS3525_CLK_FCLK 3 /* Available as PCLK input only */ 56#define AS3525_CLK_FCLK 3 /* Available as PCLK input only */
57 57
58/** ************ Change these to reconfigure clocking scheme *******************/ 58/** ************ Change these to reconfigure clocking scheme *******************/
59#ifdef SANSA_CLIPV2 59#if CONFIG_CPU == AS3525v2
60 60
61/* PLL* registers differ from AS3525 */ 61/* PLL* registers differ from AS3525 */
62#define AS3525_PLLA_FREQ 240000000 62#define AS3525_PLLA_FREQ 240000000
@@ -74,7 +74,7 @@
74#define AS3525_PLLB_FREQ 384000000 /* allows 44.1kHz with 0.04% error*/ 74#define AS3525_PLLB_FREQ 384000000 /* allows 44.1kHz with 0.04% error*/
75#define AS3525_PLLB_SETTING 0x2630 75#define AS3525_PLLB_SETTING 0x2630
76 76
77#endif /* SANSA_CLIPV2 */ 77#endif /* CONFIG_CPU == AS3525v2 */
78 78
79//#define AS3525_PLLA_FREQ 384000000 /*192,128,96,76.8,64,54.9,48,42.7,38.4*/ 79//#define AS3525_PLLA_FREQ 384000000 /*192,128,96,76.8,64,54.9,48,42.7,38.4*/
80 /* FCLK_PREDIV-> *7/8 = 336MHz 168, 112, 84, 67.2, 56, 48, 42, 37.3*/ 80 /* FCLK_PREDIV-> *7/8 = 336MHz 168, 112, 84, 67.2, 56, 48, 42, 37.3*/
@@ -142,12 +142,12 @@
142#define AS3525_IDE_SEL AS3525_CLK_PLLA /* Input Source */ 142#define AS3525_IDE_SEL AS3525_CLK_PLLA /* Input Source */
143#define AS3525_IDE_DIV (CLK_DIV(AS3525_PLLA_FREQ, AS3525_IDE_FREQ) - 1)/*div=1/(n+1)*/ 143#define AS3525_IDE_DIV (CLK_DIV(AS3525_PLLA_FREQ, AS3525_IDE_FREQ) - 1)/*div=1/(n+1)*/
144 144
145#ifdef SANSA_CLIPV2 145#if CONFIG_CPU == AS3525v2
146#define AS3525_MS_FREQ 120000000 146#define AS3525_MS_FREQ 120000000
147#define AS3525_IDE_FREQ 80000000 147#define AS3525_IDE_FREQ 80000000
148#else 148#else
149#define AS3525_IDE_FREQ 50000000 /* The OF uses 66MHz maximal freq */ 149#define AS3525_IDE_FREQ 50000000 /* The OF uses 66MHz maximal freq */
150#endif /* SANSA_CLIPV2 */ 150#endif /* CONFIG_CPU == AS3525v2 */
151 151
152 152
153//#define AS3525_USB_SEL AS3525_CLK_PLLA /* Input Source */ 153//#define AS3525_USB_SEL AS3525_CLK_PLLA /* Input Source */
diff --git a/firmware/target/arm/as3525/powermgmt-target.h b/firmware/target/arm/as3525/powermgmt-target.h
index 159a051e70..3e9cdad243 100644
--- a/firmware/target/arm/as3525/powermgmt-target.h
+++ b/firmware/target/arm/as3525/powermgmt-target.h
@@ -22,7 +22,9 @@
22#ifndef POWERMGMT_TARGET_H 22#ifndef POWERMGMT_TARGET_H
23#define POWERMGMT_TARGET_H 23#define POWERMGMT_TARGET_H
24 24
25#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) 25#if defined(SANSA_CLIP) \
26 || defined(SANSA_CLIPV2) /* FIXME */ \
27 || defined(SANSA_CLIPPLUS) /* FIXME */
26 28
27/* Check if topped-off and monitor voltage while plugged. */ 29/* Check if topped-off and monitor voltage while plugged. */
28#define BATT_FULL_VOLTAGE 4160 30#define BATT_FULL_VOLTAGE 4160
diff --git a/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c b/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c
new file mode 100644
index 0000000000..c51d61231d
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c
@@ -0,0 +1,53 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2009 Rafaël Carré
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
27/* FIXME : this is clipv2 code, not sure if it works the same on clip+ */
28
29void _backlight_on(void)
30{
31 ascodec_write(0x25, ascodec_read(0x25) | 2); /* lcd power */
32 ascodec_write(0x1c, 8|1);
33 ascodec_write(0x1b, 0x90);
34 lcd_enable(true);
35}
36
37void _backlight_off(void)
38{
39 ascodec_write(0x25, ascodec_read(0x25) & ~2); /* lcd power */
40 lcd_enable(false);
41}
42
43void _buttonlight_on(void)
44{
45 GPIOA_DIR |= (1<<5);
46 GPIOA_PIN(5) = (1<<5); /* set pin a5 high */
47}
48
49void _buttonlight_off(void)
50{
51 GPIOA_DIR |= (1<<5);
52 GPIOA_PIN(5) = 0; /* set pin a5 low */
53}
diff --git a/firmware/target/arm/as3525/sansa-clipplus/backlight-target.h b/firmware/target/arm/as3525/sansa-clipplus/backlight-target.h
new file mode 100644
index 0000000000..d202408356
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clipplus/backlight-target.h
@@ -0,0 +1,32 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2009 Rafaël Carré
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
24#define _backlight_init() true
25
26void _backlight_on(void);
27void _backlight_off(void);
28
29void _buttonlight_on(void);
30void _buttonlight_off(void);
31
32#endif
diff --git a/firmware/target/arm/as3525/sansa-clipplus/button-clip.c b/firmware/target/arm/as3525/sansa-clipplus/button-clip.c
new file mode 100644
index 0000000000..52917cca6f
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clipplus/button-clip.c
@@ -0,0 +1,33 @@
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#include "button-target.h"
23#include "as3525v2.h"
24#include "kernel.h"
25
26void button_init_device(void)
27{
28}
29
30int button_read_device(void)
31{
32 return 0;
33}
diff --git a/firmware/target/arm/as3525/sansa-clipplus/button-target.h b/firmware/target/arm/as3525/sansa-clipplus/button-target.h
new file mode 100644
index 0000000000..69f5d984ba
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clipplus/button-target.h
@@ -0,0 +1,57 @@
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 <stdbool.h>
26#include "config.h"
27
28void button_init_device(void);
29int button_read_device(void);
30bool button_hold(void);
31
32/* Main unit's buttons */
33#define BUTTON_HOME 0x00000001
34
35#define BUTTON_VOL_UP 0x00000002
36#define BUTTON_VOL_DOWN 0x00000004
37
38#define BUTTON_UP 0x00000008
39#define BUTTON_DOWN 0x00000010
40#define BUTTON_LEFT 0x00000020
41#define BUTTON_RIGHT 0x00000040
42
43#define BUTTON_SELECT 0x00000080
44
45#define BUTTON_POWER 0x00000100
46
47#define BUTTON_MAIN (BUTTON_HOME|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
48 |BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT|BUTTON_RIGHT\
49 |BUTTON_SELECT|BUTTON_POWER)
50
51#define BUTTON_REMOTE 0
52
53/* Software power-off */
54#define POWEROFF_BUTTON BUTTON_POWER
55#define POWEROFF_COUNT 10
56
57#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index 2e6b6d4085..6c3299eea3 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -205,7 +205,8 @@ static void sdram_init(void)
205/* 16 bits external bus, low power SDRAM, 16 Mbits = 2 Mbytes */ 205/* 16 bits external bus, low power SDRAM, 16 Mbits = 2 Mbytes */
206#define MEMORY_MODEL 0x21 206#define MEMORY_MODEL 0x21
207 207
208#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_CLIPV2) 208#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_CLIPV2) \
209 || defined(SANSA_CLIPPLUS)
209/* 16 bits external bus, high performance SDRAM, 64 Mbits = 8 Mbytes */ 210/* 16 bits external bus, high performance SDRAM, 64 Mbits = 8 Mbytes */
210#define MEMORY_MODEL 0x5 211#define MEMORY_MODEL 0x5
211 212
@@ -256,7 +257,7 @@ void memory_init(void)
256 257
257void system_init(void) 258void system_init(void)
258{ 259{
259#ifdef SANSA_CLIPV2 260#if CONFIG_CPU == AS3525v2
260 /* Init procedure isn't fully understood yet 261 /* Init procedure isn't fully understood yet
261 * CCU_* registers differ from AS3525 262 * CCU_* registers differ from AS3525
262 */ 263 */
@@ -270,7 +271,7 @@ void system_init(void)
270 CGU_PERI &= ~0x7f; /* pclk 24 MHz */ 271 CGU_PERI &= ~0x7f; /* pclk 24 MHz */
271 CGU_PERI |= ((CLK_DIV(AS3525_PLLA_FREQ, AS3525_PCLK_FREQ) - 1) << 2) 272 CGU_PERI |= ((CLK_DIV(AS3525_PLLA_FREQ, AS3525_PCLK_FREQ) - 1) << 2)
272 | 1; /* clk_in = PLLA */ 273 | 1; /* clk_in = PLLA */
273#else /* SANSA_CLIPV2 */ 274#else
274 unsigned int reset_loops = 640; 275 unsigned int reset_loops = 640;
275 276
276 CCU_SRC = 0x1fffff0 277 CCU_SRC = 0x1fffff0
@@ -315,7 +316,7 @@ void system_init(void)
315 sdram_init(); 316 sdram_init();
316#endif /* BOOTLOADER */ 317#endif /* BOOTLOADER */
317 318
318#endif /* SANSA_CLIPV2 */ 319#endif /* CONFIG_CPU == AS3525v2 */
319 320
320#if 0 /* the GPIO clock is already enabled by the dualboot function */ 321#if 0 /* the GPIO clock is already enabled by the dualboot function */
321 CGU_PERI |= CGU_GPIO_CLOCK_ENABLE; 322 CGU_PERI |= CGU_GPIO_CLOCK_ENABLE;