diff options
Diffstat (limited to 'firmware')
20 files changed, 1182 insertions, 184 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index e31231c9ec..b91d49b7f7 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -274,6 +274,8 @@ drivers/audio/tlv320.c | |||
274 | drivers/audio/mas35xx.c | 274 | drivers/audio/mas35xx.c |
275 | #elif defined(HAVE_AK4537) | 275 | #elif defined(HAVE_AK4537) |
276 | drivers/audio/ak4537.c | 276 | drivers/audio/ak4537.c |
277 | #elif defined(HAVE_UDA1341) | ||
278 | drivers/audio/uda1341.c | ||
277 | #endif /* defined(HAVE_*) */ | 279 | #endif /* defined(HAVE_*) */ |
278 | #endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */ | 280 | #endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */ |
279 | 281 | ||
@@ -808,15 +810,15 @@ target/arm/usb-fw-pp502x.c | |||
808 | target/arm/lcd-as-memframe.S | 810 | target/arm/lcd-as-memframe.S |
809 | target/arm/mmu-arm.S | 811 | target/arm/mmu-arm.S |
810 | target/arm/s3c2440/debug-s3c2440.c | 812 | target/arm/s3c2440/debug-s3c2440.c |
813 | target/arm/s3c2440/kernel-s3c2440.c | ||
814 | target/arm/s3c2440/lcd-s3c2440.c | ||
815 | target/arm/s3c2440/system-s3c2440.c | ||
811 | target/arm/s3c2440/gigabeat-fx/adc-meg-fx.c | 816 | target/arm/s3c2440/gigabeat-fx/adc-meg-fx.c |
812 | target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c | 817 | target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c |
813 | target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c | 818 | target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c |
814 | target/arm/s3c2440/gigabeat-fx/button-meg-fx.c | 819 | target/arm/s3c2440/gigabeat-fx/button-meg-fx.c |
815 | target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c | ||
816 | target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | ||
817 | target/arm/s3c2440/gigabeat-fx/power-meg-fx.c | 820 | target/arm/s3c2440/gigabeat-fx/power-meg-fx.c |
818 | target/arm/s3c2440/gigabeat-fx/sc606-meg-fx.c | 821 | target/arm/s3c2440/gigabeat-fx/sc606-meg-fx.c |
819 | target/arm/s3c2440/gigabeat-fx/system-meg-fx.c | ||
820 | target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c | 822 | target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c |
821 | #ifndef BOOTLOADER | 823 | #ifndef BOOTLOADER |
822 | target/arm/s3c2440/gigabeat-fx/i2c-meg-fx.c | 824 | target/arm/s3c2440/gigabeat-fx/i2c-meg-fx.c |
@@ -1392,6 +1394,33 @@ target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c | |||
1392 | #endif | 1394 | #endif |
1393 | #endif /* SIMULATOR */ | 1395 | #endif /* SIMULATOR */ |
1394 | 1396 | ||
1397 | #if defined(MINI2440) | ||
1398 | #ifndef SIMULATOR | ||
1399 | target/arm/lcd-as-memframe.S | ||
1400 | target/arm/mmu-arm.S | ||
1401 | target/arm/s3c2440/debug-s3c2440.c | ||
1402 | target/arm/s3c2440/kernel-s3c2440.c | ||
1403 | target/arm/s3c2440/lcd-s3c2440.c | ||
1404 | target/arm/s3c2440/system-s3c2440.c | ||
1405 | target/arm/s3c2440/mini2440/backlight-mini2440.c | ||
1406 | target/arm/s3c2440/mini2440/button-mini2440.c | ||
1407 | target/arm/s3c2440/mini2440/led-mini2440.c | ||
1408 | target/arm/s3c2440/mini2440/power-mini2440.c | ||
1409 | #ifdef BOOTLOADER | ||
1410 | /*target/arm/s3c2440/mini2440/mini2440_test.c*/ | ||
1411 | #endif | ||
1412 | #ifndef BOOTLOADER | ||
1413 | target/arm/s3c2440/mini2440/adc-mini2440.c | ||
1414 | target/arm/s3c2440/mini2440/i2c-mini2440.c | ||
1415 | target/arm/s3c2440/mini2440/pcm-mini2440.c | ||
1416 | target/arm/s3c2440/mini2440/powermgmt-mini2440.c | ||
1417 | target/arm/s3c2440/mini2440/power-mini2440.c | ||
1418 | target/arm/s3c2440/mini2440/timer-mini2440.c | ||
1419 | target/arm/s3c2440/mini2440/usb-mini2440.c | ||
1420 | #endif | ||
1421 | #endif /* SIMULATOR */ | ||
1422 | #endif /* MINI2440 */ | ||
1423 | |||
1395 | #ifdef SAMSUNG_YH820 | 1424 | #ifdef SAMSUNG_YH820 |
1396 | #ifndef SIMULATOR | 1425 | #ifndef SIMULATOR |
1397 | target/arm/ata-as-arm.S | 1426 | target/arm/ata-as-arm.S |
diff --git a/firmware/export/config-mini2440.h b/firmware/export/config-mini2440.h new file mode 100644 index 0000000000..0db027c7a0 --- /dev/null +++ b/firmware/export/config-mini2440.h | |||
@@ -0,0 +1,150 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2009 by Bob Cousins, Lyre Project | ||
10 | * Copyright (C) 2009 by Jorge Pinto, Lyre Project | ||
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 Mini2440 | ||
24 | */ | ||
25 | #define TARGET_TREE /* this target is using the target tree system */ | ||
26 | |||
27 | /* For Rolo and boot loader */ | ||
28 | #define MODEL_NUMBER 131 | ||
29 | #define MODEL_NAME "Mini2440" | ||
30 | |||
31 | /***************************************************************************/ | ||
32 | /* Hardware Config */ | ||
33 | |||
34 | /* TODO: ??? */ | ||
35 | #define CONFIG_SDRAM_START 0x30000000 | ||
36 | |||
37 | /* Flash storage */ | ||
38 | #define HAVE_FLASH_STORAGE | ||
39 | /* define the storage type */ | ||
40 | #define CONFIG_STORAGE STORAGE_SD | ||
41 | |||
42 | #define HAVE_MULTIDRIVE | ||
43 | #define NUM_DRIVES 2 | ||
44 | #define HAVE_HOTSWAP | ||
45 | |||
46 | /* Disk storage */ | ||
47 | /* define this if you have a disk storage, i.e. something | ||
48 | that needs spinups and can cause skips when shaked */ | ||
49 | /* #define HAVE_DISK_STORAGE */ | ||
50 | |||
51 | /* Display */ | ||
52 | /* define this if you have a bitmap LCD display */ | ||
53 | #define HAVE_LCD_BITMAP | ||
54 | /* define this if you have a colour LCD */ | ||
55 | #define HAVE_LCD_COLOR | ||
56 | /* The LCD is assumed to be 3.5" TFT touch screen, others are possible */ | ||
57 | #define CONFIG_LCD LCD_MINI2440 | ||
58 | /* LCD dimensions */ | ||
59 | #define LCD_WIDTH 240 | ||
60 | #define LCD_HEIGHT 320 | ||
61 | /* The LCD is configured for RGB565 */ | ||
62 | #define LCD_DEPTH 16 /* 65536 colours */ | ||
63 | #define LCD_PIXELFORMAT RGB565 /* rgb565 */ | ||
64 | /* Define this for LCD backlight available */ | ||
65 | /* The Mini2440 supports backight brightness depending on LCD type */ | ||
66 | /* But the 3.5" LCD touch screen does not support brightness*/ | ||
67 | #define HAVE_BACKLIGHT | ||
68 | #define HAVE_BACKLIGHT_BRIGHTNESS | ||
69 | |||
70 | /* Keypad */ | ||
71 | #define CONFIG_KEYPAD MINI2440_PAD | ||
72 | |||
73 | /* I2C */ | ||
74 | /* Do not use I2C */ | ||
75 | #define CONFIG_I2C I2C_NONE | ||
76 | |||
77 | /* Define DAC/Codec */ | ||
78 | /*#define HAVE_UDA1341*/ | ||
79 | #define HAVE_TLV320 | ||
80 | /* ... tone controls, use the software ones */ | ||
81 | #define HAVE_SW_TONE_CONTROLS | ||
82 | |||
83 | /* Battery */ | ||
84 | #define BATTERY_CAPACITY_DEFAULT 1100 /* default battery capacity */ | ||
85 | #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ | ||
86 | #define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */ | ||
87 | #define BATTERY_CAPACITY_INC 100 /* capacity increment */ | ||
88 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
89 | |||
90 | /* USB */ | ||
91 | /* TODO:#define HAVE_USBSTACK */ | ||
92 | |||
93 | /***************************************************************************/ | ||
94 | /* Application Config */ | ||
95 | |||
96 | #define HAVE_ALBUMART | ||
97 | /* define this to enable bitmap scaling */ | ||
98 | #define HAVE_BMP_SCALING | ||
99 | /* define this to enable JPEG decoding */ | ||
100 | #define HAVE_JPEG | ||
101 | /* RMC TODO: what is this for?? */ | ||
102 | /* define this if you have access to the pitchscreen */ | ||
103 | #define HAVE_PITCHSCREEN | ||
104 | |||
105 | /* Define this if you do software codec */ | ||
106 | #define CONFIG_CODEC SWCODEC | ||
107 | |||
108 | /* The number of bytes reserved for loadable codecs */ | ||
109 | #define CODEC_SIZE 0x100000 | ||
110 | |||
111 | /* The number of bytes reserved for loadable plugins */ | ||
112 | #define PLUGIN_BUFFER_SIZE 0x100000 | ||
113 | |||
114 | |||
115 | /***************************************************************************/ | ||
116 | #ifndef SIMULATOR | ||
117 | |||
118 | #define CONFIG_CPU S3C2440 | ||
119 | |||
120 | /* Define this to the CPU frequency */ | ||
121 | #define CPU_FREQ 405000000 | ||
122 | #define MCK_FREQ (CPU_FREQ/4) | ||
123 | #define SLOW_CLOCK 32768 | ||
124 | |||
125 | /* Main LCD backlight brightness range and defaults */ | ||
126 | #define MIN_BRIGHTNESS_SETTING 1 /* 0.5 mA */ | ||
127 | #define MAX_BRIGHTNESS_SETTING 12 /* 32 mA */ | ||
128 | #define DEFAULT_BRIGHTNESS_SETTING 10 /* 16 mA */ | ||
129 | /* Define this if your LCD can set contrast */ | ||
130 | #define HAVE_LCD_CONTRAST | ||
131 | #define MIN_CONTRAST_SETTING 0 | ||
132 | #define MAX_CONTRAST_SETTING 63 | ||
133 | #define DEFAULT_CONTRAST_SETTING 47 /* Match boot contrast */ | ||
134 | |||
135 | /* Hardware controlled charging with monitoring */ | ||
136 | #define CONFIG_CHARGING CHARGING_MONITOR | ||
137 | /*#define POWER_INPUT_BATTERY 0*/ | ||
138 | |||
139 | /* Offset ( in the firmware file's header ) to the file CRC */ | ||
140 | #define FIRMWARE_OFFSET_FILE_CRC 0 | ||
141 | |||
142 | /* Offset ( in the firmware file's header ) to the real data */ | ||
143 | #define FIRMWARE_OFFSET_FILE_DATA 8 | ||
144 | |||
145 | #define BOOTFILE_EXT "mini2440" | ||
146 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
147 | #define BOOTDIR "/.rockbox" | ||
148 | |||
149 | #endif | ||
150 | /***************************************************************************/ | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index 70e2c792d0..8a1adeaac8 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -112,6 +112,7 @@ | |||
112 | #define SAMSUNG_YH_PAD 38 | 112 | #define SAMSUNG_YH_PAD 38 |
113 | #define ONDAVX777_PAD 39 | 113 | #define ONDAVX777_PAD 39 |
114 | #define SAMSUNG_YPS3_PAD 40 | 114 | #define SAMSUNG_YPS3_PAD 40 |
115 | #define MINI2440_PAD 41 | ||
115 | 116 | ||
116 | /* CONFIG_REMOTE_KEYPAD */ | 117 | /* CONFIG_REMOTE_KEYPAD */ |
117 | #define H100_REMOTE 1 | 118 | #define H100_REMOTE 1 |
@@ -192,10 +193,11 @@ | |||
192 | #define LCD_ONDAVX767 30 /* as used by the Onda VX767 */ | 193 | #define LCD_ONDAVX767 30 /* as used by the Onda VX767 */ |
193 | #define LCD_SSD1303 31 /* as used by the Sansa Clip */ | 194 | #define LCD_SSD1303 31 /* as used by the Sansa Clip */ |
194 | #define LCD_FUZE 32 /* as used by the Sansa Fuze */ | 195 | #define LCD_FUZE 32 /* as used by the Sansa Fuze */ |
195 | #define LCD_LYRE_PROTO1 33 /* as used by the Lyre */ | 196 | #define LCD_LYRE_PROTO1 33 /* as used by the Lyre prototype 1 */ |
196 | #define LCD_YH925 34 /* as used by Samsung YH-925 (similar to the H10 20GB) */ | 197 | #define LCD_YH925 34 /* as used by Samsung YH-925 (similar to the H10 20GB) */ |
197 | #define LCD_VIEW 35 /* as used by the Sansa View */ | 198 | #define LCD_VIEW 35 /* as used by the Sansa View */ |
198 | #define LCD_NANO2G 36 /* as used by the iPod Nano 2nd Generation */ | 199 | #define LCD_NANO2G 36 /* as used by the iPod Nano 2nd Generation */ |
200 | #define LCD_MINI2440 37 /* as used by the Mini2440 */ | ||
199 | 201 | ||
200 | /* LCD_PIXELFORMAT */ | 202 | /* LCD_PIXELFORMAT */ |
201 | #define HORIZONTAL_PACKING 1 | 203 | #define HORIZONTAL_PACKING 1 |
@@ -216,7 +218,7 @@ | |||
216 | 218 | ||
217 | /* CONFIG_I2C */ | 219 | /* CONFIG_I2C */ |
218 | #define I2C_NONE 0 /* For targets that do not use I2C - as the | 220 | #define I2C_NONE 0 /* For targets that do not use I2C - as the |
219 | Lyre prototype 1*/ | 221 | Lyre prototype 1 */ |
220 | #define I2C_PLAYREC 1 /* Archos Player/Recorder style */ | 222 | #define I2C_PLAYREC 1 /* Archos Player/Recorder style */ |
221 | #define I2C_ONDIO 2 /* Ondio style */ | 223 | #define I2C_ONDIO 2 /* Ondio style */ |
222 | #define I2C_COLDFIRE 3 /* Coldfire style */ | 224 | #define I2C_COLDFIRE 3 /* Coldfire style */ |
@@ -386,6 +388,8 @@ Lyre prototype 1*/ | |||
386 | #include "config-view.h" | 388 | #include "config-view.h" |
387 | #elif defined(LYRE_PROTO1) | 389 | #elif defined(LYRE_PROTO1) |
388 | #include "config-lyre_proto1.h" | 390 | #include "config-lyre_proto1.h" |
391 | #elif defined(MINI2440) | ||
392 | #include "config-mini2440.h" | ||
389 | #elif defined(SAMSUNG_YH820) | 393 | #elif defined(SAMSUNG_YH820) |
390 | #include "config-yh820.h" | 394 | #include "config-yh820.h" |
391 | #elif defined(SAMSUNG_YH920) | 395 | #elif defined(SAMSUNG_YH920) |
diff --git a/firmware/export/s3c2440.h b/firmware/export/s3c2440.h index 0589f3b6b0..5f595214a1 100644 --- a/firmware/export/s3c2440.h +++ b/firmware/export/s3c2440.h | |||
@@ -178,6 +178,41 @@ | |||
178 | #define DCDST3 (*(volatile unsigned long *)0x4B0000DC) /* DMA 3 current destination */ | 178 | #define DCDST3 (*(volatile unsigned long *)0x4B0000DC) /* DMA 3 current destination */ |
179 | #define DMASKTRIG3 (*(volatile unsigned long *)0x4B0000E0) /* DMA 3 mask trigger */ | 179 | #define DMASKTRIG3 (*(volatile unsigned long *)0x4B0000E0) /* DMA 3 mask trigger */ |
180 | 180 | ||
181 | #define DISRCC_LOC_AHB (0 << 1) | ||
182 | #define DISRCC_LOC_APB (1 << 1) | ||
183 | #define DISRCC_INC_AUTO (0 << 0) | ||
184 | #define DISRCC_INC_FIXED (1 << 0) | ||
185 | |||
186 | #define DIDSTC_CHK_INT_TC_ZERO (0 << 2) | ||
187 | #define DIDSTC_CHK_INT_AFTER_RELOAD (1 << 2) | ||
188 | #define DIDSTC_LOC_AHB (0 << 1) | ||
189 | #define DIDSTC_LOC_APB (1 << 1) | ||
190 | #define DIDSTC_INC_AUTO (0 << 0) | ||
191 | #define DIDSTC_INC_FIXED (1 << 0) | ||
192 | |||
193 | #define DCON_DMD_HS (1 << 31) | ||
194 | #define DCON_SYNC_APB (0 << 30) | ||
195 | #define DCON_SYNC_AHB (1 << 30) | ||
196 | #define DCON_INT (1 << 29) | ||
197 | #define DCON_TSZ (1 << 28) | ||
198 | #define DCON_SERVMODE_WHOLE (1 << 27) | ||
199 | #define DCON_HWSRCSEL (1 << 24) | ||
200 | #define DCON_HW_SEL (1 << 23) | ||
201 | #define DCON_NO_RELOAD (1 << 22) | ||
202 | #define DCON_DSZ_MASK (3 << 20) | ||
203 | #define DCON_DSZ_BYTE (0 << 20) | ||
204 | #define DCON_DSZ_HALF_WORD (1 << 20) | ||
205 | #define DCON_DSZ_WORD (2 << 20) | ||
206 | #define DCON_TC (1 << 0) | ||
207 | |||
208 | #define DSTAT_STAT_BUSY (1 << 20) | ||
209 | #define DSTAT_CURR_TC (1 << 0) | ||
210 | |||
211 | #define DMASKTRIG_STOP (1 << 2) | ||
212 | #define DMASKTRIG_ON (1 << 1) | ||
213 | #define DMASKTRIG_SW_TRIG (1 << 0) | ||
214 | |||
215 | |||
181 | /* Clock & Power Management */ | 216 | /* Clock & Power Management */ |
182 | 217 | ||
183 | #define LOCKTIME (*(volatile unsigned long *)0x4C000000) /* PLL lock time counter */ | 218 | #define LOCKTIME (*(volatile unsigned long *)0x4C000000) /* PLL lock time counter */ |
@@ -499,7 +534,14 @@ | |||
499 | #define SDIDSTA (*(volatile unsigned long *)0x5A000034) /* SDI data status */ | 534 | #define SDIDSTA (*(volatile unsigned long *)0x5A000034) /* SDI data status */ |
500 | #define SDIFSTA (*(volatile unsigned long *)0x5A000038) /* SDI FIFO status */ | 535 | #define SDIFSTA (*(volatile unsigned long *)0x5A000038) /* SDI FIFO status */ |
501 | #define SDIIMSK (*(volatile unsigned long *)0x5A00003C) /* SDI interrupt mask */ | 536 | #define SDIIMSK (*(volatile unsigned long *)0x5A00003C) /* SDI interrupt mask */ |
502 | #define SDIDAT (*(volatile unsigned char *)0x5A000040) /* SDI data */ | 537 | |
538 | /* SDI data - LE = Little Endian, BE = Big Endian */ | ||
539 | #define SDIDAT_LLE (*(volatile unsigned long *)0x5A000040) /* 32 bit */ | ||
540 | #define SDIDAT_HLE (*(volatile unsigned short *)0x5A000044) /* 16 */ | ||
541 | #define SDIDAT_BLE (*(volatile unsigned char *)0x5A000048) /* 8 */ | ||
542 | #define SDIDAT_LBE (*(volatile unsigned long *)0x5A00004C) /* 32 */ | ||
543 | #define SDIDAT_HBE (*(volatile unsigned short *)0x5A000041) /* 16 */ | ||
544 | #define SDIDAT_BBE (*(volatile unsigned char *)0x5A000043) /* 8 */ | ||
503 | 545 | ||
504 | /* AC97 Audio-CODEC Interface */ | 546 | /* AC97 Audio-CODEC Interface */ |
505 | 547 | ||
@@ -530,5 +572,18 @@ | |||
530 | #define TIMER_FREQ (49156800/2) | 572 | #define TIMER_FREQ (49156800/2) |
531 | #define TIMER234_PRESCALE 21 | 573 | #define TIMER234_PRESCALE 21 |
532 | 574 | ||
575 | /* I/O Port macros */ | ||
576 | |||
577 | #define GPIO_INPUT 0 | ||
578 | #define GPIO_OUTPUT 1 | ||
579 | #define GPIO_FUNCTION 2 | ||
580 | #define GPIO_ALT_FUNCTION 3 | ||
581 | |||
582 | #define GPIO_PULLUP_DISABLE 1 | ||
583 | #define GPIO_PULLUP_ENABLE 0 | ||
584 | |||
585 | #define S3C2440_GPIO_CONFIG(port,pin,function) port = ( (port & ~(3<<(pin*2)) ) | (function<<(pin*2)) ) | ||
586 | #define S3C2440_GPIO_PULLUP(port,pin,state) port = ( (port & ~(1<<pin ) ) | (state<<pin ) ) | ||
587 | |||
533 | 588 | ||
534 | #endif /* __S3C2440_H__ */ | 589 | #endif /* __S3C2440_H__ */ |
diff --git a/firmware/target/arm/s3c2440/crt0.S b/firmware/target/arm/s3c2440/crt0.S index d18c2550e4..b8cb9f3908 100644 --- a/firmware/target/arm/s3c2440/crt0.S +++ b/firmware/target/arm/s3c2440/crt0.S | |||
@@ -26,6 +26,149 @@ | |||
26 | #include "config.h" | 26 | #include "config.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | 28 | ||
29 | /****************************************************************************/ | ||
30 | #ifdef TOSHIBA_GIGABEAT_F | ||
31 | |||
32 | /* Clock and Power Management setup values */ | ||
33 | #define VAL_CLKDIV 0x7 | ||
34 | #define VAL_UPLLCON 0x0003C042 | ||
35 | #define VAL_MPLLCON 0x000C9042 | ||
36 | |||
37 | /* Memory Controller setup */ | ||
38 | /* Memory setup (taken from 0x5070) */ | ||
39 | /* BWSCON | ||
40 | * Reserved 0 | ||
41 | * Bank 0: | ||
42 | * Bus width 01 (16 bit) | ||
43 | * Bank 1: | ||
44 | * Buswidth 00 (8 bit) | ||
45 | * Disable wait 0 | ||
46 | * Not using UB/LB 0 | ||
47 | * Bank 2: | ||
48 | * Buswidth 10 (32 bit) | ||
49 | * Disable wait 0 | ||
50 | * Not using UB/LB 0 | ||
51 | * Bank 3: | ||
52 | * Buswidth 10 (32 bit) | ||
53 | * Disable wait 0 | ||
54 | * Use UB/LB 1 | ||
55 | * Bank 4: | ||
56 | * Buswidth 10 (32 bit) | ||
57 | * Disable wait 0 | ||
58 | * Use UB/LB 1 | ||
59 | * Bank 5: | ||
60 | * Buswidth 00 (8 bit) | ||
61 | * Disable wait 0 | ||
62 | * Not using UB/LB 0 | ||
63 | * Bank 6: | ||
64 | * Buswidth 10 (32 bit) | ||
65 | * Disable wait 0 | ||
66 | * Not using UB/LB 0 | ||
67 | * Bank 7: | ||
68 | * Buswidth 00 (8 bit) | ||
69 | * Disable wait 0 | ||
70 | * Not using UB/LB 0 | ||
71 | */ | ||
72 | #define VAL_BWSCON 0x01055102 | ||
73 | /* BANKCON0 | ||
74 | * Pagemode: normal (1 data) 00 | ||
75 | * Pagemode access cycle: 2 clocks 00 | ||
76 | * Address hold: 2 clocks 10 | ||
77 | * Chip selection hold time: 1 clock 10 | ||
78 | * Access cycle: 8 clocks 101 | ||
79 | * Chip select setup time: 1 clock 01 | ||
80 | * Address setup time: 0 clock 00 | ||
81 | */ | ||
82 | #define VAL_BANKCON0 0x00000D60 | ||
83 | /* BANKCON1 | ||
84 | * Pagemode: normal (1 data) 00 | ||
85 | * Pagemode access cycle: 2 clocks 00 | ||
86 | * Address hold: 0 clocks 00 | ||
87 | * Chip selection hold time: 0 clock 00 | ||
88 | * Access cycle: 1 clocks 000 | ||
89 | * Chip select setup time: 0 clocks 00 | ||
90 | * Address setup time: 0 clocks 00 | ||
91 | */ | ||
92 | #define VAL_BANKCON1 0x00000000 | ||
93 | /* BANKCON2 | ||
94 | * Pagemode: normal (1 data) 00 | ||
95 | * Pagemode access cycle: 2 clocks 00 | ||
96 | * Address hold: 2 clocks 10 | ||
97 | * Chip selection hold time: 2 clocks 10 | ||
98 | * Access cycle: 14 clocks 111 | ||
99 | * Chip select setup time: 4 clocks 11 | ||
100 | * Address setup time: 0 clocks 00 | ||
101 | */ | ||
102 | #define VAL_BANKCON2 0x00001FA0 | ||
103 | #define VAL_BANKCON3 0x00001D80 | ||
104 | #define VAL_BANKCON4 0x00001D80 | ||
105 | #define VAL_BANKCON5 0x00000000 | ||
106 | /* BANKCON6/7 | ||
107 | * SCAN: 9 bit 01 | ||
108 | * Trcd: 3 clocks 01 | ||
109 | * Tcah: 0 clock 00 | ||
110 | * Tcoh: 0 clock 00 | ||
111 | * Tacc: 1 clock 000 | ||
112 | * Tcos: 0 clock 00 | ||
113 | * Tacs: 0 clock 00 | ||
114 | * MT: Sync DRAM 11 | ||
115 | */ | ||
116 | #define VAL_BANKCON6 0x00018005 | ||
117 | #define VAL_BANKCON7 0x00018005 | ||
118 | |||
119 | #define VAL_REFRESH 0x00980501 | ||
120 | /* BANKSIZE | ||
121 | * BK76MAP: 32M/32M 000 | ||
122 | * Reserved: 0 0 (was 1) | ||
123 | * SCLK_EN: always 1 (was 0) | ||
124 | * SCKE_EN: disable 0 | ||
125 | * Reserved: 0 0 | ||
126 | * BURST_EN: enabled 1 | ||
127 | */ | ||
128 | #define VAL_BANKSIZE 0x00000090 | ||
129 | #define VAL_MRSRB6 0x00000030 | ||
130 | #define VAL_MRSRB7 0x00000030 | ||
131 | #define VAL_GPACON 0x00FFFFFF | ||
132 | |||
133 | /****************************************************************************/ | ||
134 | #elif defined (MINI2440) | ||
135 | |||
136 | /* For Mini2440 board or compatible */ | ||
137 | /* Clock and Power Management setup values */ | ||
138 | #define VAL_CLKDIV 0x5 /* HCLK = FCLK/4, PCLK = HCLK/2 */ | ||
139 | #define VAL_UPLLCON 0x00038022 /* UCLK = 48 MHz */ | ||
140 | #define VAL_MPLLCON 0x0007F021 /* FCLK = 405 MHz */ | ||
141 | |||
142 | #define FCLK 405000000 | ||
143 | #define HCLK (FCLK/4) /* = 101,250,000 */ | ||
144 | #define PCLK (HCLK/2) /* = 50,625,000 */ | ||
145 | |||
146 | /* Memory Controller setup */ | ||
147 | #define VAL_BWSCON 0x22111112 | ||
148 | #define VAL_BANKCON0 0x00002F50 | ||
149 | #define VAL_BANKCON1 0x00000700 | ||
150 | #define VAL_BANKCON2 0x00000700 | ||
151 | #define VAL_BANKCON3 0x00000700 | ||
152 | #define VAL_BANKCON4 0x00000700 | ||
153 | #define VAL_BANKCON5 0x0007FFFC | ||
154 | #define VAL_BANKCON6 0x00018009 | ||
155 | #define VAL_BANKCON7 0x00018009 | ||
156 | |||
157 | #define VAL_REFRESH 0x008E04EB | ||
158 | #define VAL_BANKSIZE 0x000000B2 | ||
159 | #define VAL_MRSRB6 0x00000030 | ||
160 | #define VAL_MRSRB7 0x00000030 | ||
161 | |||
162 | #define VAL_GPACON 0x00FFFFFF | ||
163 | #define VAL_GPFCON 0x000055AA | ||
164 | #define VAL_GPGCON 0xAA2A0128 | ||
165 | #define VAL_GPGDAT 0x0000 | ||
166 | |||
167 | #else | ||
168 | #error Unknown target | ||
169 | #endif | ||
170 | /****************************************************************************/ | ||
171 | |||
29 | /* Exception Handlers */ | 172 | /* Exception Handlers */ |
30 | .section .vectors,"ax",%progbits | 173 | .section .vectors,"ax",%progbits |
31 | .code 32 | 174 | .code 32 |
@@ -73,6 +216,7 @@ word_copy: | |||
73 | .ltorg | 216 | .ltorg |
74 | .size word_copy, .-word_copy | 217 | .size word_copy, .-word_copy |
75 | 218 | ||
219 | |||
76 | /* | 220 | /* |
77 | * Entry: start | 221 | * Entry: start |
78 | * Variables: | 222 | * Variables: |
@@ -95,6 +239,7 @@ start: | |||
95 | 239 | ||
96 | /************************** DO NOT WRITE TO R0 ***************************/ | 240 | /************************** DO NOT WRITE TO R0 ***************************/ |
97 | 241 | ||
242 | #ifdef TOSHIBA_GIGABEAT_F | ||
98 | /* Check if the code is running from flash. If not skip all these checks */ | 243 | /* Check if the code is running from flash. If not skip all these checks */ |
99 | cmp r0, #0xA0000 | 244 | cmp r0, #0xA0000 |
100 | bne poweron | 245 | bne poweron |
@@ -105,7 +250,6 @@ start: | |||
105 | str r1, [r2, #0x14] | 250 | str r1, [r2, #0x14] |
106 | 251 | ||
107 | /* Did an RTC event wake the player up? */ | 252 | /* Did an RTC event wake the player up? */ |
108 | |||
109 | mov r2, #0x4A000000 | 253 | mov r2, #0x4A000000 |
110 | ldr r1, [r2] | 254 | ldr r1, [r2] |
111 | ands r1, r1, #0x40000000 | 255 | ands r1, r1, #0x40000000 |
@@ -147,6 +291,7 @@ start: | |||
147 | bootOF: | 291 | bootOF: |
148 | /* power is not down || menu is held || the charger is not connected */ | 292 | /* power is not down || menu is held || the charger is not connected */ |
149 | mov pc, #0x70 | 293 | mov pc, #0x70 |
294 | #endif | ||
150 | 295 | ||
151 | poweron: | 296 | poweron: |
152 | /* enter supervisor mode, disable IRQ */ | 297 | /* enter supervisor mode, disable IRQ */ |
@@ -166,6 +311,7 @@ poweron: | |||
166 | ldr r2, =0x00003FFF | 311 | ldr r2, =0x00003FFF |
167 | str r2, [r1, #0x1C] | 312 | str r2, [r1, #0x1C] |
168 | 313 | ||
314 | #ifdef TOSHIBA_GIGABEAT_F | ||
169 | /* Check if loaded by the old bootloader or by the OF. This copy routine | 315 | /* Check if loaded by the old bootloader or by the OF. This copy routine |
170 | * cannot run/copy properly until the memory has been initialized, so the | 316 | * cannot run/copy properly until the memory has been initialized, so the |
171 | * copy routine later is still necessary. The old bootloader/OF will | 317 | * copy routine later is still necessary. The old bootloader/OF will |
@@ -198,6 +344,7 @@ poweron: | |||
198 | bl word_copy | 344 | bl word_copy |
199 | 345 | ||
200 | mov pc, #0x31000000 | 346 | mov pc, #0x31000000 |
347 | #endif | ||
201 | 348 | ||
202 | skipreset: | 349 | skipreset: |
203 | 350 | ||
@@ -209,7 +356,7 @@ skipreset: | |||
209 | orr r0, r0, r1 | 356 | orr r0, r0, r1 |
210 | mcr p15, 0, r0, c1, c0, 0 | 357 | mcr p15, 0, r0, c1, c0, 0 |
211 | 358 | ||
212 | mov r2, #0x7 | 359 | mov r2, #VAL_CLKDIV |
213 | mov r1, #0x4C000000 | 360 | mov r1, #0x4C000000 |
214 | str r2, [r1, #0x14] | 361 | str r2, [r1, #0x14] |
215 | 362 | ||
@@ -219,7 +366,7 @@ skipreset: | |||
219 | ldr r2, =0xFFFFFFFF | 366 | ldr r2, =0xFFFFFFFF |
220 | str r2, [r1] | 367 | str r2, [r1] |
221 | 368 | ||
222 | ldr r2, =0x0003C042 | 369 | ldr r2, =VAL_UPLLCON |
223 | str r2, [r1, #0x08] | 370 | str r2, [r1, #0x08] |
224 | 371 | ||
225 | nop | 372 | nop |
@@ -231,7 +378,7 @@ skipreset: | |||
231 | nop | 378 | nop |
232 | nop | 379 | nop |
233 | 380 | ||
234 | ldr r2, =0x000C9042 | 381 | ldr r2, =VAL_MPLLCON |
235 | str r2, [r1, #0x04] | 382 | str r2, [r1, #0x04] |
236 | 383 | ||
237 | nop | 384 | nop |
@@ -248,128 +395,55 @@ skipreset: | |||
248 | mov r1, #0x56000000 | 395 | mov r1, #0x56000000 |
249 | str r2, [r1, #0x80] | 396 | str r2, [r1, #0x80] |
250 | 397 | ||
251 | /* Memory setup (taken from 0x5070) */ | 398 | /* Memory setup */ |
252 | 399 | ||
253 | /* BWSCON | 400 | ldr r2, =VAL_BWSCON |
254 | * Reserved 0 | ||
255 | * Bank 0: | ||
256 | * Bus width 01 (16 bit) | ||
257 | * Bank 1: | ||
258 | * Buswidth 00 (8 bit) | ||
259 | * Disable wait 0 | ||
260 | * Not using UB/LB 0 | ||
261 | * Bank 2: | ||
262 | * Buswidth 10 (32 bit) | ||
263 | * Disable wait 0 | ||
264 | * Not using UB/LB 0 | ||
265 | * Bank 3: | ||
266 | * Buswidth 10 (32 bit) | ||
267 | * Disable wait 0 | ||
268 | * Use UB/LB 1 | ||
269 | * Bank 4: | ||
270 | * Buswidth 10 (32 bit) | ||
271 | * Disable wait 0 | ||
272 | * Use UB/LB 1 | ||
273 | * Bank 5: | ||
274 | * Buswidth 00 (8 bit) | ||
275 | * Disable wait 0 | ||
276 | * Not using UB/LB 0 | ||
277 | * Bank 6: | ||
278 | * Buswidth 10 (32 bit) | ||
279 | * Disable wait 0 | ||
280 | * Not using UB/LB 0 | ||
281 | * Bank 7: | ||
282 | * Buswidth 00 (8 bit) | ||
283 | * Disable wait 0 | ||
284 | * Not using UB/LB 0 | ||
285 | */ | ||
286 | ldr r2, =0x01055102 | ||
287 | mov r1, #0x48000000 | 401 | mov r1, #0x48000000 |
288 | str r2, [r1] | 402 | str r2, [r1] |
289 | 403 | ||
290 | /* BANKCON0 | 404 | /* BANKCON0 */ |
291 | * Pagemode: normal (1 data) 00 | 405 | ldr r2, =VAL_BANKCON0 |
292 | * Pagemode access cycle: 2 clocks 00 | ||
293 | * Address hold: 2 clocks 10 | ||
294 | * Chip selection hold time: 1 clock 10 | ||
295 | * Access cycle: 8 clocks 101 | ||
296 | * Chip select setup time: 1 clock 01 | ||
297 | * Address setup time: 0 clock 00 | ||
298 | */ | ||
299 | ldr r2, =0x00000D60 | ||
300 | str r2, [r1, #0x04] | 406 | str r2, [r1, #0x04] |
301 | 407 | ||
302 | 408 | /* BANKCON1 */ | |
303 | /* BANKCON1 | 409 | ldr r2, =VAL_BANKCON1 |
304 | * Pagemode: normal (1 data) 00 | ||
305 | * Pagemode access cycle: 2 clocks 00 | ||
306 | * Address hold: 0 clocks 00 | ||
307 | * Chip selection hold time: 0 clock 00 | ||
308 | * Access cycle: 1 clocks 000 | ||
309 | * Chip select setup time: 0 clocks 00 | ||
310 | * Address setup time: 0 clocks 00 | ||
311 | */ | ||
312 | ldr r2, =0x00000000 | ||
313 | str r2, [r1, #0x08] | 410 | str r2, [r1, #0x08] |
314 | 411 | ||
315 | /* BANKCON2 | 412 | /* BANKCON2 */ |
316 | * Pagemode: normal (1 data) 00 | 413 | ldr r2, =VAL_BANKCON2 |
317 | * Pagemode access cycle: 2 clocks 00 | ||
318 | * Address hold: 2 clocks 10 | ||
319 | * Chip selection hold time: 2 clocks 10 | ||
320 | * Access cycle: 14 clocks 111 | ||
321 | * Chip select setup time: 4 clocks 11 | ||
322 | * Address setup time: 0 clocks 00 | ||
323 | */ | ||
324 | ldr r2, =0x00001FA0 | ||
325 | str r2, [r1, #0xC] | 414 | str r2, [r1, #0xC] |
326 | 415 | ||
327 | /* BANKCON3 */ | 416 | /* BANKCON3 */ |
328 | ldr r2, =0x00001D80 | 417 | ldr r2, =VAL_BANKCON3 |
329 | str r2, [r1, #0x10] | 418 | str r2, [r1, #0x10] |
330 | /* BANKCON4 */ | 419 | /* BANKCON4 */ |
331 | str r2, [r1, #0x14] | 420 | str r2, [r1, #0x14] |
332 | 421 | ||
333 | /* BANKCON5 */ | 422 | /* BANKCON5 */ |
334 | ldr r2, =0x00000000 | 423 | ldr r2, =VAL_BANKCON5 |
335 | str r2, [r1, #0x18] | 424 | str r2, [r1, #0x18] |
336 | 425 | ||
337 | /* BANKCON6/7 | 426 | /* BANKCON6/7 */ |
338 | * SCAN: 9 bit 01 | 427 | ldr r2, =VAL_BANKCON6 |
339 | * Trcd: 3 clocks 01 | ||
340 | * Tcah: 0 clock 00 | ||
341 | * Tcoh: 0 clock 00 | ||
342 | * Tacc: 1 clock 000 | ||
343 | * Tcos: 0 clock 00 | ||
344 | * Tacs: 0 clock 00 | ||
345 | * MT: Sync DRAM 11 | ||
346 | */ | ||
347 | ldr r2, =0x00018005 | ||
348 | str r2, [r1, #0x1C] | 428 | str r2, [r1, #0x1C] |
349 | /* BANKCON7 */ | 429 | /* BANKCON7 */ |
350 | str r2, [r1, #0x20] | 430 | str r2, [r1, #0x20] |
351 | 431 | ||
352 | /* REFRESH */ | 432 | /* REFRESH */ |
353 | ldr r2, =0x00980501 | 433 | ldr r2, =VAL_REFRESH |
354 | str r2, [r1, #0x24] | 434 | str r2, [r1, #0x24] |
355 | 435 | ||
356 | /* BANKSIZE | 436 | /* BANKSIZE */ |
357 | * BK76MAP: 32M/32M 000 | 437 | ldr r2, =VAL_BANKSIZE |
358 | * Reserved: 0 0 (was 1) | ||
359 | * SCLK_EN: always 1 (was 0) | ||
360 | * SCKE_EN: disable 0 | ||
361 | * Reserved: 0 0 | ||
362 | * BURST_EN: enabled 1 | ||
363 | */ | ||
364 | ldr r2, =0x00000090 | ||
365 | str r2, [r1, #0x28] | 438 | str r2, [r1, #0x28] |
366 | 439 | ||
367 | /* MRSRB6 */ | 440 | /* MRSRB6 */ |
368 | ldr r2, =0x00000030 | 441 | ldr r2, =VAL_MRSRB6 |
369 | str r2, [r1, #0x2C] | 442 | str r2, [r1, #0x2C] |
370 | /* MRSRB7 */ | 443 | /* MRSRB7 */ |
371 | str r2, [r1, #0x30] | 444 | str r2, [r1, #0x30] |
372 | 445 | ||
446 | /* RMC: I guess this is some notes about Gigabeat */ | ||
373 | /* | 447 | /* |
374 | 0x56000000 0x1FFFCFF | 448 | 0x56000000 0x1FFFCFF |
375 | 4 0x1FFFEFF | 449 | 4 0x1FFFEFF |
@@ -379,25 +453,33 @@ skipreset: | |||
379 | 453 | ||
380 | /* GPACON */ | 454 | /* GPACON */ |
381 | mov r1, #0x56000000 | 455 | mov r1, #0x56000000 |
382 | ldr r2, =0x00FFFFFF | 456 | ldr r2, =VAL_GPACON |
383 | str r2, [r1] | 457 | str r2, [r1] |
384 | 458 | ||
385 | /* The builds have two potential load addresses, one being from flash, | 459 | #if 0 |
460 | /* GPGCON */ | ||
461 | ldr r2, =VAL_GPGCON | ||
462 | str r2, [r1, #0x60] | ||
463 | ldr r2, =VAL_GPGDAT | ||
464 | str r2, [r1, #0x64] | ||
465 | #endif | ||
466 | |||
467 | /* Copy from current location (from NOR Flash if bootloader, load buffer if | ||
468 | firmware) to RAM */ | ||
469 | |||
470 | /* Gigabeat: The builds have two potential load addresses, one being from flash, | ||
386 | * and the other from some "unknown" location right now the assumption | 471 | * and the other from some "unknown" location right now the assumption |
387 | * is that the code is not at 0x3000000. | 472 | * is that the code is not at 0x3000000. |
388 | */ | 473 | */ |
389 | /* get the high part of our execute address (where am I) */ | 474 | /* get the high part of our execute address (where am I) */ |
390 | ldr r0, =0xfffff000 | 475 | ldr r0, =0xfffff000 |
391 | and r0, pc, r0 | 476 | and r0, pc, r0 /* copy from address */ |
392 | 477 | ||
393 | /* Copy code to 0x30000000 */ | 478 | /* SDRAM starts at 0x30000000 (physical address) */ |
479 | ldr r1, =0x30000000 /* copy To address */ | ||
394 | ldr r2, = _vectorstart | 480 | ldr r2, = _vectorstart |
395 | ldr r3, = _initdata_end | 481 | ldr r3, = _initdata_end |
396 | |||
397 | sub r2, r3, r2 /* length of loader */ | 482 | sub r2, r3, r2 /* length of loader */ |
398 | |||
399 | ldr r1, =0x30000000 /* copy location */ | ||
400 | |||
401 | bl word_copy | 483 | bl word_copy |
402 | 484 | ||
403 | ldr r1, =donecopy | 485 | ldr r1, =donecopy |
@@ -410,8 +492,8 @@ donecopy: | |||
410 | /* Setup the MMU, start by disabling */ | 492 | /* Setup the MMU, start by disabling */ |
411 | 493 | ||
412 | mrc p15, 0, r0, c1, c0, 0 | 494 | mrc p15, 0, r0, c1, c0, 0 |
413 | bic r0, r0, #0x41 /* disable mmu and dcache */ | 495 | bic r0, r0, #0x41 /* disable mmu and dcache */ |
414 | bic r0, r0, #0x1000 /* disable icache */ | 496 | bic r0, r0, #0x1000 /* disable icache */ |
415 | mcr p15, 0, r0, c1, c0, 0 | 497 | mcr p15, 0, r0, c1, c0, 0 |
416 | 498 | ||
417 | bl ttb_init | 499 | bl ttb_init |
@@ -515,6 +597,7 @@ fiq_handler: | |||
515 | UIE: | 597 | UIE: |
516 | b UIE | 598 | b UIE |
517 | 599 | ||
600 | /* TODO: Review this function - is it target dependent? */ | ||
518 | /* | 601 | /* |
519 | * Function: rom_shutdown | 602 | * Function: rom_shutdown |
520 | * Variables: | 603 | * Variables: |
diff --git a/firmware/target/arm/s3c2440/debug-target.h b/firmware/target/arm/s3c2440/debug-target.h index fa53487c10..bf1b6218e4 100644 --- a/firmware/target/arm/s3c2440/debug-target.h +++ b/firmware/target/arm/s3c2440/debug-target.h | |||
@@ -19,7 +19,12 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #ifdef GIGABEAT_F | ||
22 | #define DEBUG_CANCEL BUTTON_POWER | 23 | #define DEBUG_CANCEL BUTTON_POWER |
24 | #elif defined(MINI2440) | ||
25 | #define DEBUG_CANCEL BUTTON_MENU | ||
26 | #endif | ||
27 | |||
23 | bool __dbg_hw_info(void); | 28 | bool __dbg_hw_info(void); |
24 | bool __dbg_ports(void); | 29 | bool __dbg_ports(void); |
25 | 30 | ||
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-target.h index cb82a8076f..c136a2052d 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-target.h +++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-target.h | |||
@@ -21,3 +21,25 @@ | |||
21 | 21 | ||
22 | extern void lcd_enable(bool state); | 22 | extern void lcd_enable(bool state); |
23 | 23 | ||
24 | /* Config values for LCDCON1 */ | ||
25 | /* ENVID = 0, BPPMODE = 16 bpp, PNRMODE = TFT, MMODE = Each Frame, CLKVAL = 8 */ | ||
26 | #define LCD_CLKVAL 8 | ||
27 | #define LCD_MMODE 0 | ||
28 | #define LCD_PNRMODE 3 | ||
29 | #define LCD_BPPMODE 12 | ||
30 | #define LCD_ENVID 1 | ||
31 | |||
32 | /* Config values for LCDCON2 */ | ||
33 | /* VCPW = 1, VFPD = 5, VBPD = 7 */ | ||
34 | #define LCD_UPPER_MARGIN 7 | ||
35 | #define LCD_LOWER_MARGIN 5 | ||
36 | #define LCD_VSYNC_LEN 1 | ||
37 | |||
38 | /* Config values for LCDCON3 */ | ||
39 | /* HFPD = 9, HBPD = 7 */ | ||
40 | #define LCD_LEFT_MARGIN 7 | ||
41 | #define LCD_RIGHT_MARGIN 9 | ||
42 | |||
43 | /* Config values for LCDCON4 */ | ||
44 | /* HSPW = 7 */ | ||
45 | #define LCD_HSYNC_LEN 7 | ||
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c b/firmware/target/arm/s3c2440/kernel-s3c2440.c index 6cabc8dc81..6cabc8dc81 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c +++ b/firmware/target/arm/s3c2440/kernel-s3c2440.c | |||
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/lcd-s3c2440.c index 661ae8e6a9..b9f76b7400 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c +++ b/firmware/target/arm/s3c2440/lcd-s3c2440.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007 by Greg White | 10 | * Copyright (C) 2007 by Greg White |
11 | * Copyright (C) 2009 by Bob Cousins | ||
11 | * | 12 | * |
12 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
@@ -76,18 +77,14 @@ static inline void delay_cycles(volatile int delay) | |||
76 | 77 | ||
77 | static void LCD_CTRL_setup(void) | 78 | static void LCD_CTRL_setup(void) |
78 | { | 79 | { |
79 | /* ENVID = 0, BPPMODE = 16 bpp, PNRMODE = TFT, MMODE = Each Frame, CLKVAL = 8 */ | 80 | LCDCON1 = (LCD_CLKVAL << 8) | (LCD_MMODE << 7) | (LCD_PNRMODE << 5) | |
80 | LCDCON1 = 0x878; | 81 | (LCD_BPPMODE << 1); |
81 | 82 | LCDCON2 = (LCD_UPPER_MARGIN << 24) | ((LCD_HEIGHT - 1) << 14) | | |
82 | /* VCPW = 1, VFPD = 5, LINEVAL = 319, VBPD = 7 */ | 83 | (LCD_LOWER_MARGIN << 6) | (LCD_VSYNC_LEN << 0); |
83 | LCDCON2 = 0x74FC141; | 84 | LCDCON3 = (LCD_LEFT_MARGIN << 19) | ((LCD_WIDTH - 1) << 8) | |
84 | 85 | (LCD_RIGHT_MARGIN << 0); | |
85 | /* HFPD = 9, HOZVAL = 239, HBPD = 7 */ | 86 | LCDCON4 = (LCD_HSYNC_LEN << 0); |
86 | LCDCON3 = 0x38EF09; | 87 | |
87 | |||
88 | /* HSPW = 7 */ | ||
89 | LCDCON4 = 7; | ||
90 | |||
91 | /* HWSWP = 1, INVVFRAM = 1, INVVLINE = 1, FRM565 = 1, All others = 0 */ | 88 | /* HWSWP = 1, INVVFRAM = 1, INVVLINE = 1, FRM565 = 1, All others = 0 */ |
92 | LCDCON5 = 0xB01; | 89 | LCDCON5 = 0xB01; |
93 | 90 | ||
@@ -100,17 +97,16 @@ static void LCD_CTRL_clock(bool onoff) | |||
100 | { | 97 | { |
101 | if(onoff) | 98 | if(onoff) |
102 | { | 99 | { |
103 | GPCCON &= ~0xFFF000FC; | 100 | GPCCON &=~0xFFF000FC; |
104 | GPDCON &= ~0xFFF0FFF0; | ||
105 | |||
106 | GPCCON |= 0xAAA000A8; | 101 | GPCCON |= 0xAAA000A8; |
107 | GPCUP |= 0xFC0E; | 102 | GPCUP |= 0xFC0E; |
108 | 103 | ||
104 | GPDCON &=~0xFFF0FFF0; | ||
109 | GPDCON |= 0xAAA0AAA0; | 105 | GPDCON |= 0xAAA0AAA0; |
110 | GPDUP |= 0xFCFC; | 106 | GPDUP |= 0xFCFC; |
111 | 107 | ||
112 | s3c_regset32(&CLKCON, 0x20); /* enable LCD clock */ | 108 | s3c_regset32(&CLKCON, 0x20); /* enable LCD clock */ |
113 | LCDCON1 |=0x01; | 109 | LCDCON1 |= LCD_ENVID; |
114 | } | 110 | } |
115 | else | 111 | else |
116 | { | 112 | { |
@@ -120,11 +116,12 @@ static void LCD_CTRL_clock(bool onoff) | |||
120 | GPDCON &= ~0xFFF0FFF0; | 116 | GPDCON &= ~0xFFF0FFF0; |
121 | GPDUP &= ~0xFCFC; | 117 | GPDUP &= ~0xFCFC; |
122 | 118 | ||
123 | LCDCON1 &= ~1; /* Must diable first or bus may freeze */ | 119 | LCDCON1 &= ~LCD_ENVID; /* Must disable first or bus may freeze */ |
124 | s3c_regclr32(&CLKCON, 0x20); /* disable LCD clock */ | 120 | s3c_regclr32(&CLKCON, 0x20); /* disable LCD clock */ |
125 | } | 121 | } |
126 | } | 122 | } |
127 | 123 | ||
124 | #ifdef GIGABEAT_F | ||
128 | static void reset_LCD(bool reset) | 125 | static void reset_LCD(bool reset) |
129 | { | 126 | { |
130 | GPBCON&=~0xC000; | 127 | GPBCON&=~0xC000; |
@@ -134,10 +131,14 @@ static void reset_LCD(bool reset) | |||
134 | else | 131 | else |
135 | GPBDAT&=~0x80; | 132 | GPBDAT&=~0x80; |
136 | } | 133 | } |
134 | #endif | ||
137 | 135 | ||
136 | |||
137 | /****************************************************************************/ | ||
138 | #ifdef GIGABEAT_F | ||
138 | static void LCD_SPI_send(const unsigned char *array, int count) | 139 | static void LCD_SPI_send(const unsigned char *array, int count) |
139 | { | 140 | { |
140 | while (count--) | 141 | while (count--) |
141 | { | 142 | { |
142 | while ((SPSTA0&0x01)==0){}; | 143 | while ((SPSTA0&0x01)==0){}; |
143 | SPTDAT0=*array++; | 144 | SPTDAT0=*array++; |
@@ -146,7 +147,7 @@ static void LCD_SPI_send(const unsigned char *array, int count) | |||
146 | 147 | ||
147 | static void LCD_SPI_setreg(unsigned char reg, unsigned char value) | 148 | static void LCD_SPI_setreg(unsigned char reg, unsigned char value) |
148 | { | 149 | { |
149 | unsigned char regval[] = | 150 | unsigned char regval[] = |
150 | { | 151 | { |
151 | 0x00,reg,0x01,value | 152 | 0x00,reg,0x01,value |
152 | }; | 153 | }; |
@@ -162,7 +163,7 @@ static void LCD_SPI_SS(bool select) | |||
162 | 163 | ||
163 | if(select) | 164 | if(select) |
164 | GPBDAT|=0x100; | 165 | GPBDAT|=0x100; |
165 | else | 166 | else |
166 | GPBDAT&=~0x100; | 167 | GPBDAT&=~0x100; |
167 | } | 168 | } |
168 | 169 | ||
@@ -182,7 +183,7 @@ static void LCD_SPI_stop(void) | |||
182 | LCD_SPI_SS(false); | 183 | LCD_SPI_SS(false); |
183 | 184 | ||
184 | SPCON0 &= ~0x10; | 185 | SPCON0 &= ~0x10; |
185 | s3c_regclr32(&CLKCON, 0x40000); /* disable SPI clock */ | 186 | s3c_regclr32(&CLKCON, 0x40000); /* disable SPI clock */ |
186 | } | 187 | } |
187 | 188 | ||
188 | static void LCD_SPI_init(void) | 189 | static void LCD_SPI_init(void) |
@@ -221,8 +222,10 @@ static void LCD_SPI_init(void) | |||
221 | LCD_SPI_setreg(0x2A, 0x03); | 222 | LCD_SPI_setreg(0x2A, 0x03); |
222 | LCD_SPI_setreg(0x2B, 0x0A); | 223 | LCD_SPI_setreg(0x2B, 0x0A); |
223 | LCD_SPI_setreg(0x04, 0x01); /* Turn the display on */ | 224 | LCD_SPI_setreg(0x04, 0x01); /* Turn the display on */ |
224 | LCD_SPI_stop(); | 225 | LCD_SPI_stop(); |
225 | } | 226 | } |
227 | #endif | ||
228 | /****************************************************************************/ | ||
226 | 229 | ||
227 | /* LCD init */ | 230 | /* LCD init */ |
228 | void lcd_init_device(void) | 231 | void lcd_init_device(void) |
@@ -247,18 +250,21 @@ void lcd_init_device(void) | |||
247 | #endif | 250 | #endif |
248 | 251 | ||
249 | /* Set pins up */ | 252 | /* Set pins up */ |
250 | |||
251 | GPHUP &= 0x600; | 253 | GPHUP &= 0x600; |
252 | |||
253 | GPECON |= 0x0A800000; | 254 | GPECON |= 0x0A800000; |
254 | GPEUP |= 0x3800; | 255 | GPEUP |= 0x3800; |
255 | 256 | #ifdef GIGABEAT_F | |
256 | GPBUP |= 0x181; | 257 | GPBUP |= 0x181; |
258 | #endif | ||
257 | 259 | ||
258 | s3c_regset32(&CLKCON, 0x20); /* enable LCD clock */ | 260 | s3c_regset32(&CLKCON, 0x20); /* enable LCD clock */ |
259 | 261 | ||
260 | LCD_CTRL_setup(); | 262 | LCD_CTRL_setup(); |
263 | #ifdef GIGABEAT_F | ||
261 | LCD_SPI_init(); | 264 | LCD_SPI_init(); |
265 | #else | ||
266 | LCD_CTRL_clock(true); | ||
267 | #endif | ||
262 | } | 268 | } |
263 | 269 | ||
264 | #if defined(HAVE_LCD_SLEEP) | 270 | #if defined(HAVE_LCD_SLEEP) |
@@ -319,13 +325,14 @@ void lcd_enable(bool state) | |||
319 | lcd_update(); | 325 | lcd_update(); |
320 | lcd_activation_call_hook(); | 326 | lcd_activation_call_hook(); |
321 | } | 327 | } |
322 | else | 328 | else |
323 | { | 329 | { |
324 | lcd_on = false; | 330 | lcd_on = false; |
325 | } | 331 | } |
326 | } | 332 | } |
327 | #endif | 333 | #endif |
328 | 334 | ||
335 | #ifdef GIGABEAT_F | ||
329 | void lcd_set_flip(bool yesno) { | 336 | void lcd_set_flip(bool yesno) { |
330 | if (!lcd_on) | 337 | if (!lcd_on) |
331 | return; | 338 | return; |
@@ -335,7 +342,7 @@ void lcd_set_flip(bool yesno) { | |||
335 | { | 342 | { |
336 | LCD_SPI_setreg(0x06, 0x02); | 343 | LCD_SPI_setreg(0x06, 0x02); |
337 | } | 344 | } |
338 | else | 345 | else |
339 | { | 346 | { |
340 | LCD_SPI_setreg(0x06, 0x04); | 347 | LCD_SPI_setreg(0x06, 0x04); |
341 | } | 348 | } |
@@ -365,12 +372,37 @@ void lcd_set_invert_display(bool yesno) { | |||
365 | { | 372 | { |
366 | LCD_SPI_setreg(0x27, 0x10); | 373 | LCD_SPI_setreg(0x27, 0x10); |
367 | } | 374 | } |
368 | else | 375 | else |
369 | { | 376 | { |
370 | LCD_SPI_setreg(0x27, 0x00); | 377 | LCD_SPI_setreg(0x27, 0x00); |
371 | } | 378 | } |
372 | LCD_SPI_stop(); | 379 | LCD_SPI_stop(); |
373 | } | 380 | } |
381 | #else | ||
382 | void lcd_set_flip(bool yesno) | ||
383 | { | ||
384 | (void)yesno; | ||
385 | /* Not implemented */ | ||
386 | } | ||
387 | |||
388 | int lcd_default_contrast(void) | ||
389 | { | ||
390 | return DEFAULT_CONTRAST_SETTING; | ||
391 | } | ||
392 | |||
393 | void lcd_set_contrast(int val) | ||
394 | { | ||
395 | (void)val; | ||
396 | /* Not implemented */ | ||
397 | } | ||
398 | |||
399 | void lcd_set_invert_display(bool yesno) | ||
400 | { | ||
401 | (void)yesno; | ||
402 | /* Not implemented */ | ||
403 | } | ||
404 | |||
405 | #endif | ||
374 | 406 | ||
375 | /* Update a fraction of the display. */ | 407 | /* Update a fraction of the display. */ |
376 | void lcd_update_rect(int x, int y, int width, int height) | 408 | void lcd_update_rect(int x, int y, int width, int height) |
@@ -423,6 +455,7 @@ void lcd_update(void) | |||
423 | LCD_WIDTH*LCD_HEIGHT, 1); | 455 | LCD_WIDTH*LCD_HEIGHT, 1); |
424 | } | 456 | } |
425 | 457 | ||
458 | #if defined(TOSHIBA_GIGABEAT_F) || defined(TOSHIBA_GIGABEAT_S) | ||
426 | void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | 459 | void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, |
427 | int stride, int x, int y, int width, | 460 | int stride, int x, int y, int width, |
428 | int height) | 461 | int height) |
@@ -485,6 +518,7 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | |||
485 | [fgpat]"r"(current_vp->fg_pattern) | 518 | [fgpat]"r"(current_vp->fg_pattern) |
486 | ); | 519 | ); |
487 | } | 520 | } |
521 | #endif | ||
488 | 522 | ||
489 | void lcd_yuv_set_options(unsigned options) | 523 | void lcd_yuv_set_options(unsigned options) |
490 | { | 524 | { |
diff --git a/firmware/target/arm/s3c2440/mini2440/adc-target.h b/firmware/target/arm/s3c2440/mini2440/adc-target.h new file mode 100644 index 0000000000..24e878e735 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/adc-target.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | /* Channel 0 is connected to an on board pot for testing | ||
25 | Channels 0-3 are available via expansion connector CON4 | ||
26 | Channels 4-7 are routed to LCD connector for touchscreen operation if | ||
27 | supported by display panel. | ||
28 | */ | ||
29 | #define NUM_ADC_CHANNELS 8 | ||
30 | |||
31 | #define ADC_ONBOARD 0 | ||
32 | #define ADC_SPARE_1 1 | ||
33 | #define ADC_SPARE_2 2 | ||
34 | #define ADC_SPARE_3 3 | ||
35 | #define ADC_TSYM 4 | ||
36 | #define ADC_TSYP 5 | ||
37 | #define ADC_TSXM 6 | ||
38 | #define ADC_TSXP 7 | ||
39 | |||
40 | #define ADC_READ_ERROR 0xFFFF | ||
41 | |||
42 | #endif | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c b/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c new file mode 100644 index 0000000000..88c0b5ce2c --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 | #include "config.h" | ||
22 | #include "cpu.h" | ||
23 | #include "system.h" | ||
24 | #include "backlight-target.h" | ||
25 | #include "backlight.h" | ||
26 | #include "lcd.h" | ||
27 | #include "power.h" | ||
28 | |||
29 | |||
30 | /* Dummy value at index 0, 1-12 used. */ | ||
31 | static const unsigned char log_brightness[13] = | ||
32 | {0,0,1,2,3,5,7,10,15,22,31,44,63}; | ||
33 | |||
34 | |||
35 | static enum backlight_states | ||
36 | { | ||
37 | BACKLIGHT_CONTROL_IDLE, | ||
38 | BACKLIGHT_CONTROL_OFF, | ||
39 | BACKLIGHT_CONTROL_ON, | ||
40 | BACKLIGHT_CONTROL_SET, | ||
41 | BACKLIGHT_CONTROL_FADE | ||
42 | } backlight_control; | ||
43 | |||
44 | static unsigned char _backlight_brightness; | ||
45 | static unsigned char backlight_target; | ||
46 | |||
47 | |||
48 | /* Assumes that the backlight has been initialized */ | ||
49 | void _backlight_set_brightness(int brightness) | ||
50 | { | ||
51 | /* stop the interrupt from messing us up */ | ||
52 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
53 | _backlight_brightness = log_brightness[brightness]; | ||
54 | backlight_control = BACKLIGHT_CONTROL_SET; | ||
55 | } | ||
56 | |||
57 | void _backlight_set_state (unsigned int level) | ||
58 | { | ||
59 | if (level == 0) | ||
60 | GPGDAT &= ~GPIO_LCD_PWR; | ||
61 | else | ||
62 | GPGDAT |= GPIO_LCD_PWR; | ||
63 | } | ||
64 | |||
65 | /* led_control_service runs in interrupt context - be brief! | ||
66 | * This service is called once per interrupt timer tick - 100 times a second. | ||
67 | * | ||
68 | * There should be at most only one i2c operation per call - if more are need | ||
69 | * the calls should be spread across calls. | ||
70 | * | ||
71 | * Putting all led servicing in one thread means that we wont step on any | ||
72 | * i2c operations - they are all serialized here in the ISR tick. It also | ||
73 | * insures that we get called at equal timing for good visual effect. | ||
74 | */ | ||
75 | #ifndef BOOTLOADER | ||
76 | static void led_control_service(void) | ||
77 | { | ||
78 | switch (backlight_control) | ||
79 | { | ||
80 | case BACKLIGHT_CONTROL_IDLE: | ||
81 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
82 | break; | ||
83 | case BACKLIGHT_CONTROL_OFF: | ||
84 | _backlight_set_brightness(0); | ||
85 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
86 | break; | ||
87 | case BACKLIGHT_CONTROL_ON: | ||
88 | _backlight_set_brightness(255); | ||
89 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
90 | break; | ||
91 | case BACKLIGHT_CONTROL_SET: | ||
92 | _backlight_set_brightness(255); | ||
93 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
94 | break; | ||
95 | case BACKLIGHT_CONTROL_FADE: | ||
96 | _backlight_set_brightness(0); | ||
97 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
98 | break; | ||
99 | default: | ||
100 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
101 | break; | ||
102 | } | ||
103 | } | ||
104 | #endif /* BOOTLOADER */ | ||
105 | |||
106 | static void __backlight_dim(bool dim_now) | ||
107 | { | ||
108 | /* dont let the interrupt tick happen */ | ||
109 | backlight_control = BACKLIGHT_CONTROL_IDLE; | ||
110 | backlight_target = dim_now ? 0 : _backlight_brightness; | ||
111 | if(backlight_target==0 && _backlight_brightness==0) | ||
112 | { | ||
113 | if(dim_now == false) | ||
114 | backlight_control = BACKLIGHT_CONTROL_ON; | ||
115 | else | ||
116 | backlight_control = BACKLIGHT_CONTROL_OFF; | ||
117 | } | ||
118 | else | ||
119 | backlight_control = BACKLIGHT_CONTROL_FADE; | ||
120 | } | ||
121 | |||
122 | void _backlight_on(void) | ||
123 | { | ||
124 | #ifdef HAVE_LCD_ENABLE | ||
125 | lcd_enable(true); /* power on lcd + visible display */ | ||
126 | #endif | ||
127 | __backlight_dim(false); | ||
128 | } | ||
129 | |||
130 | void _backlight_off(void) | ||
131 | { | ||
132 | __backlight_dim(true); | ||
133 | } | ||
134 | |||
135 | |||
136 | bool _backlight_init(void) | ||
137 | { | ||
138 | unsigned char brightness = log_brightness[DEFAULT_BRIGHTNESS_SETTING]; | ||
139 | _backlight_brightness = brightness; | ||
140 | |||
141 | backlight_control = BACKLIGHT_CONTROL_ON; | ||
142 | |||
143 | _backlight_set_state (1); | ||
144 | S3C2440_GPIO_CONFIG (GPGCON, 4, GPIO_OUTPUT); | ||
145 | |||
146 | #ifndef BOOTLOADER | ||
147 | /* put the led control on the tick list */ | ||
148 | tick_add_task(led_control_service); | ||
149 | #endif | ||
150 | return true; | ||
151 | } | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/backlight-target.h b/firmware/target/arm/s3c2440/mini2440/backlight-target.h new file mode 100644 index 0000000000..c804f16bcc --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/backlight-target.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef BACKLIGHT_TARGET_H | ||
22 | #define BACKLIGHT_TARGET_H | ||
23 | |||
24 | #define GPIO_LCD_PWR (1 << 4) /* GPIO.G4 */ | ||
25 | |||
26 | bool _backlight_init(void); | ||
27 | void _backlight_on(void); | ||
28 | void _backlight_off(void); | ||
29 | void _backlight_set_brightness(int brightness); | ||
30 | |||
31 | #endif | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/button-mini2440.c b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c new file mode 100644 index 0000000000..787c04d1ef --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 "button.h" | ||
26 | #include "kernel.h" | ||
27 | |||
28 | void button_init_device(void) | ||
29 | { | ||
30 | /* Configure port directions and enable internal pullups on button inputs */ | ||
31 | |||
32 | /* These are the standard 6 buttons on the Mini2440 */ | ||
33 | S3C2440_GPIO_CONFIG (GPGCON, 0, GPIO_INPUT); | ||
34 | S3C2440_GPIO_CONFIG (GPGCON, 3, GPIO_INPUT); | ||
35 | S3C2440_GPIO_CONFIG (GPGCON, 5, GPIO_INPUT); | ||
36 | S3C2440_GPIO_CONFIG (GPGCON, 6, GPIO_INPUT); | ||
37 | S3C2440_GPIO_CONFIG (GPGCON, 7, GPIO_INPUT); | ||
38 | S3C2440_GPIO_CONFIG (GPGCON, 11, GPIO_INPUT); | ||
39 | |||
40 | S3C2440_GPIO_PULLUP (GPGUP, 0, GPIO_PULLUP_ENABLE); | ||
41 | S3C2440_GPIO_PULLUP (GPGUP, 3, GPIO_PULLUP_ENABLE); | ||
42 | S3C2440_GPIO_PULLUP (GPGUP, 5, GPIO_PULLUP_ENABLE); | ||
43 | S3C2440_GPIO_PULLUP (GPGUP, 6, GPIO_PULLUP_ENABLE); | ||
44 | S3C2440_GPIO_PULLUP (GPGUP, 7, GPIO_PULLUP_ENABLE); | ||
45 | S3C2440_GPIO_PULLUP (GPGUP, 11, GPIO_PULLUP_ENABLE); | ||
46 | |||
47 | /* These are additional buttons on my add on keypad */ | ||
48 | S3C2440_GPIO_CONFIG (GPGCON, 9, GPIO_INPUT); | ||
49 | S3C2440_GPIO_CONFIG (GPGCON, 10, GPIO_INPUT); | ||
50 | S3C2440_GPIO_PULLUP (GPGUP, 9, GPIO_PULLUP_ENABLE); | ||
51 | S3C2440_GPIO_PULLUP (GPGUP, 10, GPIO_PULLUP_ENABLE); | ||
52 | |||
53 | } | ||
54 | |||
55 | inline bool button_hold(void) | ||
56 | { | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | int button_read_device(void) | ||
61 | { | ||
62 | int btn = BUTTON_NONE; | ||
63 | |||
64 | /* Read the buttons - active low */ | ||
65 | btn = (GPGDAT & BUTTON_MAIN) ^ BUTTON_MAIN; | ||
66 | |||
67 | return btn; | ||
68 | } | ||
69 | |||
70 | void touchpad_set_sensitivity(int level) | ||
71 | { | ||
72 | (void)level; | ||
73 | /* No touchpad */ | ||
74 | } | ||
75 | |||
76 | bool headphones_inserted(void) | ||
77 | { | ||
78 | /* No detect */ | ||
79 | return false; | ||
80 | } | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/button-target.h b/firmware/target/arm/s3c2440/mini2440/button-target.h new file mode 100644 index 0000000000..4a84014462 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/button-target.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _BUTTON_TARGET_H_ | ||
22 | #define _BUTTON_TARGET_H_ | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | #include "config.h" | ||
26 | |||
27 | |||
28 | bool button_hold(void); | ||
29 | void button_init_device(void); | ||
30 | int button_read_device(void); | ||
31 | void touchpad_set_sensitivity(int level); | ||
32 | |||
33 | /* Mini2440 specific button codes */ | ||
34 | |||
35 | #define BUTTON_ONE 0x0001 | ||
36 | #define BUTTON_TWO 0x0008 | ||
37 | #define BUTTON_THREE 0x0020 | ||
38 | #define BUTTON_FOUR 0x0040 | ||
39 | #define BUTTON_FIVE 0x0080 | ||
40 | #define BUTTON_SIX 0x0800 | ||
41 | |||
42 | /* Add on buttons */ | ||
43 | #define BUTTON_SEVEN 0x0200 | ||
44 | #define BUTTON_EIGHT 0x0400 | ||
45 | |||
46 | #define BUTTON_MENU BUTTON_ONE | ||
47 | #define BUTTON_UP BUTTON_TWO | ||
48 | #define BUTTON_SELECT BUTTON_THREE | ||
49 | #define BUTTON_DOWN BUTTON_FOUR | ||
50 | #define BUTTON_LEFT BUTTON_FIVE | ||
51 | #define BUTTON_RIGHT BUTTON_SIX | ||
52 | |||
53 | /* Add on buttons */ | ||
54 | #define BUTTON_A BUTTON_SEVEN | ||
55 | #define BUTTON_POWER BUTTON_EIGHT | ||
56 | |||
57 | /* TODO: bodge to keep keymap-mini2440 happy */ | ||
58 | #define BUTTON_VOL_DOWN 0x4000 | ||
59 | #define BUTTON_VOL_UP 0x8000 | ||
60 | |||
61 | #define BUTTON_MAIN (BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT | \ | ||
62 | BUTTON_UP |BUTTON_DOWN|BUTTON_SELECT | \ | ||
63 | BUTTON_A |BUTTON_POWER ) | ||
64 | |||
65 | #define BUTTON_REMOTE 0 | ||
66 | |||
67 | #define POWEROFF_BUTTON BUTTON_MENU | ||
68 | #define POWEROFF_COUNT 10 | ||
69 | |||
70 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/lcd-target.h b/firmware/target/arm/s3c2440/mini2440/lcd-target.h new file mode 100644 index 0000000000..b2882e2390 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/lcd-target.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins, Lyre Project | ||
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 | extern void lcd_enable(bool state); | ||
23 | |||
24 | /* Setup for Mini2440, 3.5" TFT LCD Touchscreen */ | ||
25 | |||
26 | /* Config values for LCDCON1 */ | ||
27 | #define LCD_CLKVAL 4 | ||
28 | #define LCD_MMODE 0 | ||
29 | #define LCD_PNRMODE 3 | ||
30 | #define LCD_BPPMODE 12 | ||
31 | #define LCD_ENVID 1 | ||
32 | |||
33 | /* Config values for LCDCON2 */ | ||
34 | #define LCD_UPPER_MARGIN 1 | ||
35 | #define LCD_LOWER_MARGIN 4 | ||
36 | #define LCD_VSYNC_LEN 1 | ||
37 | |||
38 | /* Config values for LCDCON3 */ | ||
39 | #define LCD_RIGHT_MARGIN 0 | ||
40 | #define LCD_LEFT_MARGIN 25 | ||
41 | |||
42 | /* Config values for LCDCON4 */ | ||
43 | #define LCD_HSYNC_LEN 4 | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.c b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c new file mode 100644 index 0000000000..f541d75273 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 | #include "config.h" | ||
22 | #include "cpu.h" | ||
23 | #include "kernel.h" | ||
24 | |||
25 | /* LED functions for debug */ | ||
26 | |||
27 | void led_init (void) | ||
28 | { | ||
29 | S3C2440_GPIO_CONFIG (GPBCON, 5, GPIO_OUTPUT); | ||
30 | S3C2440_GPIO_CONFIG (GPBCON, 6, GPIO_OUTPUT); | ||
31 | S3C2440_GPIO_CONFIG (GPBCON, 7, GPIO_OUTPUT); | ||
32 | S3C2440_GPIO_CONFIG (GPBCON, 8, GPIO_OUTPUT); | ||
33 | |||
34 | S3C2440_GPIO_PULLUP (GPBUP, 5, GPIO_PULLUP_DISABLE); | ||
35 | S3C2440_GPIO_PULLUP (GPBUP, 6, GPIO_PULLUP_DISABLE); | ||
36 | S3C2440_GPIO_PULLUP (GPBUP, 7, GPIO_PULLUP_DISABLE); | ||
37 | S3C2440_GPIO_PULLUP (GPBUP, 8, GPIO_PULLUP_DISABLE); | ||
38 | } | ||
39 | |||
40 | /* Turn on one or more LEDS */ | ||
41 | void set_leds (int led_mask) | ||
42 | { | ||
43 | GPBDAT &= ~led_mask; | ||
44 | } | ||
45 | |||
46 | /* Turn off one or more LEDS */ | ||
47 | void clear_leds (int led_mask) | ||
48 | { | ||
49 | GPBDAT |= led_mask; | ||
50 | } | ||
51 | |||
52 | /* Alternate flash pattern1 and pattern2 */ | ||
53 | /* Never returns */ | ||
54 | void led_flash (int led_pattern1, int led_pattern2) | ||
55 | { | ||
56 | while (1) | ||
57 | { | ||
58 | set_leds (led_pattern1); | ||
59 | sleep(HZ/2); | ||
60 | clear_leds (led_pattern1); | ||
61 | |||
62 | set_leds(led_pattern2); | ||
63 | sleep(HZ/2); | ||
64 | clear_leds (led_pattern2); | ||
65 | } | ||
66 | } | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.h b/firmware/target/arm/s3c2440/mini2440/led-mini2440.h new file mode 100644 index 0000000000..0aaad1c9a4 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 _LED_MINI2440_H_ | ||
23 | #define _LED_MINI2440_H_ | ||
24 | |||
25 | /* LED functions for debug etc */ | ||
26 | |||
27 | #define LED1 0x0020 /* GPB5 */ | ||
28 | #define LED2 0x0040 /* GPB6 */ | ||
29 | #define LED3 0x0080 /* GPB7 */ | ||
30 | #define LED4 0x0100 /* GPB8 */ | ||
31 | |||
32 | #define LED_NONE 0x0000 | ||
33 | #define LED_ALL (LED1|LED2|LED3|LED4) | ||
34 | |||
35 | void led_init (void); | ||
36 | |||
37 | /* Turn on one or more LEDS */ | ||
38 | void set_leds (int led_mask); | ||
39 | |||
40 | /* Turn off one or more LEDS */ | ||
41 | void clear_leds (int led_mask); | ||
42 | |||
43 | /* Alternate flash of pattern1 and pattern2 - never returns */ | ||
44 | void led_flash (int led_pattern1, int led_pattern2); | ||
45 | |||
46 | #endif /* _LED_MINI2440_H_ */ | ||
diff --git a/firmware/target/arm/s3c2440/mini2440/power-mini2440.c b/firmware/target/arm/s3c2440/mini2440/power-mini2440.c new file mode 100644 index 0000000000..d4b00751e0 --- /dev/null +++ b/firmware/target/arm/s3c2440/mini2440/power-mini2440.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Bob Cousins | ||
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 | #include "config.h" | ||
22 | #include "cpu.h" | ||
23 | #include <stdbool.h> | ||
24 | #include <stdio.h> | ||
25 | #include "kernel.h" | ||
26 | #include "system.h" | ||
27 | #include "power.h" | ||
28 | #include "led-mini2440.h" | ||
29 | |||
30 | void power_init(void) | ||
31 | { | ||
32 | /* Nothing to do */ | ||
33 | } | ||
34 | |||
35 | unsigned int power_input_status(void) | ||
36 | { | ||
37 | unsigned int status = 0; | ||
38 | |||
39 | /* Always on*/ | ||
40 | status = POWER_INPUT_MAIN; | ||
41 | return status; | ||
42 | } | ||
43 | |||
44 | /* Returns true if the unit is charging the batteries. */ | ||
45 | bool charging_state(void) | ||
46 | { | ||
47 | return false; | ||
48 | } | ||
49 | |||
50 | void power_off(void) | ||
51 | { | ||
52 | /* we don't have any power control, user must do it */ | ||
53 | led_flash (LED_NONE, LED_ALL); | ||
54 | while (1); | ||
55 | } | ||
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c b/firmware/target/arm/s3c2440/system-s3c2440.c index 79d592091e..6b7609b88b 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c +++ b/firmware/target/arm/s3c2440/system-s3c2440.c | |||
@@ -165,6 +165,7 @@ void system_prepare_fw_start(void) | |||
165 | 165 | ||
166 | void system_init(void) | 166 | void system_init(void) |
167 | { | 167 | { |
168 | #ifdef GIGABEAT_F | ||
168 | INTMSK = 0xFFFFFFFF; | 169 | INTMSK = 0xFFFFFFFF; |
169 | INTMOD = 0; | 170 | INTMOD = 0; |
170 | SRCPND = 0xFFFFFFFF; | 171 | SRCPND = 0xFFFFFFFF; |
@@ -192,7 +193,7 @@ void system_init(void) | |||
192 | GPGUP |= 0x70; | 193 | GPGUP |= 0x70; |
193 | 194 | ||
194 | GPHCON |= 0x4005; | 195 | GPHCON |= 0x4005; |
195 | GPHDAT |= 0x03; | 196 | GPHDAT |= 0x03; |
196 | 197 | ||
197 | /* TODO: do something with PRIORITY */ | 198 | /* TODO: do something with PRIORITY */ |
198 | 199 | ||
@@ -208,6 +209,11 @@ void system_init(void) | |||
208 | CLKCON &= ~0xFF1ED0; | 209 | CLKCON &= ~0xFF1ED0; |
209 | 210 | ||
210 | CLKSLOW |= 0x80; | 211 | CLKSLOW |= 0x80; |
212 | #elif defined(MINI2440) | ||
213 | /* TODO: anything? */ | ||
214 | #else | ||
215 | #error Unknown target | ||
216 | #endif | ||
211 | } | 217 | } |
212 | 218 | ||
213 | int system_memory_guard(int newmode) | 219 | int system_memory_guard(int newmode) |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h b/firmware/target/arm/s3c2440/system-target.h index f310b9ac26..9808d31255 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h +++ b/firmware/target/arm/s3c2440/system-target.h | |||
@@ -1,44 +1,70 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * __________ __ ___. | 2 | * __________ __ ___. |
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007 by Greg White | 10 | * Copyright (C) 2007 by Greg White |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
14 | * as published by the Free Software Foundation; either version 2 | 14 | * as published by the Free Software Foundation; either version 2 |
15 | * of the License, or (at your option) any later version. | 15 | * of the License, or (at your option) any later version. |
16 | * | 16 | * |
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #ifndef SYSTEM_TARGET_H | 21 | #ifndef SYSTEM_TARGET_H |
22 | #define SYSTEM_TARGET_H | 22 | #define SYSTEM_TARGET_H |
23 | 23 | ||
24 | #include "system-arm.h" | 24 | #include "system-arm.h" |
25 | #include "mmu-arm.h" | 25 | #include "mmu-arm.h" |
26 | 26 | ||
27 | #define CPUFREQ_DEFAULT 98784000 | 27 | /* TODO: Needs checking/porting */ |
28 | #define CPUFREQ_NORMAL 98784000 | 28 | |
29 | #define CPUFREQ_MAX 296352000 | 29 | #ifdef GIGABEAT_F |
30 | 30 | #define CPUFREQ_DEFAULT 98784000 | |
31 | void system_prepare_fw_start(void); | 31 | #define CPUFREQ_NORMAL 98784000 |
32 | void tick_stop(void); | 32 | #define CPUFREQ_MAX 296352000 |
33 | 33 | ||
34 | /* Functions to set and clear regiser bits atomically */ | 34 | #ifdef BOOTLOADER |
35 | 35 | /* All addresses within rockbox are in IRAM in the bootloader so | |
36 | /* Set and clear register bits */ | 36 | are therefore uncached */ |
37 | void s3c_regmod32(volatile unsigned long *reg, unsigned long bits, | 37 | #define UNCACHED_ADDR(a) (a) |
38 | unsigned long mask); | 38 | #else /* !BOOTLOADER */ |
39 | /* Set register bits */ | 39 | #define UNCACHED_BASE_ADDR 0x30000000 |
40 | void s3c_regset32(volatile unsigned long *reg, unsigned long bits); | 40 | #define UNCACHED_ADDR(a) ((typeof(a))((unsigned int)(a) | UNCACHED_BASE_ADDR )) |
41 | /* Clear register bits */ | 41 | #endif /* BOOTLOADER */ |
42 | void s3c_regclr32(volatile unsigned long *reg, unsigned long bits); | 42 | |
43 | 43 | #elif defined(MINI2440) | |
44 | #endif /* SYSTEM_TARGET_H */ | 44 | |
45 | #define CPUFREQ_DEFAULT 101250000 | ||
46 | #define CPUFREQ_NORMAL 101250000 | ||
47 | #define CPUFREQ_MAX 405000000 | ||
48 | |||
49 | #define UNCACHED_BASE_ADDR 0x30000000 | ||
50 | #define UNCACHED_ADDR(a) ((typeof(a))((unsigned int)(a) | UNCACHED_BASE_ADDR )) | ||
51 | |||
52 | #else | ||
53 | #error Unknown target | ||
54 | #endif | ||
55 | |||
56 | |||
57 | void system_prepare_fw_start(void); | ||
58 | void tick_stop(void); | ||
59 | |||
60 | /* Functions to set and clear register bits atomically */ | ||
61 | |||
62 | /* Set and clear register bits */ | ||
63 | void s3c_regmod32(volatile unsigned long *reg, unsigned long bits, | ||
64 | unsigned long mask); | ||
65 | /* Set register bits */ | ||
66 | void s3c_regset32(volatile unsigned long *reg, unsigned long bits); | ||
67 | /* Clear register bits */ | ||
68 | void s3c_regclr32(volatile unsigned long *reg, unsigned long bits); | ||
69 | |||
70 | #endif /* SYSTEM_TARGET_H */ | ||