diff options
42 files changed, 3082 insertions, 11 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 38192316a6..c93c5bcc1f 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -164,4 +164,6 @@ keymaps/keymap-av300.c | |||
164 | keymaps/keymap-mr500.c | 164 | keymaps/keymap-mr500.c |
165 | #elif CONFIG_KEYPAD == MROBE100_PAD | 165 | #elif CONFIG_KEYPAD == MROBE100_PAD |
166 | keymaps/keymap-mr100.c | 166 | keymaps/keymap-mr100.c |
167 | #elif CONFIG_KEYPAD == COWOND2_PAD | ||
168 | keymaps/keymap-cowond2.c | ||
167 | #endif | 169 | #endif |
diff --git a/apps/keymaps/keymap-cowond2.c b/apps/keymaps/keymap-cowond2.c new file mode 100644 index 0000000000..ab4216e9cf --- /dev/null +++ b/apps/keymaps/keymap-cowond2.c | |||
@@ -0,0 +1,177 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id | ||
9 | * | ||
10 | * Copyright (C) 2008 Rob Purchase | ||
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 | /* Button Code Definitions for the Cowon D2 target */ | ||
21 | /* Some of these mappings are rather 'creative', given it only has 3 buttons! */ | ||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <string.h> | ||
25 | #include <stdlib.h> | ||
26 | |||
27 | #include "config.h" | ||
28 | #include "action.h" | ||
29 | #include "button.h" | ||
30 | #include "settings.h" | ||
31 | |||
32 | /* | ||
33 | * The format of the list is as follows | ||
34 | * { Action Code, Button code, Prereq button code } | ||
35 | * if there's no need to check the previous button's value, use BUTTON_NONE | ||
36 | * Insert LAST_ITEM_IN_LIST at the end of each mapping | ||
37 | */ | ||
38 | |||
39 | static const struct button_mapping button_context_standard[] = { | ||
40 | { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE }, | ||
41 | { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
42 | { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE }, | ||
43 | { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
44 | |||
45 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | ||
46 | //{ ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, | ||
47 | //{ ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, | ||
48 | |||
49 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | ||
50 | // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | ||
51 | { ACTION_STD_CONTEXT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
52 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
53 | // { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
54 | // { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
55 | LAST_ITEM_IN_LIST | ||
56 | }; /* button_context_standard */ | ||
57 | |||
58 | |||
59 | static const struct button_mapping button_context_wps[] = { | ||
60 | LAST_ITEM_IN_LIST | ||
61 | }; /* button_context_wps */ | ||
62 | |||
63 | static const struct button_mapping button_context_list[] = { | ||
64 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
65 | }; /* button_context_list */ | ||
66 | |||
67 | static const struct button_mapping button_context_tree[] = { | ||
68 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
69 | }; /* button_context_tree */ | ||
70 | |||
71 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
72 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
73 | }; | ||
74 | |||
75 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
76 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
77 | }; | ||
78 | |||
79 | static const struct button_mapping button_context_settings[] = { | ||
80 | { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE }, | ||
81 | { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
82 | { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE }, | ||
83 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
84 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, | ||
85 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
86 | |||
87 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
88 | }; /* button_context_settings */ | ||
89 | |||
90 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
91 | |||
92 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
93 | }; /* button_context_settingsgraphical */ | ||
94 | |||
95 | static const struct button_mapping button_context_yesno[] = { | ||
96 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
97 | }; /* button_context_settings_yesno */ | ||
98 | |||
99 | static const struct button_mapping button_context_colorchooser[] = { | ||
100 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
101 | }; /* button_context_colorchooser */ | ||
102 | |||
103 | static const struct button_mapping button_context_eq[] = { | ||
104 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
105 | }; /* button_context_eq */ | ||
106 | |||
107 | /** Bookmark Screen **/ | ||
108 | static const struct button_mapping button_context_bmark[] = { | ||
109 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
110 | }; /* button_context_bmark */ | ||
111 | |||
112 | static const struct button_mapping button_context_time[] = { | ||
113 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), | ||
114 | }; /* button_context_time */ | ||
115 | |||
116 | static const struct button_mapping button_context_quickscreen[] = { | ||
117 | |||
118 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
119 | }; /* button_context_quickscreen */ | ||
120 | |||
121 | static const struct button_mapping button_context_pitchscreen[] = { | ||
122 | |||
123 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
124 | }; /* button_context_pitchcreen */ | ||
125 | |||
126 | static const struct button_mapping button_context_keyboard[] = { | ||
127 | |||
128 | LAST_ITEM_IN_LIST | ||
129 | }; /* button_context_keyboard */ | ||
130 | |||
131 | extern int current_tick; | ||
132 | const struct button_mapping* get_context_mapping(int context) | ||
133 | { | ||
134 | switch (context&(~CONTEXT_REMOTE)) | ||
135 | { | ||
136 | case CONTEXT_STD: | ||
137 | return button_context_standard; | ||
138 | case CONTEXT_WPS: | ||
139 | return button_context_wps; | ||
140 | |||
141 | case CONTEXT_LIST: | ||
142 | return button_context_list; | ||
143 | case CONTEXT_MAINMENU: | ||
144 | case CONTEXT_TREE: | ||
145 | if (global_settings.hold_lr_for_scroll_in_list) | ||
146 | return button_context_listtree_scroll_without_combo; | ||
147 | else | ||
148 | return button_context_listtree_scroll_with_combo; | ||
149 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
150 | return button_context_tree; | ||
151 | |||
152 | case CONTEXT_SETTINGS: | ||
153 | return button_context_settings; | ||
154 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
155 | return button_context_settings_right_is_inc; | ||
156 | |||
157 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
158 | return button_context_colorchooser; | ||
159 | case CONTEXT_SETTINGS_EQ: | ||
160 | return button_context_eq; | ||
161 | |||
162 | case CONTEXT_SETTINGS_TIME: | ||
163 | return button_context_time; | ||
164 | |||
165 | case CONTEXT_YESNOSCREEN: | ||
166 | return button_context_yesno; | ||
167 | case CONTEXT_BOOKMARKSCREEN: | ||
168 | return button_context_bmark; | ||
169 | case CONTEXT_QUICKSCREEN: | ||
170 | return button_context_quickscreen; | ||
171 | case CONTEXT_PITCHSCREEN: | ||
172 | return button_context_pitchscreen; | ||
173 | case CONTEXT_KEYBOARD: | ||
174 | return button_context_keyboard; | ||
175 | } | ||
176 | return button_context_standard; | ||
177 | } | ||
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 392544dbbf..4444934e36 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -1,4 +1,4 @@ | |||
1 | #ifndef OLYMPUS_MROBE_100 | 1 | #if !defined(OLYMPUS_MROBE_100) |
2 | 2 | ||
3 | /* plugins common to all models */ | 3 | /* plugins common to all models */ |
4 | battery_bench.c | 4 | battery_bench.c |
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c index d277fe6d0d..e74ffc0315 100644 --- a/apps/plugins/lib/pluginlib_actions.c +++ b/apps/plugins/lib/pluginlib_actions.c | |||
@@ -130,6 +130,15 @@ const struct button_mapping generic_directions[] = | |||
130 | { PLA_DOWN_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | 130 | { PLA_DOWN_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE}, |
131 | { PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE}, | 131 | { PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE}, |
132 | { PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE}, | 132 | { PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE}, |
133 | #elif (CONFIG_KEYPAD == COWOND2_PAD) | ||
134 | { PLA_UP, BUTTON_UP, BUTTON_NONE}, | ||
135 | { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE}, | ||
136 | { PLA_LEFT, BUTTON_UP, BUTTON_MENU}, | ||
137 | { PLA_RIGHT, BUTTON_DOWN, BUTTON_MENU}, | ||
138 | { PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE}, | ||
139 | { PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | ||
140 | { PLA_LEFT_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_MENU}, | ||
141 | { PLA_RIGHT_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_MENU}, | ||
133 | #else | 142 | #else |
134 | #error pluginlib_actions: Unsupported keypad | 143 | #error pluginlib_actions: Unsupported keypad |
135 | #endif | 144 | #endif |
@@ -209,6 +218,13 @@ const struct button_mapping generic_left_right_fire[] = | |||
209 | { PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE}, | 218 | { PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE}, |
210 | { PLA_FIRE, BUTTON_RC_HEART, BUTTON_NONE}, | 219 | { PLA_FIRE, BUTTON_RC_HEART, BUTTON_NONE}, |
211 | { PLA_FIRE_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE}, | 220 | { PLA_FIRE_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE}, |
221 | #elif (CONFIG_KEYPAD == COWOND2_PAD) | ||
222 | { PLA_LEFT, BUTTON_UP, BUTTON_NONE}, | ||
223 | { PLA_RIGHT, BUTTON_DOWN, BUTTON_NONE}, | ||
224 | { PLA_LEFT_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE}, | ||
225 | { PLA_RIGHT_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | ||
226 | { PLA_FIRE, BUTTON_MENU, BUTTON_NONE}, | ||
227 | { PLA_FIRE_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE}, | ||
212 | #else | 228 | #else |
213 | #error pluginlib_actions: Unsupported keypad | 229 | #error pluginlib_actions: Unsupported keypad |
214 | #endif | 230 | #endif |
@@ -307,6 +323,12 @@ const struct button_mapping generic_actions[] = | |||
307 | {PLA_MENU, BUTTON_RC_MODE, BUTTON_NONE}, | 323 | {PLA_MENU, BUTTON_RC_MODE, BUTTON_NONE}, |
308 | {PLA_FIRE, BUTTON_RC_HEART, BUTTON_NONE}, | 324 | {PLA_FIRE, BUTTON_RC_HEART, BUTTON_NONE}, |
309 | {PLA_FIRE_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE}, | 325 | {PLA_FIRE_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE}, |
326 | #elif (CONFIG_KEYPAD == COWOND2_PAD) | ||
327 | {PLA_QUIT, BUTTON_POWER, BUTTON_NONE}, | ||
328 | {PLA_START, BUTTON_UP, BUTTON_NONE}, | ||
329 | {PLA_MENU, BUTTON_DOWN, BUTTON_NONE}, | ||
330 | {PLA_FIRE, BUTTON_MENU, BUTTON_NONE}, | ||
331 | {PLA_FIRE_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE}, | ||
310 | #else | 332 | #else |
311 | #error pluginlib_actions: Unsupported keypad | 333 | #error pluginlib_actions: Unsupported keypad |
312 | #endif | 334 | #endif |
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index e877811365..a08a4a8a54 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds | |||
@@ -60,6 +60,10 @@ OUTPUT_FORMAT(elf32-sh) | |||
60 | #define IRAMORIG DRAMORIG | 60 | #define IRAMORIG DRAMORIG |
61 | #define IRAMSIZE 0x4000 | 61 | #define IRAMSIZE 0x4000 |
62 | #define IRAM DRAM | 62 | #define IRAM DRAM |
63 | #elif defined(CPU_TCC780X) | ||
64 | #define DRAMORIG 0x20000000 | ||
65 | #define IRAMORIG 0x1000c000 | ||
66 | #define IRAMSIZE 0xc000 | ||
63 | #else | 67 | #else |
64 | #define DRAMORIG 0x09000000 + STUBOFFSET | 68 | #define DRAMORIG 0x09000000 + STUBOFFSET |
65 | #endif | 69 | #endif |
diff --git a/bootloader/SOURCES b/bootloader/SOURCES index b8d8d3ca6b..2753debe77 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES | |||
@@ -23,7 +23,7 @@ iaudio_x5.c | |||
23 | iriver_h300.c | 23 | iriver_h300.c |
24 | #elif defined(MROBE_500) | 24 | #elif defined(MROBE_500) |
25 | mrobe500.c | 25 | mrobe500.c |
26 | #elif defined(CPU_TCC77X) | 26 | #elif defined(CPU_TCC77X) || defined(CPU_TCC780X) |
27 | telechips.c | 27 | telechips.c |
28 | #else | 28 | #else |
29 | main.c | 29 | main.c |
diff --git a/bootloader/telechips.c b/bootloader/telechips.c index 6093701044..a51b6775a1 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c | |||
@@ -41,6 +41,10 @@ | |||
41 | #include "file.h" | 41 | #include "file.h" |
42 | #include "common.h" | 42 | #include "common.h" |
43 | 43 | ||
44 | #if defined(COWON_D2) | ||
45 | #include "i2c.h" | ||
46 | #endif | ||
47 | |||
44 | char version[] = APPSVERSION; | 48 | char version[] = APPSVERSION; |
45 | 49 | ||
46 | extern int line; | 50 | extern int line; |
@@ -50,6 +54,7 @@ void* main(void) | |||
50 | int button; | 54 | int button; |
51 | int power_count = 0; | 55 | int power_count = 0; |
52 | int count = 0; | 56 | int count = 0; |
57 | int i; | ||
53 | bool do_power_off = false; | 58 | bool do_power_off = false; |
54 | 59 | ||
55 | system_init(); | 60 | system_init(); |
@@ -57,6 +62,10 @@ void* main(void) | |||
57 | lcd_init(); | 62 | lcd_init(); |
58 | font_init(); | 63 | font_init(); |
59 | 64 | ||
65 | #if defined(COWON_D2) | ||
66 | lcd_enable(true); | ||
67 | #endif | ||
68 | |||
60 | _backlight_on(); | 69 | _backlight_on(); |
61 | 70 | ||
62 | while(!do_power_off) { | 71 | while(!do_power_off) { |
@@ -68,7 +77,7 @@ void* main(void) | |||
68 | /* Power-off if POWER button has been held for a long time | 77 | /* Power-off if POWER button has been held for a long time |
69 | This loop is currently running at about 100 iterations/second | 78 | This loop is currently running at about 100 iterations/second |
70 | */ | 79 | */ |
71 | if (button & BUTTON_POWERPLAY) { | 80 | if (button & POWEROFF_BUTTON) { |
72 | power_count++; | 81 | power_count++; |
73 | if (power_count > 200) | 82 | if (power_count > 200) |
74 | do_power_off = true; | 83 | do_power_off = true; |
@@ -78,6 +87,40 @@ void* main(void) | |||
78 | 87 | ||
79 | printf("Btn: 0x%08x",button); | 88 | printf("Btn: 0x%08x",button); |
80 | 89 | ||
90 | #if defined(COWON_D2) | ||
91 | printf("GPIOA: 0x%08x",GPIOA); | ||
92 | printf("GPIOB: 0x%08x",GPIOB); | ||
93 | printf("GPIOC: 0x%08x",GPIOC); | ||
94 | printf("GPIOD: 0x%08x",GPIOD); | ||
95 | printf("GPIOE: 0x%08x",GPIOE); | ||
96 | |||
97 | for (i = 0; i<4; i++) | ||
98 | { | ||
99 | printf("ADC%d: 0x%04x",i,adc_read(i)); | ||
100 | } | ||
101 | |||
102 | /* TODO: Establish how the touchscreen driver is going to work. | ||
103 | Since it needs I2C read/write, it can't easily go on a tick task */ | ||
104 | { | ||
105 | unsigned char buf[] = { 0x2f, (0xE<<1) | 1, /* ADC start for X+Y */ | ||
106 | 0, 0, 0 }; | ||
107 | int x,y; | ||
108 | i2c_write(0x10, buf, 2); | ||
109 | i2c_readmem(0x10, 0x2e, buf, 5); | ||
110 | x = (buf[2] << 2) | (buf[3] & 3); | ||
111 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | ||
112 | printf("X: 0x%03x Y: 0x%03x",x,y); | ||
113 | |||
114 | buf[0] = 0x2f; | ||
115 | buf[1] = (0xF<<1) | 1; /* ADC start for P1+P2 */ | ||
116 | i2c_write(0x10, buf, 2); | ||
117 | i2c_readmem(0x10, 0x2e, buf, 5); | ||
118 | x = (buf[2] << 2) | (buf[3] & 3); | ||
119 | y = (buf[4] << 2) | ((buf[3] & 0xC) >> 2); | ||
120 | printf("P1: 0x%03x P2: 0x%03x",x,y); | ||
121 | } | ||
122 | #endif | ||
123 | |||
81 | count++; | 124 | count++; |
82 | printf("Count: %d",count); | 125 | printf("Count: %d",count); |
83 | } | 126 | } |
@@ -86,6 +129,10 @@ void* main(void) | |||
86 | line = 0; | 129 | line = 0; |
87 | printf("POWER-OFF"); | 130 | printf("POWER-OFF"); |
88 | 131 | ||
132 | #if defined(COWON_D2) | ||
133 | lcd_enable(false); | ||
134 | #endif | ||
135 | |||
89 | /* TODO: Power-off */ | 136 | /* TODO: Power-off */ |
90 | while(1); | 137 | while(1); |
91 | 138 | ||
diff --git a/firmware/FILES b/firmware/FILES index d884e76d75..986d8beec6 100644 --- a/firmware/FILES +++ b/firmware/FILES | |||
@@ -39,6 +39,8 @@ target/arm/sandisk/sansa-e200/*.[chS] | |||
39 | target/arm/tatung/tpj1022/*.[chS] | 39 | target/arm/tatung/tpj1022/*.[chS] |
40 | target/arm/tcc77x/*.[chS] | 40 | target/arm/tcc77x/*.[chS] |
41 | target/arm/tcc77x/logikdax/*.[chS] | 41 | target/arm/tcc77x/logikdax/*.[chS] |
42 | target/arm/tcc780x/*.[chS] | ||
43 | target/arm/tcc780x/cowond2/*.[chS] | ||
42 | target/arm/tms320dm320/*.[chS] | 44 | target/arm/tms320dm320/*.[chS] |
43 | target/arm/tms320dm320/mrobe-500/*.[chS] | 45 | target/arm/tms320dm320/mrobe-500/*.[chS] |
44 | target/coldfire/*.[chS] | 46 | target/coldfire/*.[chS] |
diff --git a/firmware/SOURCES b/firmware/SOURCES index ac874a6cf9..bfc34e55c8 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -111,7 +111,7 @@ drivers/ata_mmc.c | |||
111 | #ifdef HAVE_FLASH_DISK | 111 | #ifdef HAVE_FLASH_DISK |
112 | drivers/ata_flash.c | 112 | drivers/ata_flash.c |
113 | #else /* !HAVE_FLASH_DISK */ | 113 | #else /* !HAVE_FLASH_DISK */ |
114 | #if !defined(SANSA_E200) && !defined(SANSA_C200) && !defined(LOGIK_DAX) && !defined(IAUDIO_7) | 114 | #if !defined(SANSA_E200) && !defined(SANSA_C200) && !defined(LOGIK_DAX) && !defined(IAUDIO_7) && !defined(COWON_D2) |
115 | drivers/ata.c | 115 | drivers/ata.c |
116 | #endif /* SANSA_E200 */ | 116 | #endif /* SANSA_E200 */ |
117 | #endif /* HAVE_FLASH_DISK */ | 117 | #endif /* HAVE_FLASH_DISK */ |
@@ -209,6 +209,8 @@ drivers/audio/uda1380.c | |||
209 | drivers/audio/wm8751.c | 209 | drivers/audio/wm8751.c |
210 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8978) | 210 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8978) |
211 | drivers/audio/wm8975.c | 211 | drivers/audio/wm8975.c |
212 | #elif defined(HAVE_WM8985) | ||
213 | drivers/audio/wm8985.c | ||
212 | #elif defined(HAVE_WM8758) | 214 | #elif defined(HAVE_WM8758) |
213 | drivers/audio/wm8758.c | 215 | drivers/audio/wm8758.c |
214 | #elif defined(HAVE_WM8721) | 216 | #elif defined(HAVE_WM8721) |
@@ -297,6 +299,8 @@ target/arm/memset16-arm.S | |||
297 | target/arm/i2c-pp.c | 299 | target/arm/i2c-pp.c |
298 | #elif CONFIG_I2C == I2C_PNX0101 | 300 | #elif CONFIG_I2C == I2C_PNX0101 |
299 | target/arm/pnx0101/i2c-pnx0101.c | 301 | target/arm/pnx0101/i2c-pnx0101.c |
302 | #elif CONFIG_I2C == I2C_TCC780X | ||
303 | target/arm/i2c-telechips.c | ||
300 | #elif CONFIG_I2C == I2C_S3C2440 | 304 | #elif CONFIG_I2C == I2C_S3C2440 |
301 | /* no i2c driver yet */ | 305 | /* no i2c driver yet */ |
302 | #endif | 306 | #endif |
@@ -326,6 +330,8 @@ target/arm/tms320dm320/crt0.S | |||
326 | target/arm/s3c2440/crt0.S | 330 | target/arm/s3c2440/crt0.S |
327 | #elif defined(CPU_TCC77X) | 331 | #elif defined(CPU_TCC77X) |
328 | target/arm/tcc77x/crt0.S | 332 | target/arm/tcc77x/crt0.S |
333 | #elif defined(CPU_TCC780X) | ||
334 | target/arm/tcc780x/crt0.S | ||
329 | #elif CONFIG_CPU==IMX31L | 335 | #elif CONFIG_CPU==IMX31L |
330 | target/arm/imx31/crt0.S | 336 | target/arm/imx31/crt0.S |
331 | #elif defined(CPU_ARM) | 337 | #elif defined(CPU_ARM) |
@@ -858,3 +864,23 @@ target/arm/tcc77x/iaudio7/lcd-iaudio7.c | |||
858 | target/arm/tcc77x/iaudio7/power-iaudio7.c | 864 | target/arm/tcc77x/iaudio7/power-iaudio7.c |
859 | #endif /* SIMULATOR */ | 865 | #endif /* SIMULATOR */ |
860 | #endif /* IAUDIO_7 */ | 866 | #endif /* IAUDIO_7 */ |
867 | |||
868 | #ifdef COWON_D2 | ||
869 | #ifndef SIMULATOR | ||
870 | target/arm/tcc780x/adc-tcc780x.c | ||
871 | target/arm/tcc780x/ata-nand-tcc780x.c | ||
872 | target/arm/tcc780x/kernel-tcc780x.c | ||
873 | target/arm/tcc780x/timer-tcc780x.c | ||
874 | target/arm/tcc780x/system-tcc780x.c | ||
875 | target/arm/tcc780x/cowond2/button-cowond2.c | ||
876 | target/arm/tcc780x/cowond2/lcd-cowond2.c | ||
877 | target/arm/tcc780x/cowond2/power-cowond2.c | ||
878 | target/arm/tcc780x/cowond2/powermgmt-cowond2.c | ||
879 | target/arm/tcc780x/cowond2/usb-cowond2.c | ||
880 | #ifndef BOOTLOADER | ||
881 | target/arm/wmcodec-telechips.c | ||
882 | target/arm/tcc780x/debug-tcc780x.c | ||
883 | target/arm/tcc780x/cowond2/pcm-cowond2.c | ||
884 | #endif /* BOOTLOADER */ | ||
885 | #endif /* SIMULATOR */ | ||
886 | #endif /* COWON_D2 */ | ||
diff --git a/firmware/app.lds b/firmware/app.lds index 9b83537dfe..c5c4e6e30e 100644 --- a/firmware/app.lds +++ b/firmware/app.lds | |||
@@ -13,6 +13,8 @@ INPUT(target/arm/crt0-pp.o) | |||
13 | INPUT(target/arm/tms320dm320/crt0.o) | 13 | INPUT(target/arm/tms320dm320/crt0.o) |
14 | #elif CONFIG_CPU==S3C2440 | 14 | #elif CONFIG_CPU==S3C2440 |
15 | INPUT(target/arm/s3c2440/crt0.o) | 15 | INPUT(target/arm/s3c2440/crt0.o) |
16 | #elif defined(CPU_TCC780X) | ||
17 | INPUT(target/arm/tcc780x/crt0.o) | ||
16 | #elif CONFIG_CPU == PNX0101 | 18 | #elif CONFIG_CPU == PNX0101 |
17 | INPUT(target/arm/pnx0101/crt0-pnx0101.o) | 19 | INPUT(target/arm/pnx0101/crt0-pnx0101.o) |
18 | #elif CONFIG_CPU == IMX31L | 20 | #elif CONFIG_CPU == IMX31L |
@@ -75,6 +77,14 @@ INPUT(target/sh/crt0.o) | |||
75 | #define DRAMORIG (0x0 + STUBOFFSET) | 77 | #define DRAMORIG (0x0 + STUBOFFSET) |
76 | #define IRAMORIG 0x1FFFC000 | 78 | #define IRAMORIG 0x1FFFC000 |
77 | #define IRAMSIZE 0x4000 | 79 | #define IRAMSIZE 0x4000 |
80 | #elif defined(CPU_TCC780X) | ||
81 | #define DRAMORIG 0x20000000 + STUBOFFSET | ||
82 | #define ITCMORIG 0x00000000 | ||
83 | #define ITCMSIZE 0x1000 | ||
84 | #define DTCMORIG 0xA0000000 | ||
85 | #define DTCMSIZE 0x2000 | ||
86 | #define SRAMORIG 0x10000000 | ||
87 | #define SRAMSIZE 0xc000 | ||
78 | #else | 88 | #else |
79 | #define DRAMORIG 0x09000000 + STUBOFFSET | 89 | #define DRAMORIG 0x09000000 + STUBOFFSET |
80 | #define IRAMORIG 0x0f000000 | 90 | #define IRAMORIG 0x0f000000 |
@@ -90,7 +100,12 @@ INPUT(target/sh/crt0.o) | |||
90 | MEMORY | 100 | MEMORY |
91 | { | 101 | { |
92 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE | 102 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE |
93 | #if CONFIG_CPU != S3C2440 | 103 | #if defined(CPU_TCC780X) |
104 | /* Seperate data & instruction TCMs plus SRAM. */ | ||
105 | ITCM : ORIGIN = ITCMORIG, LENGTH = ITCMSIZE | ||
106 | DTCM : ORIGIN = DTCMORIG, LENGTH = DTCMSIZE | ||
107 | SRAM : ORIGIN = SRAMORIG, LENGTH = SRAMSIZE | ||
108 | #elif CONFIG_CPU != S3C2440 | ||
94 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE | 109 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE |
95 | #endif | 110 | #endif |
96 | #if CONFIG_CPU==PNX0101 | 111 | #if CONFIG_CPU==PNX0101 |
@@ -187,6 +202,100 @@ SECTIONS | |||
187 | _end = .; | 202 | _end = .; |
188 | } > DRAM | 203 | } > DRAM |
189 | 204 | ||
205 | #elif defined(CPU_TCC780X) | ||
206 | .text : | ||
207 | { | ||
208 | loadaddress = .; | ||
209 | _loadaddress = .; | ||
210 | . = ALIGN(0x200); | ||
211 | *(.init.text) | ||
212 | *(.text*) | ||
213 | *(.glue_7) | ||
214 | *(.glue_7t) | ||
215 | . = ALIGN(0x4); | ||
216 | } > DRAM | ||
217 | |||
218 | .rodata : | ||
219 | { | ||
220 | *(.rodata) /* problems without this, dunno why */ | ||
221 | *(.rodata*) | ||
222 | *(.rodata.str1.1) | ||
223 | *(.rodata.str1.4) | ||
224 | . = ALIGN(0x4); | ||
225 | |||
226 | /* Pseudo-allocate the copies of the data sections */ | ||
227 | _datacopy = .; | ||
228 | } > DRAM | ||
229 | |||
230 | /* TRICK ALERT! For RAM execution, we put the .data section at the | ||
231 | same load address as the copy. Thus, we don't waste extra RAM | ||
232 | when we don't actually need the copy. */ | ||
233 | .data : AT ( _datacopy ) | ||
234 | { | ||
235 | _datastart = .; | ||
236 | *(.data*) | ||
237 | . = ALIGN(0x4); | ||
238 | _dataend = .; | ||
239 | } > DRAM | ||
240 | |||
241 | /DISCARD/ : | ||
242 | { | ||
243 | *(.eh_frame) | ||
244 | } | ||
245 | |||
246 | .vectors ITCMORIG : | ||
247 | { | ||
248 | _vectorsstart = .; | ||
249 | *(.vectors); | ||
250 | _vectorsend = .; | ||
251 | } > ITCM AT> DRAM | ||
252 | |||
253 | _vectorscopy = LOADADDR(.vectors); | ||
254 | |||
255 | .itcm : | ||
256 | { | ||
257 | _itcmstart = .; | ||
258 | *(.icode) | ||
259 | _itcmend = .; | ||
260 | } > ITCM AT> DRAM | ||
261 | |||
262 | _itcmcopy = LOADADDR(.itcm); | ||
263 | |||
264 | .dtcm : | ||
265 | { | ||
266 | _dtcmstart = .; | ||
267 | *(.irodata) | ||
268 | *(.idata) | ||
269 | _dtcmend = .; | ||
270 | } > DTCM AT> DRAM | ||
271 | |||
272 | _dtcmcopy = LOADADDR(.dtcm); | ||
273 | |||
274 | .ibss (NOLOAD) : | ||
275 | { | ||
276 | _iedata = .; | ||
277 | *(.ibss) | ||
278 | . = ALIGN(0x4); | ||
279 | _iend = .; | ||
280 | } > SRAM | ||
281 | |||
282 | .stack : | ||
283 | { | ||
284 | *(.stack) | ||
285 | stackbegin = .; | ||
286 | . += 0x2000; | ||
287 | stackend = .; | ||
288 | } > SRAM | ||
289 | |||
290 | .bss : | ||
291 | { | ||
292 | _edata = .; | ||
293 | *(.bss*) | ||
294 | *(COMMON) | ||
295 | . = ALIGN(0x4); | ||
296 | _end = .; | ||
297 | } > DRAM | ||
298 | |||
190 | #elif CONFIG_CPU==S3C2440 | 299 | #elif CONFIG_CPU==S3C2440 |
191 | .text : | 300 | .text : |
192 | { | 301 | { |
diff --git a/firmware/boot.lds b/firmware/boot.lds index 1b13211608..8d7d55a607 100644 --- a/firmware/boot.lds +++ b/firmware/boot.lds | |||
@@ -15,6 +15,8 @@ INPUT(target/arm/tms320dm320/crt0.o) | |||
15 | INPUT(target/arm/s3c2440/crt0.o) | 15 | INPUT(target/arm/s3c2440/crt0.o) |
16 | #elif defined(CPU_TCC77X) | 16 | #elif defined(CPU_TCC77X) |
17 | INPUT(target/arm/tcc77x/crt0.o) | 17 | INPUT(target/arm/tcc77x/crt0.o) |
18 | #elif defined(CPU_TCC780X) | ||
19 | INPUT(target/arm/tcc780x/crt0.o) | ||
18 | #elif CONFIG_CPU==IMX31L | 20 | #elif CONFIG_CPU==IMX31L |
19 | INPUT(target/arm/imx31/crt0.o) | 21 | INPUT(target/arm/imx31/crt0.o) |
20 | #else | 22 | #else |
@@ -89,6 +91,12 @@ INPUT(target/sh/crt0.o) | |||
89 | #define IRAMSIZE 64K | 91 | #define IRAMSIZE 64K |
90 | #define FLASHORIG 0x0000000 | 92 | #define FLASHORIG 0x0000000 |
91 | #define FLASHSIZE 1M | 93 | #define FLASHSIZE 1M |
94 | #elif defined(CPU_TCC780X) | ||
95 | #define DRAMORIG 0x20000000 | ||
96 | #define IRAMORIG 0x00000000 | ||
97 | #define IRAMSIZE 4K | ||
98 | #define FLASHORIG 0x0000000 | ||
99 | #define FLASHSIZE 1M | ||
92 | #else | 100 | #else |
93 | #define DRAMORIG 0x09000000 | 101 | #define DRAMORIG 0x09000000 |
94 | #define IRAMORIG 0x0f000000 | 102 | #define IRAMORIG 0x0f000000 |
@@ -97,7 +105,7 @@ INPUT(target/sh/crt0.o) | |||
97 | #define FLASHSIZE 256K - ROM_START | 105 | #define FLASHSIZE 256K - ROM_START |
98 | #endif | 106 | #endif |
99 | 107 | ||
100 | #if defined(CPU_TCC77X) | 108 | #if defined(CPU_TCC77X) || defined(CPU_TCC780X) |
101 | MEMORY | 109 | MEMORY |
102 | { | 110 | { |
103 | #ifdef TCCBOOT | 111 | #ifdef TCCBOOT |
@@ -190,7 +198,7 @@ SECTIONS | |||
190 | _end = .; | 198 | _end = .; |
191 | } | 199 | } |
192 | } | 200 | } |
193 | #elif defined(CPU_TCC77X) | 201 | #elif defined(CPU_TCC77X) || defined(CPU_TCC780X) |
194 | { | 202 | { |
195 | .text : { | 203 | .text : { |
196 | *(.init.text) | 204 | *(.init.text) |
diff --git a/firmware/drivers/audio/wm8985.c b/firmware/drivers/audio/wm8985.c new file mode 100644 index 0000000000..3117b06f98 --- /dev/null +++ b/firmware/drivers/audio/wm8985.c | |||
@@ -0,0 +1,143 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Stubs for WM8985 audio codec, (unwisely?) based on 8975 driver. | ||
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 "logf.h" | ||
20 | #include "system.h" | ||
21 | #include "string.h" | ||
22 | #include "audio.h" | ||
23 | |||
24 | #include "wmcodec.h" | ||
25 | #include "audiohw.h" | ||
26 | #include "i2s.h" | ||
27 | |||
28 | /* TODO: fix these values, they're copied straight from WM8975 */ | ||
29 | const struct sound_settings_info audiohw_settings[] = { | ||
30 | [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, | ||
31 | [SOUND_BASS] = {"dB", 0, 1, -6, 9, 0}, | ||
32 | [SOUND_TREBLE] = {"dB", 0, 1, -6, 9, 0}, | ||
33 | [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, | ||
34 | [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, | ||
35 | [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, | ||
36 | [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, | ||
37 | [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, | ||
38 | [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, | ||
39 | }; | ||
40 | |||
41 | /* convert tenth of dB volume to master volume register value */ | ||
42 | int tenthdb2master(int db) | ||
43 | { | ||
44 | #warning function not implemented | ||
45 | |||
46 | (void)db; | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | /* Silently enable / disable audio output */ | ||
51 | void audiohw_enable_output(bool enable) | ||
52 | { | ||
53 | #warning function not implemented | ||
54 | |||
55 | (void)enable; | ||
56 | } | ||
57 | |||
58 | int audiohw_set_master_vol(int vol_l, int vol_r) | ||
59 | { | ||
60 | #warning function not implemented | ||
61 | |||
62 | (void)vol_l; | ||
63 | (void)vol_r; | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | int audiohw_set_lineout_vol(int vol_l, int vol_r) | ||
68 | { | ||
69 | #warning function not implemented | ||
70 | |||
71 | (void)vol_l; | ||
72 | (void)vol_r; | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | void audiohw_set_bass(int value) | ||
77 | { | ||
78 | #warning function not implemented | ||
79 | |||
80 | (void)value; | ||
81 | } | ||
82 | |||
83 | void audiohw_set_treble(int value) | ||
84 | { | ||
85 | #warning function not implemented | ||
86 | |||
87 | (void)value; | ||
88 | } | ||
89 | |||
90 | void audiohw_mute(bool mute) | ||
91 | { | ||
92 | #warning function not implemented | ||
93 | |||
94 | (void)mute; | ||
95 | } | ||
96 | |||
97 | void audiohw_close(void) | ||
98 | { | ||
99 | #warning function not implemented | ||
100 | } | ||
101 | |||
102 | void audiohw_set_nsorder(int order) | ||
103 | { | ||
104 | #warning function not implemented | ||
105 | |||
106 | (void)order; | ||
107 | } | ||
108 | |||
109 | /* Note: Disable output before calling this function */ | ||
110 | void audiohw_set_sample_rate(int sampling_control) | ||
111 | { | ||
112 | #warning function not implemented | ||
113 | |||
114 | (void)sampling_control; | ||
115 | } | ||
116 | |||
117 | void audiohw_enable_recording(bool source_mic) | ||
118 | { | ||
119 | #warning function not implemented | ||
120 | |||
121 | (void)source_mic; | ||
122 | } | ||
123 | |||
124 | void audiohw_disable_recording(void) | ||
125 | { | ||
126 | #warning function not implemented | ||
127 | } | ||
128 | |||
129 | void audiohw_set_recvol(int left, int right, int type) | ||
130 | { | ||
131 | #warning function not implemented | ||
132 | |||
133 | (void)left; | ||
134 | (void)right; | ||
135 | (void)type; | ||
136 | } | ||
137 | |||
138 | void audiohw_set_monitor(bool enable) | ||
139 | { | ||
140 | #warning function not implemented | ||
141 | |||
142 | (void)enable; | ||
143 | } | ||
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 5dc7550478..cdc92221d7 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "wm8751.h" | 29 | #include "wm8751.h" |
30 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8978) | 30 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8978) |
31 | #include "wm8975.h" | 31 | #include "wm8975.h" |
32 | #elif defined(HAVE_WM8985) | ||
33 | #include "wm8985.h" | ||
32 | #elif defined(HAVE_WM8758) | 34 | #elif defined(HAVE_WM8758) |
33 | #include "wm8758.h" | 35 | #include "wm8758.h" |
34 | #elif defined(HAVE_WM8721) | 36 | #elif defined(HAVE_WM8721) |
@@ -62,7 +64,7 @@ enum { | |||
62 | #endif | 64 | #endif |
63 | #if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\ | 65 | #if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380) || defined(HAVE_TLV320)\ |
64 | || defined(HAVE_WM8975) || defined(HAVE_WM8758) || defined(HAVE_WM8731) \ | 66 | || defined(HAVE_WM8975) || defined(HAVE_WM8758) || defined(HAVE_WM8731) \ |
65 | || defined(HAVE_AS3514) || defined(HAVE_WM8978) | 67 | || defined(HAVE_AS3514) || defined(HAVE_WM8978) || defined(HAVE_WM8985) |
66 | SOUND_LEFT_GAIN, | 68 | SOUND_LEFT_GAIN, |
67 | SOUND_RIGHT_GAIN, | 69 | SOUND_RIGHT_GAIN, |
68 | SOUND_MIC_GAIN, | 70 | SOUND_MIC_GAIN, |
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h new file mode 100644 index 0000000000..4f2d11e424 --- /dev/null +++ b/firmware/export/config-cowond2.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | * This config file is for the Cowon iAudio D2 | ||
3 | */ | ||
4 | #define TARGET_TREE /* this target is using the target tree system */ | ||
5 | |||
6 | /* For Rolo and boot loader */ | ||
7 | #define MODEL_NUMBER 34 | ||
8 | |||
9 | /* define this if you have recording possibility */ | ||
10 | //#define HAVE_RECORDING | ||
11 | |||
12 | /* Define bitmask of input sources - recordable bitmask can be defined | ||
13 | explicitly if different */ | ||
14 | //#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF) | ||
15 | |||
16 | /* define this if you have a bitmap LCD display */ | ||
17 | #define HAVE_LCD_BITMAP | ||
18 | |||
19 | /* define this if you have a colour LCD */ | ||
20 | #define HAVE_LCD_COLOR | ||
21 | |||
22 | /* define this if you can flip your LCD */ | ||
23 | #define HAVE_LCD_FLIP | ||
24 | |||
25 | /* define this if you can invert the colours on your LCD */ | ||
26 | #define HAVE_LCD_INVERT | ||
27 | |||
28 | /* define this if you want album art for this target */ | ||
29 | #define HAVE_ALBUMART | ||
30 | |||
31 | /* define this if you have access to the quickscreen */ | ||
32 | #define HAVE_QUICKSCREEN | ||
33 | /* define this if you have access to the pitchscreen */ | ||
34 | #define HAVE_PITCHSCREEN | ||
35 | |||
36 | /* define this if you would like tagcache to build on this target */ | ||
37 | #define HAVE_TAGCACHE | ||
38 | |||
39 | /* define this if you have a flash memory storage */ | ||
40 | #define HAVE_FLASH_STORAGE | ||
41 | |||
42 | /* LCD dimensions */ | ||
43 | #define LCD_WIDTH 320 | ||
44 | #define LCD_HEIGHT 240 | ||
45 | #define LCD_DEPTH 16 | ||
46 | #define LCD_PIXELFORMAT 565 | ||
47 | |||
48 | /* define this if you have LCD enable function */ | ||
49 | #define HAVE_LCD_ENABLE | ||
50 | |||
51 | /* define this to indicate your device's keypad */ | ||
52 | #define CONFIG_KEYPAD COWOND2_PAD | ||
53 | |||
54 | /* define this if you have a real-time clock */ | ||
55 | //#define CONFIG_RTC RTC_TCC780X | ||
56 | |||
57 | /* define this if you have RTC RAM available for settings */ | ||
58 | //#define HAVE_RTC_RAM | ||
59 | |||
60 | /* Define this if you have a software controlled poweroff */ | ||
61 | #define HAVE_SW_POWEROFF | ||
62 | |||
63 | /* The number of bytes reserved for loadable codecs */ | ||
64 | #define CODEC_SIZE 0x80000 | ||
65 | |||
66 | /* The number of bytes reserved for loadable plugins */ | ||
67 | #define PLUGIN_BUFFER_SIZE 0x80000 | ||
68 | |||
69 | #define AB_REPEAT_ENABLE 1 | ||
70 | |||
71 | /* Define this if you do software codec */ | ||
72 | #define CONFIG_CODEC SWCODEC | ||
73 | |||
74 | /* The D2 uses a WM8985 codec */ | ||
75 | #define HAVE_WM8985 | ||
76 | |||
77 | /* There is no hardware tone control */ | ||
78 | /* TODO: probably need to use this */ | ||
79 | //#define HAVE_SW_TONE_CONTROLS | ||
80 | |||
81 | /* Define this for LCD backlight available */ | ||
82 | #define HAVE_BACKLIGHT | ||
83 | |||
84 | /* TODO: Enable LCD brightness control */ | ||
85 | //#define HAVE_BACKLIGHT_BRIGHTNESS | ||
86 | |||
87 | /* Main LCD backlight brightness range and defaults */ | ||
88 | //#define MIN_BRIGHTNESS_SETTING 1 | ||
89 | //#define MAX_BRIGHTNESS_SETTING 10 | ||
90 | //#define DEFAULT_BRIGHTNESS_SETTING 8 | ||
91 | |||
92 | #define CONFIG_I2C I2C_TCC780X | ||
93 | |||
94 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | ||
95 | #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ | ||
96 | #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ | ||
97 | #define BATTERY_CAPACITY_INC 50 /* capacity increment */ | ||
98 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | ||
99 | |||
100 | /* define this if the unit should not shut down on low battery. */ | ||
101 | /* TODO: this is temporary until battery monitoring implemented */ | ||
102 | #define NO_LOW_BATTERY_SHUTDOWN | ||
103 | |||
104 | #ifndef SIMULATOR | ||
105 | |||
106 | /* Define this if you have a TCC7801 */ | ||
107 | #define CONFIG_CPU TCC7801 | ||
108 | |||
109 | /* Define this if you have ATA power-off control */ | ||
110 | #define HAVE_ATA_POWER_OFF | ||
111 | |||
112 | /* Define this to the CPU frequency */ | ||
113 | #define CPU_FREQ 192000000 | ||
114 | |||
115 | /* Define this if you have adjustable CPU frequency */ | ||
116 | #define HAVE_ADJUSTABLE_CPU_FREQ | ||
117 | |||
118 | /* Offset ( in the firmware file's header ) to the file length */ | ||
119 | #define FIRMWARE_OFFSET_FILE_LENGTH 0 | ||
120 | |||
121 | /* Offset ( in the firmware file's header ) to the file CRC */ | ||
122 | #define FIRMWARE_OFFSET_FILE_CRC 4 | ||
123 | |||
124 | /* Offset ( in the firmware file's header ) to the real data */ | ||
125 | #define FIRMWARE_OFFSET_FILE_DATA 6 | ||
126 | |||
127 | /* The start address index for ROM builds */ | ||
128 | /* #define ROM_START 0x11010 for behind original Archos */ | ||
129 | #define ROM_START 0x7010 /* for behind BootBox */ | ||
130 | |||
131 | /* Software controlled LED */ | ||
132 | #define CONFIG_LED LED_VIRTUAL | ||
133 | |||
134 | #define CONFIG_LCD LCD_COWOND2 | ||
135 | |||
136 | #define BOOTFILE_EXT "iaudio" | ||
137 | #define BOOTFILE "rockbox." BOOTFILE_EXT | ||
138 | #define BOOTDIR "/" | ||
139 | |||
140 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index a3c2390f84..cf75d67aa5 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -53,6 +53,7 @@ | |||
53 | #define IMX31L 31 | 53 | #define IMX31L 31 |
54 | #define TCC771L 771 | 54 | #define TCC771L 771 |
55 | #define TCC773L 773 | 55 | #define TCC773L 773 |
56 | #define TCC7801 7801 | ||
56 | 57 | ||
57 | /* CONFIG_KEYPAD */ | 58 | /* CONFIG_KEYPAD */ |
58 | #define PLAYER_PAD 1 | 59 | #define PLAYER_PAD 1 |
@@ -75,7 +76,8 @@ | |||
75 | #define MROBE500_PAD 18 | 76 | #define MROBE500_PAD 18 |
76 | #define GIGABEAT_S_PAD 19 | 77 | #define GIGABEAT_S_PAD 19 |
77 | #define LOGIK_DAX_PAD 20 | 78 | #define LOGIK_DAX_PAD 20 |
78 | #define IAUDIO67_PAD 21 | 79 | #define IAUDIO67_PAD 21 |
80 | #define COWOND2_PAD 22 | ||
79 | 81 | ||
80 | /* CONFIG_REMOTE_KEYPAD */ | 82 | /* CONFIG_REMOTE_KEYPAD */ |
81 | #define H100_REMOTE 1 | 83 | #define H100_REMOTE 1 |
@@ -111,6 +113,7 @@ | |||
111 | #define LCD_MROBE100 19 /* as used by Olympus M:Robe 100 */ | 113 | #define LCD_MROBE100 19 /* as used by Olympus M:Robe 100 */ |
112 | #define LCD_LOGIKDAX 20 /* as used by Logik DAX - SSD1815 */ | 114 | #define LCD_LOGIKDAX 20 /* as used by Logik DAX - SSD1815 */ |
113 | #define LCD_IAUDIO67 21 /* as used by iAudio 6/7 - unknown */ | 115 | #define LCD_IAUDIO67 21 /* as used by iAudio 6/7 - unknown */ |
116 | #define LCD_COWOND2 21 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */ | ||
114 | 117 | ||
115 | /* LCD_PIXELFORMAT */ | 118 | /* LCD_PIXELFORMAT */ |
116 | #define HORIZONTAL_PACKING 1 | 119 | #define HORIZONTAL_PACKING 1 |
@@ -136,6 +139,7 @@ | |||
136 | #define I2C_PP5024 8 /* PP5024 style */ | 139 | #define I2C_PP5024 8 /* PP5024 style */ |
137 | #define I2C_IMX31L 9 | 140 | #define I2C_IMX31L 9 |
138 | #define I2C_TCC77X 10 | 141 | #define I2C_TCC77X 10 |
142 | #define I2C_TCC780X 11 | ||
139 | 143 | ||
140 | /* CONFIG_LED */ | 144 | /* CONFIG_LED */ |
141 | #define LED_REAL 1 /* SW controlled LED (Archos recorders, player) */ | 145 | #define LED_REAL 1 /* SW controlled LED (Archos recorders, player) */ |
@@ -156,6 +160,7 @@ | |||
156 | #define RTC_IMX31L 8 | 160 | #define RTC_IMX31L 8 |
157 | #define RTC_RX5X348AB 9 | 161 | #define RTC_RX5X348AB 9 |
158 | #define RTC_TCC77X 10 | 162 | #define RTC_TCC77X 10 |
163 | #define RTC_TCC780X 11 | ||
159 | 164 | ||
160 | /* USB On-the-go */ | 165 | /* USB On-the-go */ |
161 | #define USBOTG_ISP1362 1362 /* iriver H300 */ | 166 | #define USBOTG_ISP1362 1362 /* iriver H300 */ |
@@ -231,6 +236,8 @@ | |||
231 | #include "config-logikdax.h" | 236 | #include "config-logikdax.h" |
232 | #elif defined(IAUDIO_7) | 237 | #elif defined(IAUDIO_7) |
233 | #include "config-iaudio7.h" | 238 | #include "config-iaudio7.h" |
239 | #elif defined(COWON_D2) | ||
240 | #include "config-cowond2.h" | ||
234 | #else | 241 | #else |
235 | /* no known platform */ | 242 | /* no known platform */ |
236 | #endif | 243 | #endif |
@@ -345,6 +352,11 @@ | |||
345 | #define CPU_TCC77X | 352 | #define CPU_TCC77X |
346 | #endif | 353 | #endif |
347 | 354 | ||
355 | /* define for all cpus from TCC780 family */ | ||
356 | #if (CONFIG_CPU == TCC7801) | ||
357 | #define CPU_TCC780X | ||
358 | #endif | ||
359 | |||
348 | /* define for all cpus from ARM7TDMI family (for specific optimisations) */ | 360 | /* define for all cpus from ARM7TDMI family (for specific optimisations) */ |
349 | #if defined(CPU_PP) || (CONFIG_CPU == PNX0101) || (CONFIG_CPU == DSC25) | 361 | #if defined(CPU_PP) || (CONFIG_CPU == PNX0101) || (CONFIG_CPU == DSC25) |
350 | #define CPU_ARM7TDMI | 362 | #define CPU_ARM7TDMI |
@@ -353,7 +365,7 @@ | |||
353 | /* define for all cpus from ARM family */ | 365 | /* define for all cpus from ARM family */ |
354 | #if defined(CPU_PP) || (CONFIG_CPU == PNX0101) || (CONFIG_CPU == S3C2440) \ | 366 | #if defined(CPU_PP) || (CONFIG_CPU == PNX0101) || (CONFIG_CPU == S3C2440) \ |
355 | || (CONFIG_CPU == DSC25) || (CONFIG_CPU == IMX31L) || (CONFIG_CPU == DM320) \ | 367 | || (CONFIG_CPU == DSC25) || (CONFIG_CPU == IMX31L) || (CONFIG_CPU == DM320) \ |
356 | || defined(CPU_TCC77X) | 368 | || defined(CPU_TCC77X) || defined(CPU_TCC780X) |
357 | #define CPU_ARM | 369 | #define CPU_ARM |
358 | #endif | 370 | #endif |
359 | 371 | ||
@@ -380,6 +392,7 @@ | |||
380 | defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \ | 392 | defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \ |
381 | defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \ | 393 | defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \ |
382 | defined(CPU_TCC77X) || /* Telechips: core, plugins, codecs */ \ | 394 | defined(CPU_TCC77X) || /* Telechips: core, plugins, codecs */ \ |
395 | defined(CPU_TCC780X) || /* Telechips: core, plugins, codecs */ \ | ||
383 | (CONFIG_CPU == PNX0101)) | 396 | (CONFIG_CPU == PNX0101)) |
384 | #define ICODE_ATTR __attribute__ ((section(".icode"))) | 397 | #define ICODE_ATTR __attribute__ ((section(".icode"))) |
385 | #define ICONST_ATTR __attribute__ ((section(".irodata"))) | 398 | #define ICONST_ATTR __attribute__ ((section(".irodata"))) |
diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h index 84229378ec..08a91a6d10 100644 --- a/firmware/export/cpu.h +++ b/firmware/export/cpu.h | |||
@@ -51,3 +51,6 @@ | |||
51 | #ifdef CPU_TCC77X | 51 | #ifdef CPU_TCC77X |
52 | #include "tcc77x.h" | 52 | #include "tcc77x.h" |
53 | #endif | 53 | #endif |
54 | #ifdef CPU_TCC780X | ||
55 | #include "tcc780x.h" | ||
56 | #endif | ||
diff --git a/firmware/export/tcc780x.h b/firmware/export/tcc780x.h new file mode 100644 index 0000000000..df55c6f03d --- /dev/null +++ b/firmware/export/tcc780x.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Rob Purchase | ||
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 | #ifndef __TCC780X_H__ | ||
20 | #define __TCC780X_H__ | ||
21 | |||
22 | /* General-purpose IO */ | ||
23 | |||
24 | #define PORTCFG0 (*(volatile unsigned long *)0xF005A000) | ||
25 | #define PORTCFG1 (*(volatile unsigned long *)0xF005A004) | ||
26 | #define PORTCFG2 (*(volatile unsigned long *)0xF005A008) | ||
27 | #define PORTCFG3 (*(volatile unsigned long *)0xF005A00C) | ||
28 | |||
29 | #define GPIOA (*(volatile unsigned long *)0xF005A020) | ||
30 | #define GPIOB (*(volatile unsigned long *)0xF005A040) | ||
31 | #define GPIOC (*(volatile unsigned long *)0xF005A060) | ||
32 | #define GPIOD (*(volatile unsigned long *)0xF005A080) | ||
33 | #define GPIOE (*(volatile unsigned long *)0xF005A0A0) | ||
34 | |||
35 | #define GPIOA_DIR (*(volatile unsigned long *)0xF005A024) | ||
36 | #define GPIOB_DIR (*(volatile unsigned long *)0xF005A044) | ||
37 | #define GPIOC_DIR (*(volatile unsigned long *)0xF005A064) | ||
38 | #define GPIOD_DIR (*(volatile unsigned long *)0xF005A084) | ||
39 | #define GPIOE_DIR (*(volatile unsigned long *)0xF005A0A4) | ||
40 | |||
41 | #define GPIOA_SET (*(volatile unsigned long *)0xF005A028) | ||
42 | #define GPIOB_SET (*(volatile unsigned long *)0xF005A048) | ||
43 | #define GPIOC_SET (*(volatile unsigned long *)0xF005A068) | ||
44 | #define GPIOD_SET (*(volatile unsigned long *)0xF005A088) | ||
45 | #define GPIOE_SET (*(volatile unsigned long *)0xF005A0A8) | ||
46 | |||
47 | #define GPIOA_CLEAR (*(volatile unsigned long *)0xF005A02C) | ||
48 | #define GPIOB_CLEAR (*(volatile unsigned long *)0xF005A04C) | ||
49 | #define GPIOC_CLEAR (*(volatile unsigned long *)0xF005A06C) | ||
50 | #define GPIOD_CLEAR (*(volatile unsigned long *)0xF005A08C) | ||
51 | #define GPIOE_CLEAR (*(volatile unsigned long *)0xF005A0AC) | ||
52 | |||
53 | /* Clock Generator */ | ||
54 | |||
55 | #define CLKCTRL (*(volatile unsigned long *)0xF3000000) | ||
56 | #define PLL0CFG (*(volatile unsigned long *)0xF3000004) | ||
57 | #define PLL1CFG (*(volatile unsigned long *)0xF3000008) | ||
58 | #define CLKDIVC (*(volatile unsigned long *)0xF300000C) | ||
59 | #define CLKDIVC1 (*(volatile unsigned long *)0xF3000010) | ||
60 | #define MODECTR (*(volatile unsigned long *)0xF3000014) | ||
61 | #define BCLKCTR (*(volatile unsigned long *)0xF3000018) | ||
62 | #define SWRESET (*(volatile unsigned long *)0xF300001C) | ||
63 | #define PCLKCFG0 (*(volatile unsigned long *)0xF3000020) | ||
64 | #define PCLKCFG1 (*(volatile unsigned long *)0xF3000024) | ||
65 | #define PCLKCFG2 (*(volatile unsigned long *)0xF3000028) | ||
66 | #define PCLKCFG3 (*(volatile unsigned long *)0xF300002C) | ||
67 | #define PCLK_LCD (*(volatile unsigned long *)0xF3000030) | ||
68 | #define PCLKCFG5 (*(volatile unsigned long *)0xF3000034) | ||
69 | #define PCLKCFG6 (*(volatile unsigned long *)0xF3000038) | ||
70 | #define PCLKCFG7 (*(volatile unsigned long *)0xF300003C) | ||
71 | #define PCLKCFG8 (*(volatile unsigned long *)0xF3000040) | ||
72 | #define PCLK_TCT (*(volatile unsigned long *)0xF3000044) | ||
73 | #define PCLKCFG10 (*(volatile unsigned long *)0xF3000048) | ||
74 | #define PCLKCFG11 (*(volatile unsigned long *)0xF300004C) | ||
75 | #define PCLK_ADC (*(volatile unsigned long *)0xF3000050) | ||
76 | #define PCLKCFG13 (*(volatile unsigned long *)0xF3000054) | ||
77 | #define PCLKCFG14 (*(volatile unsigned long *)0xF3000058) | ||
78 | #define PCLK_RFREQ (*(volatile unsigned long *)0xF300005C) | ||
79 | #define PCLKCFG16 (*(volatile unsigned long *)0xF3000060) | ||
80 | #define PCLKCFG17 (*(volatile unsigned long *)0xF3000064) | ||
81 | |||
82 | #define PCK_EN (1<<28) | ||
83 | |||
84 | #define CKSEL_PLL0 0 | ||
85 | #define CKSEL_PLL1 1 | ||
86 | #define CKSEL_XIN 4 | ||
87 | |||
88 | /* IRQ Controller */ | ||
89 | |||
90 | #define IEN (*(volatile unsigned long *)0xF3001000) | ||
91 | #define CREQ (*(volatile unsigned long *)0xF3001004) | ||
92 | #define IRQSEL (*(volatile unsigned long *)0xF300100C) | ||
93 | #define MREQ (*(volatile unsigned long *)0xF3001014) | ||
94 | #define MIRQ (*(volatile unsigned long *)0xF3001028) | ||
95 | #define MFIQ (*(volatile unsigned long *)0xF300102C) | ||
96 | #define ALLMASK (*(volatile unsigned long *)0xF3001044) | ||
97 | #define VAIRQ (*(volatile unsigned long *)0xF3001080) | ||
98 | #define VAFIQ (*(volatile unsigned long *)0xF3001084) | ||
99 | #define VNIRQ (*(volatile unsigned long *)0xF3001088) | ||
100 | #define VNFIQ (*(volatile unsigned long *)0xF300108C) | ||
101 | |||
102 | #define TIMER_IRQ_MASK (1<<6) | ||
103 | |||
104 | /* Timer / Counters */ | ||
105 | |||
106 | #define TCFG0 (*(volatile unsigned long *)0xF3003000) | ||
107 | #define TCNT0 (*(volatile unsigned long *)0xF3003004) | ||
108 | #define TREF0 (*(volatile unsigned long *)0xF3003008) | ||
109 | #define TCFG1 (*(volatile unsigned long *)0xF3003010) | ||
110 | #define TCNT1 (*(volatile unsigned long *)0xF3003014) | ||
111 | #define TREF1 (*(volatile unsigned long *)0xF3003018) | ||
112 | |||
113 | #define TIREQ (*(volatile unsigned long *)0xF3003060) | ||
114 | /* ref. value reached */ | ||
115 | #define TF0 (1<<8) | ||
116 | #define TF1 (1<<9) | ||
117 | /* irq. status */ | ||
118 | #define TI0 (1<<0) | ||
119 | #define TI1 (1<<1) | ||
120 | |||
121 | #define TC32EN (*(volatile unsigned long *)0xF3003080) | ||
122 | #define TC32LDV (*(volatile unsigned long *)0xF3003084) | ||
123 | #define TC32MCNT (*(volatile unsigned long *)0xF3003094) | ||
124 | #define TC32IRQ (*(volatile unsigned long *)0xF3003098) | ||
125 | |||
126 | /* ADC */ | ||
127 | |||
128 | #define ADCCON (*(volatile unsigned long *)0xF3004000) | ||
129 | #define ADCDATA (*(volatile unsigned long *)0xF3004004) | ||
130 | #define ADCCONA (*(volatile unsigned long *)0xF3004080) | ||
131 | #define ADCSTATUS (*(volatile unsigned long *)0xF3004084) | ||
132 | #define ADCCFG (*(volatile unsigned long *)0xF3004088) | ||
133 | |||
134 | /* Memory Controller */ | ||
135 | |||
136 | #define SDCFG (*(volatile unsigned long *)0xF1000000) | ||
137 | #define SDFSM (*(volatile unsigned long *)0xF1000004) | ||
138 | #define MCFG (*(volatile unsigned long *)0xF1000008) | ||
139 | #define CSCFG0 (*(volatile unsigned long *)0xF1000010) | ||
140 | #define CSCFG1 (*(volatile unsigned long *)0xF1000014) | ||
141 | #define CSCFG2 (*(volatile unsigned long *)0xF1000018) | ||
142 | #define CSCFG3 (*(volatile unsigned long *)0xF100001C) | ||
143 | #define CLKCFG (*(volatile unsigned long *)0xF1000020) | ||
144 | #define SDCMD (*(volatile unsigned long *)0xF1000024) | ||
145 | |||
146 | #define SDCFG1 (*(volatile unsigned long *)0xF1001000) | ||
147 | #define MCFG1 (*(volatile unsigned long *)0xF1001008) | ||
148 | |||
149 | /* Misc */ | ||
150 | |||
151 | #define ECFG0 (*(volatile unsigned long *)0xF300500C) | ||
152 | #define MBCFG (*(volatile unsigned long *)0xF3005020) | ||
153 | |||
154 | #define TCC780_VER (*(volatile unsigned long *)0xE0001FFC) | ||
155 | |||
156 | #endif | ||
diff --git a/firmware/export/timer.h b/firmware/export/timer.h index f4df8d51d4..21995ef459 100644 --- a/firmware/export/timer.h +++ b/firmware/export/timer.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #define TIMER_FREQ (CPU_FREQ/2) | 31 | #define TIMER_FREQ (CPU_FREQ/2) |
32 | #elif CONFIG_CPU == PNX0101 | 32 | #elif CONFIG_CPU == PNX0101 |
33 | #define TIMER_FREQ 3000000 | 33 | #define TIMER_FREQ 3000000 |
34 | #elif CONFIG_CPU == S3C2440 || CONFIG_CPU == DM320 | 34 | #elif CONFIG_CPU == S3C2440 || CONFIG_CPU == DM320 || CONFIG_CPU == TCC7801 |
35 | #include "timer-target.h" | 35 | #include "timer-target.h" |
36 | #elif defined(SIMULATOR) | 36 | #elif defined(SIMULATOR) |
37 | #define TIMER_FREQ 1000000 | 37 | #define TIMER_FREQ 1000000 |
diff --git a/firmware/export/wm8985.h b/firmware/export/wm8985.h new file mode 100644 index 0000000000..9ae5515fa7 --- /dev/null +++ b/firmware/export/wm8985.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Dave Chapman | ||
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 _WM8985_H | ||
21 | #define _WM8985_H | ||
22 | |||
23 | /* volume/balance/treble/bass interdependency */ | ||
24 | #define VOLUME_MIN -730 | ||
25 | #define VOLUME_MAX 60 | ||
26 | |||
27 | extern int tenthdb2master(int db); | ||
28 | |||
29 | extern void audiohw_enable_output(bool enable); | ||
30 | extern int audiohw_set_master_vol(int vol_l, int vol_r); | ||
31 | extern int audiohw_set_lineout_vol(int vol_l, int vol_r); | ||
32 | extern void audiohw_set_bass(int value); | ||
33 | extern void audiohw_set_treble(int value); | ||
34 | extern void audiohw_set_nsorder(int order); | ||
35 | extern void audiohw_set_sample_rate(int sampling_control); | ||
36 | |||
37 | /* Register addresses */ | ||
38 | // .. tbc | ||
39 | |||
40 | /* Register settings for the supported samplerates: */ | ||
41 | // .. tbc | ||
42 | |||
43 | #endif /* _WM8985_H */ | ||
diff --git a/firmware/target/arm/i2c-telechips.c b/firmware/target/arm/i2c-telechips.c new file mode 100644 index 0000000000..e3e8fd3d33 --- /dev/null +++ b/firmware/target/arm/i2c-telechips.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 | |||
21 | #include "system.h" | ||
22 | #include "i2c.h" | ||
23 | #include "i2c-target.h" | ||
24 | |||
25 | /* arbitrary delay loop */ | ||
26 | #define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0) | ||
27 | |||
28 | static struct mutex i2c_mtx; | ||
29 | |||
30 | void i2c_init(void) | ||
31 | { | ||
32 | /* nothing to do */ | ||
33 | } | ||
34 | |||
35 | void i2c_start(void) | ||
36 | { | ||
37 | SDA_OUTPUT; | ||
38 | |||
39 | SCL_HI; | ||
40 | SDA_HI; | ||
41 | DELAY; | ||
42 | |||
43 | SDA_LO; | ||
44 | DELAY; | ||
45 | SCL_LO; | ||
46 | DELAY; | ||
47 | } | ||
48 | |||
49 | void i2c_stop(void) | ||
50 | { | ||
51 | SDA_OUTPUT; | ||
52 | |||
53 | SDA_LO; | ||
54 | DELAY; | ||
55 | |||
56 | SCL_HI; | ||
57 | DELAY; | ||
58 | SDA_HI; | ||
59 | DELAY; | ||
60 | } | ||
61 | |||
62 | void i2c_outb(unsigned char byte) | ||
63 | { | ||
64 | int bit; | ||
65 | |||
66 | SDA_OUTPUT; | ||
67 | |||
68 | for (bit = 0; bit < 8; bit++) | ||
69 | { | ||
70 | if ((byte<<bit) & 0x80) | ||
71 | SDA_HI; | ||
72 | else | ||
73 | SDA_LO; | ||
74 | |||
75 | DELAY; | ||
76 | |||
77 | SCL_HI; | ||
78 | DELAY; | ||
79 | SCL_LO; | ||
80 | DELAY; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | unsigned char i2c_inb(int ack) | ||
85 | { | ||
86 | int i; | ||
87 | unsigned char byte = 0; | ||
88 | |||
89 | SDA_INPUT; | ||
90 | |||
91 | /* clock in each bit, MSB first */ | ||
92 | for ( i=0x80; i; i>>=1 ) | ||
93 | { | ||
94 | SCL_HI; | ||
95 | DELAY; | ||
96 | |||
97 | if ( SDA ) byte |= i; | ||
98 | |||
99 | SCL_LO; | ||
100 | DELAY; | ||
101 | } | ||
102 | |||
103 | i2c_ack(ack); | ||
104 | return byte; | ||
105 | } | ||
106 | |||
107 | void i2c_ack(int bit) | ||
108 | { | ||
109 | SDA_OUTPUT; | ||
110 | |||
111 | if (bit) | ||
112 | SDA_HI; | ||
113 | else | ||
114 | SDA_LO; | ||
115 | |||
116 | SCL_HI; | ||
117 | DELAY; | ||
118 | SCL_LO; | ||
119 | DELAY; | ||
120 | } | ||
121 | |||
122 | int i2c_getack(void) | ||
123 | { | ||
124 | bool ack_bit; | ||
125 | |||
126 | SDA_INPUT; | ||
127 | |||
128 | SCL_HI; | ||
129 | DELAY; | ||
130 | |||
131 | ack_bit = SDA; | ||
132 | DELAY; | ||
133 | |||
134 | SCL_LO; | ||
135 | DELAY; | ||
136 | |||
137 | return ack_bit; | ||
138 | } | ||
139 | |||
140 | /* device = 8 bit slave address */ | ||
141 | int i2c_write(int device, unsigned char* buf, int count ) | ||
142 | { | ||
143 | int i = 0; | ||
144 | mutex_lock(&i2c_mtx); | ||
145 | |||
146 | i2c_start(); | ||
147 | i2c_outb(device & 0xfe); | ||
148 | |||
149 | while (!i2c_getack() && i < count) | ||
150 | { | ||
151 | i2c_outb(buf[i++]); | ||
152 | } | ||
153 | |||
154 | i2c_stop(); | ||
155 | mutex_unlock(&i2c_mtx); | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | |||
160 | /* device = 8 bit slave address */ | ||
161 | int i2c_readmem(int device, int address, unsigned char* buf, int count ) | ||
162 | { | ||
163 | int i = 0; | ||
164 | mutex_lock(&i2c_mtx); | ||
165 | |||
166 | i2c_start(); | ||
167 | i2c_outb(device & 0xfe); | ||
168 | if (i2c_getack()) goto exit; | ||
169 | |||
170 | i2c_outb(address); | ||
171 | if (i2c_getack()) goto exit; | ||
172 | |||
173 | i2c_start(); | ||
174 | i2c_outb(device | 1); | ||
175 | if (i2c_getack()) goto exit; | ||
176 | |||
177 | while (i < count) | ||
178 | { | ||
179 | buf[i] = i2c_inb(i == (count-1)); | ||
180 | i++; | ||
181 | } | ||
182 | |||
183 | exit: | ||
184 | i2c_stop(); | ||
185 | mutex_unlock(&i2c_mtx); | ||
186 | return 0; | ||
187 | } | ||
diff --git a/firmware/target/arm/tcc780x/adc-tcc780x.c b/firmware/target/arm/tcc780x/adc-tcc780x.c new file mode 100644 index 0000000000..871db2b61d --- /dev/null +++ b/firmware/target/arm/tcc780x/adc-tcc780x.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Dave Chapman | ||
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 "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "string.h" | ||
25 | #include "adc.h" | ||
26 | |||
27 | /* | ||
28 | TODO: We probably want to do this on the timer interrupt once we get | ||
29 | interrupts going - see the sh-adc.c implementation for an example which | ||
30 | looks like it should work well with the TCC77x. | ||
31 | |||
32 | Also, this code is practically identical between 77x & 780x targets. | ||
33 | Should probably find a common location to avoid the duplication. | ||
34 | */ | ||
35 | |||
36 | static unsigned short adcdata[8]; | ||
37 | |||
38 | static void adc_do_read(void) | ||
39 | { | ||
40 | int i; | ||
41 | uint32_t adc_status; | ||
42 | |||
43 | PCLK_ADC |= PCK_EN; /* Enable ADC clock */ | ||
44 | |||
45 | /* Start converting the first 4 channels */ | ||
46 | for (i = 0; i < 4; i++) | ||
47 | ADCCON = i; | ||
48 | |||
49 | /* Wait for data to become stable */ | ||
50 | while ((ADCDATA & 0x1) == 0); | ||
51 | |||
52 | /* Now read the values back */ | ||
53 | for (i=0;i < 4; i++) { | ||
54 | adc_status = ADCSTATUS; | ||
55 | adcdata[(adc_status >> 16) & 0x7] = adc_status & 0x3ff; | ||
56 | } | ||
57 | |||
58 | PCLK_ADC &= ~PCK_EN; /* Disable ADC clock */ | ||
59 | } | ||
60 | |||
61 | unsigned short adc_read(int channel) | ||
62 | { | ||
63 | /* Either move this to an interrupt routine, or only perform the read if | ||
64 | the last call was X length of time ago. */ | ||
65 | adc_do_read(); | ||
66 | |||
67 | return adcdata[channel]; | ||
68 | } | ||
69 | |||
70 | void adc_init(void) | ||
71 | { | ||
72 | /* consider configuring PCK_ADC source here */ | ||
73 | |||
74 | ADCCON = (1<<4); /* Leave standby mode */ | ||
75 | ADCCFG |= 0x00000003; /* Single-mode, auto power-down */ | ||
76 | } | ||
diff --git a/firmware/target/arm/tcc780x/ata-nand-tcc780x.c b/firmware/target/arm/tcc780x/ata-nand-tcc780x.c new file mode 100644 index 0000000000..5aed090d5c --- /dev/null +++ b/firmware/target/arm/tcc780x/ata-nand-tcc780x.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
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 "ata.h" | ||
20 | #include "ata-target.h" | ||
21 | #include "ata_idle_notify.h" | ||
22 | #include "system.h" | ||
23 | #include <string.h> | ||
24 | #include "thread.h" | ||
25 | #include "led.h" | ||
26 | #include "disk.h" | ||
27 | #include "panic.h" | ||
28 | #include "usb.h" | ||
29 | |||
30 | /* for compatibility */ | ||
31 | int ata_spinup_time = 0; | ||
32 | |||
33 | long last_disk_activity = -1; | ||
34 | |||
35 | /** static, private data **/ | ||
36 | static bool initialized = false; | ||
37 | |||
38 | static long next_yield = 0; | ||
39 | #define MIN_YIELD_PERIOD 2000 | ||
40 | |||
41 | /* API Functions */ | ||
42 | |||
43 | void ata_led(bool onoff) | ||
44 | { | ||
45 | led(onoff); | ||
46 | } | ||
47 | |||
48 | int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, | ||
49 | void* inbuf) | ||
50 | { | ||
51 | #warning function not implemented | ||
52 | (void)start; | ||
53 | (void)incount; | ||
54 | (void)inbuf; | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, | ||
59 | const void* outbuf) | ||
60 | { | ||
61 | #warning function not implemented | ||
62 | (void)start; | ||
63 | (void)count; | ||
64 | (void)outbuf; | ||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | void ata_spindown(int seconds) | ||
69 | { | ||
70 | #warning function not implemented | ||
71 | (void)seconds; | ||
72 | } | ||
73 | |||
74 | bool ata_disk_is_active(void) | ||
75 | { | ||
76 | #warning function not implemented | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | void ata_sleep(void) | ||
81 | { | ||
82 | #warning function not implemented | ||
83 | } | ||
84 | |||
85 | void ata_spin(void) | ||
86 | { | ||
87 | #warning function not implemented | ||
88 | } | ||
89 | |||
90 | /* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */ | ||
91 | int ata_hard_reset(void) | ||
92 | { | ||
93 | #warning function not implemented | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | int ata_soft_reset(void) | ||
98 | { | ||
99 | #warning function not implemented | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | void ata_enable(bool on) | ||
104 | { | ||
105 | #warning function not implemented | ||
106 | (void)on; | ||
107 | } | ||
108 | |||
109 | int ata_init(void) | ||
110 | { | ||
111 | #warning function not implemented | ||
112 | return 0; | ||
113 | } | ||
diff --git a/firmware/target/arm/tcc780x/ata-target.h b/firmware/target/arm/tcc780x/ata-target.h new file mode 100644 index 0000000000..79ac638de1 --- /dev/null +++ b/firmware/target/arm/tcc780x/ata-target.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
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 | #ifndef ATA_TARGET_H | ||
20 | #define ATA_TARGET_H | ||
21 | |||
22 | #endif | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/adc-target.h b/firmware/target/arm/tcc780x/cowond2/adc-target.h new file mode 100644 index 0000000000..873183d721 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/adc-target.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
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 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define NUM_ADC_CHANNELS 4 | ||
23 | |||
24 | #define ADC_BUTTONS 0 | ||
25 | |||
26 | #endif /* _ADC_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/backlight-target.h b/firmware/target/arm/tcc780x/cowond2/backlight-target.h new file mode 100644 index 0000000000..0563fc20f5 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/backlight-target.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | #include "tcc780x.h" | ||
23 | |||
24 | #define _backlight_init() true | ||
25 | |||
26 | /* nb: we can set the backlight intensity using PCF50606 register 0x35 */ | ||
27 | |||
28 | static inline void _backlight_on(void) | ||
29 | { | ||
30 | /* Enable backlight */ | ||
31 | GPIOA_SET = (1<<6); | ||
32 | } | ||
33 | |||
34 | static inline void _backlight_off(void) | ||
35 | { | ||
36 | /* Disable backlight */ | ||
37 | GPIOA_CLEAR = (1<<6); | ||
38 | } | ||
39 | |||
40 | #endif | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/button-cowond2.c b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c new file mode 100644 index 0000000000..dccdf4e8e0 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/button-cowond2.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "button.h" | ||
23 | #include "adc.h" | ||
24 | |||
25 | void button_init_device(void) | ||
26 | { | ||
27 | /* Nothing to do */ | ||
28 | } | ||
29 | |||
30 | int button_read_device(void) | ||
31 | { | ||
32 | int btn = BUTTON_NONE; | ||
33 | int adc; | ||
34 | |||
35 | if (GPIOB & 0x4) | ||
36 | { | ||
37 | adc = adc_read(ADC_BUTTONS); | ||
38 | |||
39 | /* The following contains some abitrary, but working, guesswork */ | ||
40 | if (adc < 0x038) { | ||
41 | btn |= (BUTTON_MINUS | BUTTON_PLUS | BUTTON_MENU); | ||
42 | } else if (adc < 0x048) { | ||
43 | btn |= (BUTTON_MINUS | BUTTON_PLUS); | ||
44 | } else if (adc < 0x058) { | ||
45 | btn |= (BUTTON_PLUS | BUTTON_MENU); | ||
46 | } else if (adc < 0x070) { | ||
47 | btn |= BUTTON_PLUS; | ||
48 | } else if (adc < 0x090) { | ||
49 | btn |= (BUTTON_MINUS | BUTTON_MENU); | ||
50 | } else if (adc < 0x150) { | ||
51 | btn |= BUTTON_MINUS; | ||
52 | } else if (adc < 0x200) { | ||
53 | btn |= BUTTON_MENU; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | /* TODO: Read 'fake' buttons based on touchscreen quadrants. | ||
58 | Question: How can I read from the PCF chip (I2C) in a tick task? */ | ||
59 | |||
60 | if (!(GPIOA & 0x8)) | ||
61 | btn |= BUTTON_HOLD; | ||
62 | |||
63 | if (!(GPIOA & 0x4)) | ||
64 | btn |= BUTTON_POWER; | ||
65 | |||
66 | return btn; | ||
67 | } | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/button-target.h b/firmware/target/arm/tcc780x/cowond2/button-target.h new file mode 100644 index 0000000000..aa336f2f1f --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/button-target.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Rob Purchase | ||
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 | void button_init_device(void); | ||
27 | int button_read_device(void); | ||
28 | |||
29 | /* Main unit's buttons */ | ||
30 | #define BUTTON_POWER 0x00000001 | ||
31 | #define BUTTON_HOLD 0x00000002 | ||
32 | #define BUTTON_PLUS 0x00000004 | ||
33 | #define BUTTON_MINUS 0x00000008 | ||
34 | #define BUTTON_MENU 0x00000010 | ||
35 | |||
36 | /* Faked buttons based on touchscreen quadrants (not yet read) */ | ||
37 | #define BUTTON_UP 0x00000020 | ||
38 | #define BUTTON_DOWN 0x00000040 | ||
39 | #define BUTTON_LEFT 0x00000080 | ||
40 | #define BUTTON_RIGHT 0x00000100 | ||
41 | #define BUTTON_SELECT 0x00000200 | ||
42 | |||
43 | #define BUTTON_MAIN 0x3FF | ||
44 | |||
45 | /* No remote */ | ||
46 | #define BUTTON_REMOTE 0 | ||
47 | |||
48 | /* Software power-off */ | ||
49 | #define POWEROFF_BUTTON BUTTON_POWER | ||
50 | #define POWEROFF_COUNT 40 | ||
51 | |||
52 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/i2c-target.h b/firmware/target/arm/tcc780x/cowond2/i2c-target.h new file mode 100644 index 0000000000..8925a9bae3 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/i2c-target.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 | #ifndef I2C_TARGET_H | ||
20 | #define I2C_TARGET_H | ||
21 | |||
22 | /* Definitions for the D2 I2C bus */ | ||
23 | |||
24 | #define SCL_BIT (1<<0) | ||
25 | #define SDA_BIT (1<<1) | ||
26 | |||
27 | #define SCL (GPIOA & SCL_BIT) | ||
28 | #define SCL_HI GPIOA_SET = SCL_BIT | ||
29 | #define SCL_LO GPIOA_CLEAR = SCL_BIT | ||
30 | |||
31 | #define SDA (GPIOA & SDA_BIT) | ||
32 | #define SDA_HI GPIOA_SET = SDA_BIT | ||
33 | #define SDA_LO GPIOA_CLEAR = SDA_BIT | ||
34 | #define SDA_INPUT GPIOA_DIR &= ~SDA_BIT | ||
35 | #define SDA_OUTPUT GPIOA_DIR |= SDA_BIT | ||
36 | |||
37 | #endif /* I2C_TARGET_H */ | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c new file mode 100644 index 0000000000..181c58669e --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c | |||
@@ -0,0 +1,346 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 | |||
21 | #include "hwcompat.h" | ||
22 | #include "kernel.h" | ||
23 | #include "lcd.h" | ||
24 | #include "system.h" | ||
25 | #include "cpu.h" | ||
26 | #include "i2c.h" | ||
27 | |||
28 | /* GPIO A pins for LCD panel SDI interface */ | ||
29 | |||
30 | #define LTV250QV_CS (1<<24) | ||
31 | #define LTV250QV_SCL (1<<25) | ||
32 | #define LTV250QV_SDI (1<<26) | ||
33 | |||
34 | /* LCD Controller registers */ | ||
35 | |||
36 | #define LCDC_CTRL (*(volatile unsigned long *)0xF0000000) | ||
37 | #define LCDC_CLKDIV (*(volatile unsigned long *)0xF0000008) | ||
38 | #define LCDC_HTIME1 (*(volatile unsigned long *)0xF000000C) | ||
39 | #define LCDC_HTIME2 (*(volatile unsigned long *)0xF0000010) | ||
40 | #define LCDC_VTIME1 (*(volatile unsigned long *)0xF0000014) | ||
41 | #define LCDC_VTIME2 (*(volatile unsigned long *)0xF0000018) | ||
42 | #define LCDC_VTIME3 (*(volatile unsigned long *)0xF000001C) | ||
43 | #define LCDC_VTIME4 (*(volatile unsigned long *)0xF0000020) | ||
44 | #define LCDC_DS (*(volatile unsigned long *)0xF000005C) | ||
45 | #define LCDC_I1CTRL (*(volatile unsigned long *)0xF000008C) | ||
46 | #define LCDC_I1POS (*(volatile unsigned long *)0xF0000090) | ||
47 | #define LCDC_I1SIZE (*(volatile unsigned long *)0xF0000094) | ||
48 | #define LCDC_I1BASE (*(volatile unsigned long *)0xF0000098) | ||
49 | #define LCDC_I1OFF (*(volatile unsigned long *)0xF00000A8) | ||
50 | #define LCDC_I1SCALE (*(volatile unsigned long *)0xF00000AC) | ||
51 | |||
52 | /* Power and display status */ | ||
53 | static bool display_on = false; /* Is the display turned on? */ | ||
54 | |||
55 | |||
56 | int lcd_default_contrast(void) | ||
57 | { | ||
58 | return 0x1f; | ||
59 | } | ||
60 | |||
61 | void lcd_set_contrast(int val) | ||
62 | { | ||
63 | /* iirc there is an ltv250qv command to do this */ | ||
64 | #warning function not implemented | ||
65 | (void)val; | ||
66 | } | ||
67 | |||
68 | |||
69 | /* LTV250QV panel functions */ | ||
70 | |||
71 | static void ltv250qv_write(unsigned int command) | ||
72 | { | ||
73 | int i; | ||
74 | |||
75 | GPIOA_CLEAR = LTV250QV_CS; | ||
76 | |||
77 | for (i = 23; i >= 0; i--) | ||
78 | { | ||
79 | GPIOA_CLEAR = LTV250QV_SCL; | ||
80 | |||
81 | if ((command>>i) & 1) | ||
82 | GPIOA_SET = LTV250QV_SDI; | ||
83 | else | ||
84 | GPIOA_CLEAR = LTV250QV_SDI; | ||
85 | |||
86 | GPIOA_SET = LTV250QV_SCL; | ||
87 | } | ||
88 | |||
89 | GPIOA_SET = LTV250QV_CS; | ||
90 | } | ||
91 | |||
92 | static void lcd_write_reg(unsigned char reg, unsigned short val) | ||
93 | { | ||
94 | ltv250qv_write(0x740000 | reg); | ||
95 | ltv250qv_write(0x760000 | val); | ||
96 | } | ||
97 | |||
98 | |||
99 | /* TODO: The existing pcf50606 drivers are target-specific, so the following | ||
100 | lonely function exists until a D2 driver exists. */ | ||
101 | |||
102 | void pcf50606_write_reg(unsigned char reg, unsigned char val) | ||
103 | { | ||
104 | unsigned char data[] = { reg, val }; | ||
105 | i2c_write(0x10, data, 2); | ||
106 | } | ||
107 | |||
108 | |||
109 | /* | ||
110 | TEMP: Rough millisecond delay routine used by the LCD panel init sequence. | ||
111 | PCK_TCT must first have been initialised to 2Mhz by calling clock_init(). | ||
112 | */ | ||
113 | static void sleep_ms(unsigned int ms) | ||
114 | { | ||
115 | /* disable timer */ | ||
116 | TCFG1 = 0; | ||
117 | |||
118 | /* set Timer1 reference value based on 125kHz tick */ | ||
119 | TREF1 = ms * 125; | ||
120 | |||
121 | /* single count, zero the counter, divider = 16 [2^(3+1)], enable */ | ||
122 | TCFG1 = (1<<9) | (1<<8) | (3<<4) | 1; | ||
123 | |||
124 | /* wait until Timer1 ref reached */ | ||
125 | while (!(TIREQ & TF1)) {}; | ||
126 | } | ||
127 | |||
128 | |||
129 | static void lcd_display_on(void) | ||
130 | { | ||
131 | /* power on sequence as per the D2 firmware */ | ||
132 | GPIOA_SET = (1<<16); | ||
133 | |||
134 | sleep_ms(10); | ||
135 | |||
136 | lcd_write_reg(1, 0x1D); | ||
137 | lcd_write_reg(2, 0x0); | ||
138 | lcd_write_reg(3, 0x0); | ||
139 | lcd_write_reg(4, 0x0); | ||
140 | lcd_write_reg(5, 0x40A3); | ||
141 | lcd_write_reg(6, 0x0); | ||
142 | lcd_write_reg(7, 0x0); | ||
143 | lcd_write_reg(8, 0x0); | ||
144 | lcd_write_reg(9, 0x0); | ||
145 | lcd_write_reg(10, 0x0); | ||
146 | lcd_write_reg(16, 0x0); | ||
147 | lcd_write_reg(17, 0x0); | ||
148 | lcd_write_reg(18, 0x0); | ||
149 | lcd_write_reg(19, 0x0); | ||
150 | lcd_write_reg(20, 0x0); | ||
151 | lcd_write_reg(21, 0x0); | ||
152 | lcd_write_reg(22, 0x0); | ||
153 | lcd_write_reg(23, 0x0); | ||
154 | lcd_write_reg(24, 0x0); | ||
155 | lcd_write_reg(25, 0x0); | ||
156 | sleep_ms(10); | ||
157 | |||
158 | lcd_write_reg(9, 0x4055); | ||
159 | lcd_write_reg(10, 0x0); | ||
160 | sleep_ms(40); | ||
161 | |||
162 | lcd_write_reg(10, 0x2000); | ||
163 | sleep_ms(40); | ||
164 | |||
165 | lcd_write_reg(1, 0xC01D); | ||
166 | lcd_write_reg(2, 0x204); | ||
167 | lcd_write_reg(3, 0xE100); | ||
168 | lcd_write_reg(4, 0x1000); | ||
169 | lcd_write_reg(5, 0x5033); | ||
170 | lcd_write_reg(6, 0x4); | ||
171 | lcd_write_reg(7, 0x30); | ||
172 | lcd_write_reg(8, 0x41C); | ||
173 | lcd_write_reg(16, 0x207); | ||
174 | lcd_write_reg(17, 0x702); | ||
175 | lcd_write_reg(18, 0xB05); | ||
176 | lcd_write_reg(19, 0xB05); | ||
177 | lcd_write_reg(20, 0x707); | ||
178 | lcd_write_reg(21, 0x507); | ||
179 | lcd_write_reg(22, 0x103); | ||
180 | lcd_write_reg(23, 0x406); | ||
181 | lcd_write_reg(24, 0x2); | ||
182 | lcd_write_reg(25, 0x0); | ||
183 | sleep_ms(60); | ||
184 | |||
185 | lcd_write_reg(9, 0xA55); | ||
186 | lcd_write_reg(10, 0x111F); | ||
187 | sleep_ms(10); | ||
188 | |||
189 | pcf50606_write_reg(0x35, 0xe9); /* PWMC1 - backlight power (intensity) */ | ||
190 | pcf50606_write_reg(0x38, 0x3); /* GPOC1 - ? */ | ||
191 | |||
192 | /* tell that we're on now */ | ||
193 | display_on = true; | ||
194 | } | ||
195 | |||
196 | static void lcd_display_off(void) | ||
197 | { | ||
198 | /* block drawing operations and changing of first */ | ||
199 | display_on = false; | ||
200 | |||
201 | /* LQV shutdown sequence */ | ||
202 | lcd_write_reg(9, 0x55); | ||
203 | lcd_write_reg(10, 0x1417); | ||
204 | lcd_write_reg(5, 0x4003); | ||
205 | sleep_ms(10); | ||
206 | |||
207 | lcd_write_reg(9, 0x0); | ||
208 | sleep_ms(10); | ||
209 | |||
210 | /* kill power to LCD panel (unconfirmed) */ | ||
211 | GPIOA_CLEAR = (1<<16); | ||
212 | |||
213 | /* also kill the backlight, otherwise LCD fade is visible on screen */ | ||
214 | GPIOA_CLEAR = (1<<6); | ||
215 | } | ||
216 | |||
217 | |||
218 | void lcd_enable(bool on) | ||
219 | { | ||
220 | if (on == display_on) | ||
221 | return; | ||
222 | |||
223 | if (on) | ||
224 | { | ||
225 | lcd_display_on(); /* Turn on display */ | ||
226 | lcd_update(); /* Resync display */ | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | lcd_display_off(); /* Turn off display */ | ||
231 | } | ||
232 | } | ||
233 | |||
234 | bool lcd_enabled(void) | ||
235 | { | ||
236 | return display_on; | ||
237 | } | ||
238 | |||
239 | |||
240 | void lcd_init_device(void) | ||
241 | { | ||
242 | BCLKCTR |= 4; /* enable LCD bus clock */ | ||
243 | |||
244 | /* set PCK_LCD to 108Mhz */ | ||
245 | PCLK_LCD &= ~PCK_EN; | ||
246 | PCLK_LCD = PCK_EN | (CKSEL_PLL1<<24) | 1; /* source = PLL1, divided by 2 */ | ||
247 | |||
248 | /* reset the LCD controller */ | ||
249 | SWRESET |= 4; | ||
250 | SWRESET &= ~4; | ||
251 | |||
252 | /* set port configuration */ | ||
253 | PORTCFG1 &= ~0xC0000000; | ||
254 | PORTCFG1 &= ~0x3FC0; | ||
255 | PORTCFG2 &= ~0x100; | ||
256 | |||
257 | /* set physical display size */ | ||
258 | LCDC_DS = (LCD_HEIGHT<<16) | LCD_WIDTH; | ||
259 | |||
260 | LCDC_HTIME1 = (0x2d<<16) | 0x3bf; | ||
261 | LCDC_HTIME2 = (1<<16) | 1; | ||
262 | LCDC_VTIME1 = LCDC_VTIME3 = (0<<16) | 239; | ||
263 | LCDC_VTIME2 = LCDC_VTIME4 = (1<<16) | 3; | ||
264 | |||
265 | LCDC_I1BASE = (unsigned int)lcd_framebuffer; /* dirty, dirty hack */ | ||
266 | LCDC_I1SIZE = (LCD_HEIGHT<<16) | LCD_WIDTH; /* image 1 size */ | ||
267 | //LCDC_I1POS = (0<<16) | 0; /* position */ | ||
268 | //LCDC_I1OFF = 0; /* address offset */ | ||
269 | //LCDC_I1SCALE = 0; /* scaling */ | ||
270 | LCDC_I1CTRL = 5; /* 565bpp (7 = 888bpp) */ | ||
271 | //LCDC_CTRL &= ~(1<<28); | ||
272 | |||
273 | LCDC_CLKDIV = (LCDC_CLKDIV &~ 0xFF00FF) | (1<<16) | 2; /* and this means? */ | ||
274 | |||
275 | /* set and clear various flags - not investigated yet */ | ||
276 | //LCDC_CTRL &~ 0x090006AA; /* clear bits 1,3,5,7,9,10,24,27 */ | ||
277 | LCDC_CTRL |= 0x02800144; /* set bits 2,6,8,25,23 */ | ||
278 | LCDC_CTRL = (LCDC_CTRL &~ 0xF0000) | 0x20000; | ||
279 | //LCDC_CTRL = (LCDC_CTRL &~ 0x700000) | 0x700000; | ||
280 | |||
281 | /* enable LCD controller */ | ||
282 | LCDC_CTRL |= 1; | ||
283 | } | ||
284 | |||
285 | |||
286 | /*** Update functions ***/ | ||
287 | |||
288 | |||
289 | /* Update the display. | ||
290 | This must be called after all other LCD functions that change the display. */ | ||
291 | void lcd_update(void) ICODE_ATTR; | ||
292 | void lcd_update(void) | ||
293 | { | ||
294 | #warning function not implemented | ||
295 | /* currently lcd_framebuffer is accessed directly by the hardware */ | ||
296 | } | ||
297 | |||
298 | /* Update a fraction of the display. */ | ||
299 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; | ||
300 | void lcd_update_rect(int x, int y, int width, int height) | ||
301 | { | ||
302 | #warning function not implemented | ||
303 | (void)x; | ||
304 | (void)y; | ||
305 | (void)width; | ||
306 | (void)height; | ||
307 | } | ||
308 | |||
309 | void lcd_set_flip(bool yesno) | ||
310 | { | ||
311 | #warning function not implemented | ||
312 | (void)yesno; | ||
313 | } | ||
314 | |||
315 | void lcd_set_invert_display(bool yesno) | ||
316 | { | ||
317 | #warning function not implemented | ||
318 | (void)yesno; | ||
319 | } | ||
320 | |||
321 | void lcd_blit(const fb_data* data, int bx, int y, int bwidth, | ||
322 | int height, int stride) | ||
323 | { | ||
324 | #warning function not implemented | ||
325 | (void)data; | ||
326 | (void)bx; | ||
327 | (void)y; | ||
328 | (void)bwidth; | ||
329 | (void)height; | ||
330 | (void)stride; | ||
331 | } | ||
332 | |||
333 | void lcd_yuv_blit(unsigned char * const src[3], | ||
334 | int src_x, int src_y, int stride, | ||
335 | int x, int y, int width, int height) | ||
336 | { | ||
337 | #warning function not implemented | ||
338 | (void)src; | ||
339 | (void)src_x; | ||
340 | (void)src_y; | ||
341 | (void)stride; | ||
342 | (void)x; | ||
343 | (void)y; | ||
344 | (void)width; | ||
345 | (void)height; | ||
346 | } | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c b/firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c new file mode 100644 index 0000000000..2d50f042d9 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/pcm-cowond2.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Karl Kurbjun | ||
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 "system.h" | ||
20 | #include "kernel.h" | ||
21 | #include "logf.h" | ||
22 | #include "audio.h" | ||
23 | #include "sound.h" | ||
24 | #include "file.h" | ||
25 | |||
26 | void pcm_postinit(void) | ||
27 | { | ||
28 | #warning function not implemented | ||
29 | } | ||
30 | |||
31 | const void * pcm_play_dma_get_peak_buffer(int *count) | ||
32 | { | ||
33 | #warning function not implemented | ||
34 | (void) count; | ||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | void pcm_play_dma_init(void) | ||
39 | { | ||
40 | #warning function not implemented | ||
41 | } | ||
42 | |||
43 | void pcm_apply_settings(void) | ||
44 | { | ||
45 | #warning function not implemented | ||
46 | } | ||
47 | |||
48 | void pcm_set_frequency(unsigned int frequency) | ||
49 | { | ||
50 | #warning function not implemented | ||
51 | (void) frequency; | ||
52 | } | ||
53 | |||
54 | void pcm_play_dma_start(const void *addr, size_t size) | ||
55 | { | ||
56 | #warning function not implemented | ||
57 | (void) addr; | ||
58 | (void) size; | ||
59 | } | ||
60 | |||
61 | void pcm_play_dma_stop(void) | ||
62 | { | ||
63 | #warning function not implemented | ||
64 | } | ||
65 | |||
66 | void pcm_play_lock(void) | ||
67 | { | ||
68 | #warning function not implemented | ||
69 | } | ||
70 | |||
71 | void pcm_play_unlock(void) | ||
72 | { | ||
73 | #warning function not implemented | ||
74 | } | ||
75 | |||
76 | void pcm_play_dma_pause(bool pause) | ||
77 | { | ||
78 | #warning function not implemented | ||
79 | (void) pause; | ||
80 | } | ||
81 | |||
82 | size_t pcm_get_bytes_waiting(void) | ||
83 | { | ||
84 | #warning function not implemented | ||
85 | return 0; | ||
86 | } | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c new file mode 100644 index 0000000000..d8a58570e4 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
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 <stdbool.h> | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | #include "power.h" | ||
25 | |||
26 | #ifndef SIMULATOR | ||
27 | |||
28 | void power_init(void) | ||
29 | { | ||
30 | #warning function not implemented | ||
31 | } | ||
32 | |||
33 | void ide_power_enable(bool on) | ||
34 | { | ||
35 | #warning function not implemented | ||
36 | (void)on; | ||
37 | } | ||
38 | |||
39 | bool ide_powered(void) | ||
40 | { | ||
41 | #warning function not implemented | ||
42 | return true; | ||
43 | } | ||
44 | |||
45 | void power_off(void) | ||
46 | { | ||
47 | #warning function not implemented | ||
48 | } | ||
49 | |||
50 | #else /* SIMULATOR */ | ||
51 | |||
52 | bool charger_inserted(void) | ||
53 | { | ||
54 | return false; | ||
55 | } | ||
56 | |||
57 | void charger_enable(bool on) | ||
58 | { | ||
59 | (void)on; | ||
60 | } | ||
61 | |||
62 | void power_off(void) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | void ide_power_enable(bool on) | ||
67 | { | ||
68 | (void)on; | ||
69 | } | ||
70 | |||
71 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c new file mode 100644 index 0000000000..b3572307e9 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Karl Kurbjun | ||
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 "config.h" | ||
21 | #include "adc.h" | ||
22 | #include "powermgmt.h" | ||
23 | #include "kernel.h" | ||
24 | |||
25 | unsigned short current_voltage = 3910; | ||
26 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
27 | { | ||
28 | 0 | ||
29 | }; | ||
30 | |||
31 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
32 | { | ||
33 | 0 | ||
34 | }; | ||
35 | |||
36 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
37 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
38 | { | ||
39 | { 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320 }, | ||
40 | }; | ||
41 | |||
42 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
43 | const unsigned short percent_to_volt_charge[11] = | ||
44 | { | ||
45 | 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320, | ||
46 | }; | ||
47 | |||
48 | void read_battery_inputs(void) | ||
49 | { | ||
50 | #warning function not implemented | ||
51 | } | ||
52 | |||
53 | /* Returns battery voltage from ADC [millivolts] */ | ||
54 | unsigned int battery_adc_voltage(void) | ||
55 | { | ||
56 | #warning function not implemented | ||
57 | return 0; | ||
58 | } | ||
59 | |||
diff --git a/firmware/target/arm/tcc780x/cowond2/usb-cowond2.c b/firmware/target/arm/tcc780x/cowond2/usb-cowond2.c new file mode 100644 index 0000000000..6ec903b917 --- /dev/null +++ b/firmware/target/arm/tcc780x/cowond2/usb-cowond2.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "system.h" | ||
23 | #include "kernel.h" | ||
24 | #include "ata.h" | ||
25 | |||
26 | /* USB detect is GPIOC 26 active low */ | ||
27 | inline bool usb_detect(void) | ||
28 | { | ||
29 | return (GPIOC & 1<<26)?false:true; | ||
30 | } | ||
31 | |||
32 | void usb_init_device(void) | ||
33 | { | ||
34 | #warning function not implemented | ||
35 | } | ||
36 | |||
37 | void usb_enable(bool on) | ||
38 | { | ||
39 | #warning function not implemented | ||
40 | |||
41 | if (on) | ||
42 | { | ||
43 | |||
44 | } | ||
45 | else | ||
46 | { | ||
47 | |||
48 | } | ||
49 | } | ||
diff --git a/firmware/target/arm/tcc780x/crt0.S b/firmware/target/arm/tcc780x/crt0.S new file mode 100644 index 0000000000..6e092bcd82 --- /dev/null +++ b/firmware/target/arm/tcc780x/crt0.S | |||
@@ -0,0 +1,304 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
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 | /* Arm bootloader and startup code based on startup.s from the iPodLinux loader | ||
21 | * | ||
22 | * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org) | ||
23 | * Copyright (c) 2005, Bernard Leach <leachbj@bouncycastle.org> | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #include "config.h" | ||
28 | #include "cpu.h" | ||
29 | |||
30 | .section .init.text,"ax",%progbits | ||
31 | |||
32 | .global start | ||
33 | |||
34 | /* Telechips firmware files start with a 32-byte header, as part of the code. */ | ||
35 | |||
36 | start: | ||
37 | #ifdef TCCBOOT | ||
38 | /* Add -DTCCBOOT to EXTRA_DEFINES in the bootloader Makefile to | ||
39 | enable building the bootloader to be appended to the end of the | ||
40 | original firmware, dual-booting based on a key-press. | ||
41 | |||
42 | NB: On the D2 TCCBOOT currently only works in USB boot mode (via tcctool) | ||
43 | When flashed to the device, the OF will boot as normal - but holding a | ||
44 | key to boot Rockbox results in a blank screen and crashed player. | ||
45 | |||
46 | The following two values are filled in by mktccboot. | ||
47 | */ | ||
48 | .word 0 /* Saved entrypoint of original firmware*/ | ||
49 | .word 0 /* Location in RAM of the start of our bootloader */ | ||
50 | #else | ||
51 | ldr pc, =start_loc /* jump to the main entry point */ | ||
52 | |||
53 | .word 0xffff0601 /* Unknown magic */ | ||
54 | .word 0x3a726556 /* "Ver:" */ | ||
55 | .word 0x31373030 /* "0071" */ | ||
56 | .word 0 /* First CRC32 */ | ||
57 | .word 0 /* Unknown - always 0 */ | ||
58 | .word 0 /* Second CRC32 */ | ||
59 | .word 0 /* length of firmware file */ | ||
60 | |||
61 | #ifdef COWON_D2 | ||
62 | /* Some original firmwares have 0x40 bytes of zeroes here - we | ||
63 | don't know why, but err on the side of caution and include it | ||
64 | here. */ | ||
65 | .space 0x40 | ||
66 | #endif | ||
67 | #endif | ||
68 | |||
69 | start_loc: | ||
70 | |||
71 | #ifdef BOOTLOADER | ||
72 | #ifdef TCCBOOT | ||
73 | #ifdef COWON_D2 | ||
74 | ldr r0, =0xf005a000 | ||
75 | ldr r0, [r0, #0x40] /* Read GPIO B */ | ||
76 | tst r0, #0x4 | ||
77 | ldreq pc, [pc, #-28] /* Jump to original firmware if keypad not pressed */ | ||
78 | #else | ||
79 | #error No bootup key detection implemented for this target | ||
80 | #endif | ||
81 | |||
82 | /* Copy bootloader to safe area - 0x21000000 (DRAM) */ | ||
83 | /* TODO: Adjust this for other targets - DRAM + DRAMSIZE - 0x100000 */ | ||
84 | ldr r0, [pc, #-28] | ||
85 | mov r1, #0x22000000 | ||
86 | sub r1, r1, #0x100000 | ||
87 | ldr r2, =_dataend | ||
88 | 1: | ||
89 | cmp r2, r1 | ||
90 | ldrhi r3, [r0], #4 | ||
91 | strhi r3, [r1], #4 | ||
92 | bhi 1b | ||
93 | |||
94 | ldr pc, =copied_start /* jump to the relocated start_loc: */ | ||
95 | |||
96 | copied_start: | ||
97 | #endif | ||
98 | #else | ||
99 | /* We don't use interrupts in the bootloader */ | ||
100 | |||
101 | /* Set up stack for IRQ mode */ | ||
102 | mov r0,#0xd2 | ||
103 | msr cpsr, r0 | ||
104 | ldr sp, =irq_stack | ||
105 | /* Set up stack for FIQ mode */ | ||
106 | mov r0,#0xd1 | ||
107 | msr cpsr, r0 | ||
108 | ldr sp, =fiq_stack | ||
109 | |||
110 | /* Let abort and undefined modes use IRQ stack */ | ||
111 | mov r0,#0xd7 | ||
112 | msr cpsr, r0 | ||
113 | ldr sp, =irq_stack | ||
114 | mov r0,#0xdb | ||
115 | msr cpsr, r0 | ||
116 | ldr sp, =irq_stack | ||
117 | #endif | ||
118 | |||
119 | /* Switch to supervisor mode */ | ||
120 | mov r0,#0xd3 | ||
121 | msr cpsr, r0 | ||
122 | ldr sp, =stackend | ||
123 | |||
124 | |||
125 | #if !defined(BOOTLOADER) && !defined(STUB) | ||
126 | |||
127 | /* Copy exception handler code to address 0 */ | ||
128 | ldr r2, =_vectorsstart | ||
129 | ldr r3, =_vectorsend | ||
130 | ldr r4, =_vectorscopy | ||
131 | 1: | ||
132 | cmp r3, r2 | ||
133 | ldrhi r5, [r4], #4 | ||
134 | strhi r5, [r2], #4 | ||
135 | bhi 1b | ||
136 | |||
137 | /* Zero out IBSS */ | ||
138 | ldr r2, =_iedata | ||
139 | ldr r3, =_iend | ||
140 | mov r4, #0 | ||
141 | 1: | ||
142 | cmp r3, r2 | ||
143 | strhi r4, [r2], #4 | ||
144 | bhi 1b | ||
145 | |||
146 | /* Copy the ITCM */ | ||
147 | ldr r2, =_itcmcopy | ||
148 | ldr r3, =_itcmstart | ||
149 | ldr r4, =_itcmend | ||
150 | 1: | ||
151 | cmp r4, r3 | ||
152 | ldrhi r5, [r2], #4 | ||
153 | strhi r5, [r3], #4 | ||
154 | bhi 1b | ||
155 | |||
156 | /* Copy the DTCM */ | ||
157 | ldr r2, =_dtcmcopy | ||
158 | ldr r3, =_dtcmstart | ||
159 | ldr r4, =_dtcmend | ||
160 | 1: | ||
161 | cmp r4, r3 | ||
162 | ldrhi r5, [r2], #4 | ||
163 | strhi r5, [r3], #4 | ||
164 | bhi 1b | ||
165 | #endif /* !BOOTLOADER,!STUB */ | ||
166 | |||
167 | /* Initialise bss section to zero */ | ||
168 | ldr r2, =_edata | ||
169 | ldr r3, =_end | ||
170 | mov r4, #0 | ||
171 | 1: | ||
172 | cmp r3, r2 | ||
173 | strhi r4, [r2], #4 | ||
174 | bhi 1b | ||
175 | |||
176 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
177 | ldr sp, =stackend | ||
178 | mov r3, sp | ||
179 | ldr r2, =stackbegin | ||
180 | ldr r4, =0xdeadbeef | ||
181 | 1: | ||
182 | cmp r3, r2 | ||
183 | strhi r4, [r2], #4 | ||
184 | bhi 1b | ||
185 | |||
186 | /* | ||
187 | Enable cache & TCM regions | ||
188 | TODO: This is just doing what the OF does at present. It needs to be | ||
189 | better understood and moved out to a separate MMU functions package. | ||
190 | */ | ||
191 | ldr r1, =0x1fe0c | ||
192 | mov r0, #0xf7000000 | ||
193 | str r1, [r0] | ||
194 | ldr r1, =0x2801ae24 | ||
195 | str r1, [r0,#4] | ||
196 | ldr r1, =0x13e44 | ||
197 | str r1, [r0,#8] | ||
198 | ldr r1, =0x4001ce60 | ||
199 | str r1, [r0,#0xc] | ||
200 | ldr r1, =0x6001be80 | ||
201 | str r1, [r0,#0x10] | ||
202 | ldr r1, =0x3801aea4 | ||
203 | str r1, [r0,#0x14] | ||
204 | ldr r1, =0x8001eec0 | ||
205 | str r1, [r0,#0x18] | ||
206 | ldr r1, =0x1001aee0 | ||
207 | str r1, [r0,#0x1c] | ||
208 | add r1, r0, #0x8000 /* r1 now = 0xf7008000 */ | ||
209 | ldr r0, =0xa0000011 | ||
210 | ldr r2, =0x5507d | ||
211 | mcr p15, 0, r0,c9,c1 /* data tcm region (enabled; 8kb; 0xa0000000) */ | ||
212 | mov r0, #0xd | ||
213 | mcr p15, 0, r0,c9,c1, 1 /* inst tcm region (enabled, 4kb, 0x00000000) */ | ||
214 | ldr r0, =0x55555555 | ||
215 | mcr p15, 0, r1,c2,c0 /* translation table base register = 0xf7008000 */ | ||
216 | mcr p15, 0, r0,c3,c0 /* domain access d0-d15 = 'client' */ | ||
217 | mov r0, #0 | ||
218 | mcr p15, 0, r0,c7,c5 /* invalidate icache */ | ||
219 | mcr p15, 0, r2,c1,c0 /* enable mmu, i & d caches */ | ||
220 | mcr p15, 0, r0,c7,c6 /* invalidate dcache */ | ||
221 | mcr p15, 0, r1,c8,c7 /* invalidate tlb */ | ||
222 | |||
223 | bl main | ||
224 | /* main() should never return */ | ||
225 | |||
226 | #ifndef BOOTLOADER | ||
227 | |||
228 | /* Exception handlers. Will be copied to address 0 after memory remapping */ | ||
229 | .section .vectors,"aw" | ||
230 | ldr pc, [pc, #24] | ||
231 | ldr pc, [pc, #24] | ||
232 | ldr pc, [pc, #24] | ||
233 | ldr pc, [pc, #24] | ||
234 | ldr pc, [pc, #24] | ||
235 | ldr pc, [pc, #24] | ||
236 | ldr pc, [pc, #24] | ||
237 | ldr pc, [pc, #24] | ||
238 | |||
239 | /* Exception vectors */ | ||
240 | .global vectors | ||
241 | vectors: | ||
242 | .word start | ||
243 | .word undef_instr_handler | ||
244 | .word software_int_handler | ||
245 | .word prefetch_abort_handler | ||
246 | .word data_abort_handler | ||
247 | .word reserved_handler | ||
248 | .word irq_handler | ||
249 | .word fiq_handler | ||
250 | |||
251 | .text | ||
252 | |||
253 | #if !defined(STUB) | ||
254 | .global irq | ||
255 | .global fiq | ||
256 | .global UIE | ||
257 | #endif | ||
258 | |||
259 | /* All illegal exceptions call into UIE with exception address as first | ||
260 | parameter. This is calculated differently depending on which exception | ||
261 | we're in. Second parameter is exception number, used for a string lookup | ||
262 | in UIE. | ||
263 | */ | ||
264 | undef_instr_handler: | ||
265 | mov r0, lr | ||
266 | mov r1, #0 | ||
267 | b UIE | ||
268 | |||
269 | /* We run supervisor mode most of the time, and should never see a software | ||
270 | exception being thrown. Perhaps make it illegal and call UIE? | ||
271 | */ | ||
272 | software_int_handler: | ||
273 | reserved_handler: | ||
274 | movs pc, lr | ||
275 | |||
276 | prefetch_abort_handler: | ||
277 | sub r0, lr, #4 | ||
278 | mov r1, #1 | ||
279 | b UIE | ||
280 | |||
281 | data_abort_handler: | ||
282 | sub r0, lr, #8 | ||
283 | mov r1, #2 | ||
284 | b UIE | ||
285 | |||
286 | #if defined(STUB) | ||
287 | UIE: | ||
288 | b UIE | ||
289 | #endif | ||
290 | |||
291 | /* We don't use interrupts in the bootloader */ | ||
292 | |||
293 | /* Align stacks to cache line boundary */ | ||
294 | .balign 16 | ||
295 | |||
296 | /* 256 words of IRQ stack */ | ||
297 | .space 256*4 | ||
298 | irq_stack: | ||
299 | |||
300 | /* 256 words of FIQ stack */ | ||
301 | .space 256*4 | ||
302 | fiq_stack: | ||
303 | |||
304 | #endif | ||
diff --git a/firmware/target/arm/tcc780x/debug-tcc780x.c b/firmware/target/arm/tcc780x/debug-tcc780x.c new file mode 100644 index 0000000000..cc5716fd88 --- /dev/null +++ b/firmware/target/arm/tcc780x/debug-tcc780x.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Rob Purchase | ||
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 "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "system.h" | ||
23 | #include "string.h" | ||
24 | #include <stdbool.h> | ||
25 | #include "button.h" | ||
26 | #include "lcd.h" | ||
27 | #include "sprintf.h" | ||
28 | #include "font.h" | ||
29 | |||
30 | bool __dbg_ports(void); | ||
31 | bool __dbg_ports(void) | ||
32 | { | ||
33 | return false; | ||
34 | } | ||
35 | |||
36 | //extern char r_buffer[5]; | ||
37 | //extern int r_button; | ||
38 | |||
39 | bool __dbg_hw_info(void); | ||
40 | bool __dbg_hw_info(void) | ||
41 | { | ||
42 | int line = 0, button, oldline; | ||
43 | int *address=0x0; | ||
44 | bool done=false; | ||
45 | char buf[100]; | ||
46 | |||
47 | lcd_setmargins(0, 0); | ||
48 | lcd_setfont(FONT_SYSFIXED); | ||
49 | lcd_clear_display(); | ||
50 | |||
51 | /* Put all the static text before the while loop */ | ||
52 | lcd_puts(0, line++, "[Hardware info]"); | ||
53 | |||
54 | /* TODO: ... */ | ||
55 | |||
56 | line++; | ||
57 | oldline=line; | ||
58 | while(!done) | ||
59 | { | ||
60 | line = oldline; | ||
61 | button = button_get(false); | ||
62 | |||
63 | button &= ~BUTTON_REPEAT; | ||
64 | |||
65 | if (button == BUTTON_MENU) | ||
66 | done=true; | ||
67 | if(button==BUTTON_DOWN) | ||
68 | address+=0x01; | ||
69 | else if (button==BUTTON_UP) | ||
70 | address-=0x01; | ||
71 | |||
72 | /*snprintf(buf, sizeof(buf), "Buffer: 0x%02x%02x%02x%02x%02x", | ||
73 | r_buffer[0], r_buffer[1], r_buffer[2], r_buffer[3],r_buffer[4] ); lcd_puts(0, line++, buf); | ||
74 | snprintf(buf, sizeof(buf), "Button: 0x%08x, HWread: 0x%08x", | ||
75 | (unsigned int)button, r_button); lcd_puts(0, line++, buf);*/ | ||
76 | snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", | ||
77 | (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); | ||
78 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", | ||
79 | (unsigned int)address, *address); lcd_puts(0, line++, buf); | ||
80 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", | ||
81 | (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); | ||
82 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", | ||
83 | (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); | ||
84 | |||
85 | lcd_update(); | ||
86 | } | ||
87 | return false; | ||
88 | } | ||
diff --git a/firmware/target/arm/tcc780x/kernel-tcc780x.c b/firmware/target/arm/tcc780x/kernel-tcc780x.c new file mode 100644 index 0000000000..e0d9c3342e --- /dev/null +++ b/firmware/target/arm/tcc780x/kernel-tcc780x.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 "config.h" | ||
21 | #include "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "timer.h" | ||
24 | #include "thread.h" | ||
25 | |||
26 | /* NB: PCK_TCT must previously have been set to 2Mhz by calling clock_init() */ | ||
27 | void tick_start(unsigned int interval_in_ms) | ||
28 | { | ||
29 | /* disable Timer0 */ | ||
30 | TCFG0 &= ~1; | ||
31 | |||
32 | /* set counter reference value based on 1Mhz tick */ | ||
33 | TREF0 = interval_in_ms * 1000; | ||
34 | |||
35 | /* Timer0 = reset to 0, divide=2, IRQ enable, enable (continuous) */ | ||
36 | TCFG0 = (1<<8) | (0<<4) | (1<<3) | 1; | ||
37 | |||
38 | /* Unmask timer IRQ */ | ||
39 | MIRQ &= ~TIMER_IRQ_MASK; | ||
40 | } | ||
41 | |||
42 | /* NB: Since the 7801 has a single timer IRQ, the tick tasks are dispatched | ||
43 | as part of the central timer IRQ processing in timer-tcc780x.c */ | ||
diff --git a/firmware/target/arm/tcc780x/system-target.h b/firmware/target/arm/tcc780x/system-target.h new file mode 100644 index 0000000000..15508bc8bf --- /dev/null +++ b/firmware/target/arm/tcc780x/system-target.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Dave Chapman | ||
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 | #ifndef SYSTEM_TARGET_H | ||
20 | #define SYSTEM_TARGET_H | ||
21 | |||
22 | #include "system-arm.h" | ||
23 | |||
24 | #define CPUFREQ_DEFAULT 98784000 | ||
25 | #define CPUFREQ_NORMAL 98784000 | ||
26 | #define CPUFREQ_MAX 192000000 | ||
27 | |||
28 | #define inl(a) (*(volatile unsigned long *) (a)) | ||
29 | #define outl(a,b) (*(volatile unsigned long *) (b) = (a)) | ||
30 | #define inb(a) (*(volatile unsigned char *) (a)) | ||
31 | #define outb(a,b) (*(volatile unsigned char *) (b) = (a)) | ||
32 | #define inw(a) (*(volatile unsigned short *) (a)) | ||
33 | #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) | ||
34 | |||
35 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/tcc780x/system-tcc780x.c b/firmware/target/arm/tcc780x/system-tcc780x.c new file mode 100644 index 0000000000..30221d180e --- /dev/null +++ b/firmware/target/arm/tcc780x/system-tcc780x.c | |||
@@ -0,0 +1,275 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Rob Purchase | ||
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 "kernel.h" | ||
21 | #include "system.h" | ||
22 | #include "panic.h" | ||
23 | |||
24 | #if !defined(BOOTLOADER) | ||
25 | |||
26 | #define default_interrupt(name) \ | ||
27 | extern __attribute__((weak,alias("UIRQ"))) void name (void) | ||
28 | |||
29 | void irq_handler(void) __attribute__((interrupt ("IRQ"), naked)); | ||
30 | void fiq_handler(void) __attribute__((interrupt ("FIQ"), naked)); | ||
31 | |||
32 | default_interrupt(EXT0); | ||
33 | default_interrupt(EXT1); | ||
34 | default_interrupt(EXT2); | ||
35 | default_interrupt(EXT3); | ||
36 | default_interrupt(IRQ4); | ||
37 | default_interrupt(IRQ5); | ||
38 | default_interrupt(TIMER); | ||
39 | default_interrupt(IRQ7); | ||
40 | default_interrupt(IRQ8); | ||
41 | default_interrupt(IRQ9); | ||
42 | default_interrupt(IRQ10); | ||
43 | default_interrupt(IRQ11); | ||
44 | default_interrupt(IRQ12); | ||
45 | default_interrupt(IRQ13); | ||
46 | default_interrupt(DAI_RX); | ||
47 | default_interrupt(DAI_TX); | ||
48 | default_interrupt(IRQ16); | ||
49 | default_interrupt(IRQ17); | ||
50 | default_interrupt(IRQ18); | ||
51 | default_interrupt(IRQ19); | ||
52 | default_interrupt(IRQ20); | ||
53 | default_interrupt(IRQ21); | ||
54 | default_interrupt(IRQ22); | ||
55 | default_interrupt(IRQ23); | ||
56 | default_interrupt(IRQ24); | ||
57 | default_interrupt(IRQ25); | ||
58 | default_interrupt(IRQ26); | ||
59 | default_interrupt(IRQ27); | ||
60 | default_interrupt(IRQ28); | ||
61 | default_interrupt(IRQ29); | ||
62 | default_interrupt(IRQ30); | ||
63 | default_interrupt(IRQ31); | ||
64 | |||
65 | static void (* const irqvector[])(void) = | ||
66 | { | ||
67 | EXT0,EXT1,EXT2,EXT3,IRQ4,IRQ5,TIMER,IRQ7, | ||
68 | IRQ8,IRQ9,IRQ10,IRQ11,IRQ12,IRQ13,DAI_RX,DAI_TX, | ||
69 | IRQ16,IRQ17,IRQ18,IRQ19,IRQ20,IRQ21,IRQ22,IRQ23, | ||
70 | IRQ24,IRQ25,IRQ26,IRQ27,IRQ28,IRQ29,IRQ30,IRQ31 | ||
71 | }; | ||
72 | |||
73 | static const char * const irqname[] = | ||
74 | { | ||
75 | "EXT0","EXT1","EXT2","EXT3","IRQ4","IRQ5","TIMER","IRQ7", | ||
76 | "IRQ8","IRQ9","IRQ10","IRQ11","IRQ12","IRQ13","DAI_RX","DAI_TX", | ||
77 | "IRQ16","IRQ17","IRQ18","IRQ19","IRQ20","IRQ21","IRQ22","IRQ23", | ||
78 | "IRQ24","IRQ25","IRQ26","IRQ27","IRQ28","IRQ29","IRQ30","IRQ31" | ||
79 | }; | ||
80 | |||
81 | static void UIRQ(void) | ||
82 | { | ||
83 | unsigned int offset = VNIRQ; | ||
84 | panicf("Unhandled IRQ %02X: %s", offset, irqname[offset]); | ||
85 | } | ||
86 | |||
87 | void irq_handler(void) | ||
88 | { | ||
89 | /* | ||
90 | * Based on: linux/arch/arm/kernel/entry-armv.S and system-meg-fx.c | ||
91 | */ | ||
92 | |||
93 | asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */ | ||
94 | "sub sp, sp, #8 \n"); /* Reserve stack */ | ||
95 | irqvector[VNIRQ](); | ||
96 | asm volatile( "add sp, sp, #8 \n" /* Cleanup stack */ | ||
97 | "ldmfd sp!, {r0-r7, ip, lr} \n" /* Restore context */ | ||
98 | "subs pc, lr, #4 \n"); /* Return from FIQ */ | ||
99 | } | ||
100 | |||
101 | void fiq_handler(void) | ||
102 | { | ||
103 | asm volatile ( | ||
104 | "sub lr, lr, #4 \r\n" | ||
105 | "movs lr,pc \r\n" | ||
106 | ); | ||
107 | } | ||
108 | #endif /* !defined(BOOTLOADER) */ | ||
109 | |||
110 | |||
111 | /* TODO: | ||
112 | a) this is not the place for this function | ||
113 | b) it currently ignores the supplied frequency and uses default values | ||
114 | c) if the PLL being set drives any PCKs, an appropriate new clock divider | ||
115 | will have to be re-calculated for those PCKs (the OF maintains a list of | ||
116 | PCK frequencies for this purpose). | ||
117 | */ | ||
118 | void set_pll_frequency(unsigned int pll_number, unsigned int frequency) | ||
119 | { | ||
120 | int i = 0; | ||
121 | |||
122 | if (pll_number > 1) return; | ||
123 | |||
124 | /* The frequency parameter is currently ignored and temporary values are | ||
125 | used (PLL0=192Mhz, PLL1=216Mhz). The D2 firmware uses a lookup table | ||
126 | to derive the values of PLLxCFG from a the supplied frequency. | ||
127 | Presumably we will need to do something similar. */ | ||
128 | if (pll_number == 0) | ||
129 | { | ||
130 | /* drive CPU off Xin while switching */ | ||
131 | CLKCTRL = 0xB00FF014; /* Xin enable, Fsys driven by Xin, Fbus = Fsys, | ||
132 | MCPU=Fbus, SCPU=Fbus */ | ||
133 | |||
134 | asm volatile ( | ||
135 | "nop \n\t" | ||
136 | "nop \n\t" | ||
137 | ); | ||
138 | |||
139 | PLL0CFG |= (1<<31); /* power down */ | ||
140 | CLKDIVC = CLKDIVC &~ (0xff << 24); /* disable PLL0 divider */ | ||
141 | PLL0CFG = 0x80019808; /* set for 192Mhz (with power down) */ | ||
142 | PLL0CFG = PLL0CFG &~ (1<<31); /* power up */ | ||
143 | |||
144 | CLKCTRL = (CLKCTRL & ~0x1f) | 0x800FF010; | ||
145 | |||
146 | asm volatile ( | ||
147 | "nop \n\t" | ||
148 | "nop \n\t" | ||
149 | ); | ||
150 | } | ||
151 | else if (pll_number == 1) | ||
152 | { | ||
153 | PLL1CFG |= (1<<31); /* power down */ | ||
154 | CLKDIVC = CLKDIVC &~ (0xff << 16); /* disable PLL1 divider */ | ||
155 | PLL1CFG = 0x80002503; /* set for 216Mhz (with power down)*/ | ||
156 | PLL1CFG = PLL1CFG &~ (1<<31); /* power up */ | ||
157 | } | ||
158 | |||
159 | i = 0x1000; | ||
160 | while (--i) {}; | ||
161 | } | ||
162 | |||
163 | |||
164 | /* TODO - these should live in the target-specific directories and | ||
165 | once we understand what all the GPIO pins do, move the init to the | ||
166 | specific driver for that hardware. For now, we just perform the | ||
167 | same GPIO init as the original firmware - this makes it easier to | ||
168 | investigate what the GPIO pins do. | ||
169 | */ | ||
170 | |||
171 | #ifdef COWON_D2 | ||
172 | static void gpio_init(void) | ||
173 | { | ||
174 | /* Do what the original firmware does */ | ||
175 | GPIOA = 0x07000C83; | ||
176 | GPIOA_DIR = 0x0F010CE3; | ||
177 | GPIOB = 0; | ||
178 | GPIOB_DIR = 0x00080000; | ||
179 | GPIOC = 0x39000000; | ||
180 | GPIOC_DIR = 0xB9000000; | ||
181 | GPIOD = 0; | ||
182 | GPIOD_DIR = 0; | ||
183 | GPIOD = 0; | ||
184 | GPIOD_DIR = 0x00480000; | ||
185 | |||
186 | PORTCFG0 = 0x00034540; | ||
187 | PORTCFG1 = 0x0566A000; | ||
188 | PORTCFG2 = 0x000004C0; | ||
189 | PORTCFG3 = 0x0AA40455; | ||
190 | } | ||
191 | #endif | ||
192 | |||
193 | |||
194 | /* Second function called in the original firmware's startup code - we just | ||
195 | set up the clocks in the same way as the original firmware for now. */ | ||
196 | #ifdef COWON_D2 | ||
197 | static void clock_init(void) | ||
198 | { | ||
199 | int i; | ||
200 | |||
201 | CSCFG3 = (CSCFG3 &~ 0x3fff) | 0x841; | ||
202 | CLKCTRL = (CLKCTRL & ~0xff) | 0x14; | ||
203 | |||
204 | PCLK_RFREQ = 0x1401002d; /* RAM refresh source = Xin (4) / 0x2d = 266kHz */ | ||
205 | |||
206 | MCFG |= 1; | ||
207 | SDCFG = (SDCFG &~ 0x7000) | 0x2000; | ||
208 | |||
209 | MCFG1 |= 1; | ||
210 | SDCFG1 = (SDCFG &~ 0x7000) | 0x2000; | ||
211 | |||
212 | PLL0CFG |= 0x80000000; /* power down */ | ||
213 | PLL0CFG = 0x14010000; /* power up, source = Xin (4) undivided = 12Mhz */ | ||
214 | |||
215 | i = 0x8000; | ||
216 | while (--i) {}; | ||
217 | |||
218 | CLKCTRL = (CLKCTRL &~ 0x1f) | 0x800FF010; /* CPU and COP driven by PLL0 */ | ||
219 | |||
220 | asm volatile ( | ||
221 | "nop \n\t" | ||
222 | "nop \n\t" | ||
223 | ); | ||
224 | |||
225 | /* configure PCK_TCT to 2Mhz (clock source 4 (Xin) divided by 6) */ | ||
226 | PCLK_TCT = PCK_EN | (CKSEL_XIN<<24) | 5; | ||
227 | } | ||
228 | #endif | ||
229 | |||
230 | |||
231 | #ifdef COWON_D2 | ||
232 | void system_init(void) | ||
233 | { | ||
234 | MBCFG = 0x19; | ||
235 | |||
236 | if (TCC780_VER == 0) | ||
237 | ECFG0 = 0x309; | ||
238 | else | ||
239 | ECFG0 = 0x30d; | ||
240 | |||
241 | /* mask all interrupts */ | ||
242 | MIRQ = -1; | ||
243 | |||
244 | gpio_init(); | ||
245 | clock_init(); | ||
246 | |||
247 | /* TODO: these almost certainly shouldn't be here */ | ||
248 | set_pll_frequency(0, 192000000); /* drives CPU */ | ||
249 | set_pll_frequency(1, 216000000); /* drives LCD PXCLK - divided by 2 */ | ||
250 | } | ||
251 | #endif | ||
252 | |||
253 | |||
254 | void system_reboot(void) | ||
255 | { | ||
256 | #warning function not implemented | ||
257 | } | ||
258 | |||
259 | int system_memory_guard(int newmode) | ||
260 | { | ||
261 | #warning function not implemented | ||
262 | |||
263 | (void)newmode; | ||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
268 | |||
269 | void set_cpu_frequency(long frequency) | ||
270 | { | ||
271 | #warning function not implemented | ||
272 | (void)frequency; | ||
273 | } | ||
274 | |||
275 | #endif | ||
diff --git a/firmware/target/arm/tcc780x/timer-target.h b/firmware/target/arm/tcc780x/timer-target.h new file mode 100644 index 0000000000..db25df7cd4 --- /dev/null +++ b/firmware/target/arm/tcc780x/timer-target.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Karl Kurbjun | ||
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 | #ifndef TIMER_TARGET_H | ||
20 | #define TIMER_TARGET_H | ||
21 | |||
22 | /* timers are based on XIN (12Mhz) */ | ||
23 | #define TIMER_FREQ (12000000) | ||
24 | |||
25 | bool __timer_set(long cycles, bool set); | ||
26 | bool __timer_register(void); | ||
27 | void __timer_unregister(void); | ||
28 | |||
29 | #define __TIMER_SET(cycles, set) \ | ||
30 | __timer_set(cycles, set) | ||
31 | |||
32 | #define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \ | ||
33 | int_prio, timer_callback) \ | ||
34 | __timer_register() | ||
35 | |||
36 | #define __TIMER_UNREGISTER(...) \ | ||
37 | __timer_unregister() | ||
38 | |||
39 | #endif /* TIMER_TARGET_H */ | ||
diff --git a/firmware/target/arm/tcc780x/timer-tcc780x.c b/firmware/target/arm/tcc780x/timer-tcc780x.c new file mode 100644 index 0000000000..c724c4b3a8 --- /dev/null +++ b/firmware/target/arm/tcc780x/timer-tcc780x.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Rob Purchase | ||
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 "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include "system.h" | ||
23 | #include "timer.h" | ||
24 | #include "logf.h" | ||
25 | |||
26 | /* Use the TC32 counter [sourced by Xin:12Mhz] for this timer, as it's the | ||
27 | only one that allows a 32-bit counter (Timer0-5 are 16/20 bit only). */ | ||
28 | |||
29 | bool __timer_set(long cycles, bool start) | ||
30 | { | ||
31 | #warning function not implemented | ||
32 | |||
33 | (void)cycles; | ||
34 | (void)start; | ||
35 | return false; | ||
36 | } | ||
37 | |||
38 | bool __timer_register(void) | ||
39 | { | ||
40 | #warning function not implemented | ||
41 | |||
42 | return false; | ||
43 | } | ||
44 | |||
45 | void __timer_unregister(void) | ||
46 | { | ||
47 | #warning function not implemented | ||
48 | } | ||
49 | |||
50 | |||
51 | /* Timer interrupt processing - all timers (inc. tick) have a single IRQ */ | ||
52 | |||
53 | extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); | ||
54 | |||
55 | void TIMER(void) | ||
56 | { | ||
57 | if (TIREQ & TF0) /* Timer0 reached ref value */ | ||
58 | { | ||
59 | int i; | ||
60 | |||
61 | /* Run through the list of tick tasks */ | ||
62 | for(i = 0; i < MAX_NUM_TICK_TASKS; i++) | ||
63 | { | ||
64 | if(tick_funcs[i]) | ||
65 | { | ||
66 | tick_funcs[i](); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | current_tick++; | ||
71 | |||
72 | /* reset Timer 0 IRQ & ref flags */ | ||
73 | TIREQ |= TI0 | TF0; | ||
74 | } | ||
75 | |||
76 | if (TC32IRQ & (1<<3)) /* end of TC32 prescale */ | ||
77 | { | ||
78 | /* dispatch timer */ | ||
79 | } | ||
80 | |||
81 | CREQ |= TIMER_IRQ_MASK; /* clear IRQ */ | ||
82 | } | ||
diff --git a/firmware/target/arm/wmcodec-telechips.c b/firmware/target/arm/wmcodec-telechips.c new file mode 100644 index 0000000000..851158ca8d --- /dev/null +++ b/firmware/target/arm/wmcodec-telechips.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * TCC specific code for Wolfson audio codecs | ||
11 | * | ||
12 | * Based on code from the ipodlinux project - http://ipodlinux.org/ | ||
13 | * Adapted for Rockbox in December 2005 | ||
14 | * | ||
15 | * Original file: linux/arch/armnommu/mach-ipod/audio.c | ||
16 | * | ||
17 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) | ||
18 | * | ||
19 | * All files in this archive are subject to the GNU General Public License. | ||
20 | * See the file COPYING in the source tree root for full license agreement. | ||
21 | * | ||
22 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
23 | * KIND, either express or implied. | ||
24 | * | ||
25 | ****************************************************************************/ | ||
26 | |||
27 | #include "system.h" | ||
28 | #include "audiohw.h" | ||
29 | #include "i2c.h" | ||
30 | |||
31 | #if defined(COWON_D2) | ||
32 | /* The D2's audio codec uses an I2C address of 0x34 */ | ||
33 | #define I2C_AUDIO_ADDRESS 0x34 | ||
34 | #else | ||
35 | #error wmcodec not implemented for this target! | ||
36 | #endif | ||
37 | |||
38 | |||
39 | void audiohw_init(void) | ||
40 | { | ||
41 | #warning function not implemented | ||
42 | } | ||
43 | |||
44 | void wmcodec_write(int reg, int data) | ||
45 | { | ||
46 | unsigned char d[2]; | ||
47 | d[0] = (reg << 1) | ((data & 0x100) >> 8); | ||
48 | d[1] = data; | ||
49 | |||
50 | i2c_write(I2C_AUDIO_ADDRESS, d, 2); | ||
51 | } | ||
diff --git a/tools/configure b/tools/configure index 4d654f35af..2ece6cd3ff 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -600,6 +600,7 @@ cat <<EOF | |||
600 | 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 | 600 | 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 |
601 | 31) M5/M5L 41) Gigabeat S 51) Sansa e200R | 601 | 31) M5/M5L 41) Gigabeat S 51) Sansa e200R |
602 | 32) 7 52) Sansa c200 | 602 | 32) 7 52) Sansa c200 |
603 | 33) Cowon D2 | ||
603 | 604 | ||
604 | ==Tatung== ==Olympus== ==Logik== | 605 | ==Tatung== ==Olympus== ==Logik== |
605 | 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB | 606 | 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB |
@@ -1479,6 +1480,31 @@ EOF | |||
1479 | t_manufacturer="tcc77x" | 1480 | t_manufacturer="tcc77x" |
1480 | t_model="iaudio7" | 1481 | t_model="iaudio7" |
1481 | ;; | 1482 | ;; |
1483 | |||
1484 | 33|cowond2) | ||
1485 | target_id=34 | ||
1486 | archos="cowond2" | ||
1487 | target="-DCOWON_D2" | ||
1488 | memory=32 | ||
1489 | arm926ejscc | ||
1490 | tool="cp " | ||
1491 | boottool="$rootdir/tools/scramble -tcc=crc" | ||
1492 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | ||
1493 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" | ||
1494 | bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" | ||
1495 | bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" | ||
1496 | output="rockbox.iaudio" | ||
1497 | appextra="recorder:gui" | ||
1498 | archosrom="" | ||
1499 | flash="" | ||
1500 | plugins="no" | ||
1501 | swcodec="yes" | ||
1502 | toolset="$tccbitmaptools" | ||
1503 | # architecture, manufacturer and model for the target-tree build | ||
1504 | t_cpu="arm" | ||
1505 | t_manufacturer="tcc780x" | ||
1506 | t_model="cowond2" | ||
1507 | ;; | ||
1482 | 1508 | ||
1483 | *) | 1509 | *) |
1484 | echo "Please select a supported target platform!" | 1510 | echo "Please select a supported target platform!" |