diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2008-12-24 04:10:18 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2008-12-24 04:10:18 +0000 |
commit | c97f640060cd13ba4fed041f1f1feecd84aa2ae0 (patch) | |
tree | b7bac8f1d7586ff75e1fc3119574242ba059825f | |
parent | be26da8662f19b0c72c98bbe9eeb00b0468af23c (diff) | |
download | rockbox-c97f640060cd13ba4fed041f1f1feecd84aa2ae0.tar.gz rockbox-c97f640060cd13ba4fed041f1f1feecd84aa2ae0.zip |
Commit FS#9679 by Thomas Martitz. Adds c200v2 to the target tree. Has some buttons defined, a bootloader, and stubs for most drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19574 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/sansa_as3525.c | 4 | ||||
-rw-r--r-- | firmware/SOURCES | 13 | ||||
-rw-r--r-- | firmware/export/config-c200v2.h | 209 | ||||
-rw-r--r-- | firmware/export/config.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/as3525/clock-target.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c | 71 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-c200v2/backlight-target.h | 32 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c | 111 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-c200v2/button-target.h | 55 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-c200v2/lcd-c200v2.c | 429 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 2 | ||||
-rwxr-xr-x | tools/configure | 28 | ||||
-rw-r--r-- | tools/scramble.c | 2 |
13 files changed, 957 insertions, 3 deletions
diff --git a/bootloader/sansa_as3525.c b/bootloader/sansa_as3525.c index 6da546fcac..4537c4b43f 100644 --- a/bootloader/sansa_as3525.c +++ b/bootloader/sansa_as3525.c | |||
@@ -46,6 +46,10 @@ void main(void) | |||
46 | system_init(); | 46 | system_init(); |
47 | kernel_init(); | 47 | kernel_init(); |
48 | 48 | ||
49 | #ifdef SANSA_C200V2 | ||
50 | /* stop here */ | ||
51 | while(1); | ||
52 | #endif | ||
49 | lcd_init(); | 53 | lcd_init(); |
50 | show_logo(); | 54 | show_logo(); |
51 | 55 | ||
diff --git a/firmware/SOURCES b/firmware/SOURCES index fd0ec39f2f..c1771a3935 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1100,6 +1100,19 @@ target/arm/as3525/powermgmt-as3525.c | |||
1100 | #endif /* !SIMULATOR */ | 1100 | #endif /* !SIMULATOR */ |
1101 | #endif /* SANSA_E200V2 */ | 1101 | #endif /* SANSA_E200V2 */ |
1102 | 1102 | ||
1103 | #ifdef SANSA_C200V2 | ||
1104 | #ifndef SIMULATOR | ||
1105 | target/arm/as3525/sansa-c200v2/lcd-c200v2.c | ||
1106 | target/arm/as3525/sansa-c200v2/button-c200v2.c | ||
1107 | target/arm/as3525/sansa-c200v2/backlight-c200v2.c | ||
1108 | #ifndef BOOTLOADER | ||
1109 | drivers/generic_i2c.c | ||
1110 | target/arm/as3525/fmradio-i2c-as3525.c | ||
1111 | target/arm/as3525/powermgmt-as3525.c | ||
1112 | #endif /* !BOOTLOADER */ | ||
1113 | #endif /* !SIMULATOR */ | ||
1114 | #endif /* SANSA_E200V2 */ | ||
1115 | |||
1103 | #ifdef SANSA_M200V4 | 1116 | #ifdef SANSA_M200V4 |
1104 | #ifndef SIMULATOR | 1117 | #ifndef SIMULATOR |
1105 | target/arm/lcd-ssd1815.c | 1118 | target/arm/lcd-ssd1815.c |
diff --git a/firmware/export/config-c200v2.h b/firmware/export/config-c200v2.h new file mode 100644 index 0000000000..6ecb478c09 --- /dev/null +++ b/firmware/export/config-c200v2.h | |||
@@ -0,0 +1,209 @@ | |||
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 44 | ||
8 | #define MODEL_NAME "Sandisk Sansa c200v2 series" | ||
9 | |||
10 | #define HW_SAMPR_CAPS (SAMPR_CAP_44) | ||
11 | |||
12 | #if 0 | ||
13 | /* define this if you have recording possibility */ | ||
14 | #define HAVE_RECORDING | ||
15 | |||
16 | #define REC_SAMPR_CAPS (SAMPR_CAP_22) | ||
17 | #define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ | ||
18 | #define REC_SAMPR_DEFAULT SAMPR_22 | ||
19 | |||
20 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
21 | explicitly if different */ | ||
22 | #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) | ||
23 | #endif | ||
24 | |||
25 | /* define this if you have a bitmap LCD display */ | ||
26 | #define HAVE_LCD_BITMAP | ||
27 | |||
28 | /* define this if you have a colour LCD */ | ||
29 | #define HAVE_LCD_COLOR | ||
30 | |||
31 | /* define this if you want album art for this target */ | ||
32 | #define HAVE_ALBUMART | ||
33 | |||
34 | /* define this if you have a light associated with the buttons */ | ||
35 | #define HAVE_BUTTON_LIGHT | ||
36 | |||
37 | /* define this if you have access to the quickscreen */ | ||
38 | #define HAVE_QUICKSCREEN | ||
39 | |||
40 | /* define this if you have access to the pitchscreen */ | ||
41 | #define HAVE_PITCHSCREEN | ||
42 | |||
43 | /* define this if you would like tagcache to build on this target */ | ||
44 | #define HAVE_TAGCACHE | ||
45 | |||
46 | /* LCD dimensions */ | ||
47 | #define LCD_WIDTH 132 | ||
48 | #define LCD_HEIGHT 80 | ||
49 | #define LCD_DEPTH 16 /* 65536 colours */ | ||
50 | #define LCD_PIXELFORMAT RGB565 /* rgb565 */ | ||
51 | |||
52 | #ifndef BOOTLOADER | ||
53 | /* define this if you have LCD enable function */ | ||
54 | #define HAVE_LCD_ENABLE | ||
55 | |||
56 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE | ||
57 | should be defined as well. */ | ||
58 | /* TODO: #define HAVE_LCD_SLEEP */ | ||
59 | /* TODO: #define HAVE_LCD_SLEEP_SETTING <= optional */ | ||
60 | #endif | ||
61 | /* define this if you can flip your LCD */ | ||
62 | #define HAVE_LCD_FLIP | ||
63 | |||
64 | /* define this if you can invert the colours on your LCD */ | ||
65 | /* TODO: #define HAVE_LCD_INVERT */ | ||
66 | |||
67 | #if 0 | ||
68 | /* Define this if your LCD can set contrast */ | ||
69 | #define HAVE_LCD_CONTRAST | ||
70 | |||
71 | #define MIN_CONTRAST_SETTING 0 | ||
72 | #define MAX_CONTRAST_SETTING 255 | ||
73 | #define DEFAULT_CONTRAST_SETTING 85 | ||
74 | #endif | ||
75 | /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ | ||
76 | |||
77 | #define CONFIG_KEYPAD SANSA_C200_PAD | ||
78 | |||
79 | /* define this if the target has volume keys which can be used in the lists */ | ||
80 | #define HAVE_VOLUME_IN_LIST | ||
81 | |||
82 | /* Define this if you do software codec */ | ||
83 | #define CONFIG_CODEC SWCODEC | ||
84 | |||
85 | /* There is no hardware tone control */ | ||
86 | #define HAVE_SW_TONE_CONTROLS | ||
87 | |||
88 | /* The PP5024 has a built-in AustriaMicrosystems AS3514 */ | ||
89 | #define HAVE_AS3514 | ||
90 | |||
91 | /* define this if you have a real-time clock */ | ||
92 | #ifndef BOOTLOADER | ||
93 | #define CONFIG_RTC RTC_AS3514 | ||
94 | #endif | ||
95 | |||
96 | /* Define this if you have a software controlled poweroff */ | ||
97 | #define HAVE_SW_POWEROFF | ||
98 | |||
99 | /* Some Sansa E200s seem to be FAT16 formatted */ | ||
100 | #define HAVE_FAT16SUPPORT | ||
101 | |||
102 | /* The number of bytes reserved for loadable codecs */ | ||
103 | #define CODEC_SIZE 0x100000 | ||
104 | |||
105 | /* The number of bytes reserved for loadable plugins */ | ||
106 | #define PLUGIN_BUFFER_SIZE 0x80000 | ||
107 | |||
108 | #define AB_REPEAT_ENABLE 1 | ||
109 | |||
110 | /* FM Tuner - suspected to be the SI4702 */ | ||
111 | //#define CONFIG_TUNER SI4700 | ||
112 | /* #define HAVE_TUNER_PWR_CTRL */ | ||
113 | |||
114 | /* Define this for LCD backlight available */ | ||
115 | #define HAVE_BACKLIGHT | ||
116 | #define HAVE_BACKLIGHT_BRIGHTNESS | ||
117 | |||
118 | /* define this if you have a flash memory storage */ | ||
119 | #define HAVE_FLASH_STORAGE | ||
120 | |||
121 | /* define this if the flash memory uses the SecureDigital Memory Card protocol */ | ||
122 | #define CONFIG_STORAGE STORAGE_SD | ||
123 | |||
124 | #define BATTERY_CAPACITY_DEFAULT 530 /* default battery capacity */ | ||
125 | #define BATTERY_CAPACITY_MIN 530 /* min. capacity selectable */ | ||
126 | #define BATTERY_CAPACITY_MAX 530 /* max. capacity selectable */ | ||
127 | #define BATTERY_CAPACITY_INC 0 /* capacity increment */ | ||
128 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
129 | |||
130 | /* Hardware controlled charging? FIXME */ | ||
131 | #define CONFIG_CHARGING CHARGING_SIMPLE | ||
132 | |||
133 | /* define this if the unit can be powered or charged via USB */ | ||
134 | #define HAVE_USB_POWER | ||
135 | |||
136 | /** Non-simulator section **/ | ||
137 | #ifndef SIMULATOR | ||
138 | |||
139 | /* define this if the backlight thread is used for fade, not for sim, needs | ||
140 | * HAVE_BACKLIGHT_BRIGHTNESS */ | ||
141 | #ifndef BOOTLOADER | ||
142 | #define USE_BACKLIGHT_SW_FADING | ||
143 | #endif | ||
144 | |||
145 | /* Define this if you have a PortalPlayer PP5024 */ | ||
146 | #define CONFIG_CPU AS3525 | ||
147 | |||
148 | /* Define this if you want to use the PP5024 i2c interface */ | ||
149 | #define CONFIG_I2C I2C_AS3525 | ||
150 | |||
151 | /* define this if the hardware can be powered off while charging */ | ||
152 | /* Sansa can't be powered off while charging */ | ||
153 | /* #define HAVE_POWEROFF_WHILE_CHARGING */ | ||
154 | |||
155 | /* The start address index for ROM builds */ | ||
156 | #define ROM_START 0x00000000 | ||
157 | |||
158 | /* Define this to the CPU frequency */ | ||
159 | #define CPU_FREQ 75000000 | ||
160 | |||
161 | /* Type of LCD TODO: hopefully the same as the x5 but check this*/ | ||
162 | #define CONFIG_LCD LCD_C200 | ||
163 | |||
164 | /* Offset ( in the firmware file's header ) to the file CRC and data. These are | ||
165 | only used when loading the old format rockbox.e200 file */ | ||
166 | #define FIRMWARE_OFFSET_FILE_CRC 0x0 | ||
167 | #define FIRMWARE_OFFSET_FILE_DATA 0x8 | ||
168 | |||
169 | /* #define USB_IPODSTYLE */ | ||
170 | |||
171 | #ifndef BOOTLOADER | ||
172 | #define HAVE_MULTIVOLUME | ||
173 | #define HAVE_HOTSWAP | ||
174 | #endif | ||
175 | |||
176 | /* USB On-the-go */ | ||
177 | #define CONFIG_USBOTG USBOTG_ARC | ||
178 | |||
179 | /* enable these for the experimental usb stack */ | ||
180 | //#define HAVE_USBSTACK | ||
181 | //#define USB_VENDOR_ID 0x0781 | ||
182 | //#define USB_PRODUCT_ID 0x7450 | ||
183 | /* Virtual LED (icon) */ | ||
184 | #define CONFIG_LED LED_VIRTUAL | ||
185 | |||
186 | /* Define this if you have adjustable CPU frequency */ | ||
187 | #define HAVE_ADJUSTABLE_CPU_FREQ | ||
188 | |||
189 | #define BOOTFILE_EXT "sansa" | ||
190 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
191 | #define BOOTDIR "/.rockbox" | ||
192 | |||
193 | #define ICODE_ATTR_TREMOR_NOT_MDCT | ||
194 | |||
195 | #define INCLUDE_TIMEOUT_API | ||
196 | |||
197 | #endif /* SIMULATOR */ | ||
198 | |||
199 | /** Port-specific settings **/ | ||
200 | |||
201 | /* Main LCD backlight brightness range and defaults */ | ||
202 | #define MIN_BRIGHTNESS_SETTING 1 | ||
203 | #define MAX_BRIGHTNESS_SETTING 12 | ||
204 | #define DEFAULT_BRIGHTNESS_SETTING 6 | ||
205 | |||
206 | /* Default recording levels */ | ||
207 | #define DEFAULT_REC_MIC_GAIN 23 | ||
208 | #define DEFAULT_REC_LEFT_GAIN 23 | ||
209 | #define DEFAULT_REC_RIGHT_GAIN 23 | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index d484805532..d8c14ddcef 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -330,6 +330,8 @@ | |||
330 | #include "config-m200v4.h" | 330 | #include "config-m200v4.h" |
331 | #elif defined(SANSA_FUZE) | 331 | #elif defined(SANSA_FUZE) |
332 | #include "config-fuze.h" | 332 | #include "config-fuze.h" |
333 | #elif defined(SANSA_C200V2) | ||
334 | #include "config-c200v2.h" | ||
333 | #else | 335 | #else |
334 | /* no known platform */ | 336 | /* no known platform */ |
335 | #endif | 337 | #endif |
diff --git a/firmware/target/arm/as3525/clock-target.h b/firmware/target/arm/as3525/clock-target.h index fd8cb021fa..1e55753555 100644 --- a/firmware/target/arm/as3525/clock-target.h +++ b/firmware/target/arm/as3525/clock-target.h | |||
@@ -56,6 +56,8 @@ | |||
56 | #define AS3525_DBOP_FREQ 24000000 | 56 | #define AS3525_DBOP_FREQ 24000000 |
57 | #elif defined(SANSA_E200V2) | 57 | #elif defined(SANSA_E200V2) |
58 | #define AS3525_DBOP_FREQ 8000000 | 58 | #define AS3525_DBOP_FREQ 8000000 |
59 | #elif defined(SANSA_C200V2) | ||
60 | #define AS3525_DBOP_FREQ 8000000 | ||
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | /* macro for not giving a target clock > at the one provided */ | 63 | /* macro for not giving a target clock > at the one provided */ |
diff --git a/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c b/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c new file mode 100644 index 0000000000..ba9db6a1f5 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: backlight-e200v2-fuze.c 19224 2008-11-26 10:21:03Z pondlife $ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
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 "backlight-target.h" | ||
23 | #include "system.h" | ||
24 | #include "lcd.h" | ||
25 | #include "backlight.h" | ||
26 | #include "ascodec-target.h" | ||
27 | #include "as3514.h" | ||
28 | |||
29 | /* TODO: This file is copy & pasted from backlight-e200v2-fuze.c, as I think | ||
30 | * it'll be the same for c200v2; prove it */ | ||
31 | void _backlight_set_brightness(int brightness) | ||
32 | { | ||
33 | if (brightness > 0) | ||
34 | _backlight_on(); | ||
35 | else | ||
36 | _backlight_off(); | ||
37 | } | ||
38 | |||
39 | void _backlight_on(void) | ||
40 | { | ||
41 | #ifdef HAVE_LCD_SLEEP | ||
42 | backlight_lcd_sleep_countdown(false); /* stop counter */ | ||
43 | #endif | ||
44 | #ifdef HAVE_LCD_ENABLE | ||
45 | lcd_enable(true); /* power on lcd + visible display */ | ||
46 | #endif | ||
47 | ascodec_write(AS3514_DCDC15, backlight_brightness); | ||
48 | } | ||
49 | |||
50 | void _backlight_off(void) | ||
51 | { | ||
52 | ascodec_write(AS3514_DCDC15, 0x0); | ||
53 | #ifdef HAVE_LCD_ENABLE | ||
54 | lcd_enable(false); /* power off visible display */ | ||
55 | #endif | ||
56 | #ifdef HAVE_LCD_SLEEP | ||
57 | backlight_lcd_sleep_countdown(true); /* start countdown */ | ||
58 | #endif | ||
59 | } | ||
60 | |||
61 | void _buttonlight_on(void) | ||
62 | { | ||
63 | GPIOD_DIR |= (1<<7); | ||
64 | GPIOD_PIN(7) = (1<<7); | ||
65 | } | ||
66 | |||
67 | void _buttonlight_off(void) | ||
68 | { | ||
69 | GPIOD_DIR |= (1<<7); | ||
70 | GPIOD_PIN(7) = 0; | ||
71 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-c200v2/backlight-target.h b/firmware/target/arm/as3525/sansa-c200v2/backlight-target.h new file mode 100644 index 0000000000..e8a60fa881 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-c200v2/backlight-target.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: backlight-target.h 19136 2008-11-18 13:44:27Z dave $ | ||
9 | * | ||
10 | * Copyright (C) 2006 Barry Wardell | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef BACKLIGHT_TARGET_H | ||
22 | #define BACKLIGHT_TARGET_H | ||
23 | |||
24 | #define _backlight_init() true | ||
25 | void _backlight_on(void); | ||
26 | void _backlight_off(void); | ||
27 | void _backlight_set_brightness(int brightness); | ||
28 | int __backlight_is_on(void); | ||
29 | |||
30 | void _buttonlight_on(void); | ||
31 | void _buttonlight_off(void); | ||
32 | #endif | ||
diff --git a/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c b/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c new file mode 100644 index 0000000000..18ae41ce97 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-c200v2/button-c200v2.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: button-e200v2.c 19035 2008-11-07 05:31:05Z jdgordon $ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
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 | /* Taken from button-h10.c by Barry Wardell and reverse engineering by MrH. */ | ||
23 | |||
24 | #include "system.h" | ||
25 | #include "button.h" | ||
26 | #include "backlight.h" | ||
27 | #include "powermgmt.h" | ||
28 | |||
29 | |||
30 | #ifndef BOOTLOADER | ||
31 | /* Buttons */ | ||
32 | static bool hold_button = false; | ||
33 | static bool hold_button_old = false; | ||
34 | #define _button_hold() hold_button | ||
35 | #else | ||
36 | #define _button_hold() false /* FIXME */ | ||
37 | #endif /* BOOTLOADER */ | ||
38 | static int int_btn = BUTTON_NONE; | ||
39 | |||
40 | void button_init_device(void) | ||
41 | { | ||
42 | } | ||
43 | |||
44 | bool button_hold(void) | ||
45 | { | ||
46 | return _button_hold(); | ||
47 | } | ||
48 | |||
49 | /* device buttons */ | ||
50 | void button_int(void) | ||
51 | { | ||
52 | int delay = 0x50; | ||
53 | int dir_save_c = 0; | ||
54 | int afsel_save_c = 0; | ||
55 | |||
56 | int_btn = BUTTON_NONE; | ||
57 | |||
58 | /* Save the current direction and afsel */ | ||
59 | dir_save_c = GPIOC_DIR; | ||
60 | afsel_save_c = GPIOC_AFSEL; | ||
61 | |||
62 | GPIOA_DIR &= ~(1<<2); | ||
63 | GPIOC_AFSEL &= ~(1<<6|1<<5|1<<4|1<<3); | ||
64 | GPIOC_DIR |= (1<<6|1<<5|1<<4|1<<3); | ||
65 | |||
66 | /* These should not be needed with button event interupts */ | ||
67 | /* they are necessary now to clear out lcd data */ | ||
68 | |||
69 | GPIOC_PIN(6) = (1<<6); | ||
70 | GPIOC_PIN(5) = (1<<5); | ||
71 | GPIOC_PIN(4) = (1<<4); | ||
72 | GPIOC_PIN(3) = (1<<3); | ||
73 | GPIOC_DIR &= ~(1<<6|1<<5|1<<4|1<<3); | ||
74 | |||
75 | while(delay--); | ||
76 | |||
77 | /* direct GPIO connections */ | ||
78 | if (GPIOA_PIN(3)) | ||
79 | int_btn |= BUTTON_POWER; | ||
80 | if (!GPIOC_PIN(6)) | ||
81 | int_btn |= BUTTON_RIGHT; | ||
82 | if (!GPIOC_PIN(5)) | ||
83 | int_btn |= BUTTON_UP; | ||
84 | if (!GPIOC_PIN(4)) | ||
85 | int_btn |= BUTTON_SELECT; | ||
86 | if (!GPIOC_PIN(3)) | ||
87 | int_btn |= BUTTON_DOWN; | ||
88 | |||
89 | /* return to settings needed for lcd */ | ||
90 | GPIOC_DIR = dir_save_c; | ||
91 | GPIOC_AFSEL = afsel_save_c; | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * Get button pressed from hardware | ||
96 | */ | ||
97 | int button_read_device(void) | ||
98 | { | ||
99 | /* Read buttons directly */ | ||
100 | button_int(); | ||
101 | #ifndef BOOTLOADER | ||
102 | /* light handling */ | ||
103 | if (hold_button != hold_button_old) | ||
104 | { | ||
105 | hold_button_old = hold_button; | ||
106 | backlight_hold_changed(hold_button); | ||
107 | } | ||
108 | #endif /* BOOTLOADER */ | ||
109 | |||
110 | return int_btn; | ||
111 | } | ||
diff --git a/firmware/target/arm/as3525/sansa-c200v2/button-target.h b/firmware/target/arm/as3525/sansa-c200v2/button-target.h new file mode 100644 index 0000000000..cc668c4015 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-c200v2/button-target.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id:$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Mark Arigo | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef _BUTTON_TARGET_H_ | ||
23 | #define _BUTTON_TARGET_H_ | ||
24 | |||
25 | #include <stdbool.h> | ||
26 | #include "config.h" | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | bool button_hold(void); | ||
31 | void button_init_device(void); | ||
32 | int button_read_device(void); | ||
33 | |||
34 | /* Sandisk Sansa c200 button codes */ | ||
35 | |||
36 | /* Main unit's buttons */ | ||
37 | #define BUTTON_REC 0x00000001 | ||
38 | #define BUTTON_DOWN 0x00000002 | ||
39 | #define BUTTON_RIGHT 0x00000004 | ||
40 | #define BUTTON_LEFT 0x00000008 | ||
41 | #define BUTTON_SELECT 0x00000010 | ||
42 | #define BUTTON_UP 0x00000020 | ||
43 | #define BUTTON_POWER 0x00000040 | ||
44 | #define BUTTON_VOL_UP 0x00000080 | ||
45 | #define BUTTON_VOL_DOWN 0x00000100 | ||
46 | |||
47 | #define BUTTON_MAIN 0x00000fff | ||
48 | |||
49 | /* No Remote control */ | ||
50 | #define BUTTON_REMOTE 0 | ||
51 | |||
52 | #define POWEROFF_BUTTON BUTTON_POWER | ||
53 | #define POWEROFF_COUNT 10 | ||
54 | |||
55 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/as3525/sansa-c200v2/lcd-c200v2.c b/firmware/target/arm/as3525/sansa-c200v2/lcd-c200v2.c new file mode 100644 index 0000000000..2fc3e1f6c5 --- /dev/null +++ b/firmware/target/arm/as3525/sansa-c200v2/lcd-c200v2.c | |||
@@ -0,0 +1,429 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: lcd-e200v2.c 19453 2008-12-16 02:50:39Z saratoga $ | ||
9 | * | ||
10 | * Copyright (C) 2004 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 | |||
22 | /* FIXME: Copied from e200v2 lcd driver, unlikely to work, but maybe */ | ||
23 | |||
24 | #include "config.h" | ||
25 | |||
26 | #include "cpu.h" | ||
27 | #include "lcd.h" | ||
28 | #include "kernel.h" | ||
29 | #include "thread.h" | ||
30 | #include <string.h> | ||
31 | #include <stdlib.h> | ||
32 | #include "file.h" | ||
33 | #include "debug.h" | ||
34 | #include "system.h" | ||
35 | #include "font.h" | ||
36 | #include "bidi.h" | ||
37 | #include "clock-target.h" | ||
38 | |||
39 | static bool display_on = false; /* is the display turned on? */ | ||
40 | static bool display_flipped = false; | ||
41 | static int y_offset = 0; /* needed for flip */ | ||
42 | |||
43 | /* register defines */ | ||
44 | #define R_START_OSC 0x00 | ||
45 | #define R_DRV_OUTPUT_CONTROL 0x01 | ||
46 | #define R_DRV_WAVEFORM_CONTROL 0x02 | ||
47 | #define R_ENTRY_MODE 0x03 | ||
48 | #define R_COMPARE_REG1 0x04 | ||
49 | #define R_COMPARE_REG2 0x05 | ||
50 | |||
51 | #define R_DISP_CONTROL1 0x07 | ||
52 | #define R_DISP_CONTROL2 0x08 | ||
53 | #define R_DISP_CONTROL3 0x09 | ||
54 | |||
55 | #define R_FRAME_CYCLE_CONTROL 0x0b | ||
56 | #define R_EXT_DISP_IF_CONTROL 0x0c | ||
57 | |||
58 | #define R_POWER_CONTROL1 0x10 | ||
59 | #define R_POWER_CONTROL2 0x11 | ||
60 | #define R_POWER_CONTROL3 0x12 | ||
61 | #define R_POWER_CONTROL4 0x13 | ||
62 | |||
63 | #define R_RAM_ADDR_SET 0x21 | ||
64 | #define R_WRITE_DATA_2_GRAM 0x22 | ||
65 | |||
66 | #define R_GAMMA_FINE_ADJ_POS1 0x30 | ||
67 | #define R_GAMMA_FINE_ADJ_POS2 0x31 | ||
68 | #define R_GAMMA_FINE_ADJ_POS3 0x32 | ||
69 | #define R_GAMMA_GRAD_ADJ_POS 0x33 | ||
70 | |||
71 | #define R_GAMMA_FINE_ADJ_NEG1 0x34 | ||
72 | #define R_GAMMA_FINE_ADJ_NEG2 0x35 | ||
73 | #define R_GAMMA_FINE_ADJ_NEG3 0x36 | ||
74 | #define R_GAMMA_GRAD_ADJ_NEG 0x37 | ||
75 | |||
76 | #define R_GAMMA_AMP_ADJ_RES_POS 0x38 | ||
77 | #define R_GAMMA_AMP_AVG_ADJ_RES_NEG 0x39 | ||
78 | |||
79 | #define R_GATE_SCAN_POS 0x40 | ||
80 | #define R_VERT_SCROLL_CONTROL 0x41 | ||
81 | #define R_1ST_SCR_DRV_POS 0x42 | ||
82 | #define R_2ND_SCR_DRV_POS 0x43 | ||
83 | #define R_HORIZ_RAM_ADDR_POS 0x44 | ||
84 | #define R_VERT_RAM_ADDR_POS 0x45 | ||
85 | |||
86 | #define R_ENTRY_MODE_HORZ 0x7030 | ||
87 | #define R_ENTRY_MODE_VERT 0x7038 | ||
88 | #define R_ENTRY_MODE_SOLID_VERT 0x1038 | ||
89 | |||
90 | /* TODO: Implement this function */ | ||
91 | static void lcd_delay(int x) | ||
92 | { | ||
93 | /* This is just arbitrary - the OF does something more complex */ | ||
94 | x *= 1024; | ||
95 | while (x--); | ||
96 | } | ||
97 | |||
98 | /* DBOP initialisation, do what OF does */ | ||
99 | static void ams3525_dbop_init(void) | ||
100 | { | ||
101 | CGU_DBOP = (1<<3) | CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ); | ||
102 | |||
103 | DBOP_TIMPOL_01 = 0xe167e167; | ||
104 | DBOP_TIMPOL_23 = 0xe167006e; | ||
105 | DBOP_CTRL = 0x41008; | ||
106 | |||
107 | GPIOB_AFSEL = 0xfc; | ||
108 | GPIOC_AFSEL = 0xff; | ||
109 | |||
110 | DBOP_TIMPOL_23 = 0x6000e; | ||
111 | DBOP_CTRL = 0x51008; | ||
112 | DBOP_TIMPOL_01 = 0x6e167; | ||
113 | DBOP_TIMPOL_23 = 0xa167e06f; | ||
114 | |||
115 | /* TODO: The OF calls some other functions here, but maybe not important */ | ||
116 | } | ||
117 | |||
118 | |||
119 | static void lcd_write_cmd(int cmd) | ||
120 | { | ||
121 | /* Write register */ | ||
122 | DBOP_CTRL &= ~(1<<14); | ||
123 | |||
124 | DBOP_TIMPOL_23 = 0xa167006e; | ||
125 | |||
126 | DBOP_DOUT = cmd; | ||
127 | |||
128 | /* Wait for fifo to empty */ | ||
129 | while ((DBOP_STAT & (1<<10)) == 0); | ||
130 | |||
131 | DBOP_TIMPOL_23 = 0xa167e06f; | ||
132 | } | ||
133 | |||
134 | void lcd_write_data(const fb_data* p_bytes, int count) | ||
135 | { | ||
136 | while (count--) | ||
137 | { | ||
138 | DBOP_DOUT = *p_bytes++; | ||
139 | |||
140 | /* Wait for fifo to empty */ | ||
141 | while ((DBOP_STAT & (1<<10)) == 0); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | static void lcd_write_reg(int reg, int value) | ||
146 | { | ||
147 | unsigned short data = value; | ||
148 | |||
149 | lcd_write_cmd(reg); | ||
150 | lcd_write_data(&data, 1); | ||
151 | } | ||
152 | |||
153 | /*** hardware configuration ***/ | ||
154 | |||
155 | void lcd_set_contrast(int val) | ||
156 | { | ||
157 | (void)val; | ||
158 | } | ||
159 | |||
160 | void lcd_set_invert_display(bool yesno) | ||
161 | { | ||
162 | (void)yesno; | ||
163 | } | ||
164 | |||
165 | static void flip_lcd(bool yesno) | ||
166 | { | ||
167 | (void)yesno; | ||
168 | } | ||
169 | |||
170 | |||
171 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
172 | void lcd_set_flip(bool yesno) | ||
173 | { | ||
174 | display_flipped = yesno; | ||
175 | y_offset = yesno ? 4 : 0; /* FIXME: Is a y_offset needed? */ | ||
176 | |||
177 | if (display_on) | ||
178 | flip_lcd(yesno); | ||
179 | } | ||
180 | |||
181 | static void _display_on(void) | ||
182 | { | ||
183 | /* Initialisation the display the same way as the original firmware */ | ||
184 | |||
185 | lcd_write_reg(R_START_OSC, 0x0001); /* Start Oscilation */ | ||
186 | |||
187 | lcd_write_reg(R_DRV_OUTPUT_CONTROL, 0x011b); /* 220 lines, GS=0, SS=1 */ | ||
188 | |||
189 | /* B/C = 1: n-line inversion form | ||
190 | * EOR = 1: polarity inversion occurs by applying an EOR to odd/even | ||
191 | * frame select signal and an n-line inversion signal. | ||
192 | * FLD = 01b: 1 field interlaced scan, external display iface */ | ||
193 | lcd_write_reg(R_DRV_WAVEFORM_CONTROL, 0x0700); | ||
194 | |||
195 | /* Address counter updated in horizontal direction; left to right; | ||
196 | * vertical increment horizontal increment. | ||
197 | * data format for 8bit transfer or spi = 65k (5,6,5) */ | ||
198 | lcd_write_reg(R_ENTRY_MODE, 0x0030); | ||
199 | |||
200 | /* Replace data on writing to GRAM */ | ||
201 | lcd_write_reg(R_COMPARE_REG1, 0); | ||
202 | lcd_write_reg(R_COMPARE_REG2, 0); | ||
203 | |||
204 | lcd_write_reg(R_DISP_CONTROL1, 0x0000); /* GON = 0, DTE = 0, D1-0 = 00b */ | ||
205 | |||
206 | /* Front porch lines: 2; Back porch lines: 2; */ | ||
207 | lcd_write_reg(R_DISP_CONTROL2, 0x0203); | ||
208 | |||
209 | /* Scan cycle = 0 frames */ | ||
210 | lcd_write_reg(R_DISP_CONTROL3, 0x0000); | ||
211 | |||
212 | /* 16 clocks */ | ||
213 | lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0000); | ||
214 | |||
215 | /* 18-bit RGB interface (one transfer/pixel) | ||
216 | * internal clock operation; | ||
217 | * System interface/VSYNC interface */ | ||
218 | lcd_write_reg(R_EXT_DISP_IF_CONTROL, 0x0000); | ||
219 | |||
220 | |||
221 | /* zero everything*/ | ||
222 | lcd_write_reg(R_POWER_CONTROL1, 0x0000); /* STB = 0, SLP = 0 */ | ||
223 | |||
224 | lcd_delay(10); | ||
225 | |||
226 | /* initialise power supply */ | ||
227 | |||
228 | /* DC12-10 = 000b: Step-up1 = clock/8, | ||
229 | * DC02-00 = 000b: Step-up2 = clock/16, | ||
230 | * VC2-0 = 010b: VciOUT = 0.87 * VciLVL */ | ||
231 | lcd_write_reg(R_POWER_CONTROL2, 0x0002); | ||
232 | |||
233 | /* VRH3-0 = 1000b: Vreg1OUT = REGP * 1.90 */ | ||
234 | lcd_write_reg(R_POWER_CONTROL3, 0x0008); | ||
235 | |||
236 | lcd_delay(40); | ||
237 | |||
238 | lcd_write_reg(R_POWER_CONTROL4, 0x0000); /* VCOMG = 0 */ | ||
239 | |||
240 | /* This register is unknown */ | ||
241 | lcd_write_reg(0x56, 0x80f); | ||
242 | |||
243 | |||
244 | lcd_write_reg(R_POWER_CONTROL1, 0x4140); | ||
245 | |||
246 | lcd_delay(10); | ||
247 | |||
248 | lcd_write_reg(R_POWER_CONTROL2, 0x0000); | ||
249 | lcd_write_reg(R_POWER_CONTROL3, 0x0013); | ||
250 | |||
251 | lcd_delay(20); | ||
252 | |||
253 | lcd_write_reg(R_POWER_CONTROL4, 0x6d0e); | ||
254 | |||
255 | lcd_delay(20); | ||
256 | |||
257 | lcd_write_reg(R_POWER_CONTROL4, 0x6d0e); | ||
258 | |||
259 | lcd_write_reg(R_GAMMA_FINE_ADJ_POS1, 0x0002); | ||
260 | lcd_write_reg(R_GAMMA_FINE_ADJ_POS2, 0x0707); | ||
261 | lcd_write_reg(R_GAMMA_FINE_ADJ_POS3, 0x0182); | ||
262 | lcd_write_reg(R_GAMMA_GRAD_ADJ_POS, 0x0203); | ||
263 | lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1, 0x0706); | ||
264 | lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2, 0x0006); | ||
265 | lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3, 0x0706); | ||
266 | lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG, 0x0000); | ||
267 | lcd_write_reg(R_GAMMA_AMP_ADJ_RES_POS, 0x030f); | ||
268 | lcd_write_reg(R_GAMMA_AMP_AVG_ADJ_RES_NEG, 0x0f08); | ||
269 | |||
270 | |||
271 | lcd_write_reg(R_RAM_ADDR_SET, 0); | ||
272 | lcd_write_reg(R_GATE_SCAN_POS, 0); | ||
273 | lcd_write_reg(R_VERT_SCROLL_CONTROL, 0); | ||
274 | |||
275 | lcd_write_reg(R_1ST_SCR_DRV_POS, (LCD_HEIGHT-1) << 8); | ||
276 | lcd_write_reg(R_2ND_SCR_DRV_POS, (LCD_HEIGHT-1) << 8); | ||
277 | |||
278 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_WIDTH-1) << 8); | ||
279 | lcd_write_reg(R_VERT_RAM_ADDR_POS, (LCD_HEIGHT-1) << 8); | ||
280 | |||
281 | |||
282 | lcd_write_reg(R_DISP_CONTROL1, 0x0037); | ||
283 | |||
284 | display_on=true; /* must be done before calling lcd_update() */ | ||
285 | lcd_update(); | ||
286 | } | ||
287 | |||
288 | /* LCD init */ | ||
289 | void lcd_init_device(void) | ||
290 | { | ||
291 | ams3525_dbop_init(); | ||
292 | |||
293 | /* Init GPIOs the same as the OF */ | ||
294 | |||
295 | GPIOA_DIR |= (1<<5); | ||
296 | GPIOA_PIN(5) = 0; | ||
297 | |||
298 | GPIOA_PIN(3) = (1<<3); | ||
299 | |||
300 | GPIOA_DIR |= (3<<3); | ||
301 | |||
302 | GPIOA_PIN(3) = (1<<3); | ||
303 | |||
304 | GPIOA_PIN(4) = 0; /*c80b0040 := 0;*/ | ||
305 | |||
306 | GPIOA_DIR |= (1<<7); | ||
307 | GPIOA_PIN(7) = 0; | ||
308 | |||
309 | lcd_delay(1); | ||
310 | |||
311 | GPIOA_PIN(5) = (1<<5); | ||
312 | |||
313 | lcd_delay(1); | ||
314 | |||
315 | _display_on(); | ||
316 | } | ||
317 | |||
318 | void lcd_enable(bool on) | ||
319 | { | ||
320 | if(display_on!=on) | ||
321 | { | ||
322 | if(on) | ||
323 | { | ||
324 | _display_on(); | ||
325 | lcd_call_enable_hook(); | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | /* TODO: Implement off sequence */ | ||
330 | display_on=false; | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
335 | bool lcd_enabled(void) | ||
336 | { | ||
337 | return display_on; | ||
338 | } | ||
339 | |||
340 | void lcd_sleep(void) | ||
341 | { | ||
342 | /* TODO */ | ||
343 | } | ||
344 | |||
345 | /*** update functions ***/ | ||
346 | |||
347 | /* Performance function to blit a YUV bitmap directly to the LCD | ||
348 | * src_x, src_y, width and height should be even | ||
349 | * x, y, width and height have to be within LCD bounds | ||
350 | */ | ||
351 | void lcd_blit_yuv(unsigned char * const src[3], | ||
352 | int src_x, int src_y, int stride, | ||
353 | int x, int y, int width, int height) | ||
354 | { | ||
355 | (void)src; | ||
356 | (void)src_x; | ||
357 | (void)src_y; | ||
358 | (void)stride; | ||
359 | (void)x; | ||
360 | (void)y; | ||
361 | (void)width; | ||
362 | (void)height; | ||
363 | } | ||
364 | |||
365 | /* Update the display. | ||
366 | This must be called after all other LCD functions that change the display. */ | ||
367 | void lcd_update(void) | ||
368 | { | ||
369 | if (!display_on) | ||
370 | return; | ||
371 | |||
372 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); | ||
373 | |||
374 | /* Set start position and window */ | ||
375 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (LCD_WIDTH-1) << 8); | ||
376 | lcd_write_reg(R_VERT_RAM_ADDR_POS, | ||
377 | ((y_offset + LCD_HEIGHT-1) << 8) | y_offset); | ||
378 | lcd_write_reg(R_RAM_ADDR_SET, (y_offset) << 8); | ||
379 | |||
380 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | ||
381 | |||
382 | lcd_write_data((unsigned short *)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT); | ||
383 | |||
384 | } /* lcd_update */ | ||
385 | |||
386 | |||
387 | /* Update a fraction of the display. */ | ||
388 | void lcd_update_rect(int x, int y, int width, int height) | ||
389 | { | ||
390 | int ymax; | ||
391 | const unsigned short *ptr; | ||
392 | |||
393 | if (!display_on) | ||
394 | return; | ||
395 | |||
396 | if (x + width > LCD_WIDTH) | ||
397 | width = LCD_WIDTH - x; /* Clip right */ | ||
398 | if (x < 0) | ||
399 | width += x, x = 0; /* Clip left */ | ||
400 | if (width <= 0) | ||
401 | return; /* nothing left to do */ | ||
402 | |||
403 | ymax = y + height; | ||
404 | if (ymax > LCD_HEIGHT) | ||
405 | ymax = LCD_HEIGHT; /* Clip bottom */ | ||
406 | if (y < 0) | ||
407 | y = 0; /* Clip top */ | ||
408 | if (y >= ymax) | ||
409 | return; /* nothing left to do */ | ||
410 | |||
411 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); | ||
412 | /* Set start position and window */ | ||
413 | lcd_write_reg(R_HORIZ_RAM_ADDR_POS, | ||
414 | ((x + width-1) << 8) | x); | ||
415 | lcd_write_reg(R_VERT_RAM_ADDR_POS, | ||
416 | ((y_offset + y + height - 1) << 8) | (y_offset + y)); | ||
417 | lcd_write_reg(R_RAM_ADDR_SET, ((y + y_offset) << 8) | x); | ||
418 | |||
419 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | ||
420 | |||
421 | ptr = (unsigned short *)&lcd_framebuffer[y][x]; | ||
422 | |||
423 | do | ||
424 | { | ||
425 | lcd_write_data(ptr, width); | ||
426 | ptr += LCD_WIDTH; | ||
427 | } | ||
428 | while (++y < ymax); | ||
429 | } /* lcd_update_rect */ | ||
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index c2a2e4f47d..f2f2c0b454 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -183,7 +183,7 @@ static void sdram_init(void) | |||
183 | MPMC_DYNAMIC_tRRD = 2; | 183 | MPMC_DYNAMIC_tRRD = 2; |
184 | MPMC_DYNAMIC_tMRD = 2; | 184 | MPMC_DYNAMIC_tMRD = 2; |
185 | 185 | ||
186 | #if defined(SANSA_CLIP) || defined(SANSA_M200V4) | 186 | #if defined(SANSA_CLIP) || defined(SANSA_M200V4) || defined(SANSA_C200V2) |
187 | /* 16 bits external bus, low power SDRAM, 16 Mbits = 2 Mbytes */ | 187 | /* 16 bits external bus, low power SDRAM, 16 Mbits = 2 Mbytes */ |
188 | #define MEMORY_MODEL 0x21 | 188 | #define MEMORY_MODEL 0x21 |
189 | 189 | ||
diff --git a/tools/configure b/tools/configure index 979d8cea7c..1bf72f89dc 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -706,8 +706,9 @@ cat <<EOF | |||
706 | ==Creative== 71) M:Robe 100 56) Sansa e200v2 | 706 | ==Creative== 71) M:Robe 100 56) Sansa e200v2 |
707 | 90) Zen Vision:M 30GB 57) Sansa m200v4 | 707 | 90) Zen Vision:M 30GB 57) Sansa m200v4 |
708 | 91) Zen Vision:M 60GB ==Philips== 58) Sansa Fuze | 708 | 91) Zen Vision:M 60GB ==Philips== 58) Sansa Fuze |
709 | 92) Zen Vision 100) GoGear SA9200 | 709 | 92) Zen Vision 100) GoGear SA9200 59) Sansa c200v2 |
710 | 101) GoGear HDD1630 ==Logik== | 710 | 101) GoGear HDD1630 |
711 | ==Logik== | ||
711 | ==Onda== 80) DAX 1GB MP3/DAB | 712 | ==Onda== 80) DAX 1GB MP3/DAB |
712 | 120) VX747 ==Meizu== | 713 | 120) VX747 ==Meizu== |
713 | 121) VX767 110) M6SL | 714 | 121) VX767 110) M6SL |
@@ -1757,6 +1758,29 @@ fi | |||
1757 | ;; | 1758 | ;; |
1758 | 1759 | ||
1759 | 1760 | ||
1761 | 59|c200v2) | ||
1762 | target_id=55 | ||
1763 | modelname="c200v2" | ||
1764 | target="-DSANSA_C200V2" | ||
1765 | memory=2 # as per OF diagnosis mode | ||
1766 | arm9tdmicc | ||
1767 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | ||
1768 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" | ||
1769 | tool="$rootdir/tools/scramble -add=c2v2" | ||
1770 | output="rockbox.sansa" | ||
1771 | bootoutput="bootloader-c200v2.sansa" | ||
1772 | appextra="recorder:gui" | ||
1773 | plugins="yes" | ||
1774 | swcodec="yes" | ||
1775 | # toolset is the tools within the tools directory that we build for | ||
1776 | # this particular target. | ||
1777 | toolset=$scramblebitmaptools | ||
1778 | # architecture, manufacturer and model for the target-tree build | ||
1779 | t_cpu="arm" | ||
1780 | t_manufacturer="as3525" | ||
1781 | t_model="sansa-c200v2" | ||
1782 | ;; | ||
1783 | |||
1760 | 60|tpj1022) | 1784 | 60|tpj1022) |
1761 | target_id=25 | 1785 | target_id=25 |
1762 | modelname="tpj1022" | 1786 | modelname="tpj1022" |
diff --git a/tools/scramble.c b/tools/scramble.c index 8c4b435c02..9fea89ce30 100644 --- a/tools/scramble.c +++ b/tools/scramble.c | |||
@@ -293,6 +293,8 @@ int main (int argc, char** argv) | |||
293 | modelnum = 42; | 293 | modelnum = 42; |
294 | else if (!strcmp(&argv[1][5], "fuze")) | 294 | else if (!strcmp(&argv[1][5], "fuze")) |
295 | modelnum = 43; | 295 | modelnum = 43; |
296 | else if (!strcmp(&argv[1][5], "c2v2")) | ||
297 | modelnum = 44; | ||
296 | else { | 298 | else { |
297 | fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); | 299 | fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); |
298 | return 2; | 300 | return 2; |