summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-03-30 12:20:47 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-03-30 12:20:47 +0000
commit8983fcb5f2687b22b2cba68573f839ff2800e3c9 (patch)
treecabc0667fa7293148bb0aabf5af235c7135c8526
parentddc554f62bb99a00b534e5f18aa0f1165df0622f (diff)
downloadrockbox-8983fcb5f2687b22b2cba68573f839ff2800e3c9.tar.gz
rockbox-8983fcb5f2687b22b2cba68573f839ff2800e3c9.zip
Initial commit for the "Lyre prototype 1" port by Jorge Pinto from FS#10045.
Bootloader builds, normal does not. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20574 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/SOURCES3
-rw-r--r--bootloader/lyre_proto1.c36
-rw-r--r--firmware/SOURCES12
-rw-r--r--firmware/export/at91sam9260.h678
-rw-r--r--firmware/export/config-lyre_proto1.h100
-rw-r--r--firmware/export/config.h14
-rw-r--r--firmware/target/arm/at91sam/boot.lds81
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/adc-lyre_proto1.c31
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/adc-target.h28
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/backlight-lyre_proto1.c45
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/backlight-target.h26
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/button-lyre_proto1.c99
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/button-target.h48
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/crt0.S274
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/debug-lyre_proto1.c34
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/debug-target.h26
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/kernel-lyre_proto1.c78
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/lcd-lyre_proto1.c27
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/lcd-target.h24
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/system-lyre_proto1.c150
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/system-target.h29
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c123
-rw-r--r--firmware/target/arm/at91sam/lyre_proto1/timer-target.h42
-rwxr-xr-xtools/configure27
24 files changed, 2029 insertions, 6 deletions
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 693644df5e..d86a815840 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -47,4 +47,7 @@ creativezvm.c
47#elif CONFIG_CPU==AS3525 47#elif CONFIG_CPU==AS3525
48sansa_as3525.c 48sansa_as3525.c
49show_logo.c 49show_logo.c
50#elif defined(LYRE_PROTO1)
51lyre_proto1.c
52show_logo.c
50#endif 53#endif
diff --git a/bootloader/lyre_proto1.c b/bootloader/lyre_proto1.c
new file mode 100644
index 0000000000..b40143b988
--- /dev/null
+++ b/bootloader/lyre_proto1.c
@@ -0,0 +1,36 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 Standard files */
23#include "kernel.h"
24#include "system.h"
25
26/* Show the Rockbox logo - in show_logo.c */
27extern int show_logo(void);
28
29int main(void)
30{
31 /* Initialize Rockbox kernel */
32 kernel_init();
33
34 /* Never returns */
35 while(1) ;
36}
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 82b7b34942..91482bf683 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1259,4 +1259,16 @@ target/mips/ingenic_jz47xx/onda_vx767/lcd-onda_vx767.c
1259target/mips/ingenic_jz47xx/onda_vx767/power-onda_vx767.c 1259target/mips/ingenic_jz47xx/onda_vx767/power-onda_vx767.c
1260target/mips/ingenic_jz47xx/onda_vx767/sadc-onda_vx767.c 1260target/mips/ingenic_jz47xx/onda_vx767/sadc-onda_vx767.c
1261#endif /* ONDA_VX767 */ 1261#endif /* ONDA_VX767 */
1262
1263#if defined(LYRE_PROTO1)
1264target/arm/at91sam/lyre_proto1/adc-lyre_proto1.c
1265target/arm/at91sam/lyre_proto1/backlight-lyre_proto1.c
1266target/arm/at91sam/lyre_proto1/button-lyre_proto1.c
1267target/arm/at91sam/lyre_proto1/crt0.S
1268target/arm/at91sam/lyre_proto1/debug-lyre_proto1.c
1269target/arm/at91sam/lyre_proto1/kernel-lyre_proto1.c
1270target/arm/at91sam/lyre_proto1/lcd-lyre_proto1.c
1271target/arm/at91sam/lyre_proto1/system-lyre_proto1.c
1272target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c
1273#endif
1262#endif /* SIMULATOR */ 1274#endif /* SIMULATOR */
diff --git a/firmware/export/at91sam9260.h b/firmware/export/at91sam9260.h
new file mode 100644
index 0000000000..fa0b9d2d4f
--- /dev/null
+++ b/firmware/export/at91sam9260.h
@@ -0,0 +1,678 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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/* MATRIX_MRCR : (MATRIX Offset: 0x100) MRCR Register */
23#define AT91C_MATRIX_RCA926I (0x1 << 0) /* (MATRIX) Remap Command for
24ARM926EJ-S Instruction Master */
25#define AT91C_MATRIX_RCA926D (0x1 << 1) /* (MATRIX) Remap Command for
26ARM926EJ-S Data Master */
27
28/* Register definition for MATRIX peripheral */
29#define AT91C_MATRIX_MCFG0 (*(volatile unsigned long*) 0xFFFFEE00) /*(MATRIX)
30Master Configuration Register 0 (ram96k) */
31#define AT91C_MATRIX_MCFG7 (*(volatile unsigned long*) 0xFFFFEE1C) /*(MATRIX)
32Master Configuration Register 7 (teak_prog) */
33#define AT91C_MATRIX_SCFG1 (*(volatile unsigned long*) 0xFFFFEE44) /*(MATRIX)
34Slave Configuration Register 1 (rom) */
35#define AT91C_MATRIX_MCFG4 (*(volatile unsigned long*) 0xFFFFEE10) /*(MATRIX)
36Master Configuration Register 4 (bridge) */
37#define AT91C_MATRIX_VERSION (*(volatile unsigned long*) 0xFFFFEFFC) /*(MATRIX)
38Version Register */
39#define AT91C_MATRIX_MCFG2 (*(volatile unsigned long*) 0xFFFFEE08) /*(MATRIX)
40Master Configuration Register 2 (hperiphs) */
41#define AT91C_MATRIX_PRBS0 (*(volatile unsigned long*) 0xFFFFEE84) /*(MATRIX)
42PRBS0 (ram0) */
43#define AT91C_MATRIX_SCFG3 (*(volatile unsigned long*) 0xFFFFEE4C) /*(MATRIX)
44Slave Configuration Register 3 (ebi) */
45#define AT91C_MATRIX_MCFG6 (*(volatile unsigned long*) 0xFFFFEE18) /*(MATRIX)
46Master Configuration Register 6 (ram16k) */
47#define AT91C_MATRIX_EBI (*(volatile unsigned long*) 0xFFFFEF1C) /*(MATRIX)
48Slave 3 (ebi) Special Function Register */
49#define AT91C_MATRIX_SCFG0 (*(volatile unsigned long*) 0xFFFFEE40) /*(MATRIX)
50Slave Configuration Register 0 (ram96k) */
51#define AT91C_MATRIX_PRAS0 (*(volatile unsigned long*) 0xFFFFEE80) /*(MATRIX)
52PRAS0 (ram0) */
53#define AT91C_MATRIX_MCFG3 (*(volatile unsigned long*) 0xFFFFEE0C) /*(MATRIX)
54Master Configuration Register 3 (ebi) */
55#define AT91C_MATRIX_PRAS1 (*(volatile unsigned long*) 0xFFFFEE88) /*(MATRIX)
56PRAS1 (ram1) */
57#define AT91C_MATRIX_PRAS2 (*(volatile unsigned long*) 0xFFFFEE90) /*(MATRIX)
58PRAS2 (ram2) */
59#define AT91C_MATRIX_SCFG2 (*(volatile unsigned long*) 0xFFFFEE48) /*(MATRIX)
60Slave Configuration Register 2 (hperiphs) */
61#define AT91C_MATRIX_MCFG5 (*(volatile unsigned long*) 0xFFFFEE14) /*(MATRIX)
62Master Configuration Register 5 (mailbox) */
63#define AT91C_MATRIX_MCFG1 (*(volatile unsigned long*) 0xFFFFEE04) /*(MATRIX)
64Master Configuration Register 1 (rom) */
65#define AT91C_MATRIX_MRCR (*(volatile unsigned long*) 0xFFFFEF00) /*(MATRIX)
66Master Remp Control Register */
67#define AT91C_MATRIX_PRBS2 (*(volatile unsigned long*) 0xFFFFEE94) /*(MATRIX)
68PRBS2 (ram2) */
69#define AT91C_MATRIX_SCFG4 (*(volatile unsigned long*) 0xFFFFEE50) /*(MATRIX)
70Slave Configuration Register 4 (bridge) */
71#define AT91C_MATRIX_TEAKCFG (*(volatile unsigned long*) 0xFFFFEF2C) /*(MATRIX)
72Slave 7 (teak_prog) Special Function Register */
73#define AT91C_MATRIX_PRBS1 (*(volatile unsigned long*) 0xFFFFEE8C) /*(MATRIX)
74PRBS1 (ram1) */
75
76/* SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface */
77/* - WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register ---- */
78#define AT91C_WDTC_WDRSTT (0x1 << 0) /* (WDTC) Watchdog Restart */
79#define AT91C_WDTC_KEY (0xFF << 24) /* (WDTC) Watchdog KEY Password */
80/* -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- */
81#define AT91C_WDTC_WDV (0xFFF << 0) /* (WDTC) Watchdog Timer Restart */
82#define AT91C_WDTC_WDFIEN (0x1 << 12) /* (WDTC) Watchdog Fault Interrupt
83Enable */
84#define AT91C_WDTC_WDRSTEN (0x1 << 13) /* (WDTC) Watchdog Reset Enable */
85#define AT91C_WDTC_WDRPROC (0x1 << 14) /* (WDTC) Watchdog Timer Restart */
86#define AT91C_WDTC_WDDIS (0x1 << 15) /* (WDTC) Watchdog Disable */
87#define AT91C_WDTC_WDD (0xFFF << 16) /* (WDTC) Watchdog Delta Value */
88#define AT91C_WDTC_WDDBGHLT (0x1 << 28) /* (WDTC) Watchdog Debug Halt */
89#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) /* (WDTC) Watchdog Idle Halt */
90/* -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register ----- */
91#define AT91C_WDTC_WDUNF (0x1 << 0) /* (WDTC) Watchdog Underflow */
92#define AT91C_WDTC_WDERR (0x1 << 1) /* (WDTC) Watchdog Error */
93
94/* SOFTWARE API DEFINITION FOR Watchdog Timer Controller Interface */
95/* - WDTC_WDCR : (WDTC Offset: 0x0) Periodic Interval Image Register ---- */
96#define AT91C_WDTC_WDRSTT (0x1 << 0) /* (WDTC) Watchdog Restart */
97#define AT91C_WDTC_KEY (0xFF << 24) /* (WDTC) Watchdog KEY Password */
98/* -------- WDTC_WDMR : (WDTC Offset: 0x4) Watchdog Mode Register -------- */
99#define AT91C_WDTC_WDV (0xFFF << 0) /* (WDTC) Watchdog Timer Restart */
100#define AT91C_WDTC_WDFIEN (0x1 << 12) /* (WDTC) Watchdog Fault Interrupt
101Enable */
102#define AT91C_WDTC_WDRSTEN (0x1 << 13) /* (WDTC) Watchdog Reset Enable */
103#define AT91C_WDTC_WDRPROC (0x1 << 14) /* (WDTC) Watchdog Timer Restart */
104#define AT91C_WDTC_WDDIS (0x1 << 15) /* (WDTC) Watchdog Disable */
105#define AT91C_WDTC_WDD (0xFFF << 16) /* (WDTC) Watchdog Delta Value */
106#define AT91C_WDTC_WDDBGHLT (0x1 << 28) /* (WDTC) Watchdog Debug Halt */
107#define AT91C_WDTC_WDIDLEHLT (0x1 << 29) /* (WDTC) Watchdog Idle Halt */
108/* -------- WDTC_WDSR : (WDTC Offset: 0x8) Watchdog Status Register ----- */
109#define AT91C_WDTC_WDUNF (0x1 << 0) /* (WDTC) Watchdog Underflow */
110#define AT91C_WDTC_WDERR (0x1 << 1) /* (WDTC) Watchdog Error */
111
112/* Register definition for WDTC peripheral */
113#define AT91C_WDTC_WDCR (*(volatile unsigned long*) 0xFFFFFD40) /* (WDTC)
114Watchdog Control Register */
115#define AT91C_WDTC_WDSR (*(volatile unsigned long*) 0xFFFFFD48) /* (WDTC)
116Watchdog Status Register */
117#define AT91C_WDTC_WDMR (*(volatile unsigned long*) 0xFFFFFD44) /* (WDTC)
118Watchdog Mode Register */
119
120/* CKGR_MOR : (CKGR Offset: 0x0) Main Oscillator Register */
121#define AT91C_CKGR_MOSCEN (0x1 << 0) /* (CKGR) Main Oscillator Enable */
122#define AT91C_CKGR_OSCBYPASS (0x1 << 1) /* (CKGR) Main Oscillator Bypass */
123#define AT91C_CKGR_OSCOUNT (0xFF << 8) /* (CKGR) Main Oscillator Start
124-up Time */
125/* CKGR_MCFR : (CKGR Offset: 0x4) Main Clock Frequency Register */
126#define AT91C_CKGR_MAINF (0xFFFF << 0) /* (CKGR) Main Clock Frequency */
127#define AT91C_CKGR_MAINRDY (0x1 << 16) /* (CKGR) Main Clock Ready */
128/* CKGR_PLLAR : (CKGR Offset: 0x8) PLL A Register */
129#define AT91C_CKGR_DIVA (0xFF << 0) /* (CKGR) Divider A Selected */
130#define AT91C_CKGR_DIVA_0 (0x0) /* (CKGR) Divider A output is 0 */
131#define AT91C_CKGR_DIVA_BYPASS (0x1) /* (CKGR) Divider A is bypassed */
132#define AT91C_CKGR_PLLACOUNT (0x3F << 8) /* (CKGR) PLL A Counter */
133#define AT91C_CKGR_OUTA (0x3 << 14) /* (CKGR) PLL A Output Frequency Range */
134#define AT91C_CKGR_OUTA_0 (0x0 << 14) /* (CKGR) Please
135refer to the PLLA datasheet */
136#define AT91C_CKGR_OUTA_1 (0x1 << 14) /* (CKGR) Please
137refer to the PLLA datasheet */
138#define AT91C_CKGR_OUTA_2 (0x2 << 14) /* (CKGR) Please
139refer to the PLLA datasheet */
140#define AT91C_CKGR_OUTA_3 (0x3 << 14) /* (CKGR) Please
141refer to the PLLA datasheet */
142#define AT91C_CKGR_MULA (0x7FF << 16) /* (CKGR) PLL A Multiplier */
143#define AT91C_CKGR_SRCA (0x1 << 29) /* (CKGR) */
144/* CKGR_PLLBR : (CKGR Offset: 0xc) PLL B Register */
145#define AT91C_CKGR_DIVB (0xFF << 0) /* (CKGR) Divider B Selected */
146#define AT91C_CKGR_DIVB_0 (0x0) /* (CKGR) Divider B output is 0 */
147#define AT91C_CKGR_DIVB_BYPASS (0x1) /* (CKGR) Divider B is bypassed */
148#define AT91C_CKGR_PLLBCOUNT (0x3F << 8) /* (CKGR) PLL B Counter */
149#define AT91C_CKGR_OUTB (0x3 << 14) /* (CKGR) PLL B Output Frequency Range */
150#define AT91C_CKGR_OUTB_0 (0x0 << 14) /* (CKGR) Please
151refer to the PLLB datasheet */
152#define AT91C_CKGR_OUTB_1 (0x1 << 14) /* (CKGR) Please
153refer to the PLLB datasheet */
154#define AT91C_CKGR_OUTB_2 (0x2 << 14) /* (CKGR) Please
155refer to the PLLB datasheet */
156#define AT91C_CKGR_OUTB_3 (0x3 << 14) /* (CKGR) Please
157refer to the PLLB datasheet */
158#define AT91C_CKGR_MULB (0x7FF << 16) /* (CKGR) PLL B Multiplier */
159#define AT91C_CKGR_USBDIV (0x3 << 28) /* (CKGR) Divider for USB Clocks */
160#define AT91C_CKGR_USBDIV_0 (0x0 << 28) /* (CKGR)
161Divider output is PLL clock output */
162#define AT91C_CKGR_USBDIV_1 (0x1 << 28) /* (CKGR)
163Divider output is PLL clock output divided by 2 */
164#define AT91C_CKGR_USBDIV_2 (0x2 << 28) /* (CKGR)
165Divider output is PLL clock output divided by 4 */
166
167/* SOFTWARE API DEFINITION FOR Power Management Controler */
168/* -------- PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register ----- */
169#define AT91C_PMC_PCK (0x1 << 0) /* (PMC) Processor Clock */
170#define AT91C_PMC_UHP (0x1 << 6) /* (PMC) USB Host Port Clock */
171#define AT91C_PMC_UDP (0x1 << 7) /* (PMC) USB Device Port Clock */
172#define AT91C_PMC_PCK0 (0x1 << 8) /* (PMC) Programmable Clock Output */
173#define AT91C_PMC_PCK1 (0x1 << 9) /* (PMC) Programmable Clock Output */
174#define AT91C_PMC_HCK0 (0x1 << 16) /* (PMC) AHB UHP Clock Output */
175#define AT91C_PMC_HCK1 (0x1 << 17) /* (PMC) AHB LCDC Clock Output */
176/* -------- PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register ----- */
177 /* -------- PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register ----- */
178 /* -------- CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register -------- */
179 /* -------- CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register--- */
180 /* -------- CKGR_PLLAR : (PMC Offset: 0x28) PLL A Register -------- */
181 /* -------- CKGR_PLLBR : (PMC Offset: 0x2c) PLL B Register -------- */
182 /* -------- PMC_MCKR : (PMC Offset: 0x30) Master Clock Register -------- */
183 #define AT91C_PMC_CSS (0x3 << 0) /* (PMC) Programmable Clock Selection */
184 #define AT91C_PMC_CSS_SLOW_CLK (0x0) /* (PMC) Slow Clock is selected */
185 #define AT91C_PMC_CSS_MAIN_CLK (0x1) /* (PMC) Main Clock is selected */
186 #define AT91C_PMC_CSS_PLLA_CLK (0x2) /* (PMC) Clock from PLL A is selected */
187 #define AT91C_PMC_CSS_PLLB_CLK (0x3) /* (PMC) Clock from PLL B is selected */
188 #define AT91C_PMC_PRES (0x7 << 2) /* (PMC) Programmable Clock Prescaler */
189 #define AT91C_PMC_PRES_CLK (0x0 << 2) /* (PMC) Selected clock */
190 #define AT91C_PMC_PRES_CLK_2 (0x1 << 2) /* (PMC) Selected clock
191 divided by 2 */
192 #define AT91C_PMC_PRES_CLK_4 (0x2 << 2) /* (PMC) Selected clock
193 divided by 4 */
194 #define AT91C_PMC_PRES_CLK_8 (0x3 << 2) /* (PMC) Selected clock
195 divided by 8 */
196 #define AT91C_PMC_PRES_CLK_16 (0x4 << 2) /* (PMC) Selected clock
197 divided by 16 */
198 #define AT91C_PMC_PRES_CLK_32 (0x5 << 2) /* (PMC) Selected clock
199 divided by 32 */
200 #define AT91C_PMC_PRES_CLK_64 (0x6 << 2) /* (PMC) Selected clock
201 divided by 64 */
202 #define AT91C_PMC_MDIV (0x3 << 8) /* (PMC) Master Clock Divisionv */
203 #define AT91C_PMC_MDIV_1 (0x0 << 8) /* (PMC) The master clock and the
204 processor clock are the same */
205 #define AT91C_PMC_MDIV_2 (0x1 << 8) /* (PMC) The processor clock is twice
206 as fast as the master clock */
207 #define AT91C_PMC_MDIV_3 (0x2 << 8) /* (PMC) The processor clock is four
208 times faster than the master clock */
209 /* -------- PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register ----- */
210 /* -------- PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register ---- */
211 #define AT91C_PMC_MOSCS (0x1 << 0) /* (PMC) MOSC Status/Enable/Disable/Mask*/
212 #define AT91C_PMC_LOCKA (0x1 << 1) /* (PMC) PLL A Status/Enable/Disable/
213 Mask */
214 #define AT91C_PMC_LOCKB (0x1 << 2) /* (PMC) PLL B Status/Enable/Disable/
215 Mask */
216 #define AT91C_PMC_MCKRDY (0x1 << 3) /* (PMC) Master Clock Status/Enable/
217 Disable/Mask */
218 #define AT91C_PMC_PCK0RDY (0x1 << 8) /* (PMC) PCK0_RDY Status/Enable/
219 Disable/Mask */
220 #define AT91C_PMC_PCK1RDY (0x1 << 9) /* (PMC) PCK1_RDY Status/Enable/
221 Disable/Mask */
222 /* ---PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register -------- */
223 /* ------ PMC_SR : (PMC Offset: 0x68) PMC Status Register -------- */
224 #define AT91C_PMC_OSCSEL (0x1 << 7) /* (PMC) 32kHz Oscillator
225 selection status */
226 /* -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register ---- */
227
228/* SOFTWARE API DEFINITION FOR Advanced Interrupt Controller */
229/* -------- AIC_SMR : (AIC Offset: 0x0) Control Register -------- */
230#define AT91C_AIC_PRIOR (0x7 << 0) /* (AIC) Priority Level */
231#define AT91C_AIC_PRIOR_LOWEST (0x0) /* (AIC) Lowest priority
232 level */
233#define AT91C_AIC_PRIOR_HIGHEST (0x7) /* (AIC) Highest
234 priority level */
235#define AT91C_AIC_SRCTYPE (0x3 << 5) /* (AIC) Interrupt Source Type */
236#define AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE (0x0 << 5) /* (AIC)
237 Internal Sources Code Label Level Sensitive */
238#define AT91C_AIC_SRCTYPE_INT_EDGE_TRIGGERED (0x1 << 5) /* (AIC)
239 Internal Sources Code Label Edge triggered */
240#define AT91C_AIC_SRCTYPE_EXT_HIGH_LEVEL (0x2 << 5) /* (AIC)
241 External Sources Code Label High-level Sensitive */
242#define AT91C_AIC_SRCTYPE_EXT_POSITIVE_EDGE (0x3 << 5) /* (AIC)
243 External Sources Code Label Positive Edge triggered */
244/* - AIC_CISR : (AIC Offset: 0x114) AIC Core Interrupt Status Register ----- */
245#define AT91C_AIC_NFIQ (0x1 << 0) /* (AIC) NFIQ Status */
246#define AT91C_AIC_NIRQ (0x1 << 1) /* (AIC) NIRQ Status */
247/* - AIC_DCR : (AIC Offset: 0x138) AIC Debug Control Register (Protect) ---- */
248#define AT91C_AIC_DCR_PROT (0x1 << 0) /* (AIC) Protection Mode */
249#define AT91C_AIC_DCR_GMSK (0x1 << 1) /* (AIC) General Mask */
250
251/* Register definition for AIC peripheral */
252#define AT91C_AIC_IVR (*(volatile unsigned long*) 0xFFFFF100) /* (AIC) IRQ
253Vector Register */
254#define AIC_IVR 0x00000100
255/* (AIC) Source Mode Register */
256#define AT91C_AIC_SMR(a) (*(volatile unsigned long*) (0xFFFFF000 + 4*(a)))
257#define AT91C_AIC_FVR (*(volatile unsigned long*) 0xFFFFF104) /* (AIC) FIQ
258Vector Register */
259#define AT91C_AIC_DCR (*(volatile unsigned long*) 0xFFFFF138) /* (AIC) Debug
260Control Register (Protect) */
261#define AT91C_AIC_EOICR (*(volatile unsigned long*) 0xFFFFF130) /* (AIC) End
262of Interrupt Command Register */
263#define AIC_EOICR 0x00000130
264/* (AIC) Source Vector Register */
265#define AT91C_AIC_SVR(a) (*(volatile unsigned long*) (0xFFFFF080 + 4*(a)))
266#define AT91C_AIC_FFSR (*(volatile unsigned long*) 0xFFFFF148) /* (AIC) Fast
267Forcing Status Register */
268#define AT91C_AIC_ICCR (*(volatile unsigned long*) 0xFFFFF128) /* (AIC)
269Interrupt Clear Command Register */
270#define AT91C_AIC_ISR (*(volatile unsigned long*) 0xFFFFF108) /* (AIC)
271Interrupt Status Register */
272#define AT91C_AIC_IMR (*(volatile unsigned long*) 0xFFFFF110) /* (AIC)
273Interrupt Mask Register */
274#define AT91C_AIC_IPR (*(volatile unsigned long*) 0xFFFFF10C) /* (AIC)
275Interrupt Pending Register */
276#define AT91C_AIC_FFER (*(volatile unsigned long*) 0xFFFFF140) /* (AIC)
277Fast Forcing Enable Register */
278#define AT91C_AIC_IECR (*(volatile unsigned long*) 0xFFFFF120) /* (AIC)
279Interrupt Enable Command Register */
280#define AT91C_AIC_ISCR (*(volatile unsigned long*) 0xFFFFF12C) /* (AIC)
281Interrupt Set Command Register */
282#define AT91C_AIC_FFDR (*(volatile unsigned long*) 0xFFFFF144) /* (AIC)
283Fast Forcing Disable Register */
284#define AT91C_AIC_CISR (*(volatile unsigned long*) 0xFFFFF114) /* (AIC)
285Core Interrupt Status Register */
286#define AT91C_AIC_IDCR (*(volatile unsigned long*) 0xFFFFF124) /* (AIC)
287Interrupt Disable Command Register */
288#define AT91C_AIC_SPU (*(volatile unsigned long*) 0xFFFFF134) /* (AIC)
289Spurious Vector Register */
290
291/* SOFTWARE API DEFINITION FOR Periodic Interval Timer Controller Interface */
292/* PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register -------- */
293#define AT91C_PITC_PIV (0xFFFFF << 0) /* (PITC) Periodic Interval
294Value */
295#define AT91C_PITC_PITEN (0x1 << 24) /* (PITC) Periodic Interval Timer
296Enabled */
297#define AT91C_PITC_PITIEN (0x1 << 25) /* (PITC) Periodic Interval Timer
298Interrupt Enable */
299/* --- PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register - */
300#define AT91C_PITC_PITS (0x1 << 0) /* (PITC) Periodic Interval Timer
301Status */
302/* - PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register ---- */
303#define AT91C_PITC_CPIV (0xFFFFF << 0) /* (PITC) Current Periodic
304Interval Value */
305#define AT91C_PITC_PICNT (0xFFF << 20) /* (PITC) Periodic Interval Counter */
306/* PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register ---- */
307
308/* Register definition for AIC peripheral */
309#define AT91C_AIC_IVR (*(volatile unsigned long*) 0xFFFFF100) /* (AIC) IRQ
310Vector Register */
311#define AIC_IVR 0x00000100
312#define AT91C_AIC_EOICR (*(volatile unsigned long*) 0xFFFFF130) /* (AIC) End
313of Interrupt Command Register */
314#define AIC_EOICR 0x00000130
315
316/* Register definition for PIOA peripheral */
317#define AT91C_PIOA_ODR (*(volatile unsigned long*) 0xFFFFF414) /* (PIOA)
318Output Disable Registerr */
319#define AT91C_PIOA_SODR (*(volatile unsigned long*) 0xFFFFF430) /* (PIOA)
320Set Output Data Register */
321#define AT91C_PIOA_ISR (*(volatile unsigned long*) 0xFFFFF44C) /* (PIOA)
322Interrupt Status Register */
323#define AT91C_PIOA_ABSR (*(volatile unsigned long*) 0xFFFFF478) /* (PIOA)
324AB Select Status Register */
325#define AT91C_PIOA_IER (*(volatile unsigned long*) 0xFFFFF440) /* (PIOA)
326Interrupt Enable Register */
327#define AT91C_PIOA_PPUDR (*(volatile unsigned long*) 0xFFFFF460) /* (PIOA)
328Pull-up Disable Register */
329#define AT91C_PIOA_IMR (*(volatile unsigned long*) 0xFFFFF448) /* (PIOA)
330Interrupt Mask Register */
331#define AT91C_PIOA_PER (*(volatile unsigned long*) 0xFFFFF400) /* (PIOA)
332PIO Enable Register */
333#define AT91C_PIOA_IFDR (*(volatile unsigned long*) 0xFFFFF424) /* (PIOA)
334Input Filter Disable Register */
335#define AT91C_PIOA_OWDR (*(volatile unsigned long*) 0xFFFFF4A4) /* (PIOA)
336Output Write Disable Register */
337#define AT91C_PIOA_MDSR (*(volatile unsigned long*) 0xFFFFF458) /* (PIOA)
338Multi-driver Status Register */
339#define AT91C_PIOA_IDR (*(volatile unsigned long*) 0xFFFFF444) /* (PIOA)
340Interrupt Disable Register */
341#define AT91C_PIOA_ODSR (*(volatile unsigned long*) 0xFFFFF438) /* (PIOA)
342Output Data Status Register */
343#define AT91C_PIOA_PPUSR (*(volatile unsigned long*) 0xFFFFF468) /* (PIOA)
344Pull-up Status Register */
345#define AT91C_PIOA_OWSR (*(volatile unsigned long*) 0xFFFFF4A8) /* (PIOA)
346Output Write Status Register */
347#define AT91C_PIOA_BSR (*(volatile unsigned long*) 0xFFFFF474) /* (PIOA)
348Select B Register */
349#define AT91C_PIOA_OWER (*(volatile unsigned long*) 0xFFFFF4A0) /* (PIOA)
350Output Write Enable Register */
351#define AT91C_PIOA_IFER (*(volatile unsigned long*) 0xFFFFF420) /* (PIOA)
352Input Filter Enable Register */
353#define AT91C_PIOA_PDSR (*(volatile unsigned long*) 0xFFFFF43C) /* (PIOA)
354Pin Data Status Register */
355#define AT91C_PIOA_PPUER (*(volatile unsigned long*) 0xFFFFF464) /* (PIOA)
356Pull-up Enable Register */
357#define AT91C_PIOA_OSR (*(volatile unsigned long*) 0xFFFFF418) /* (PIOA)
358Output Status Register */
359#define AT91C_PIOA_ASR (*(volatile unsigned long*) 0xFFFFF470) /* (PIOA)
360Select A Register */
361#define AT91C_PIOA_MDDR (*(volatile unsigned long*) 0xFFFFF454) /* (PIOA)
362Multi-driver Disable Register */
363#define AT91C_PIOA_CODR (*(volatile unsigned long*) 0xFFFFF434) /* (PIOA)
364Clear Output Data Register */
365#define AT91C_PIOA_MDER (*(volatile unsigned long*) 0xFFFFF450) /* (PIOA)
366Multi-driver Enable Register */
367#define AT91C_PIOA_PDR (*(volatile unsigned long*) 0xFFFFF404) /* (PIOA)
368PIO Disable Register */
369#define AT91C_PIOA_IFSR (*(volatile unsigned long*) 0xFFFFF428) /* (PIOA)
370Input Filter Status Register */
371#define AT91C_PIOA_OER (*(volatile unsigned long*) 0xFFFFF410) /* (PIOA)
372Output Enable Register */
373#define AT91C_PIOA_PSR (*(volatile unsigned long*) 0xFFFFF408) /* (PIOA)
374PIO Status Register */
375
376/* Register definition for PIOB peripheral */
377#define AT91C_PIOB_OWDR (*(volatile unsigned long*) 0xFFFFF6A4) /* (PIOB)
378Output Write Disable Register */
379#define AT91C_PIOB_MDER (*(volatile unsigned long*) 0xFFFFF650) /* (PIOB)
380Multi-driver Enable Register */
381#define AT91C_PIOB_PPUSR (*(volatile unsigned long*) 0xFFFFF668) /* (PIOB)
382Pull-up Status Register */
383#define AT91C_PIOB_IMR (*(volatile unsigned long*) 0xFFFFF648) /* (PIOB)
384Interrupt Mask Register */
385#define AT91C_PIOB_ASR (*(volatile unsigned long*) 0xFFFFF670) /* (PIOB)
386Select A Register */
387#define AT91C_PIOB_PPUDR (*(volatile unsigned long*) 0xFFFFF660) /* (PIOB)
388Pull-up Disable Register */
389#define AT91C_PIOB_PSR (*(volatile unsigned long*) 0xFFFFF608) /* (PIOB)
390PIO Status Register */
391#define AT91C_PIOB_IER (*(volatile unsigned long*) 0xFFFFF640) /* (PIOB)
392Interrupt Enable Register */
393#define AT91C_PIOB_CODR (*(volatile unsigned long*) 0xFFFFF634) /* (PIOB)
394Clear Output Data Register */
395#define AT91C_PIOB_OWER (*(volatile unsigned long*) 0xFFFFF6A0) /* (PIOB)
396Output Write Enable Register */
397#define AT91C_PIOB_ABSR (*(volatile unsigned long*) 0xFFFFF678) /* (PIOB)
398AB Select Status Register */
399#define AT91C_PIOB_IFDR (*(volatile unsigned long*) 0xFFFFF624) /* (PIOB)
400Input Filter Disable Register */
401#define AT91C_PIOB_PDSR (*(volatile unsigned long*) 0xFFFFF63C) /* (PIOB)
402Pin Data Status Register */
403#define AT91C_PIOB_IDR (*(volatile unsigned long*) 0xFFFFF644) /* (PIOB)
404Interrupt Disable Register */
405#define AT91C_PIOB_OWSR (*(volatile unsigned long*) 0xFFFFF6A8) /* (PIOB)
406Output Write Status Register */
407#define AT91C_PIOB_PDR (*(volatile unsigned long*) 0xFFFFF604) /* (PIOB)
408PIO Disable Register */
409#define AT91C_PIOB_ODR (*(volatile unsigned long*) 0xFFFFF614) /* (PIOB)
410Output Disable Registerr */
411#define AT91C_PIOB_IFSR (*(volatile unsigned long*) 0xFFFFF628) /* (PIOB)
412Input Filter Status Register */
413#define AT91C_PIOB_PPUER (*(volatile unsigned long*) 0xFFFFF664) /* (PIOB)
414Pull-up Enable Register */
415#define AT91C_PIOB_SODR (*(volatile unsigned long*) 0xFFFFF630) /* (PIOB)
416Set Output Data Register */
417#define AT91C_PIOB_ISR (*(volatile unsigned long*) 0xFFFFF64C) /* (PIOB)
418Interrupt Status Register */
419#define AT91C_PIOB_ODSR (*(volatile unsigned long*) 0xFFFFF638) /* (PIOB)
420Output Data Status Register */
421#define AT91C_PIOB_OSR (*(volatile unsigned long*) 0xFFFFF618) /* (PIOB)
422Output Status Register */
423#define AT91C_PIOB_MDSR (*(volatile unsigned long*) 0xFFFFF658) /* (PIOB)
424Multi-driver Status Register */
425#define AT91C_PIOB_IFER (*(volatile unsigned long*) 0xFFFFF620) /* (PIOB)
426Input Filter Enable Register */
427#define AT91C_PIOB_BSR (*(volatile unsigned long*) 0xFFFFF674) /* (PIOB)
428Select B Register */
429#define AT91C_PIOB_MDDR (*(volatile unsigned long*) 0xFFFFF654) /* (PIOB)
430Multi-driver Disable Register */
431#define AT91C_PIOB_OER (*(volatile unsigned long*) 0xFFFFF610) /* (PIOB)
432Output Enable Register */
433#define AT91C_PIOB_PER (*(volatile unsigned long*) 0xFFFFF600) /* (PIOB)
434PIO Enable Register */
435
436/* Register definition for PIOC peripheral */
437#define AT91C_PIOC_OWDR (*(volatile unsigned long*) 0xFFFFF8A4) /* (PIOC)
438Output Write Disable Register */
439#define AT91C_PIOC_SODR (*(volatile unsigned long*) 0xFFFFF830) /* (PIOC)
440Set Output Data Register */
441#define AT91C_PIOC_PPUER (*(volatile unsigned long*) 0xFFFFF864) /* (PIOC)
442Pull-up Enable Register */
443#define AT91C_PIOC_CODR (*(volatile unsigned long*) 0xFFFFF834) /* (PIOC)
444Clear Output Data Register */
445#define AT91C_PIOC_PSR (*(volatile unsigned long*) 0xFFFFF808) /* (PIOC)
446PIO Status Register */
447#define AT91C_PIOC_PDR (*(volatile unsigned long*) 0xFFFFF804) /* (PIOC)
448PIO Disable Register */
449#define AT91C_PIOC_ODR (*(volatile unsigned long*) 0xFFFFF814) /* (PIOC)
450Output Disable Register */
451#define AT91C_PIOC_PPUSR (*(volatile unsigned long*) 0xFFFFF868) /* (PIOC)
452Pull-up Status Register */
453#define AT91C_PIOC_ABSR (*(volatile unsigned long*) 0xFFFFF878) /* (PIOC)
454AB Select Status Register */
455#define AT91C_PIOC_IFSR (*(volatile unsigned long*) 0xFFFFF828) /* (PIOC)
456Input Filter Status Register */
457#define AT91C_PIOC_OER (*(volatile unsigned long*) 0xFFFFF810) /* (PIOC)
458Output Enable Register */
459#define AT91C_PIOC_IMR (*(volatile unsigned long*) 0xFFFFF848) /* (PIOC)
460Interrupt Mask Register */
461#define AT91C_PIOC_ASR (*(volatile unsigned long*) 0xFFFFF870) /* (PIOC)
462Select A Register */
463#define AT91C_PIOC_MDDR (*(volatile unsigned long*) 0xFFFFF854) /* (PIOC)
464Multi-driver Disable Register */
465#define AT91C_PIOC_OWSR (*(volatile unsigned long*) 0xFFFFF8A8) /* (PIOC)
466Output Write Status Register */
467#define AT91C_PIOC_PER (*(volatile unsigned long*) 0xFFFFF800) /* (PIOC)
468PIO Enable Register */
469#define AT91C_PIOC_IDR (*(volatile unsigned long*) 0xFFFFF844) /* (PIOC)
470Interrupt Disable Register */
471#define AT91C_PIOC_MDER (*(volatile unsigned long*) 0xFFFFF850) /* (PIOC)
472Multi-driver Enable Register */
473#define AT91C_PIOC_PDSR (*(volatile unsigned long*) 0xFFFFF83C) /* (PIOC)
474Pin Data Status Register */
475#define AT91C_PIOC_MDSR (*(volatile unsigned long*) 0xFFFFF858) /* (PIOC)
476Multi-driver Status Register */
477#define AT91C_PIOC_OWER (*(volatile unsigned long*) 0xFFFFF8A0) /* (PIOC)
478Output Write Enable Register */
479#define AT91C_PIOC_BSR (*(volatile unsigned long*) 0xFFFFF874) /* (PIOC)
480Select B Register */
481#define AT91C_PIOC_PPUDR (*(volatile unsigned long*) 0xFFFFF860) /* (PIOC)
482Pull-up Disable Register */
483#define AT91C_PIOC_IFDR (*(volatile unsigned long*) 0xFFFFF824) /* (PIOC)
484Input Filter Disable Register */
485#define AT91C_PIOC_IER (*(volatile unsigned long*) 0xFFFFF840) /* (PIOC)
486Interrupt Enable Register */
487#define AT91C_PIOC_OSR (*(volatile unsigned long*) 0xFFFFF818) /* (PIOC)
488Output Status Register */
489#define AT91C_PIOC_ODSR (*(volatile unsigned long*) 0xFFFFF838) /* (PIOC)
490Output Data Status Register */
491#define AT91C_PIOC_ISR (*(volatile unsigned long*) 0xFFFFF84C) /* (PIOC)
492Interrupt Status Register */
493#define AT91C_PIOC_IFER (*(volatile unsigned long*) 0xFFFFF820) /* (PIOC)
494Input Filter Enable Register */
495
496/* Register definition for PMC peripheral */
497#define AT91C_PMC_PCER (*(volatile unsigned long*) 0xFFFFFC10) /* (PMC)
498Peripheral Clock Enable Register */
499#define AT91C_PMC_PCKR (*(volatile unsigned long*) 0xFFFFFC40) /* (PMC)
500Programmable Clock Register */
501#define AT91C_PMC_MCKR (*(volatile unsigned long*) 0xFFFFFC30) /* (PMC)
502Master Clock Register */
503#define AT91C_PMC_PLLAR (*(volatile unsigned long*) 0xFFFFFC28) /* (PMC)
504PLL A Register */
505#define AT91C_PMC_PCDR (*(volatile unsigned long*) 0xFFFFFC14) /* (PMC)
506Peripheral Clock Disable Register */
507#define AT91C_PMC_SCSR (*(volatile unsigned long*) 0xFFFFFC08) /* (PMC)
508System Clock Status Register */
509#define AT91C_PMC_MCFR (*(volatile unsigned long*) 0xFFFFFC24) /* (PMC)
510Main Clock Frequency Register */
511#define AT91C_PMC_IMR (*(volatile unsigned long*) 0xFFFFFC6C) /* (PMC)
512Interrupt Mask Register */
513#define AT91C_PMC_IER (*(volatile unsigned long*) 0xFFFFFC60) /* (PMC)
514Interrupt Enable Register */
515#define AT91C_PMC_MOR (*(volatile unsigned long *) 0xFFFFFC20) /* (PMC)
516Main Oscillator Register */
517#define AT91C_PMC_IDR (*(volatile unsigned long *) 0xFFFFFC64) /* (PMC)
518Interrupt Disable Register */
519#define AT91C_PMC_PLLBR (*(volatile unsigned long*) 0xFFFFFC2C) /* (PMC)
520PLL B Register */
521#define AT91C_PMC_SCDR (*(volatile unsigned long*) 0xFFFFFC04) /* (PMC)
522System Clock Disable Register */
523#define AT91C_PMC_PCSR (*(volatile unsigned long*) 0xFFFFFC18) /* (PMC)
524Peripheral Clock Status Register */
525#define AT91C_PMC_SCER (*(volatile unsigned long*) 0xFFFFFC00) /* (PMC)
526System Clock Enable Register */
527#define AT91C_PMC_SR (*(volatile unsigned long*) 0xFFFFFC68) /* (PMC)
528Status Register */
529
530/* Register definition for PITC peripheral */
531#define AT91C_PITC_PIVR (*(volatile unsigned long*) 0xFFFFFD38) /* (PITC)
532Period Interval Value Register */
533#define AT91C_PITC_PISR (*(volatile unsigned long*) 0xFFFFFD34) /* (PITC)
534Period Interval Status Register */
535#define AT91C_PITC_PIIR (*(volatile unsigned long*) 0xFFFFFD3C) /* (PITC)
536Period Interval Image Register */
537#define AT91C_PITC_PIMR (*(volatile unsigned long*) 0xFFFFFD30) /* (PITC)
538Period Interval Mode Register */
539
540/* PIO DEFINITIONS FOR AT91SAM9260 */
541#define AT91C_PIO_PA0 (1 << 0) /* Pin Controlled by PA0 */
542#define AT91C_PIO_PA1 (1 << 1) /* Pin Controlled by PA1 */
543#define AT91C_PIO_PA10 (1 << 10) /* Pin Controlled by PA10 */
544#define AT91C_PIO_PA11 (1 << 11) /* Pin Controlled by PA11 */
545#define AT91C_PIO_PA12 (1 << 12) /* Pin Controlled by PA12 */
546#define AT91C_PIO_PA13 (1 << 13) /* Pin Controlled by PA13 */
547#define AT91C_PIO_PA14 (1 << 14) /* Pin Controlled by PA14 */
548#define AT91C_PIO_PA15 (1 << 15) /* Pin Controlled by PA15 */
549#define AT91C_PIO_PA16 (1 << 16) /* Pin Controlled by PA16 */
550#define AT91C_PIO_PA17 (1 << 17) /* Pin Controlled by PA17 */
551#define AT91C_PIO_PA18 (1 << 18) /* Pin Controlled by PA18 */
552#define AT91C_PIO_PA19 (1 << 19) /* Pin Controlled by PA19 */
553#define AT91C_PIO_PA2 (1 << 2) /* Pin Controlled by PA2 */
554#define AT91C_PIO_PA20 (1 << 20) /* Pin Controlled by PA20 */
555#define AT91C_PIO_PA21 (1 << 21) /* Pin Controlled by PA21 */
556#define AT91C_PIO_PA22 (1 << 22) /* Pin Controlled by PA22 */
557#define AT91C_PIO_PA23 (1 << 23) /* Pin Controlled by PA23 */
558#define AT91C_PIO_PA24 (1 << 24) /* Pin Controlled by PA24 */
559#define AT91C_PIO_PA25 (1 << 25) /* Pin Controlled by PA25 */
560#define AT91C_PIO_PA26 (1 << 26) /* Pin Controlled by PA26 */
561#define AT91C_PIO_PA27 (1 << 27) /* Pin Controlled by PA27 */
562#define AT91C_PIO_PA28 (1 << 28) /* Pin Controlled by PA28 */
563#define AT91C_PIO_PA29 (1 << 29) /* Pin Controlled by PA29 */
564#define AT91C_PIO_PA3 (1 << 3) /* Pin Controlled by PA3 */
565#define AT91C_PIO_PA30 (1 << 30) /* Pin Controlled by PA30 */
566#define AT91C_PIO_PA31 (1 << 31) /* Pin Controlled by PA31 */
567#define AT91C_PIO_PA4 (1 << 4) /* Pin Controlled by PA4 */
568#define AT91C_PIO_PA5 (1 << 5) /* Pin Controlled by PA5 */
569#define AT91C_PIO_PA6 (1 << 6) /* Pin Controlled by PA6 */
570#define AT91C_PIO_PA7 (1 << 7) /* Pin Controlled by PA7 */
571#define AT91C_PIO_PA8 (1 << 8) /* Pin Controlled by PA8 */
572#define AT91C_PIO_PA9 (1 << 9) /* Pin Controlled by PA9 */
573#define AT91C_PIO_PB0 (1 << 0) /* Pin Controlled by PB0 */
574#define AT91C_PIO_PB1 (1 << 1) /* Pin Controlled by PB1 */
575#define AT91C_PIO_PB10 (1 << 10) /* Pin Controlled by PB10 */
576#define AT91C_PIO_PB11 (1 << 11) /* Pin Controlled by PB11 */
577#define AT91C_PIO_PB12 (1 << 12) /* Pin Controlled by PB12 */
578#define AT91C_PIO_PB13 (1 << 13) /* Pin Controlled by PB13 */
579#define AT91C_PIO_PB14 (1 << 14) /* Pin Controlled by PB14 */
580#define AT91C_PIO_PB15 (1 << 15) /* Pin Controlled by PB15 */
581#define AT91C_PIO_PB16 (1 << 16) /* Pin Controlled by PB16 */
582#define AT91C_PIO_PB17 (1 << 17) /* Pin Controlled by PB17 */
583#define AT91C_PIO_PB18 (1 << 18) /* Pin Controlled by PB18 */
584#define AT91C_PIO_PB19 (1 << 19) /* Pin Controlled by PB19 */
585#define AT91C_PIO_PB2 (1 << 2) /* Pin Controlled by PB2 */
586#define AT91C_PIO_PB20 (1 << 20) /* Pin Controlled by PB20 */
587#define AT91C_PIO_PB21 (1 << 21) /* Pin Controlled by PB21 */
588#define AT91C_PIO_PB22 (1 << 22) /* Pin Controlled by PB22 */
589#define AT91C_PIO_PB23 (1 << 23) /* Pin Controlled by PB23 */
590#define AT91C_PIO_PB24 (1 << 24) /* Pin Controlled by PB24 */
591#define AT91C_PIO_PB25 (1 << 25) /* Pin Controlled by PB25 */
592#define AT91C_PIO_PB26 (1 << 26) /* Pin Controlled by PB26 */
593#define AT91C_PIO_PB27 (1 << 27) /* Pin Controlled by PB27 */
594#define AT91C_PIO_PB28 (1 << 28) /* Pin Controlled by PB28 */
595#define AT91C_PIO_PB29 (1 << 29) /* Pin Controlled by PB29 */
596#define AT91C_PIO_PB3 (1 << 3) /* Pin Controlled by PB3 */
597#define AT91C_PIO_PB30 (1 << 30) /* Pin Controlled by PB30 */
598#define AT91C_PIO_PB31 (1 << 31) /* Pin Controlled by PB31 */
599#define AT91C_PIO_PB4 (1 << 4) /* Pin Controlled by PB4 */
600#define AT91C_PIO_PB5 (1 << 5) /* Pin Controlled by PB5 */
601#define AT91C_PIO_PB6 (1 << 6) /* Pin Controlled by PB6 */
602#define AT91C_PIO_PB7 (1 << 7) /* Pin Controlled by PB7 */
603#define AT91C_PIO_PB8 (1 << 8) /* Pin Controlled by PB8 */
604#define AT91C_PIO_PB9 (1 << 9) /* Pin Controlled by PB9 */
605#define AT91C_PIO_PC0 (1 << 0) /* Pin Controlled by PC0 */
606#define AT91C_PIO_PC1 (1 << 1) /* Pin Controlled by PC1 */
607#define AT91C_PIO_PC10 (1 << 10) /* Pin Controlled by PC10 */
608#define AT91C_PIO_PC11 (1 << 11) /* Pin Controlled by PC11 */
609#define AT91C_PIO_PC12 (1 << 12) /* Pin Controlled by PC12 */
610#define AT91C_PIO_PC13 (1 << 13) /* Pin Controlled by PC13 */
611#define AT91C_PIO_PC14 (1 << 14) /* Pin Controlled by PC14 */
612#define AT91C_PIO_PC15 (1 << 15) /* Pin Controlled by PC15 */
613#define AT91C_PIO_PC16 (1 << 16) /* Pin Controlled by PC16 */
614#define AT91C_PIO_PC17 (1 << 17) /* Pin Controlled by PC17 */
615#define AT91C_PIO_PC18 (1 << 18) /* Pin Controlled by PC18 */
616#define AT91C_PIO_PC19 (1 << 19) /* Pin Controlled by PC19 */
617#define AT91C_PIO_PC2 (1 << 2) /* Pin Controlled by PC2 */
618#define AT91C_PIO_PC20 (1 << 20) /* Pin Controlled by PC20 */
619#define AT91C_PIO_PC21 (1 << 21) /* Pin Controlled by PC21 */
620#define AT91C_PIO_PC22 (1 << 22) /* Pin Controlled by PC22 */
621#define AT91C_PIO_PC23 (1 << 23) /* Pin Controlled by PC23 */
622#define AT91C_PIO_PC24 (1 << 24) /* Pin Controlled by PC24 */
623#define AT91C_PIO_PC25 (1 << 25) /* Pin Controlled by PC25 */
624#define AT91C_PIO_PC26 (1 << 26) /* Pin Controlled by PC26 */
625#define AT91C_PIO_PC27 (1 << 27) /* Pin Controlled by PC27 */
626#define AT91C_PIO_PC28 (1 << 28) /* Pin Controlled by PC28 */
627#define AT91C_PIO_PC29 (1 << 29) /* Pin Controlled by PC29 */
628#define AT91C_PIO_PC3 (1 << 3) /* Pin Controlled by PC3 */
629#define AT91C_PIO_PC30 (1 << 30) /* Pin Controlled by PC30 */
630#define AT91C_PIO_PC31 (1 << 31) /* Pin Controlled by PC31 */
631#define AT91C_PIO_PC4 (1 << 4) /* Pin Controlled by PC4 */
632#define AT91C_PIO_PC5 (1 << 5) /* Pin Controlled by PC5 */
633#define AT91C_PIO_PC6 (1 << 6) /* Pin Controlled by PC6 */
634#define AT91C_PIO_PC7 (1 << 7) /* Pin Controlled by PC7 */
635#define AT91C_PIO_PC8 (1 << 8) /* Pin Controlled by PC8 */
636#define AT91C_PIO_PC9 (1 << 9) /* Pin Controlled by PC9 */
637
638/* PERIPHERAL ID DEFINITIONS FOR AT91SAM9260 */
639#define AT91C_ID_FIQ ( 0) /* Advanced Interrupt Controller (FIQ) */
640#define AT91C_ID_SYS ( 1) /* System Controller */
641#define AT91C_ID_PIOA ( 2) /* Parallel IO Controller A */
642#define AT91C_ID_PIOB ( 3) /* Parallel IO Controller B */
643#define AT91C_ID_PIOC ( 4) /* Parallel IO Controller C */
644#define AT91C_ID_ADC ( 5) /* ADC */
645#define AT91C_ID_US0 ( 6) /* USART 0 */
646#define AT91C_ID_US1 ( 7) /* USART 1 */
647#define AT91C_ID_US2 ( 8) /* USART 2 */
648#define AT91C_ID_MCI ( 9) /* Multimedia Card Interface 0 */
649#define AT91C_ID_UDP (10) /* USB Device Port */
650#define AT91C_ID_TWI (11) /* Two-Wire Interface */
651#define AT91C_ID_SPI0 (12) /* Serial Peripheral Interface 0 */
652#define AT91C_ID_SPI1 (13) /* Serial Peripheral Interface 1 */
653#define AT91C_ID_SSC0 (14) /* Serial Synchronous Controller 0 */
654#define AT91C_ID_TC0 (17) /* Timer Counter 0 */
655#define AT91C_ID_TC1 (18) /* Timer Counter 1 */
656#define AT91C_ID_TC2 (19) /* Timer Counter 2 */
657#define AT91C_ID_UHP (20) /* USB Host Port */
658#define AT91C_ID_EMAC (21) /* Ethernet Mac */
659#define AT91C_ID_HISI (22) /* Image Sensor Interface */
660#define AT91C_ID_US3 (23) /* USART 3 */
661#define AT91C_ID_US4 (24) /* USART 4 */
662#define AT91C_ID_US5 (25) /* USART 5 */
663#define AT91C_ID_TC3 (26) /* Timer Counter 3 */
664#define AT91C_ID_TC4 (27) /* Timer Counter 4 */
665#define AT91C_ID_TC5 (28) /* Timer Counter 5 */
666#define AT91C_ID_IRQ0 (29) /* Advanced Interrupt Controller (IRQ0) */
667#define AT91C_ID_IRQ1 (30) /* Advanced Interrupt Controller (IRQ1) */
668#define AT91C_ID_IRQ2 (31) /* Advanced Interrupt Controller (IRQ2) */
669#define AT91C_ALL_INT (0xFFFE7FFF) /* ALL VALID INTERRUPTS */
670
671/* MEMORY MAPPING DEFINITIONS FOR AT91SAM9260 */
672#define AT91C_IRAM_1 (0x00200000) /* Maximum IRAM_1 Area : 4Kbyte
673base address */
674#define AT91C_IRAM_1_SIZE (0x00001000) /* Maximum IRAM_1 Area : 4Kbyte size
675 in byte (4 Kbytes) */
676#define AT91C_EBI_SDRAM_32BIT (0x20000000) /* SDRAM on EBI Chip Select 1
677base address */
678#define AT91C_BASE_AIC 0xFFFFF000 /* (AIC) Base Address */
diff --git a/firmware/export/config-lyre_proto1.h b/firmware/export/config-lyre_proto1.h
new file mode 100644
index 0000000000..58a9350bb9
--- /dev/null
+++ b/firmware/export/config-lyre_proto1.h
@@ -0,0 +1,100 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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/*
23 * This config file is for the Lyre prototype 1.
24 */
25#define TARGET_TREE /* this target is using the target tree system */
26
27#define CONFIG_SDRAM_START 0x20000000
28
29/* For Rolo and boot loader */
30#define MODEL_NUMBER 130
31
32/* define this if the flash memory uses the
33 * SecureDigital Memory Card protocol */
34#define CONFIG_STORAGE STORAGE_SD
35#define HAVE_FLASH_STORAGE
36
37/* define this if you have a bitmap LCD display */
38#define HAVE_LCD_BITMAP
39
40/* define this if you have a colour LCD */
41#define HAVE_LCD_COLOR
42
43#define CONFIG_LCD LCD_LYRE_PROTO1
44
45/* LCD dimensions */
46#define LCD_WIDTH 128
47#define LCD_HEIGHT 128
48/* The LCD used is just rgb444, 64 colours. We do a bit conversion on LCD
49 * drivers. */
50#define LCD_DEPTH 16 /* 65536 colours */
51#define LCD_PIXELFORMAT RGB565 /* rgb565 */
52
53#define HAVE_ALBUMART
54
55#define CONFIG_KEYPAD LYRE_PROTO1_PAD
56
57/* Define this if you do software codec */
58#define CONFIG_CODEC SWCODEC
59
60/* The number of bytes reserved for loadable codecs */
61#define CODEC_SIZE 0x100000
62
63/* The number of bytes reserved for loadable plugins */
64#define PLUGIN_BUFFER_SIZE 0x100000
65
66/* Lyre prototype 1 do not use I2C, just SPI */
67#define CONFIG_I2C I2C_NONE
68
69/* Define this if you have the TLV320 audio codec -> controlled by the DSP */
70#define HAVE_TLV320
71
72/* TLV320 has no tone controls, so we use the software ones */
73#define HAVE_SW_TONE_CONTROLS
74
75#define BATTERY_CAPACITY_DEFAULT 1100 /* default battery capacity */
76#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
77#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */
78#define BATTERY_CAPACITY_INC 100 /* capacity increment */
79#define BATTERY_TYPES_COUNT 1 /* only one type */
80
81#ifndef SIMULATOR
82
83#define CONFIG_CPU AT91SAM9260
84
85/* Define this to the CPU frequency */
86#define CPU_FREQ 198656000
87#define MCK_FREQ 99328000
88#define SLOW_CLOCK 32768
89
90/* Offset ( in the firmware file's header ) to the file CRC */
91#define FIRMWARE_OFFSET_FILE_CRC 0
92
93/* Offset ( in the firmware file's header ) to the real data */
94#define FIRMWARE_OFFSET_FILE_DATA 8
95
96#define BOOTFILE_EXT "lyre_proto1"
97#define BOOTFILE "rockbox." BOOTFILE_EXT
98#define BOOTDIR "/.rockbox"
99
100#endif
diff --git a/firmware/export/config.h b/firmware/export/config.h
index d7375ddaac..45dd5d2394 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -69,6 +69,7 @@
69#define S5L8700 8700 69#define S5L8700 8700
70#define JZ4732 4732 70#define JZ4732 4732
71#define AS3525 3525 71#define AS3525 3525
72#define AT91SAM9260 9260
72 73
73/* CONFIG_KEYPAD */ 74/* CONFIG_KEYPAD */
74#define PLAYER_PAD 1 75#define PLAYER_PAD 1
@@ -107,6 +108,7 @@
107#define MEIZU_M3_PAD 34 108#define MEIZU_M3_PAD 34
108#define SANSA_CLIP_PAD 35 109#define SANSA_CLIP_PAD 35
109#define SANSA_FUZE_PAD 36 110#define SANSA_FUZE_PAD 36
111#define LYRE_PROTO1_PAD 37
110 112
111/* CONFIG_REMOTE_KEYPAD */ 113/* CONFIG_REMOTE_KEYPAD */
112#define H100_REMOTE 1 114#define H100_REMOTE 1
@@ -145,7 +147,7 @@
145#define CHARGING_TARGET 3 /* Any algorithm - usually software controlled 147#define CHARGING_TARGET 3 /* Any algorithm - usually software controlled
146 * charging or specific programming is required to 148 * charging or specific programming is required to
147 * use the charging hardware. */ 149 * use the charging hardware. */
148 150
149/* CONFIG_LCD */ 151/* CONFIG_LCD */
150#define LCD_SSD1815 1 /* as used by Archos Recorders and Ondios */ 152#define LCD_SSD1815 1 /* as used by Archos Recorders and Ondios */
151#define LCD_SSD1801 2 /* as used by Archos Player/Studio */ 153#define LCD_SSD1801 2 /* as used by Archos Player/Studio */
@@ -181,6 +183,7 @@
181#define LCD_ONDAVX767 30 /* as used by the Onda VX767 */ 183#define LCD_ONDAVX767 30 /* as used by the Onda VX767 */
182#define LCD_SSD1303 31 /* as used by the Sansa Clip */ 184#define LCD_SSD1303 31 /* as used by the Sansa Clip */
183#define LCD_FUZE 32 /* as used by the Sansa Fuze */ 185#define LCD_FUZE 32 /* as used by the Sansa Fuze */
186#define LCD_LYRE_PROTO1 33 /* as used by the Lyre */
184 187
185/* LCD_PIXELFORMAT */ 188/* LCD_PIXELFORMAT */
186#define HORIZONTAL_PACKING 1 189#define HORIZONTAL_PACKING 1
@@ -196,6 +199,8 @@
196#define SCREEN_SQUARE 2 199#define SCREEN_SQUARE 2
197 200
198/* CONFIG_I2C */ 201/* CONFIG_I2C */
202#define I2C_NONE 0 /* For targets that do not use I2C - as the
203Lyre prototype 1*/
199#define I2C_PLAYREC 1 /* Archos Player/Recorder style */ 204#define I2C_PLAYREC 1 /* Archos Player/Recorder style */
200#define I2C_ONDIO 2 /* Ondio style */ 205#define I2C_ONDIO 2 /* Ondio style */
201#define I2C_COLDFIRE 3 /* Coldfire style */ 206#define I2C_COLDFIRE 3 /* Coldfire style */
@@ -356,6 +361,8 @@
356#include "config-fuze.h" 361#include "config-fuze.h"
357#elif defined(SANSA_C200V2) 362#elif defined(SANSA_C200V2)
358#include "config-c200v2.h" 363#include "config-c200v2.h"
364#elif defined(LYRE_PROTO1)
365#include "config-lyre_proto1.h"
359#else 366#else
360/* no known platform */ 367/* no known platform */
361#endif 368#endif
@@ -535,7 +542,7 @@
535#endif /* BOOTLOADER */ 542#endif /* BOOTLOADER */
536 543
537#if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \ 544#if defined(HAVE_USBSTACK) || (CONFIG_CPU == JZ4732) \
538 || (CONFIG_CPU == AS3525) || (CONFIG_CPU == S3C2440) 545 || (CONFIG_CPU == AS3525) || (CONFIG_CPU == S3C2440)
539#define HAVE_WAKEUP_OBJECTS 546#define HAVE_WAKEUP_OBJECTS
540#endif 547#endif
541 548
@@ -580,7 +587,8 @@
580#define ARM_ARCH 6 /* ARMv6 */ 587#define ARM_ARCH 6 /* ARMv6 */
581#endif 588#endif
582 589
583#if defined(CPU_TCC77X) || defined(CPU_TCC780X) || (CONFIG_CPU == DM320) 590#if defined(CPU_TCC77X) || defined(CPU_TCC780X) || (CONFIG_CPU == DM320) \
591 || (CONFIG_CPU == AT91SAM9260)
584#define CPU_ARM 592#define CPU_ARM
585#define ARM_ARCH 5 /* ARMv5 */ 593#define ARM_ARCH 5 /* ARMv5 */
586#endif 594#endif
diff --git a/firmware/target/arm/at91sam/boot.lds b/firmware/target/arm/at91sam/boot.lds
new file mode 100644
index 0000000000..c638511e47
--- /dev/null
+++ b/firmware/target/arm/at91sam/boot.lds
@@ -0,0 +1,81 @@
1OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
2OUTPUT_ARCH(arm)
3ENTRY(reset_handler)
4STARTUP(target/arm/at91sam/lyre_proto1/crt0.o)
5
6#define DRAMSIZE (MEMORYSIZE * 0x100000)
7#define DRAMORIG 0x20000000
8#define IRAM0ORIG 0x200000
9#define IRAM0SIZE 4K
10#define IRAM1ORIG 0x300000
11#define IRAM1SIZE 4K
12#define STACKSIZE 2k
13
14MEMORY
15{
16 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
17 IRAM0 : ORIGIN = IRAM0ORIG, LENGTH = IRAM0SIZE
18}
19
20SECTIONS
21{
22 /* We will put Rockbox bootloader at the last 1MByte of the SDRAM. */
23
24 /* Example of a section:
25 * .section VMA(Virtual Memory Address) : LMA(Load Memory Address).
26 * VMA and LMA addresses can be verified by doing:
27 * "arm-elf-objdump -h bootloader.elf". */
28
29 .vectors 0 : AT (DRAMORIG + DRAMSIZE - 1M)
30 {
31 _start_vectors_section = .;
32 *(.vectors)
33 *(.glue_7)
34 *(.glue_7t)
35 . = ALIGN(4);
36 _end_vectors_section = .;
37 }
38
39 .text (DRAMORIG + DRAMSIZE -1M + SIZEOF(.vectors)) : \
40 AT (DRAMORIG + DRAMSIZE -1M + SIZEOF(.vectors))
41 {
42 *(.text)
43 *(.text*)
44 *(.icode)
45 *(.icode*)
46 *(.rodata)
47 *(.rodata*)
48 . = ALIGN(4);
49 }
50
51 /* Initialized variables are placed on SDRAM, right after .vectors section. */
52 /* Data section: VMA is the same as the LMA, right after the end of .vector */
53 .data . :
54 {
55 *(.data)
56 *(.data*)
57 . = ALIGN(4);
58 _end_data_section = .;
59 }
60
61 /* Uninitialized variables are placed at SDRAM, right after .text section. */
62 .bss (NOLOAD) :
63
64 {
65 _start_bss_section = .;
66 *(.bss) /* Bss section contains all uninitialized data generated by the compiler. */
67 *(.bss*)
68 *(COMMON)
69 . = ALIGN(4);
70 _end_bss_section = .;
71 }
72
73 /* Stack is placed at SDRAM, right after .bss section. */
74 .stack . :
75 {
76 *(.stack)
77 stackbegin = .;
78 . += STACKSIZE;
79 stackend = .;
80 }
81}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/adc-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/adc-lyre_proto1.c
new file mode 100644
index 0000000000..3734d6d1b1
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/adc-lyre_proto1.c
@@ -0,0 +1,31 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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
22void adc_init(void)
23{
24}
25
26/* Called to get the recent ADC reading */
27inline unsigned short adc_read(int channel)
28{
29 (void)channel;
30 return 0;
31}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/adc-target.h b/firmware/target/arm/at91sam/lyre_proto1/adc-target.h
new file mode 100644
index 0000000000..3712e476ea
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/adc-target.h
@@ -0,0 +1,28 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 _ADC_TARGET_H_
23#define _ADC_TARGET_H_
24
25void adc_init(void);
26inline unsigned short adc_read(int channel);
27
28#endif
diff --git a/firmware/target/arm/at91sam/lyre_proto1/backlight-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/backlight-lyre_proto1.c
new file mode 100644
index 0000000000..fabf8aa041
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/backlight-lyre_proto1.c
@@ -0,0 +1,45 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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
22void _backlight_set_brightness(int brightness)
23{
24 (void)brightness;
25}
26
27void _backlight_on(void)
28{
29
30}
31
32void _backlight_off(void)
33{
34
35}
36
37void _buttonlight_on(void)
38{
39
40}
41
42void _buttonlight_off(void)
43{
44
45}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/backlight-target.h b/firmware/target/arm/at91sam/lyre_proto1/backlight-target.h
new file mode 100644
index 0000000000..f4e253abbe
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/backlight-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 BACKLIGHT_TARGET_H
23#define BACKLIGHT_TARGET_H
24
25
26#endif
diff --git a/firmware/target/arm/at91sam/lyre_proto1/button-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/button-lyre_proto1.c
new file mode 100644
index 0000000000..2d38803115
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/button-lyre_proto1.c
@@ -0,0 +1,99 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 "at91sam9260.h"
23#include "button.h"
24
25#define BUTTON_01 AT91C_PIO_PB4
26#define BUTTON_02 AT91C_PIO_PB5
27#define BUTTON_03 AT91C_PIO_PB27
28#define BUTTON_04 AT91C_PIO_PB26
29#define BUTTON_05 AT91C_PIO_PB25
30#define BUTTON_06 AT91C_PIO_PB24
31#define BUTTON_07 AT91C_PIO_PB22
32#define BUTTON_08 AT91C_PIO_PB23
33
34void button_init_device(void)
35{
36 /* Enable the periph clock for the PIO controller */
37 /* This is mandatory when PIO are configured as input */
38 AT91C_PMC_PCER = (1 << AT91C_ID_PIOB);
39
40 /* Set the PIO line in input */
41 AT91C_PIOB_ODR = (BUTTON_01 |
42 BUTTON_02 |
43 BUTTON_03 |
44 BUTTON_04 |
45 BUTTON_05 |
46 BUTTON_06 |
47 BUTTON_07 |
48 BUTTON_08);
49
50 /* Set the PIO controller in PIO mode instead of peripheral mode */
51 AT91C_PIOB_PER = (BUTTON_01 |
52 BUTTON_02 |
53 BUTTON_03 |
54 BUTTON_04 |
55 BUTTON_05 |
56 BUTTON_06 |
57 BUTTON_07 |
58 BUTTON_08);
59}
60
61bool button_hold(void)
62{
63 return (0);
64}
65
66/*
67 * Get button pressed from hardware
68 */
69int button_read_device(void)
70{
71 uint32_t buttons = AT91C_PIOB_PDSR;
72 uint32_t ret = 0;
73
74 if ((buttons & BUTTON_01) == 0)
75 ret |= BUTTON_UP;
76
77 if ((buttons & BUTTON_02) == 0)
78 ret |= BUTTON_RIGHT;
79
80 if ((buttons & BUTTON_03) == 0)
81 ret |= BUTTON_PLAY;
82
83 if ((buttons & BUTTON_04) == 0)
84 ret |= BUTTON_SELECT;
85
86 if ((buttons & BUTTON_05) == 0)
87 ret |= BUTTON_LEFT;
88
89 if ((buttons & BUTTON_06) == 0)
90 ret |= BUTTON_DOWN;
91
92 if ((buttons & BUTTON_07) == 0)
93 ret |= BUTTON_STOP;
94
95 if ((buttons & BUTTON_08) == 0)
96 ret |= BUTTON_MENU;
97
98 return ret;
99}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/button-target.h b/firmware/target/arm/at91sam/lyre_proto1/button-target.h
new file mode 100644
index 0000000000..e05f9f294f
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/button-target.h
@@ -0,0 +1,48 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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
28#define BUTTON_SELECT 0x00000001
29#define BUTTON_MENU 0x00000002
30#define BUTTON_PLAY 0x00000004
31#define BUTTON_STOP 0x00000008
32
33#define BUTTON_LEFT 0x00000010
34#define BUTTON_RIGHT 0x00000020
35#define BUTTON_UP 0x00000040
36#define BUTTON_DOWN 0x00000080
37
38#define BUTTON_MAIN (BUTTON_UP|BUTTON_DOWN|BUTTON_RIGHT|BUTTON_LEFT \
39 |BUTTON_SELECT|BUTTON_MENU|BUTTON_PLAY \
40 |BUTTON_STOP)
41bool button_hold(void);
42void button_init_device(void);
43int button_read_device(void);
44
45/* No Remote control */
46#define BUTTON_REMOTE 0
47
48#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/at91sam/lyre_proto1/crt0.S b/firmware/target/arm/at91sam/lyre_proto1/crt0.S
new file mode 100644
index 0000000000..0146a8409c
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/crt0.S
@@ -0,0 +1,274 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 "at91sam9260.h"
23
24#define DRAMORIG AT91C_EBI_SDRAM_32BIT
25#define DRAMSIZE (MEMORYSIZE * 0x100000)
26#define IRAM0ORIG AT91C_IRAM_1
27#define IRAM0SIZE AT91C_IRAM_1_SIZE
28#define TOP_OF_MEMORY (IRAM0ORIG + IRAM0SIZE)
29#define ABT_STACK_SIZE 8*3*4
30#define IRQ_STACK_SIZE 8*3*4
31
32#define ARM_MODE_ABT 0x17
33#define ARM_MODE_FIQ 0x11
34#define ARM_MODE_IRQ 0x12
35#define ARM_MODE_SVC 0x13
36
37#define I_BIT 0x80
38#define F_BIT 0x40
39
40
41/* Application startup entry point */
42.globl reset_handler
43
44.align 4
45
46.section .vectors
47.arm
48
49
50/* Exception vectors (should be a branch to be detected as a valid code
51 * by the rom) */
52_exception_vectors:
53reset_vector:
54 ldr pc, =reset_handler
55undef_vector:
56 b undef_vector /* Undefined Instruction */
57swi_vector:
58 b swi_vector /* Software Interrupt */
59pabt_vector:
60 ldr pc, =pabt_handler /* Prefetch Abort */
61dabt_vector:
62 ldr pc, =dabt_handler /* Data Abort */
63rsvd_vector:
64 b rsvd_vector /* reserved */
65irq_vector:
66 b irq_handler /* IRQ : read the AIC */
67fiq_vector:
68/*-----------------------------------------------------------------------------
69 *- Function : fiq_handler
70 *- Treatments : FIQ (Fast Interrupt) Interrupt Handler.
71 *- Called Functions :
72 *---------------------------------------------------------------------------*/
73fiq_handler:
74pabt_handler:
75dabt_handler:
76 b fiq_handler
77
78/*-----------------------------------------------------------------------------
79 *- Function : irq_handler
80 *- Treatments : IRQ Controller Interrupt Handler.
81 *- Called Functions : AIC_IVR[interrupt]
82 *---------------------------------------------------------------------------*/
83irq_handler:
84/*- Manage Exception Entry */
85/*- Adjust and save LR_irq in IRQ stack - (LR - Link Register) */
86 sub lr, lr, #4
87 stmfd sp!, {lr}
88/*- Save r0 and SPSR (Saved Program Status Register) in IRQ stack */
89 mrs r14, SPSR
90 stmfd sp!, {r0,r14}
91
92/*- Write in the IVR (Interrupt Vector Register) to support Protect Mode */
93/*- No effect in Normal Mode */
94/*- De-assert the NIRQ and clear the source in Protect Mode */
95 ldr r14, =AT91C_BASE_AIC
96 ldr r0 , [r14, #AIC_IVR]
97 str r14, [r14, #AIC_IVR]
98
99/*- Enable Interrupt and Switch in Supervisor Mode */
100 msr CPSR_c, #ARM_MODE_SVC
101
102/*- Save scratch/used registers and LR in User Stack */
103 stmfd sp!, {r1-r3, r12, r14}
104
105/*- Branch to the routine pointed by the AIC_IVR */
106 mov r14, pc
107 bx r0
108
109/*- Restore scratch/used registers and LR from User Stack */
110 ldmia sp!, {r1-r3, r12, r14}
111
112/*- Disable Interrupt and switch back in IRQ mode */
113 msr CPSR_c, #ARM_MODE_IRQ | I_BIT
114
115/*- Mark the End of Interrupt on the AIC */
116 ldr r14, =AT91C_BASE_AIC
117 str r14, [r14, #AIC_EOICR]
118
119/*- Restore SPSR_irq and r0 from IRQ stack */
120 ldmia sp!, {r0,r14}
121 msr SPSR_cxsf, r14
122
123/*- Restore adjusted LR_irq from IRQ stack directly in the PC */
124 ldmia sp!, {pc}^
125
126/*-----------------------------------------------------------------------------
127 *- Function : reset_handler
128 *- Treatments : Reset Interrupt Handler.
129 *- Called Functions : lowlevel_init
130 * main
131 *---------------------------------------------------------------------------*/
132.section .text
133reset_handler:
134/*-----------------------------------------------------------------------------
135 *- Low level Init is performed in a C function: lowlevel_init
136 *- Init Stack Pointer to a valid memory area before calling lowlevel_init
137 *
138 * Put Stack Pointer on end of IRAM 1 and branches to lowlevel_init function.
139 *---------------------------------------------------------------------------*/
140/*- Temporary stack in internal RAM for Low Level Init execution */
141_low_level_init:
142 ldr r2, =_litteral_pool_lowlevel_init /* Load r2 with the address of
143 * _litteral_pool_lowlevel_init
144 */
145 ldmia r2, {r0, r1} /* r0 = lowlevel_init and r1 = TOP_OF_MEMORY */
146 mov sp, r1 /* sp (Stack Pointer) = TOP_OF_MEMORY (end of IRAM 1) */
147 mov lr, pc /* lr (Link register) = pc (Program Counter) */
148 bx r0 /* Branch on C function (interworking) -- branch to
149 * lowlevel_init
150 */
151
152/*-----------------------------------------------------------------------------
153 *- Setup the stack for each mode
154 *
155 * Executes this code after returning from lowlevel_init fucntion.
156 * Configures Abort Mode Stack + Interrupt Mode Stack + Supervisor Mode Stack,
157 * reserves 3 blocks, one for each mode and they start at end of IRAM 1.
158 *---------------------------------------------------------------------------*/
159_stack_init:
160 ldr r2, =_litteral_pool_stack_init
161 ldmia r2, {r0, r1, r2} /* r0 = TOP_OF_MEMORY (end of IRAM 1);
162 * r1 = ABT_STACK_SIZE;
163 * r2 = IRQ_STACK_SIZE
164 */
165
166 /*- Set up Abort Mode and set ABT Mode Stack */
167 msr CPSR_c, #ARM_MODE_ABT | I_BIT | F_BIT /* Enter in Mode Abort
168 * and disable IRQ (Interrupt) and FIQ (Fast Interrupt)
169 */
170
171 mov sp, r0 /* sp (ABT Mode Stack Pointer) = TOP_OF_MEMORY
172 * (end of IRAM 1)
173 */
174
175 /* put r0 with value of the new address for next Stack */
176 sub r0, r0, r1 /* r0 = r0 - r1 --> r0 = (end of IRAM 1) -
177 * (ABT_STACK_SIZE)
178 */
179
180 /*- Set up Interrupt Mode and set IRQ Mode Stack */
181 msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* Enter in Mode Interrupt
182 * and disable IRQ (Interrupt) and FIQ (Fast Interrupt)
183 */
184
185 mov sp, r0 /* sp (Interrupt Mode Stack Pointer) =
186 * TOP_OF_MEMORY (end of IRAM 1) - (ABT_STACK_SIZE)
187 */
188
189 sub r0, r0, r2 /* Put on r0 the new address for next
190 * Stack (Supervisor Mode)
191 */
192
193/*- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack */
194 msr CPSR_c, #ARM_MODE_SVC | F_BIT
195 mov sp, r0
196
197/*-----------------------------------------------------------------------------
198 *- Segments initialization
199 *---------------------------------------------------------------------------*/
200/* Copy the vectors section code from the LMA address to the LVA address */
201_init_vectors:
202 ldr r1, =_litteral_pool_vectors /* Load r1 with the address of
203 * _litteral_pool_vectors
204 */
205 ldmia r1, {r2, r3, r4} /* r2 = DRAMORIG; r3 = _start_vectors_section;
206 * r4 = _end_vectors_section;
207 */
2081:
209 cmp r3, r4 /* Compare r3 with r4 (r3 - r4) */
210 ldrcc r5, [r2], #4 /* if (_start_vectors_section < _end_vectors_section)
211 * { r5 = [r2]; r2 = r2 + 4; }
212 */
213 strcc r5, [r3], #4 /* if (_start_vectors_section < _end_vectors_section)
214 * { [r3] = r5; r3 = r3 + 4; }
215 */
216 bcc 1b /* loop while (_start_vectors_section < _end_vectors_section) */
217
218/* Clear the bss segment */
219_init_bss:
220 ldr r2, =_litteral_pool_bss
221 ldmia r2, {r3, r4} /* r3 = _start_bss_section; r4 = _end_bss_section */
222 mov r2, #0 /* r2 = 0 */
2231:
224 cmp r3, r4 /* Compare --> (_start_bss_section - _end_bss_section) */
225 strcc r2, [r3], #4 /* if (_start_bss_section < _end_bss_section) {
226 * [r3] = 0; r3 = r3 + 4; }
227 */
228 bcc 1b /* loop while _start_bss_section < _end_bss_section */
229
230/* Set up some stack and munge it with 0xdeadbeef */
231 ldr sp, =stackend
232 mov r3, sp
233 ldr r2, =stackbegin
234 ldr r4, =0xdeadbeef
235
236stackmunge:
237 cmp r3, r2
238 strhi r4, [r2], #4
239 bhi stackmunge
240
241/*-----------------------------------------------------------------------------
242 *- Branch to the main
243 *---------------------------------------------------------------------------*/
244_branch_main:
245 ldr r0, =main
246 mov lr, pc
247 bx r0
248
249/*-----------------------------------------------------------------------------
250 *- Litteral pools
251 *---------------------------------------------------------------------------*/
252_litteral_pool_lowlevel_init:
253 .word lowlevel_init
254 .word TOP_OF_MEMORY /* Default SVC stack after power up */
255
256_litteral_pool_stack_init:
257 .word TOP_OF_MEMORY /* Top of the stack */
258 .word ABT_STACK_SIZE /* ABT stack size */
259 .word IRQ_STACK_SIZE /* IRQ stack size */
260
261_litteral_pool_bss:
262 .word _start_bss_section
263 .word _end_bss_section
264
265_litteral_pool_vectors:
266#if defined(BOOTLOADER)
267 .word (DRAMORIG + DRAMSIZE - 0x100000) /* LMA address of vectors are at
268 * end of DRAM minus 1MByte
269 */
270#else
271 .word DRAMORIG /* LMA address of vectors are at DRAMORIG */
272#endif
273 .word _start_vectors_section
274 .word _end_vectors_section
diff --git a/firmware/target/arm/at91sam/lyre_proto1/debug-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/debug-lyre_proto1.c
new file mode 100644
index 0000000000..54a262a9ff
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/debug-lyre_proto1.c
@@ -0,0 +1,34 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 "at91sam9260.h"
23#include <stdbool.h>
24#include "debug-target.h"
25
26bool __dbg_ports(void)
27{
28 return false;
29}
30
31bool __dbg_hw_info(void)
32{
33 return false;
34}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/debug-target.h b/firmware/target/arm/at91sam/lyre_proto1/debug-target.h
new file mode 100644
index 0000000000..140feafe67
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/debug-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 <stdbool.h>
23
24bool __dbg_ports(void);
25bool __dbg_hw_info(void);
26
diff --git a/firmware/target/arm/at91sam/lyre_proto1/kernel-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/kernel-lyre_proto1.c
new file mode 100644
index 0000000000..4d7167b3ba
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/kernel-lyre_proto1.c
@@ -0,0 +1,78 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 "config.h"
23#include "system.h"
24#include "kernel.h"
25#include "timer.h"
26#include "thread.h"
27#include "at91sam9260.h"
28
29/*-----------------------------------------------------------------------------
30 * Function Name : pitc_handler
31 * Object : Handler for PITC interrupt
32 *---------------------------------------------------------------------------*/
33void pitc_handler(void)
34{
35 unsigned long pivr = 0;
36 unsigned long pisr = 0;
37
38 /* Read the PISR */
39 pisr = AT91C_PITC_PISR & AT91C_PITC_PITS;
40
41 /* Read the PIVR. It acknowledges the IT */
42 pivr = AT91C_PITC_PIVR;
43
44 /* Run through the list of tick tasks */
45 call_tick_tasks();
46}
47
48void tick_start(unsigned int interval_in_ms)
49{
50 volatile unsigned long pimr = 0;
51
52 /* Configure a resolution of 1 ms */
53 AT91C_PITC_PIMR = MCK_FREQ / (((16 * 1000) - 1) / interval_in_ms);
54
55 /* Enable interrupts */
56 /* Disable the interrupt on the interrupt controller */
57 AT91C_AIC_IDCR = (1 << AT91C_ID_SYS);
58
59 /* Save the interrupt handler routine pointer and the interrupt priority */
60 AT91C_AIC_SVR(AT91C_ID_SYS) = (unsigned long) pitc_handler;
61
62 /* Store the Source Mode Register */
63 AT91C_AIC_SMR(AT91C_ID_SYS) = AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE | \
64 AT91C_AIC_PRIOR_LOWEST;
65 /* Clear the interrupt on the interrupt controller */
66 AT91C_AIC_ICCR = (1 << AT91C_ID_SYS);
67
68 /* Enable the interrupt on the interrupt controller */
69 AT91C_AIC_IECR = (1 << AT91C_ID_SYS);
70
71 /* Enable the interrupt on the pit */
72 pimr = AT91C_PITC_PIMR;
73 AT91C_PITC_PIMR = pimr | AT91C_PITC_PITIEN;
74
75 /* Enable the pit */
76 pimr = AT91C_PITC_PIMR;
77 AT91C_PITC_PIMR = pimr | AT91C_PITC_PITEN;
78}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/lcd-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/lcd-lyre_proto1.c
new file mode 100644
index 0000000000..3ace8e791d
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/lcd-lyre_proto1.c
@@ -0,0 +1,27 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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/* Update the display.
23 This must be called after all other LCD functions that change the display */
24void lcd_update(void)
25{
26
27}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/lcd-target.h b/firmware/target/arm/at91sam/lyre_proto1/lcd-target.h
new file mode 100644
index 0000000000..5008bd861d
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/lcd-target.h
@@ -0,0 +1,24 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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
22void lcd_update_rect(int x, int y, int width, int height);
23
24
diff --git a/firmware/target/arm/at91sam/lyre_proto1/system-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/system-lyre_proto1.c
new file mode 100644
index 0000000000..e91ef7a918
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/system-lyre_proto1.c
@@ -0,0 +1,150 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 Standard files */
23#include "at91sam9260.h"
24#include "debug-target.h"
25#include "config.h"
26
27/*-----------------------------------------------------------------------------
28 * Function Name : default_spurious_handler
29 * Object : default handler for spurious interrupt
30 *---------------------------------------------------------------------------*/
31void default_spurious_handler(void)
32{
33 while (1);
34}
35
36/*-----------------------------------------------------------------------------
37 * Function Name : default_fiq_handler
38 * Object : default handler for fast interrupt
39 *---------------------------------------------------------------------------*/
40void default_fiq_handler(void)
41{
42 while (1);
43}
44
45/*-----------------------------------------------------------------------------
46 * Function Name : default_irq_handler
47 * Object : default handler for irq
48 *---------------------------------------------------------------------------*/
49void default_irq_handler(void)
50{
51#if defined(BOOTLOADER)
52 while (1);
53#endif
54}
55
56/*-----------------------------------------------------------------------------
57 * Function Name : lowlevel_init
58 * Object : This function performs very low level HW initialization
59 * this function can use a Stack, depending the compilation
60 * optimization mode
61 *---------------------------------------------------------------------------*/
62void lowlevel_init(void)
63{
64 unsigned char i = 0;
65
66 /* void default_fiq_handler(void)
67 * Init PMC Step 1. Enable Main Oscillator
68 * Main Oscillator startup time is board specific:
69 * Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms
70 * (0x40 for AT91C_CKGR_OSCOUNT field)
71 */
72 AT91C_PMC_MOR = (((AT91C_CKGR_OSCOUNT & (0x40 << 8)) | AT91C_CKGR_MOSCEN));
73 /* Wait Main Oscillator stabilization */
74 while (!(AT91C_PMC_SR & AT91C_PMC_MOSCS));
75
76 /* Init PMC Step 2.
77 * Set PLLA to 198,608MHz
78 * PLL Startup time depends on PLL RC filter: worst case is choosen.
79 *
80 * Crystal frequency = 18.432MHz; PLLA = (18.432 * 96) / 9 = 198,608MHz.
81 */
82
83 AT91C_PMC_PLLAR = (1 << 29) |
84 (0x60 << 16) | /* MULA = 96 */
85 (0x2 << 14) |
86 (0x3f << 8) |
87 (0x09); /* DIVA = 9 */
88
89 /* Wait for PLLA stabilization */
90 while (!(AT91C_PMC_SR & AT91C_PMC_LOCKA));
91 /* Wait until the master clock is established for the case we already */
92 /* turn on the PLLA */
93 while (!(AT91C_PMC_SR & AT91C_PMC_MCKRDY));
94
95 /* Init PMC Step 3.
96 * Processor Clock = 198,608MHz (PLLA); Master clock =
97 * (198,608MHz (PLLA))/2 = 98,304MHz.
98 * The PMC_MCKR register must not be programmed in a single write operation
99 * (see. Product Errata Sheet)
100 */
101 AT91C_PMC_MCKR = AT91C_PMC_PRES_CLK | AT91C_PMC_MDIV_2;
102 /* Wait until the master clock is established */
103 while (!(AT91C_PMC_SR & AT91C_PMC_MCKRDY));
104
105 AT91C_PMC_MCKR |= AT91C_PMC_CSS_PLLA_CLK;
106 /* Wait until the master clock is established */
107 while (!(AT91C_PMC_SR & AT91C_PMC_MCKRDY));
108
109 /* Reset AIC: assign default handler for each interrupt source
110 */
111
112 /* Disable the interrupt on the interrupt controller */
113 AT91C_AIC_IDCR = (1 << AT91C_ID_SYS);
114
115 /* Assign default handler for each IRQ source */
116 AT91C_AIC_SVR(AT91C_ID_FIQ) = (int) default_fiq_handler;
117 for (i = 1; i < 31; i++)
118 {
119 AT91C_AIC_SVR(i) = (int) default_irq_handler;
120 }
121 AT91C_AIC_SPU = (unsigned int) default_spurious_handler;
122
123 /* Perform 8 IT acknoledge (write any value in EOICR) */
124
125/* The End of Interrupt Command Register (AIC_EOICR) must be written in order
126to indicate to the AIC that the current interrupt is finished. This causes the
127current level to be popped from the stack, restoring the previous current level
128if one exists on the stack. If another interrupt is pending, with lower or
129equal priority than the old current level but with higher priority than the new
130current level, the nIRQ line is re-asserted, but the interrupt sequence does
131not immediately start because the “I” bit is set in the core.
132SPSR_irq is restored. Finally, the saved value of the link register is restored
133directly into the PC. This has the effect of returning from the interrupt to
134whatever was being executed before, and of loading the CPSR with the stored
135SPSR, masking or unmasking the interrupts depending on the state saved in
136SPSR_irq. */
137 for (i = 0; i < 8 ; i++)
138 {
139 AT91C_AIC_EOICR = 0;
140 }
141
142 /* Enable the interrupt on the interrupt controller */
143 AT91C_AIC_IECR = (1 << AT91C_ID_SYS);
144
145 /* Disable Watchdog */
146 AT91C_WDTC_WDMR = AT91C_WDTC_WDDIS;
147
148 /* Remap */
149 AT91C_MATRIX_MRCR = AT91C_MATRIX_RCA926I | AT91C_MATRIX_RCA926D;
150}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/system-target.h b/firmware/target/arm/at91sam/lyre_proto1/system-target.h
new file mode 100644
index 0000000000..479614f634
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/system-target.h
@@ -0,0 +1,29 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 SYSTEM_TARGET_H
23#define SYSTEM_TARGET_H
24
25#include "system-arm.h"
26
27void system_init(void);
28
29#endif /* SYSTEM_TARGET_H */
diff --git a/firmware/target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c b/firmware/target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c
new file mode 100644
index 0000000000..5924438d10
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c
@@ -0,0 +1,123 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 "config.h"
23#include "cpu.h"
24#include "system.h"
25#include "timer.h"
26#include "logf.h"
27#include "at91sam9260.h"
28
29/*-----------------------------------------------------------------------------
30 * Function Name : pitc_handler
31 * Object : Handler for PITC interrupt
32 *---------------------------------------------------------------------------*/
33void pitc_handler(void)
34{
35 unsigned long pivr = 0;
36 unsigned long pisr = 0;
37
38 /* Read the PISR */
39 pisr = AT91C_PITC_PISR & AT91C_PITC_PITS;
40
41 if (pisr != 0)
42 {
43 /* Read the PIVR. It acknowledges the IT */
44 pivr = AT91C_PITC_PIVR;
45
46 if (pfn_timer != NULL)
47 pfn_timer();
48 }
49}
50
51bool __timer_set(long cycles, bool start)
52{
53 if (cycles < 1000) /* Max value on PITC?? */
54 {
55 if (start && pfn_unregister != NULL)
56 {
57 pfn_unregister();
58 pfn_unregister = NULL;
59 }
60
61 /* Configure a resolution of <cycles> ms */
62 AT91C_PITC_PIMR = MCK_FREQ / ( 16 * cycles) - 1;
63
64 return true;
65 }
66
67 return false;
68}
69
70bool __timer_register(void)
71{
72 bool retval = true;
73 volatile unsigned long pimr = 0;
74
75 /* Configure a resolution of 1 ms */
76 AT91C_PITC_PIMR = MCK_FREQ / (16 * 1000) - 1;
77
78 /* Enable interrupts */
79 /* Disable the interrupt on the interrupt controller */
80 AT91C_AIC_IDCR = (1 << AT91C_ID_SYS);
81
82 /* Save the interrupt handler routine pointer and the interrupt priority */
83 AT91C_AIC_SVR(AT91C_ID_SYS) = (unsigned long) pitc_handler;
84 /* Store the Source Mode Register */
85 AT91C_AIC_SMR(AT91C_ID_SYS) = AT91C_AIC_SRCTYPE_INT_LEVEL_SENSITIVE | \
86 AT91C_AIC_PRIOR_LOWEST;
87 /* Clear the interrupt on the interrupt controller */
88 AT91C_AIC_ICCR = (1 << AT91C_ID_SYS);
89
90 /* Enable the interrupt on the interrupt controller */
91 AT91C_AIC_IECR = (1 << AT91C_ID_SYS);
92
93 /* Enable the interrupt on the pit */
94 pimr = AT91C_PITC_PIMR;
95 AT91C_PITC_PIMR = pimr | AT91C_PITC_PITIEN;
96
97 /* Enable the pit */
98 pimr = AT91C_PITC_PIMR;
99 AT91C_PITC_PIMR = pimr | AT91C_PITC_PITEN;
100
101 return retval;
102}
103
104void __timer_unregister(void)
105{
106 volatile unsigned long pimr = 0;
107
108 /* Disable the interrupt on the interrupt controller */
109 AT91C_AIC_IDCR = (1 << AT91C_ID_SYS);
110
111 /* Clear the interrupt on the interrupt controller */
112 AT91C_AIC_ICCR = (1 << AT91C_ID_SYS);
113
114 /* Disable the interrupt on the pit */
115 pimr = AT91C_PITC_PIMR;
116 pimr &= ~AT91C_PITC_PITIEN;
117 AT91C_PITC_PIMR = pimr;
118
119 /* Disable the pit */
120 pimr = AT91C_PITC_PIMR;
121 pimr &= ~AT91C_PITC_PITEN;
122 AT91C_PITC_PIMR = pimr;
123}
diff --git a/firmware/target/arm/at91sam/lyre_proto1/timer-target.h b/firmware/target/arm/at91sam/lyre_proto1/timer-target.h
new file mode 100644
index 0000000000..d16577b0de
--- /dev/null
+++ b/firmware/target/arm/at91sam/lyre_proto1/timer-target.h
@@ -0,0 +1,42 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2009 by Jorge Pinto
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 TIMER_TARGET_H
23#define TIMER_TARGET_H
24
25/* timer is based on PCLK and minimum division is 2 */
26#define TIMER_FREQ (49156800/2)
27
28bool __timer_set(long cycles, bool set);
29bool __timer_register(void);
30void __timer_unregister(void);
31
32#define __TIMER_SET(cycles, set) \
33 __timer_set(cycles, set)
34
35#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
36 int_prio, timer_callback) \
37 __timer_register()
38
39#define __TIMER_UNREGISTER(...) \
40 __timer_unregister()
41
42#endif /* TIMER_TARGET_H */
diff --git a/tools/configure b/tools/configure
index 04954ccb35..b4400dd7fa 100755
--- a/tools/configure
+++ b/tools/configure
@@ -750,10 +750,9 @@ cat <<EOF
750 HDD1830 ==Logik== 750 HDD1830 ==Logik==
751 ==Onda== 80) DAX 1GB MP3/DAB 751 ==Onda== 80) DAX 1GB MP3/DAB
752 120) VX747 ==Meizu== 752 120) VX747 ==Meizu==
753 121) VX767 110) M6SL 753 121) VX767 110) M6SL ==Lyre project==
754 122) VX747+ 111) M6SP 754 122) VX747+ 111) M6SP 130) Lyre proto 1
755 112) M3 755 112) M3
756
757EOF 756EOF
758 757
759 buildfor=`input`; 758 buildfor=`input`;
@@ -2022,6 +2021,28 @@ fi
2022 t_manufacturer="ingenic_jz47xx" 2021 t_manufacturer="ingenic_jz47xx"
2023 t_model="onda_vx747" 2022 t_model="onda_vx747"
2024 ;; 2023 ;;
2024
2025 130|lyre_proto1)
2026 target_id=56
2027 modelname="lyre_proto1"
2028 target="-DLYRE_PROTO1"
2029 memory=64
2030 arm926ejscc
2031 tool="cp"
2032 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2033 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2034 output="rockbox.lyre"
2035 appextra="recorder:gui"
2036 plugins=""
2037 swcodec="yes"
2038 toolset=$scramblebitmaptools
2039 boottool="cp"
2040 bootoutput="bootloader-proto1.lyre"
2041 # architecture, manufacturer and model for the target-tree build
2042 t_cpu="arm"
2043 t_manufacturer="at91sam"
2044 t_model="lyre_proto1"
2045 ;;
2025 2046
2026 *) 2047 *)
2027 echo "Please select a supported target platform!" 2048 echo "Please select a supported target platform!"