diff options
author | Mark Arigo <markarigo@gmail.com> | 2007-09-06 03:28:58 +0000 |
---|---|---|
committer | Mark Arigo <markarigo@gmail.com> | 2007-09-06 03:28:58 +0000 |
commit | dbc6b4e39a8f68708bc20a7b3295662c7871856a (patch) | |
tree | 725674ac56a56c80246181f1e42342ada60b7199 /firmware | |
parent | 4f3bcbbb11905c95337fcbe670a1b7da477fbf13 (diff) | |
download | rockbox-dbc6b4e39a8f68708bc20a7b3295662c7871856a.tar.gz rockbox-dbc6b4e39a8f68708bc20a7b3295662c7871856a.zip |
Sansa c200 port. Rockbox works with sound. Several features are disabled including some lcd options, FM radio, recording, and all plugins. Loading the OF from the Rockbox bootloader does not work.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14625 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 23 | ||||
-rw-r--r-- | firmware/export/as3514.h | 2 | ||||
-rw-r--r-- | firmware/export/config-c200.h | 190 | ||||
-rw-r--r-- | firmware/export/config.h | 10 | ||||
-rw-r--r-- | firmware/export/usb.h | 3 | ||||
-rw-r--r-- | firmware/target/arm/crt0-pp.S | 2 | ||||
-rw-r--r-- | firmware/target/arm/i2c-pp.c | 17 | ||||
-rw-r--r-- | firmware/target/arm/i2s-pp.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/ata-c200_e200.c | 27 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/backlight-c200_e200.c | 7 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/backlight-target.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/power-c200_e200.c | 7 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-c200/button-c200.c | 62 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-c200/button-target.h | 53 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-c200/lcd-c200.c | 249 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c | 58 | ||||
-rw-r--r-- | firmware/target/arm/system-pp502x.c | 6 |
17 files changed, 706 insertions, 14 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 3b0aca79fc..7a6e253a81 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -110,7 +110,7 @@ drivers/ata_mmc.c | |||
110 | #ifdef HAVE_FLASH_DISK | 110 | #ifdef HAVE_FLASH_DISK |
111 | drivers/ata_flash.c | 111 | drivers/ata_flash.c |
112 | #else /* !HAVE_FLASH_DISK */ | 112 | #else /* !HAVE_FLASH_DISK */ |
113 | #ifndef SANSA_E200 | 113 | #if !defined(SANSA_E200) && !defined(SANSA_C200) |
114 | drivers/ata.c | 114 | drivers/ata.c |
115 | #endif /* SANSA_E200 */ | 115 | #endif /* SANSA_E200 */ |
116 | #endif /* HAVE_FLASH_DISK */ | 116 | #endif /* HAVE_FLASH_DISK */ |
@@ -239,7 +239,7 @@ usbstack/drivers/device/usb_storage.c | |||
239 | #if CONFIG_USBOTG == USBOTG_ISP1362 | 239 | #if CONFIG_USBOTG == USBOTG_ISP1362 |
240 | drivers/isp1362.c | 240 | drivers/isp1362.c |
241 | #endif | 241 | #endif |
242 | #if defined(SANSA_E200) || !defined(BOOTLOADER) | 242 | #if defined(SANSA_E200) || defined(SANSA_C200) || !defined(BOOTLOADER) |
243 | #if CONFIG_USBOTG == USBOTG_M5636 | 243 | #if CONFIG_USBOTG == USBOTG_M5636 |
244 | drivers/m5636.c | 244 | drivers/m5636.c |
245 | #elif CONFIG_USBOTG == USBOTG_ARC | 245 | #elif CONFIG_USBOTG == USBOTG_ARC |
@@ -319,7 +319,7 @@ target/arm/system-pp502x.c | |||
319 | target/arm/crt0-pp-bl.S | 319 | target/arm/crt0-pp-bl.S |
320 | #else | 320 | #else |
321 | target/arm/pcm-pp.c | 321 | target/arm/pcm-pp.c |
322 | #ifndef SANSA_E200 | 322 | #if !defined(SANSA_E200) && !defined(SANSA_C200) |
323 | target/arm/audio-pp.c | 323 | target/arm/audio-pp.c |
324 | #endif /* SANSA_E200 */ | 324 | #endif /* SANSA_E200 */ |
325 | target/arm/crt0-pp.S | 325 | target/arm/crt0-pp.S |
@@ -415,6 +415,23 @@ target/arm/sandisk/audio-c200_e200.c | |||
415 | #endif /* SIMULATOR */ | 415 | #endif /* SIMULATOR */ |
416 | #endif /* SANSA_E200 */ | 416 | #endif /* SANSA_E200 */ |
417 | 417 | ||
418 | #ifdef SANSA_C200 | ||
419 | #ifndef SIMULATOR | ||
420 | target/arm/sandisk/ata-c200_e200.c | ||
421 | target/arm/sandisk/sansa-c200/lcd-c200.c | ||
422 | target/arm/sandisk/adc-c200_e200.c | ||
423 | target/arm/sandisk/backlight-c200_e200.c | ||
424 | target/arm/usb-fw-pp502x.c | ||
425 | target/arm/sandisk/sansa-c200/button-c200.c | ||
426 | target/arm/sandisk/power-c200_e200.c | ||
427 | target/arm/sandisk/sansa-c200/powermgmt-c200.c | ||
428 | target/arm/i2s-pp.c | ||
429 | #ifndef BOOTLOADER | ||
430 | target/arm/sandisk/audio-c200_e200.c | ||
431 | #endif /* BOOTLOADER */ | ||
432 | #endif /* SIMULATOR */ | ||
433 | #endif /* SANSA_C200 */ | ||
434 | |||
418 | #ifdef IAUDIO_X5 | 435 | #ifdef IAUDIO_X5 |
419 | #ifndef SIMULATOR | 436 | #ifndef SIMULATOR |
420 | target/coldfire/ata-as-coldfire.S | 437 | target/coldfire/ata-as-coldfire.S |
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index c01790f082..8df228f105 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h | |||
@@ -70,7 +70,7 @@ extern void audiohw_set_monitor(int enable); | |||
70 | #define VOLUME_MIN -735 | 70 | #define VOLUME_MIN -735 |
71 | #define VOLUME_MAX 60 | 71 | #define VOLUME_MAX 60 |
72 | 72 | ||
73 | #ifdef SANSA_E200 | 73 | #if defined(SANSA_E200) || defined(SANSA_C200) |
74 | #define AS3514_I2C_ADDR 0x46 | 74 | #define AS3514_I2C_ADDR 0x46 |
75 | #endif | 75 | #endif |
76 | 76 | ||
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h new file mode 100644 index 0000000000..c0e8753493 --- /dev/null +++ b/firmware/export/config-c200.h | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | * This config file is for the Sandisk Sansa e200 | ||
3 | */ | ||
4 | #define TARGET_TREE /* this target is using the target tree system */ | ||
5 | |||
6 | /* For Rolo and boot loader */ | ||
7 | #define MODEL_NUMBER 20 | ||
8 | #define MODEL_NAME "Sandisk Sansa c200" | ||
9 | |||
10 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | ||
11 | |||
12 | /* define this if you have recording possibility */ | ||
13 | /* TODO: #define HAVE_RECORDING */ | ||
14 | |||
15 | #define REC_SAMPR_CAPS (SAMPR_CAP_22) | ||
16 | #define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ | ||
17 | #define REC_SAMPR_DEFAULT SAMPR_22 | ||
18 | |||
19 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
20 | explicitly if different */ | ||
21 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) | ||
22 | |||
23 | /* define this if you have a bitmap LCD display */ | ||
24 | #define HAVE_LCD_BITMAP | ||
25 | |||
26 | /* define this if you have a colour LCD */ | ||
27 | #define HAVE_LCD_COLOR | ||
28 | |||
29 | /* define this if you have a light associated with the buttons */ | ||
30 | /* TODO: #define HAVE_BUTTON_LIGHT */ | ||
31 | |||
32 | /* define this if you have access to the quickscreen */ | ||
33 | #define HAVE_QUICKSCREEN | ||
34 | |||
35 | /* define this if you have access to the pitchscreen */ | ||
36 | #define HAVE_PITCHSCREEN | ||
37 | |||
38 | /* define this if you would like tagcache to build on this target */ | ||
39 | #define HAVE_TAGCACHE | ||
40 | |||
41 | /* LCD dimensions */ | ||
42 | #define LCD_WIDTH 132 | ||
43 | #define LCD_HEIGHT 80 | ||
44 | #define LCD_DEPTH 16 /* 65536 colours */ | ||
45 | #define LCD_PIXELFORMAT RGB565 /* rgb565 */ | ||
46 | |||
47 | /* define this if you have LCD enable function */ | ||
48 | /* TODO: #define HAVE_LCD_ENABLE */ | ||
49 | |||
50 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE | ||
51 | should be defined as well. */ | ||
52 | /* TODO: #define HAVE_LCD_SLEEP */ | ||
53 | |||
54 | /* define this if you can flip your LCD */ | ||
55 | /* TODO: #define HAVE_LCD_FLIP */ | ||
56 | |||
57 | /* define this if you can invert the colours on your LCD */ | ||
58 | /* TODO: #define HAVE_LCD_INVERT */ | ||
59 | |||
60 | /* Define this if your LCD can set contrast */ | ||
61 | /* #define HAVE_LCD_CONTRAST */ | ||
62 | |||
63 | #define MIN_CONTRAST_SETTING 0 | ||
64 | #define MAX_CONTRAST_SETTING 30 | ||
65 | #define DEFAULT_CONTRAST_SETTING 14 /* Match boot contrast */ | ||
66 | |||
67 | /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ | ||
68 | |||
69 | #define CONFIG_KEYPAD SANSA_C200_PAD | ||
70 | |||
71 | /* Define this if you do software codec */ | ||
72 | #define CONFIG_CODEC SWCODEC | ||
73 | |||
74 | /* There is no hardware tone control */ | ||
75 | #define HAVE_SW_TONE_CONTROLS | ||
76 | |||
77 | /* The PP5024 has a built-in AustriaMicrosystems AS3514 */ | ||
78 | #define HAVE_AS3514 | ||
79 | |||
80 | /* define this if you have a real-time clock */ | ||
81 | #ifndef BOOTLOADER | ||
82 | #define CONFIG_RTC RTC_AS3514 | ||
83 | #endif | ||
84 | |||
85 | /* Define this if you have a software controlled poweroff */ | ||
86 | #define HAVE_SW_POWEROFF | ||
87 | |||
88 | /* Some Sansa E200s seem to be FAT16 formatted */ | ||
89 | #define HAVE_FAT16SUPPORT | ||
90 | |||
91 | /* The number of bytes reserved for loadable codecs */ | ||
92 | #define CODEC_SIZE 0x80000 | ||
93 | |||
94 | /* The number of bytes reserved for loadable plugins */ | ||
95 | #define PLUGIN_BUFFER_SIZE 0x80000 | ||
96 | |||
97 | #define AB_REPEAT_ENABLE 1 | ||
98 | |||
99 | /* FM Tuner */ | ||
100 | /* TODO: #define CONFIG_TUNER LV24020LP */ | ||
101 | /* TODO: #define HAVE_TUNER_PWR_CTRL */ | ||
102 | |||
103 | /* Define this for LCD backlight available */ | ||
104 | #define HAVE_BACKLIGHT | ||
105 | #define HAVE_BACKLIGHT_BRIGHTNESS | ||
106 | |||
107 | /* define this if you have a flash memory storage */ | ||
108 | #define HAVE_FLASH_STORAGE | ||
109 | |||
110 | #define HAVE_MULTIVOLUME | ||
111 | |||
112 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ | ||
113 | #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ | ||
114 | #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ | ||
115 | #define BATTERY_CAPACITY_INC 0 /* capacity increment */ | ||
116 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
117 | |||
118 | /* Hardware controlled charging? FIXME */ | ||
119 | #define CONFIG_CHARGING CHARGING_SIMPLE | ||
120 | |||
121 | /* define this if the unit can be powered or charged via USB */ | ||
122 | #define HAVE_USB_POWER | ||
123 | |||
124 | /** Non-simulator section **/ | ||
125 | #ifndef SIMULATOR | ||
126 | |||
127 | /* Define this if you have a PortalPlayer PP5024 */ | ||
128 | #define CONFIG_CPU PP5022 | ||
129 | |||
130 | /* Define this if you want to use the PP5024 i2c interface */ | ||
131 | #define CONFIG_I2C I2C_PP5024 | ||
132 | |||
133 | /* define this if the hardware can be powered off while charging */ | ||
134 | /* Sansa can't be powered off while charging */ | ||
135 | /* #define HAVE_POWEROFF_WHILE_CHARGING */ | ||
136 | |||
137 | /* The start address index for ROM builds */ | ||
138 | #define ROM_START 0x00000000 | ||
139 | |||
140 | /* Define this to the CPU frequency */ | ||
141 | #define CPU_FREQ 75000000 | ||
142 | |||
143 | /* Type of LCD TODO: hopefully the same as the x5 but check this*/ | ||
144 | #define CONFIG_LCD LCD_C200 | ||
145 | |||
146 | #define HAVE_HOTSWAP | ||
147 | |||
148 | /* Offset ( in the firmware file's header ) to the file CRC and data. These are | ||
149 | only used when loading the old format rockbox.e200 file */ | ||
150 | #define FIRMWARE_OFFSET_FILE_CRC 0x0 | ||
151 | #define FIRMWARE_OFFSET_FILE_DATA 0x8 | ||
152 | |||
153 | /* #define USB_IPODSTYLE */ | ||
154 | |||
155 | /* USB On-the-go */ | ||
156 | #define CONFIG_USBOTG USBOTG_ARC | ||
157 | |||
158 | /* enable these for the experimental usb stack | ||
159 | #define HAVE_USBSTACK | ||
160 | #define USBSTACK_CAPS CONTROLLER_DEVICE | ||
161 | */ | ||
162 | |||
163 | /* Virtual LED (icon) */ | ||
164 | #define CONFIG_LED LED_VIRTUAL | ||
165 | |||
166 | /* Define this if you have adjustable CPU frequency */ | ||
167 | #define HAVE_ADJUSTABLE_CPU_FREQ | ||
168 | |||
169 | #define MI4_FORMAT | ||
170 | #define BOOTFILE_EXT "mi4" | ||
171 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
172 | #define BOOTDIR "/.rockbox" | ||
173 | |||
174 | #define ICODE_ATTR_TREMOR_NOT_MDCT | ||
175 | |||
176 | #define INCLUDE_TIMEOUT_API | ||
177 | |||
178 | #endif /* SIMULATOR */ | ||
179 | |||
180 | /** Port-specific settings **/ | ||
181 | |||
182 | /* Main LCD backlight brightness range and defaults */ | ||
183 | #define MIN_BRIGHTNESS_SETTING 1 | ||
184 | #define MAX_BRIGHTNESS_SETTING 12 | ||
185 | #define DEFAULT_BRIGHTNESS_SETTING 6 | ||
186 | |||
187 | /* Default recording levels */ | ||
188 | #define DEFAULT_REC_MIC_GAIN 23 | ||
189 | #define DEFAULT_REC_LEFT_GAIN 23 | ||
190 | #define DEFAULT_REC_RIGHT_GAIN 23 | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index 44583183b1..a18bf14a97 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -63,8 +63,9 @@ | |||
63 | #define GIGABEAT_PAD 11 | 63 | #define GIGABEAT_PAD 11 |
64 | #define IRIVER_H10_PAD 12 | 64 | #define IRIVER_H10_PAD 12 |
65 | #define SANSA_E200_PAD 13 | 65 | #define SANSA_E200_PAD 13 |
66 | #define ELIO_TPJ1022_PAD 14 | 66 | #define SANSA_C200_PAD 14 |
67 | #define ARCHOS_AV300_PAD 15 | 67 | #define ELIO_TPJ1022_PAD 15 |
68 | #define ARCHOS_AV300_PAD 16 | ||
68 | 69 | ||
69 | /* CONFIG_REMOTE_KEYPAD */ | 70 | /* CONFIG_REMOTE_KEYPAD */ |
70 | #define H100_REMOTE 1 | 71 | #define H100_REMOTE 1 |
@@ -95,6 +96,7 @@ | |||
95 | #define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */ | 96 | #define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */ |
96 | #define LCD_TPJ1022 15 /* as used by Tatung Elio TPJ-1022 */ | 97 | #define LCD_TPJ1022 15 /* as used by Tatung Elio TPJ-1022 */ |
97 | #define LCD_DSC25 16 /* as used by Archos AV300 */ | 98 | #define LCD_DSC25 16 /* as used by Archos AV300 */ |
99 | #define LCD_C200 17 /* as used by Sandisk Sansa c200 */ | ||
98 | 100 | ||
99 | /* LCD_PIXELFORMAT */ | 101 | /* LCD_PIXELFORMAT */ |
100 | #define HORIZONTAL_PACKING 1 | 102 | #define HORIZONTAL_PACKING 1 |
@@ -191,6 +193,8 @@ | |||
191 | #include "config-h10_5gb.h" | 193 | #include "config-h10_5gb.h" |
192 | #elif defined(SANSA_E200) | 194 | #elif defined(SANSA_E200) |
193 | #include "config-e200.h" | 195 | #include "config-e200.h" |
196 | #elif defined(SANSA_C200) | ||
197 | #include "config-c200.h" | ||
194 | #elif defined(ELIO_TPJ1022) | 198 | #elif defined(ELIO_TPJ1022) |
195 | #include "config-tpj1022.h" | 199 | #include "config-tpj1022.h" |
196 | #else | 200 | #else |
@@ -249,7 +253,7 @@ | |||
249 | /* Enable the directory cache and tagcache in RAM if we have | 253 | /* Enable the directory cache and tagcache in RAM if we have |
250 | * plenty of RAM. Both features can be enabled independently. */ | 254 | * plenty of RAM. Both features can be enabled independently. */ |
251 | #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ | 255 | #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ |
252 | !defined(BOOTLOADER) && !defined(SANSA_E200) | 256 | !defined(BOOTLOADER) && !defined(SANSA_E200) && !defined(SANSA_C200) |
253 | #define HAVE_DIRCACHE | 257 | #define HAVE_DIRCACHE |
254 | #ifdef HAVE_TAGCACHE | 258 | #ifdef HAVE_TAGCACHE |
255 | #define HAVE_TC_RAMCACHE | 259 | #define HAVE_TC_RAMCACHE |
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 82b9d36d4a..0c4231a4e5 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h | |||
@@ -50,7 +50,8 @@ | |||
50 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD | 50 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD |
51 | #define USBPOWER_BUTTON BUTTON_NONE | 51 | #define USBPOWER_BUTTON BUTTON_NONE |
52 | #define USBPOWER_BTN_IGNORE BUTTON_POWER | 52 | #define USBPOWER_BTN_IGNORE BUTTON_POWER |
53 | #elif CONFIG_KEYPAD == SANSA_E200_PAD | 53 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ |
54 | (CONFIG_KEYPAD == SANSA_C200_PAD) | ||
54 | #define USBPOWER_BUTTON BUTTON_SELECT | 55 | #define USBPOWER_BUTTON BUTTON_SELECT |
55 | #define USBPOWER_BTN_IGNORE BUTTON_POWER | 56 | #define USBPOWER_BTN_IGNORE BUTTON_POWER |
56 | #endif | 57 | #endif |
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S index 85dd7f8b24..c1ced11cec 100644 --- a/firmware/target/arm/crt0-pp.S +++ b/firmware/target/arm/crt0-pp.S | |||
@@ -60,7 +60,7 @@ start: | |||
60 | .space 60*4 /* (more than enough) space for exception vectors and mi4 magic */ | 60 | .space 60*4 /* (more than enough) space for exception vectors and mi4 magic */ |
61 | 61 | ||
62 | pad_skip: | 62 | pad_skip: |
63 | #ifdef SANSA_E200 | 63 | #if defined(SANSA_E200) || defined(SANSA_C200) |
64 | /* On the Sansa, copying the vectors fails if the cache is initialised */ | 64 | /* On the Sansa, copying the vectors fails if the cache is initialised */ |
65 | ldr r1, =CACHE_CTRL | 65 | ldr r1, =CACHE_CTRL |
66 | mov r2, #0x0 | 66 | mov r2, #0x0 |
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c index 07fa822ab3..1cc25a1a10 100644 --- a/firmware/target/arm/i2c-pp.c +++ b/firmware/target/arm/i2c-pp.c | |||
@@ -198,10 +198,27 @@ void i2c_init(void) | |||
198 | outl(0x0, 0x600060a4); | 198 | outl(0x0, 0x600060a4); |
199 | outl(0x80 | (0 << 8), 0x600060a4); | 199 | outl(0x80 | (0 << 8), 0x600060a4); |
200 | #elif CONFIG_I2C == I2C_PP5024 | 200 | #elif CONFIG_I2C == I2C_PP5024 |
201 | #ifdef SANSA_E200 | ||
201 | /* Sansa OF sets this to 0x20 first, communicates with the AS3514 | 202 | /* Sansa OF sets this to 0x20 first, communicates with the AS3514 |
202 | then sets it to 0x23 - this still works fine though */ | 203 | then sets it to 0x23 - this still works fine though */ |
203 | outl(0x0, 0x600060a4); | 204 | outl(0x0, 0x600060a4); |
204 | outl(0x23, 0x600060a4); | 205 | outl(0x23, 0x600060a4); |
206 | #elif defined(SANSA_C200) | ||
207 | /* This is the init sequence from the Sansa c200 bootloader. | ||
208 | I'm not sure what's really necessary. */ | ||
209 | pp_i2c_wait_not_busy(); | ||
210 | |||
211 | outl(0, 0x600060a4); | ||
212 | outl(0x64, 0x600060a4); | ||
213 | |||
214 | outl(0x55, 0x7000c02c); | ||
215 | outl(0x54, 0x7000c030); | ||
216 | |||
217 | outl(0, 0x600060a4); | ||
218 | outl(0x1e, 0x600060a4); | ||
219 | |||
220 | pp_i2c_send(0x46, 0x24, 5); | ||
221 | #endif | ||
205 | #endif | 222 | #endif |
206 | 223 | ||
207 | spinlock_init(&i2c_mutex); | 224 | spinlock_init(&i2c_mutex); |
diff --git a/firmware/target/arm/i2s-pp.c b/firmware/target/arm/i2s-pp.c index b9e32b8789..fc01e38e91 100644 --- a/firmware/target/arm/i2s-pp.c +++ b/firmware/target/arm/i2s-pp.c | |||
@@ -142,7 +142,7 @@ void i2s_reset(void) | |||
142 | IISFIFO_CFG |= 0x1100; | 142 | IISFIFO_CFG |= 0x1100; |
143 | } | 143 | } |
144 | 144 | ||
145 | #ifdef SANSA_E200 | 145 | #if defined(SANSA_E200) || defined(SANSA_C200) |
146 | void i2s_scale_attn_level(long frequency) | 146 | void i2s_scale_attn_level(long frequency) |
147 | { | 147 | { |
148 | unsigned int iisfifo_cfg = IISFIFO_CFG & ~0xff; | 148 | unsigned int iisfifo_cfg = IISFIFO_CFG & ~0xff; |
diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c index a61e2ab610..addc490417 100644 --- a/firmware/target/arm/sandisk/ata-c200_e200.c +++ b/firmware/target/arm/sandisk/ata-c200_e200.c | |||
@@ -519,6 +519,7 @@ static int sd_select_bank(unsigned char bank) | |||
519 | static void sd_card_mux(int card_no) | 519 | static void sd_card_mux(int card_no) |
520 | { | 520 | { |
521 | /* Set the current card mux */ | 521 | /* Set the current card mux */ |
522 | #ifdef SANSA_E200 | ||
522 | if (card_no == 0) | 523 | if (card_no == 0) |
523 | { | 524 | { |
524 | outl(inl(0x70000080) | 0x4, 0x70000080); | 525 | outl(inl(0x70000080) | 0x4, 0x70000080); |
@@ -543,6 +544,32 @@ static void sd_card_mux(int card_no) | |||
543 | 544 | ||
544 | outl(inl(0x70000014) & ~(0x3ffff), 0x70000014); | 545 | outl(inl(0x70000014) & ~(0x3ffff), 0x70000014); |
545 | } | 546 | } |
547 | #else /* SANSA_C200 */ | ||
548 | if (card_no == 0) | ||
549 | { | ||
550 | outl(inl(0x70000080) | 0x4, 0x70000080); | ||
551 | |||
552 | GPIOD_ENABLE &= ~0x1f; | ||
553 | GPIOD_OUTPUT_EN &= ~0x1f; | ||
554 | GPIOA_ENABLE |= 0x7a; | ||
555 | GPIOA_OUTPUT_VAL |= 0x7a; | ||
556 | GPIOA_OUTPUT_EN |= 0x7a; | ||
557 | |||
558 | outl(inl(0x70000014) & ~(0x3ffff), 0x70000014); | ||
559 | } | ||
560 | else | ||
561 | { | ||
562 | outl(inl(0x70000080) & ~0x4, 0x70000080); | ||
563 | |||
564 | GPIOA_ENABLE &= ~0x7a; | ||
565 | GPIOA_OUTPUT_EN &= ~0x7a; | ||
566 | GPIOD_ENABLE |= 0x1f; | ||
567 | GPIOD_OUTPUT_VAL |= 0x1f; | ||
568 | GPIOD_OUTPUT_EN |= 0x1f; | ||
569 | |||
570 | outl((inl(0x70000014) & ~(0x3ffff)) | 0x255aa, 0x70000014); | ||
571 | } | ||
572 | #endif | ||
546 | } | 573 | } |
547 | 574 | ||
548 | static void sd_init_device(int card_no) | 575 | static void sd_init_device(int card_no) |
diff --git a/firmware/target/arm/sandisk/backlight-c200_e200.c b/firmware/target/arm/sandisk/backlight-c200_e200.c index 29c6ab4b45..411c19f7ad 100644 --- a/firmware/target/arm/sandisk/backlight-c200_e200.c +++ b/firmware/target/arm/sandisk/backlight-c200_e200.c | |||
@@ -36,17 +36,21 @@ void __backlight_set_brightness(int brightness) | |||
36 | 36 | ||
37 | void __backlight_on(void) | 37 | void __backlight_on(void) |
38 | { | 38 | { |
39 | #ifdef HAVE_LCD_ENABLE | ||
39 | lcd_enable(true); /* power on lcd */ | 40 | lcd_enable(true); /* power on lcd */ |
41 | #endif | ||
40 | pp_i2c_send( 0x46, 0x23, backlight_brightness); | 42 | pp_i2c_send( 0x46, 0x23, backlight_brightness); |
41 | } | 43 | } |
42 | 44 | ||
43 | void __backlight_off(void) | 45 | void __backlight_off(void) |
44 | { | 46 | { |
45 | pp_i2c_send( 0x46, 0x23, 0x0); | 47 | pp_i2c_send( 0x46, 0x23, 0x0); |
48 | #ifdef HAVE_LCD_ENABLE | ||
46 | lcd_enable(false); /* power off lcd */ | 49 | lcd_enable(false); /* power off lcd */ |
50 | #endif | ||
47 | } | 51 | } |
48 | 52 | ||
49 | 53 | #ifdef HAVE_BUTTON_LIGHT | |
50 | void __button_backlight_on(void) | 54 | void __button_backlight_on(void) |
51 | { | 55 | { |
52 | GPIOG_OUTPUT_VAL |=0x80; | 56 | GPIOG_OUTPUT_VAL |=0x80; |
@@ -56,3 +60,4 @@ void __button_backlight_off(void) | |||
56 | { | 60 | { |
57 | GPIOG_OUTPUT_VAL &=~ 0x80; | 61 | GPIOG_OUTPUT_VAL &=~ 0x80; |
58 | } | 62 | } |
63 | #endif | ||
diff --git a/firmware/target/arm/sandisk/backlight-target.h b/firmware/target/arm/sandisk/backlight-target.h index ac256036b9..1b1a6ad4e1 100644 --- a/firmware/target/arm/sandisk/backlight-target.h +++ b/firmware/target/arm/sandisk/backlight-target.h | |||
@@ -25,6 +25,8 @@ void __backlight_off(void); | |||
25 | void __backlight_set_brightness(int brightness); | 25 | void __backlight_set_brightness(int brightness); |
26 | int __backlight_is_on(void); | 26 | int __backlight_is_on(void); |
27 | 27 | ||
28 | #ifdef HAVE_BUTTON_LIGHT | ||
28 | void __button_backlight_on(void); | 29 | void __button_backlight_on(void); |
29 | void __button_backlight_off(void); | 30 | void __button_backlight_off(void); |
30 | #endif | 31 | #endif |
32 | #endif | ||
diff --git a/firmware/target/arm/sandisk/power-c200_e200.c b/firmware/target/arm/sandisk/power-c200_e200.c index b9a77cb9e0..cb85b117c4 100644 --- a/firmware/target/arm/sandisk/power-c200_e200.c +++ b/firmware/target/arm/sandisk/power-c200_e200.c | |||
@@ -53,7 +53,11 @@ void power_off(void) | |||
53 | 53 | ||
54 | bool charger_inserted(void) | 54 | bool charger_inserted(void) |
55 | { | 55 | { |
56 | #ifdef SANSA_E200 | ||
56 | if(GPIOB_INPUT_VAL & 0x10) | 57 | if(GPIOB_INPUT_VAL & 0x10) |
58 | #else /* SANSA_C200 */ | ||
59 | if(GPIOH_INPUT_VAL & 0x2) | ||
60 | #endif | ||
57 | return true; | 61 | return true; |
58 | return false; | 62 | return false; |
59 | } | 63 | } |
@@ -63,6 +67,7 @@ void ide_power_enable(bool on) | |||
63 | (void)on; | 67 | (void)on; |
64 | } | 68 | } |
65 | 69 | ||
70 | #if CONFIG_TUNER | ||
66 | /** Tuner **/ | 71 | /** Tuner **/ |
67 | static bool powered = false; | 72 | static bool powered = false; |
68 | 73 | ||
@@ -125,3 +130,5 @@ bool tuner_power(bool status) | |||
125 | lv24020lp_unlock(); | 130 | lv24020lp_unlock(); |
126 | return old_status; | 131 | return old_status; |
127 | } | 132 | } |
133 | |||
134 | #endif | ||
diff --git a/firmware/target/arm/sandisk/sansa-c200/button-c200.c b/firmware/target/arm/sandisk/sansa-c200/button-c200.c new file mode 100644 index 0000000000..eedd937699 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-c200/button-c200.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id:$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "system.h" | ||
21 | #include "button.h" | ||
22 | #include "backlight.h" | ||
23 | |||
24 | void button_init_device(void) | ||
25 | { | ||
26 | /* TODO...for now, hardware initialisation is done by the c200 bootloader */ | ||
27 | } | ||
28 | |||
29 | bool button_hold(void) | ||
30 | { | ||
31 | return !(GPIOI_INPUT_VAL & 0x80); | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * Get button pressed from hardware | ||
36 | */ | ||
37 | int button_read_device(void) | ||
38 | { | ||
39 | int btn = BUTTON_NONE; | ||
40 | static bool hold_button = false; | ||
41 | bool hold_button_old; | ||
42 | |||
43 | /* Hold */ | ||
44 | hold_button_old = hold_button; | ||
45 | hold_button = button_hold(); | ||
46 | |||
47 | /* device buttons */ | ||
48 | if (!hold_button) | ||
49 | { | ||
50 | if ( (GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; | ||
51 | if (!(GPIOG_INPUT_VAL & 0x10)) btn |= BUTTON_UP; | ||
52 | if (!(GPIOH_INPUT_VAL & 0x01)) btn |= BUTTON_DOWN; | ||
53 | if (!(GPIOI_INPUT_VAL & 0x04)) btn |= BUTTON_LEFT; | ||
54 | if (!(GPIOG_INPUT_VAL & 0x02)) btn |= BUTTON_RIGHT; | ||
55 | if (!(GPIOL_INPUT_VAL & 0x04)) btn |= BUTTON_SELECT; | ||
56 | if (!(GPIOG_INPUT_VAL & 0x01)) btn |= BUTTON_REC; | ||
57 | if (!(GPIOL_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; | ||
58 | if (!(GPIOL_INPUT_VAL & 0x20)) btn |= BUTTON_VOL_DOWN; | ||
59 | } | ||
60 | |||
61 | return btn; | ||
62 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-c200/button-target.h b/firmware/target/arm/sandisk/sansa-c200/button-target.h new file mode 100644 index 0000000000..6f42822f7f --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-c200/button-target.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id:$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _BUTTON_TARGET_H_ | ||
21 | #define _BUTTON_TARGET_H_ | ||
22 | |||
23 | #include <stdbool.h> | ||
24 | #include "config.h" | ||
25 | |||
26 | #define HAS_BUTTON_HOLD | ||
27 | |||
28 | bool button_hold(void); | ||
29 | void button_init_device(void); | ||
30 | int button_read_device(void); | ||
31 | |||
32 | /* Sandisk Sansa c200 button codes */ | ||
33 | |||
34 | /* Main unit's buttons */ | ||
35 | #define BUTTON_REC 0x00000001 | ||
36 | #define BUTTON_DOWN 0x00000002 | ||
37 | #define BUTTON_RIGHT 0x00000004 | ||
38 | #define BUTTON_LEFT 0x00000008 | ||
39 | #define BUTTON_SELECT 0x00000010 | ||
40 | #define BUTTON_UP 0x00000020 | ||
41 | #define BUTTON_POWER 0x00000040 | ||
42 | #define BUTTON_VOL_UP 0x00000080 | ||
43 | #define BUTTON_VOL_DOWN 0x00000100 | ||
44 | |||
45 | #define BUTTON_MAIN 0x00000fff | ||
46 | |||
47 | /* No Remote control */ | ||
48 | #define BUTTON_REMOTE 0 | ||
49 | |||
50 | #define POWEROFF_BUTTON BUTTON_POWER | ||
51 | #define POWEROFF_COUNT 10 | ||
52 | |||
53 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c new file mode 100644 index 0000000000..6626ea4e6d --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c | |||
@@ -0,0 +1,249 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id:$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Mark Arigo | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "lcd.h" | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | |||
25 | #define LCD_BASE (*(volatile unsigned long *)(0x70003000)) | ||
26 | #define LCD_CMD (*(volatile unsigned long *)(0x70003008)) | ||
27 | #define LCD_DATA (*(volatile unsigned long *)(0x70003010)) | ||
28 | |||
29 | #define LCD_BUSY 0x8000 | ||
30 | |||
31 | /* check if number of useconds has past */ | ||
32 | static inline bool timer_check(int clock_start, int usecs) | ||
33 | { | ||
34 | return ((int)(USEC_TIMER - clock_start)) >= usecs; | ||
35 | } | ||
36 | |||
37 | /* wait for LCD with timeout */ | ||
38 | static inline void lcd_wait_write(void) | ||
39 | { | ||
40 | int start = USEC_TIMER; | ||
41 | |||
42 | do { | ||
43 | if ((LCD_BASE & LCD_BUSY) == 0) | ||
44 | break; | ||
45 | } while (timer_check(start, 1000) == 0); | ||
46 | } | ||
47 | |||
48 | /* send LCD data */ | ||
49 | static void lcd_send_data(unsigned data) | ||
50 | { | ||
51 | lcd_wait_write(); | ||
52 | LCD_DATA = (data >> 8) & 0xff; | ||
53 | |||
54 | lcd_wait_write(); | ||
55 | LCD_DATA = data & 0xff; | ||
56 | } | ||
57 | |||
58 | /* send LCD command */ | ||
59 | static void lcd_send_command(unsigned cmd) | ||
60 | { | ||
61 | lcd_wait_write(); | ||
62 | LCD_CMD = cmd; | ||
63 | } | ||
64 | |||
65 | /* LCD init */ | ||
66 | void lcd_init_device(void) | ||
67 | { | ||
68 | /* This is from the c200 of bootloader beginning at offset 0xbbf4 */ | ||
69 | outl(inl(0x70000010) & ~0xfc000000, 0x70000010); | ||
70 | outl(inl(0x70000010), 0x70000010); | ||
71 | |||
72 | DEV_INIT &= ~0x400; | ||
73 | udelay(10000); | ||
74 | |||
75 | LCD_BASE &= ~0x4; | ||
76 | udelay(15); | ||
77 | |||
78 | LCD_BASE |= 0x4; | ||
79 | udelay(10); | ||
80 | |||
81 | LCD_BASE = 0x4687; | ||
82 | udelay(10000); | ||
83 | |||
84 | lcd_send_command(0x2c); | ||
85 | udelay(20000); | ||
86 | |||
87 | lcd_send_command(0x02); | ||
88 | lcd_send_command(0x01); | ||
89 | udelay(20000); | ||
90 | |||
91 | lcd_send_command(0x26); | ||
92 | lcd_send_command(0x01); | ||
93 | udelay(20000); | ||
94 | |||
95 | lcd_send_command(0x26); | ||
96 | lcd_send_command(0x09); | ||
97 | udelay(20000); | ||
98 | |||
99 | lcd_send_command(0x26); | ||
100 | lcd_send_command(0x0b); | ||
101 | udelay(20000); | ||
102 | |||
103 | lcd_send_command(0x26); | ||
104 | lcd_send_command(0x0f); | ||
105 | udelay(20000); | ||
106 | |||
107 | lcd_send_command(0x10); | ||
108 | lcd_send_command(0x07); | ||
109 | |||
110 | lcd_send_command(0x20); | ||
111 | lcd_send_command(0x03); | ||
112 | |||
113 | lcd_send_command(0x24); | ||
114 | lcd_send_command(0x03); | ||
115 | |||
116 | lcd_send_command(0x28); | ||
117 | lcd_send_command(0x01); | ||
118 | |||
119 | lcd_send_command(0x2a); | ||
120 | lcd_send_command(0x55); | ||
121 | |||
122 | lcd_send_command(0x30); | ||
123 | lcd_send_command(0x10); | ||
124 | |||
125 | lcd_send_command(0x32); | ||
126 | lcd_send_command(0x0e); | ||
127 | |||
128 | lcd_send_command(0x34); | ||
129 | lcd_send_command(0x0d); | ||
130 | |||
131 | lcd_send_command(0x36); | ||
132 | lcd_send_command(0); | ||
133 | |||
134 | lcd_send_command(0x40); | ||
135 | lcd_send_command(0x82); | ||
136 | |||
137 | lcd_send_command(0x43); /* vertical dimensions */ | ||
138 | lcd_send_command(0x1a); /* y1 + 0x1a */ | ||
139 | lcd_send_command(LCD_HEIGHT - 1 + 0x1a); /* y2 + 0x1a */ | ||
140 | |||
141 | lcd_send_command(0x42); /* horizontal dimensions */ | ||
142 | lcd_send_command(0); /* x1 */ | ||
143 | lcd_send_command(LCD_WIDTH - 1); /* x2 */ | ||
144 | udelay(100000); | ||
145 | |||
146 | lcd_send_command(0x51); | ||
147 | } | ||
148 | |||
149 | /*** hardware configuration ***/ | ||
150 | int lcd_default_contrast(void) | ||
151 | { | ||
152 | return DEFAULT_CONTRAST_SETTING; | ||
153 | } | ||
154 | |||
155 | void lcd_set_contrast(int val) | ||
156 | { | ||
157 | /* TODO: Implement lcd_set_contrast() */ | ||
158 | (void)val; | ||
159 | } | ||
160 | |||
161 | void lcd_set_invert_display(bool yesno) | ||
162 | { | ||
163 | /* TODO: Implement lcd_set_invert_display() */ | ||
164 | (void)yesno; | ||
165 | } | ||
166 | |||
167 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
168 | void lcd_set_flip(bool yesno) | ||
169 | { | ||
170 | /* TODO: Implement lcd_set_flip() */ | ||
171 | (void)yesno; | ||
172 | } | ||
173 | |||
174 | /*** update functions ***/ | ||
175 | |||
176 | /* Performance function that works with an external buffer | ||
177 | note that by and bheight are in 4-pixel units! */ | ||
178 | void lcd_blit(const fb_data* data, int x, int by, int width, | ||
179 | int bheight, int stride) | ||
180 | { | ||
181 | /* TODO: Implement lcd_blit() */ | ||
182 | (void)data; | ||
183 | (void)x; | ||
184 | (void)by; | ||
185 | (void)width; | ||
186 | (void)bheight; | ||
187 | (void)stride; | ||
188 | } | ||
189 | |||
190 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
191 | void lcd_yuv_blit(unsigned char * const src[3], | ||
192 | int src_x, int src_y, int stride, | ||
193 | int x, int y, int width, int height) | ||
194 | { | ||
195 | (void)src; | ||
196 | (void)src_x; | ||
197 | (void)src_y; | ||
198 | (void)stride; | ||
199 | (void)x; | ||
200 | (void)y; | ||
201 | (void)width; | ||
202 | (void)height; | ||
203 | } | ||
204 | |||
205 | /* Update the display. | ||
206 | This must be called after all other LCD functions that change the display. */ | ||
207 | void lcd_update(void) | ||
208 | { | ||
209 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
210 | } | ||
211 | |||
212 | /* Update a fraction of the display. */ | ||
213 | void lcd_update_rect(int x0, int y0, int width, int height) | ||
214 | { | ||
215 | unsigned short *addr; | ||
216 | int c, r; | ||
217 | int x1 = (x0 + width) - 1; | ||
218 | int y1 = (y0 + height) - 1; | ||
219 | |||
220 | if ((x1 <= 0) || (y1 <= 0)) | ||
221 | return; | ||
222 | |||
223 | if(y1 >= LCD_HEIGHT) | ||
224 | y1 = LCD_HEIGHT - 1; | ||
225 | |||
226 | lcd_send_command(0x43); | ||
227 | lcd_send_command(y0 + 0x1a); | ||
228 | lcd_send_command(y1 + 0x1a); | ||
229 | |||
230 | if(x1 >= LCD_WIDTH) | ||
231 | x1 = LCD_WIDTH - 1; | ||
232 | |||
233 | lcd_send_command(0x42); | ||
234 | lcd_send_command(x0); | ||
235 | lcd_send_command(x1); | ||
236 | |||
237 | addr = (unsigned short*)&lcd_framebuffer[y0][x0]; | ||
238 | |||
239 | /* for each row */ | ||
240 | for (r = 0; r < height; r++) { | ||
241 | /* for each column */ | ||
242 | for (c = 0; c < width; c++) { | ||
243 | /* output 1 pixel */ | ||
244 | lcd_send_data(*(addr++)); | ||
245 | } | ||
246 | |||
247 | addr += LCD_WIDTH - width; | ||
248 | } | ||
249 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c b/firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c new file mode 100644 index 0000000000..1de57cb184 --- /dev/null +++ b/firmware/target/arm/sandisk/sansa-c200/powermgmt-c200.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: powermgmt-e200.c 14375 2007-08-17 06:45:18Z amiconn $ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese | ||
11 | * Revisions copyright (C) 2005 by Gerald Van Baren | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include "config.h" | ||
22 | #include "adc.h" | ||
23 | #include "powermgmt.h" | ||
24 | |||
25 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
26 | { | ||
27 | 3400 | ||
28 | }; | ||
29 | |||
30 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
31 | { | ||
32 | 3300 | ||
33 | }; | ||
34 | |||
35 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
36 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
37 | { | ||
38 | /* Sansa Li Ion 750mAH FIXME this is a first linear approach */ | ||
39 | { 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 }, | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | /* Sansa Li Ion 750mAH FIXME*/ | ||
46 | 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 | ||
47 | }; | ||
48 | |||
49 | /* ADC should read 0x3ff=5.12V */ | ||
50 | #define BATTERY_SCALE_FACTOR 5125 | ||
51 | /* full-scale ADC readout (2^10) in millivolt */ | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
57 | } | ||
58 | |||
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index a282564d19..465457d0e1 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c | |||
@@ -120,7 +120,7 @@ static void pp_set_cpu_frequency(long frequency) | |||
120 | while (test_and_set(&boostctrl_mtx.locked, 1)) ; | 120 | while (test_and_set(&boostctrl_mtx.locked, 1)) ; |
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | #ifdef SANSA_E200 | 123 | #if defined(SANSA_E200) || defined(SANSA_C200) |
124 | i2s_scale_attn_level(CPUFREQ_DEFAULT); | 124 | i2s_scale_attn_level(CPUFREQ_DEFAULT); |
125 | #endif | 125 | #endif |
126 | 126 | ||
@@ -183,7 +183,7 @@ static void pp_set_cpu_frequency(long frequency) | |||
183 | CLCD_CLOCK_SRC; /* dummy read (to sync the write pipeline??) */ | 183 | CLCD_CLOCK_SRC; /* dummy read (to sync the write pipeline??) */ |
184 | CLCD_CLOCK_SRC = clcd_clock_src; /* restore saved value */ | 184 | CLCD_CLOCK_SRC = clcd_clock_src; /* restore saved value */ |
185 | 185 | ||
186 | #ifdef SANSA_E200 | 186 | #if defined(SANSA_E200) || defined(SANSA_C200) |
187 | i2s_scale_attn_level(frequency); | 187 | i2s_scale_attn_level(frequency); |
188 | #endif | 188 | #endif |
189 | 189 | ||
@@ -231,7 +231,7 @@ void system_init(void) | |||
231 | GPIOK_INT_EN = 0; | 231 | GPIOK_INT_EN = 0; |
232 | GPIOL_INT_EN = 0; | 232 | GPIOL_INT_EN = 0; |
233 | 233 | ||
234 | #ifdef SANSA_E200 | 234 | #if defined(SANSA_E200) || defined(SANSA_C200) |
235 | /* outl(0x00000000, 0x6000b000); */ | 235 | /* outl(0x00000000, 0x6000b000); */ |
236 | outl(inl(0x6000a000) | 0x80000000, 0x6000a000); /* Init DMA controller? */ | 236 | outl(inl(0x6000a000) | 0x80000000, 0x6000a000); /* Init DMA controller? */ |
237 | #endif | 237 | #endif |