diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:28:09 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-10-22 00:34:44 +0200 |
commit | d3bc64833c76adca4d6300e5b5880ee8ea63de02 (patch) | |
tree | 621978b661c875364c878ba31a9cfed61cf55015 | |
parent | 9ed980785429db35f51f8d324cc75c23f2e5fb20 (diff) | |
download | rockbox-d3bc64833c76adca4d6300e5b5880ee8ea63de02.tar.gz rockbox-d3bc64833c76adca4d6300e5b5880ee8ea63de02.zip |
Initial commit for the Creative ZEN Mozaic
Change-Id: Ib65aad9f5de37e514047955cad7ca40dc0af4f74
21 files changed, 1214 insertions, 0 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index f050fd1e83..8fa1a7ed40 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -287,6 +287,8 @@ keymaps/keymap-hm801.c | |||
287 | keymaps/keymap-sansa-connect.c | 287 | keymaps/keymap-sansa-connect.c |
288 | #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD | 288 | #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD |
289 | keymaps/keymap-ypr0.c | 289 | keymaps/keymap-ypr0.c |
290 | #elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD | ||
291 | keymaps/keymap-zen.c | ||
290 | #elif CONFIG_KEYPAD == MA_PAD | 292 | #elif CONFIG_KEYPAD == MA_PAD |
291 | keymaps/keymap-ma.c | 293 | keymaps/keymap-ma.c |
292 | #elif CONFIG_KEYPAD == SONY_NWZ_PAD | 294 | #elif CONFIG_KEYPAD == SONY_NWZ_PAD |
diff --git a/apps/keymaps/keymap-zen.c b/apps/keymaps/keymap-zen.c new file mode 100644 index 0000000000..dda12959d8 --- /dev/null +++ b/apps/keymaps/keymap-zen.c | |||
@@ -0,0 +1,448 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright © Amaury Pouly 2013 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "action.h" | ||
24 | #include "button.h" | ||
25 | #include "settings.h" | ||
26 | |||
27 | /** This keymap is shared by the ZEN targets with some variants. All ZEN targets | ||
28 | * shared a core set of buttons: left, right, up, down, select, back, play/pause | ||
29 | * and they all have a hold button. Two extra groups of button may exist: | ||
30 | * (ctl) menu, shortcut | ||
31 | * (dir) top left, top right, bottom left, bottom left | ||
32 | * (vol) vol up, vol down | ||
33 | * Here is the list of ZEN targets are the groups: | ||
34 | * target core ctl dir vol | ||
35 | * V (Plus) 1 0 0 1 | ||
36 | * Mozaic 1 1 0 0 | ||
37 | * ZEN 1 1 0 0 | ||
38 | * X-Fi 1 1 1 0 */ | ||
39 | |||
40 | /* {Action Code, Button code, Prereq button code } */ | ||
41 | |||
42 | #ifdef BUTTON_VOL_UP | ||
43 | #define ZEN_HAS_VOL | ||
44 | #endif | ||
45 | |||
46 | #ifdef BUTTON_BOTTOMLEFT | ||
47 | #define ZEN_HAS_DIRECTIONAL | ||
48 | #endif | ||
49 | |||
50 | #ifdef BUTTON_MENU | ||
51 | #define ZEN_HAS_CONTROL | ||
52 | #endif | ||
53 | |||
54 | /* | ||
55 | * The format of the list is as follows | ||
56 | * { Action Code, Button code, Prereq button code } | ||
57 | * if there's no need to check the previous button's value, use BUTTON_NONE | ||
58 | * Insert LAST_ITEM_IN_LIST at the end of each mapping | ||
59 | */ | ||
60 | static const struct button_mapping button_context_standard[] = { | ||
61 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
62 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
63 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
64 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
65 | |||
66 | { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
67 | { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, | ||
68 | |||
69 | { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, | ||
70 | { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
71 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
72 | { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
73 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
74 | { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
75 | |||
76 | LAST_ITEM_IN_LIST | ||
77 | }; /* button_context_standard */ | ||
78 | |||
79 | static const struct button_mapping button_context_wps[] = { | ||
80 | { ACTION_WPS_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
81 | { ACTION_WPS_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, | ||
82 | |||
83 | { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, | ||
84 | |||
85 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
86 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
87 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
88 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
89 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, | ||
90 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, | ||
91 | |||
92 | #ifdef ZEN_HAS_VOL | ||
93 | { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
94 | { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
95 | #endif | ||
96 | { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, | ||
97 | { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
98 | |||
99 | #ifdef ZEN_HAS_VOL | ||
100 | { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
101 | { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
102 | #endif | ||
103 | { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
104 | { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
105 | |||
106 | { ACTION_WPS_MENU, BUTTON_BACK, BUTTON_NONE }, | ||
107 | { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
108 | |||
109 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
110 | }; /* button_context_wps */ | ||
111 | |||
112 | static const struct button_mapping button_context_keyboard[] = { | ||
113 | { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
114 | { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
115 | { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
116 | { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
117 | { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, | ||
118 | { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
119 | { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
120 | { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
121 | |||
122 | { ACTION_KBD_BACKSPACE, BUTTON_BACK, BUTTON_NONE }, | ||
123 | { ACTION_KBD_BACKSPACE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
124 | |||
125 | { ACTION_KBD_SELECT, BUTTON_PLAYPAUSE, BUTTON_NONE }, | ||
126 | { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
127 | { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE }, | ||
128 | |||
129 | #ifdef ZEN_HAS_VOL | ||
130 | { ACTION_KBD_MORSE_INPUT, BUTTON_VOL_UP, BUTTON_NONE }, | ||
131 | { ACTION_KBD_MORSE_SELECT, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_NONE }, | ||
132 | #endif | ||
133 | |||
134 | LAST_ITEM_IN_LIST | ||
135 | }; /* button_context_keyboard */ | ||
136 | |||
137 | static const struct button_mapping button_context_quickscreen[] = { | ||
138 | { ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE }, | ||
139 | { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, | ||
140 | { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE }, | ||
141 | { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE }, | ||
142 | { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
143 | { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
144 | { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
145 | |||
146 | LAST_ITEM_IN_LIST | ||
147 | }; /* button_context_quickscreen */ | ||
148 | |||
149 | static const struct button_mapping button_context_tree[] = { | ||
150 | { ACTION_TREE_WPS, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
151 | { ACTION_TREE_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, | ||
152 | |||
153 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
154 | }; /* button_context_tree */ | ||
155 | |||
156 | static const struct button_mapping button_context_list[] = { | ||
157 | #ifdef HAVE_VOLUME_IN_LIST | ||
158 | #ifdef ZEN_HAS_VOL | ||
159 | { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
160 | { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
161 | { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
162 | { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
163 | #endif | ||
164 | #endif | ||
165 | /*#ifdef HAVE_HOTKEY on some gesture later? | ||
166 | { ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_BACK|BUTTON_REPEAT }, | ||
167 | #endif*/ | ||
168 | |||
169 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
170 | }; /* button_context_list */ | ||
171 | |||
172 | #ifdef CONFIG_TUNER | ||
173 | static const struct button_mapping button_context_radio[] = { | ||
174 | { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, | ||
175 | { ACTION_FM_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
176 | { ACTION_FM_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, | ||
177 | #ifdef ZEN_HAS_VOL | ||
178 | { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE }, | ||
179 | { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
180 | { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
181 | { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
182 | #endif | ||
183 | |||
184 | { ACTION_FM_EXIT, BUTTON_BACK, BUTTON_NONE }, | ||
185 | |||
186 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
187 | }; /* button_context_radio */ | ||
188 | #endif | ||
189 | |||
190 | #ifdef HAVE_RECORDING | ||
191 | static const struct button_mapping button_context_recscreen[] = { | ||
192 | { ACTION_REC_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
193 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, | ||
194 | { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
195 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, | ||
196 | { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
197 | |||
198 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
199 | }; /* button_context_recscreen */ | ||
200 | #endif | ||
201 | |||
202 | static const struct button_mapping button_context_settings[] = { | ||
203 | /* we overwrite this to avoid select from std */ | ||
204 | { ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
205 | |||
206 | { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, | ||
207 | { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
208 | { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, | ||
209 | { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
210 | |||
211 | { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, | ||
212 | { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
213 | { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
214 | { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
215 | |||
216 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
217 | { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, | ||
218 | |||
219 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
220 | }; /* button_context_settings */ | ||
221 | |||
222 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
223 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, | ||
224 | { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
225 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, | ||
226 | { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
227 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
228 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
229 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
230 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
231 | |||
232 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
233 | }; /* button_context_settingsgraphical */ | ||
234 | |||
235 | static const struct button_mapping button_context_time[] = { | ||
236 | |||
237 | { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, | ||
238 | { ACTION_STD_OK, BUTTON_PLAYPAUSE, BUTTON_NONE }, | ||
239 | |||
240 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
241 | }; /* button_context_time */ | ||
242 | |||
243 | static const struct button_mapping button_context_colorchooser[] = { | ||
244 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
245 | { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, | ||
246 | |||
247 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
248 | }; /* button_context_colorchooser */ | ||
249 | |||
250 | static const struct button_mapping button_context_eq[] = { | ||
251 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
252 | |||
253 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
254 | }; /* button_context_eq */ | ||
255 | |||
256 | /* Bookmark Screen */ | ||
257 | static const struct button_mapping button_context_bmark[] = { | ||
258 | { ACTION_BMS_DELETE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
259 | |||
260 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
261 | }; /* button_context_bmark */ | ||
262 | |||
263 | static const struct button_mapping button_context_pitchscreen[] = { | ||
264 | |||
265 | { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, | ||
266 | { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
267 | { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, | ||
268 | { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
269 | |||
270 | { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
271 | { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
272 | { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
273 | { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
274 | |||
275 | { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, | ||
276 | { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE }, | ||
277 | { ACTION_PS_EXIT, BUTTON_PLAYPAUSE, BUTTON_NONE }, | ||
278 | |||
279 | LAST_ITEM_IN_LIST | ||
280 | }; /* button_context_pitchcreen */ | ||
281 | |||
282 | static const struct button_mapping button_context_yesno[] = { | ||
283 | { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, | ||
284 | |||
285 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
286 | }; /* button_context_yesno */ | ||
287 | |||
288 | #ifdef USB_ENABLE_HID | ||
289 | static const struct button_mapping button_context_usb_hid[] = { | ||
290 | { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, | ||
291 | { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, | ||
292 | |||
293 | LAST_ITEM_IN_LIST | ||
294 | }; /* button_context_usb_hid */ | ||
295 | |||
296 | static const struct button_mapping button_context_usb_hid_mode_multimedia[] = { | ||
297 | |||
298 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
299 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
300 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE }, | ||
301 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
302 | #ifdef ZEN_HAS_VOL | ||
303 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
304 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
305 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
306 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
307 | #endif | ||
308 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
309 | { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, | ||
310 | { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
311 | { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE }, | ||
312 | { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
313 | { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
314 | |||
315 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) | ||
316 | }; /* button_context_usb_hid_mode_multimedia */ | ||
317 | |||
318 | |||
319 | static const struct button_mapping button_context_usb_hid_mode_presentation[] = { | ||
320 | { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
321 | { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE }, | ||
322 | { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
323 | { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
324 | { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
325 | { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
326 | { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE }, | ||
327 | { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
328 | { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
329 | { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
330 | { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT, BUTTON_SELECT }, | ||
331 | { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
332 | |||
333 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) | ||
334 | }; /* button_context_usb_hid_mode_presentation */ | ||
335 | |||
336 | static const struct button_mapping button_context_usb_hid_mode_browser[] = { | ||
337 | { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE }, | ||
338 | { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
339 | { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
340 | { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
341 | #ifdef ZEN_HAS_VOL | ||
342 | { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP, BUTTON_NONE }, | ||
343 | { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
344 | { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
345 | { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
346 | #endif | ||
347 | { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, | ||
348 | { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
349 | { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
350 | { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK }, | ||
351 | { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, | ||
352 | { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, | ||
353 | { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
354 | |||
355 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) | ||
356 | }; /* button_context_usb_hid_mode_browser */ | ||
357 | |||
358 | #ifdef HAVE_USB_HID_MOUSE | ||
359 | static const struct button_mapping button_context_usb_hid_mode_mouse[] = { | ||
360 | { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE }, | ||
361 | { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
362 | { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
363 | { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
364 | { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE }, | ||
365 | { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
366 | { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, | ||
367 | { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
368 | |||
369 | { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE }, | ||
370 | { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, | ||
371 | |||
372 | { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_PLAYPAUSE, BUTTON_NONE }, | ||
373 | { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, | ||
374 | |||
375 | { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK, BUTTON_NONE }, | ||
376 | { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
377 | |||
378 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) | ||
379 | }; /* button_context_usb_hid_mode_mouse */ | ||
380 | #endif | ||
381 | #endif | ||
382 | |||
383 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | ||
384 | const struct button_mapping* get_context_mapping(int context) | ||
385 | { | ||
386 | switch (context) | ||
387 | { | ||
388 | case CONTEXT_STD: | ||
389 | return button_context_standard; | ||
390 | case CONTEXT_MAINMENU: | ||
391 | return button_context_tree; | ||
392 | case CONTEXT_SETTINGS: | ||
393 | return button_context_settings; | ||
394 | case CONTEXT_WPS: | ||
395 | return button_context_wps; | ||
396 | case CONTEXT_YESNOSCREEN: | ||
397 | return button_context_yesno; | ||
398 | case CONTEXT_SETTINGS_TIME: | ||
399 | return button_context_time; | ||
400 | case CONTEXT_KEYBOARD: | ||
401 | case CONTEXT_MORSE_INPUT: | ||
402 | return button_context_keyboard; | ||
403 | #ifdef CONFIG_TUNER | ||
404 | case CONTEXT_FM: | ||
405 | return button_context_radio; | ||
406 | #endif | ||
407 | case CONTEXT_LIST: | ||
408 | return button_context_list; | ||
409 | case CONTEXT_TREE: | ||
410 | return button_context_tree; | ||
411 | case CONTEXT_SETTINGS_EQ: | ||
412 | return button_context_eq; | ||
413 | #ifdef HAVE_RECORDING | ||
414 | case CONTEXT_RECSCREEN: | ||
415 | return button_context_recscreen; | ||
416 | #endif | ||
417 | case CONTEXT_QUICKSCREEN: | ||
418 | return button_context_quickscreen; | ||
419 | case CONTEXT_BOOKMARKSCREEN: | ||
420 | return button_context_bmark; | ||
421 | case CONTEXT_PITCHSCREEN: | ||
422 | return button_context_pitchscreen; | ||
423 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
424 | return button_context_colorchooser; | ||
425 | case CONTEXT_SETTINGS_RECTRIGGER: | ||
426 | return button_context_settings_right_is_inc; | ||
427 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
428 | return button_context_settings_right_is_inc; | ||
429 | #ifdef USB_ENABLE_HID | ||
430 | case CONTEXT_USB_HID: | ||
431 | return button_context_usb_hid; | ||
432 | case CONTEXT_USB_HID_MODE_MULTIMEDIA: | ||
433 | return button_context_usb_hid_mode_multimedia; | ||
434 | case CONTEXT_USB_HID_MODE_PRESENTATION: | ||
435 | return button_context_usb_hid_mode_presentation; | ||
436 | case CONTEXT_USB_HID_MODE_BROWSER: | ||
437 | return button_context_usb_hid_mode_browser; | ||
438 | #ifdef HAVE_USB_HID_MOUSE | ||
439 | case CONTEXT_USB_HID_MODE_MOUSE: | ||
440 | return button_context_usb_hid_mode_mouse; | ||
441 | #endif | ||
442 | #endif | ||
443 | default: | ||
444 | return button_context_standard; | ||
445 | } | ||
446 | return button_context_standard; | ||
447 | } | ||
448 | |||
diff --git a/firmware/SOURCES b/firmware/SOURCES index 884e1102e2..f6df418049 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1184,6 +1184,18 @@ target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c | |||
1184 | target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c | 1184 | target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c |
1185 | #endif | 1185 | #endif |
1186 | 1186 | ||
1187 | #ifdef CREATIVE_ZENMOZAIC | ||
1188 | target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c | ||
1189 | target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c | ||
1190 | target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c | ||
1191 | target/arm/imx233/creative-zenmozaic/button-zenmozaic.c | ||
1192 | target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c | ||
1193 | target/arm/imx233/creative-zenmozaic/power-zenmozaic.c | ||
1194 | target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c | ||
1195 | target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c | ||
1196 | target/arm/imx233/button-lradc-imx233.c | ||
1197 | #endif | ||
1198 | |||
1187 | #if defined(SONY_NWZE360) || defined(SONY_NWZE370) | 1199 | #if defined(SONY_NWZE360) || defined(SONY_NWZE370) |
1188 | target/arm/imx233/button-lradc-imx233.c | 1200 | target/arm/imx233/button-lradc-imx233.c |
1189 | target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c | 1201 | target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c |
diff --git a/firmware/export/config.h b/firmware/export/config.h index 3ee2330879..37146b649d 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -149,6 +149,7 @@ | |||
149 | #define CREATIVE_ZENXFI3_PAD 55 | 149 | #define CREATIVE_ZENXFI3_PAD 55 |
150 | #define MA_PAD 56 | 150 | #define MA_PAD 56 |
151 | #define SONY_NWZ_PAD 57 | 151 | #define SONY_NWZ_PAD 57 |
152 | #define CREATIVE_ZEN_PAD 58 | ||
152 | 153 | ||
153 | /* CONFIG_REMOTE_KEYPAD */ | 154 | /* CONFIG_REMOTE_KEYPAD */ |
154 | #define H100_REMOTE 1 | 155 | #define H100_REMOTE 1 |
@@ -253,6 +254,7 @@ | |||
253 | #define LCD_ILI9342 50 /* as used by HiFi E.T MA9/MA8 */ | 254 | #define LCD_ILI9342 50 /* as used by HiFi E.T MA9/MA8 */ |
254 | #define LCD_NWZE370 51 /* as used by Sony NWZ-E370 series */ | 255 | #define LCD_NWZE370 51 /* as used by Sony NWZ-E370 series */ |
255 | #define LCD_NWZE360 52 /* as used by Sony NWZ-E360 series */ | 256 | #define LCD_NWZE360 52 /* as used by Sony NWZ-E360 series */ |
257 | #define LCD_CREATIVEZENMOZAIC 56 /* as used by the Creative ZEN Mozaic (FGD0801) */ | ||
256 | 258 | ||
257 | /* LCD_PIXELFORMAT */ | 259 | /* LCD_PIXELFORMAT */ |
258 | #define HORIZONTAL_PACKING 1 | 260 | #define HORIZONTAL_PACKING 1 |
@@ -521,6 +523,8 @@ Lyre prototype 1 */ | |||
521 | #include "config/pandora.h" | 523 | #include "config/pandora.h" |
522 | #elif defined(SAMSUNG_YPR0) | 524 | #elif defined(SAMSUNG_YPR0) |
523 | #include "config/samsungypr0.h" | 525 | #include "config/samsungypr0.h" |
526 | #elif defined(CREATIVE_ZENMOZAIC) | ||
527 | #include "config/creativezenmozaic.h" | ||
524 | #elif defined(MA9) | 528 | #elif defined(MA9) |
525 | #include "config/hifietma9.h" | 529 | #include "config/hifietma9.h" |
526 | #elif defined(SONY_NWZE370) | 530 | #elif defined(SONY_NWZE370) |
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h b/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h new file mode 100644 index 0000000000..5a525152f6 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #define NUM_ADC_CHANNELS 2 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_DIE_TEMP 1 | ||
28 | |||
29 | #endif | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c new file mode 100644 index 0000000000..92c1063c24 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "adc-target.h" | ||
22 | #include "adc-imx233.h" | ||
23 | |||
24 | int imx233_adc_mapping[] = | ||
25 | { | ||
26 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
27 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
28 | }; | ||
29 | |||
30 | const char *imx233_adc_channel_name[] = | ||
31 | { | ||
32 | "Die temperature(°C)", | ||
33 | "Battery(raw)", | ||
34 | }; | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h b/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h new file mode 100644 index 0000000000..4ee2e2f402 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef __audio_target__ | ||
22 | #define __audio_target__ | ||
23 | |||
24 | #endif /* __audio_target__ */ | ||
25 | |||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h b/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h new file mode 100644 index 0000000000..78a0a72d85 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef BACKLIGHT_TARGET_H | ||
22 | #define BACKLIGHT_TARGET_H | ||
23 | |||
24 | bool _backlight_init(void); | ||
25 | void _backlight_on(void); | ||
26 | void _backlight_off(void); | ||
27 | void _backlight_set_brightness(int brightness); | ||
28 | |||
29 | #endif /* BACKLIGHT_TARGET_H */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c new file mode 100644 index 0000000000..0d223b52e9 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "backlight.h" | ||
25 | #include "lcd.h" | ||
26 | #include "backlight-target.h" | ||
27 | #include "uartdbg-imx233.h" | ||
28 | #include "pinctrl-imx233.h" | ||
29 | |||
30 | void _backlight_set_brightness(int level) | ||
31 | { | ||
32 | unsigned val = (level + 200) * level / 1000; | ||
33 | if(level != 0) | ||
34 | { | ||
35 | for(unsigned mask = 0x10; mask; mask >>= 1) | ||
36 | imx233_uartdbg_send((val & mask) ? 0xff : 0xf8); | ||
37 | imx233_uartdbg_send(0); | ||
38 | imx233_pinctrl_set_gpio(1, 12, true); | ||
39 | } | ||
40 | else | ||
41 | imx233_pinctrl_set_gpio(1, 12, false); | ||
42 | } | ||
43 | |||
44 | bool _backlight_init(void) | ||
45 | { | ||
46 | imx233_pinctrl_acquire(1, 12, "backlight_enable"); | ||
47 | imx233_pinctrl_set_function(1, 12, PINCTRL_FUNCTION_GPIO); | ||
48 | imx233_pinctrl_enable_gpio(1, 12, true); | ||
49 | imx233_uartdbg_init(BAUD_38400); | ||
50 | return true; | ||
51 | } | ||
52 | |||
53 | void _backlight_on(void) | ||
54 | { | ||
55 | #ifdef HAVE_LCD_ENABLE | ||
56 | lcd_enable(true); /* power on lcd + visible display */ | ||
57 | #endif | ||
58 | /* restore the previous backlight level */ | ||
59 | _backlight_set_brightness(backlight_brightness); | ||
60 | } | ||
61 | |||
62 | void _backlight_off(void) | ||
63 | { | ||
64 | /* there is no real on/off but we can set to 0 brightness */ | ||
65 | _backlight_set_brightness(0); | ||
66 | #ifdef HAVE_LCD_ENABLE | ||
67 | lcd_enable(false); /* power off visible display */ | ||
68 | #endif | ||
69 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/button-target.h b/firmware/target/arm/imx233/creative-zenmozaic/button-target.h new file mode 100644 index 0000000000..714e9983fd --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/button-target.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _BUTTON_TARGET_H_ | ||
22 | #define _BUTTON_TARGET_H_ | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | |||
26 | bool button_debug_screen(void); | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | #define HAVE_HEADPHONE_DETECTION | ||
30 | |||
31 | #define IMX233_BUTTON_LRADC_CHANNEL 0 | ||
32 | #define IMX233_BUTTON_LRADC_HOLD_DET BLH_ADC | ||
33 | |||
34 | /* Main unit's buttons */ | ||
35 | #define BUTTON_POWER 0x00000001 | ||
36 | #define BUTTON_LEFT 0x00000002 | ||
37 | #define BUTTON_UP 0x00000004 | ||
38 | #define BUTTON_RIGHT 0x00000008 | ||
39 | #define BUTTON_DOWN 0x00000010 | ||
40 | #define BUTTON_SELECT 0x00000020 | ||
41 | #define BUTTON_PLAYPAUSE 0x00000040 | ||
42 | #define BUTTON_BACK 0x00000080 | ||
43 | #define BUTTON_MENU 0x00000100 | ||
44 | #define BUTTON_SHORTCUT 0x00000200 | ||
45 | |||
46 | |||
47 | #define BUTTON_MAIN (BUTTON_POWER|BUTTON_LEFT|BUTTON_UP|BUTTON_RIGHT|\ | ||
48 | BUTTON_DOWN|BUTTON_SELECT|BUTTON_PLAYPAUSE|BUTTON_BACK|\ | ||
49 | BUTTON_MENU|BUTTON_SHORTCUT) | ||
50 | |||
51 | /* Software power-off */ | ||
52 | #define POWEROFF_BUTTON BUTTON_POWER | ||
53 | #define POWEROFF_COUNT 10 | ||
54 | |||
55 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c new file mode 100644 index 0000000000..bf6729a273 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "button-target.h" | ||
22 | #include "system.h" | ||
23 | #include "system-target.h" | ||
24 | #include "pinctrl-imx233.h" | ||
25 | #include "power-imx233.h" | ||
26 | #include "button-lradc-imx233.h" | ||
27 | |||
28 | struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = | ||
29 | { | ||
30 | {0, IMX233_BUTTON_LRADC_HOLD}, | ||
31 | {200, BUTTON_MENU}, | ||
32 | {445, BUTTON_SHORTCUT}, | ||
33 | {645, BUTTON_UP}, | ||
34 | {860, BUTTON_LEFT}, | ||
35 | {1060, BUTTON_RIGHT}, | ||
36 | {1260, BUTTON_DOWN}, | ||
37 | {1480, BUTTON_SELECT}, | ||
38 | {2700, BUTTON_BACK}, | ||
39 | {2945, BUTTON_PLAYPAUSE}, | ||
40 | {3400, 0}, | ||
41 | {0, IMX233_BUTTON_LRADC_END}, | ||
42 | }; | ||
43 | |||
44 | void button_init_device(void) | ||
45 | { | ||
46 | imx233_button_lradc_init(); | ||
47 | |||
48 | imx233_pinctrl_acquire(2, 8, "jack_detect"); | ||
49 | imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO); | ||
50 | imx233_pinctrl_enable_gpio(2, 8, false); | ||
51 | } | ||
52 | |||
53 | bool headphones_inserted(void) | ||
54 | { | ||
55 | return imx233_pinctrl_get_gpio(2, 8); | ||
56 | } | ||
57 | |||
58 | bool button_hold(void) | ||
59 | { | ||
60 | return imx233_button_lradc_hold(); | ||
61 | } | ||
62 | |||
63 | int button_read_device(void) | ||
64 | { | ||
65 | int btn = 0; | ||
66 | if(BF_RD(POWER_STS, PSWITCH) == 1) | ||
67 | btn |= BUTTON_POWER; | ||
68 | return imx233_button_lradc_read(btn); | ||
69 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c new file mode 100644 index 0000000000..a350d0ae62 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "system.h" | ||
23 | #include "button-target.h" | ||
24 | #include "lcd-target.h" | ||
25 | |||
26 | bool dbg_hw_target_info(void) | ||
27 | { | ||
28 | return false; | ||
29 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c new file mode 100644 index 0000000000..a1377ce1f2 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "fmradio_i2c.h" | ||
25 | #include "pinctrl-imx233.h" | ||
26 | #include "i2c.h" | ||
27 | |||
28 | void fmradio_i2c_init(void) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) | ||
33 | { | ||
34 | return i2c_write(address, buf, count); | ||
35 | } | ||
36 | |||
37 | int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count) | ||
38 | { | ||
39 | return i2c_read(address, buf, count); | ||
40 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h b/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h new file mode 100644 index 0000000000..5133c75d1b --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef LCD_TARGET_H | ||
22 | #define LCD_TARGET_H | ||
23 | |||
24 | bool lcd_debug_screen(void); | ||
25 | void lcd_set_contrast(int val); | ||
26 | |||
27 | #endif /* LCD_TARGET_H */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c new file mode 100644 index 0000000000..eac36676ae --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c | |||
@@ -0,0 +1,152 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include <sys/types.h> /* off_t */ | ||
22 | #include <string.h> | ||
23 | #include "cpu.h" | ||
24 | #include "system.h" | ||
25 | #include "backlight-target.h" | ||
26 | #include "lcd.h" | ||
27 | #include "lcdif-imx233.h" | ||
28 | #include "clkctrl-imx233.h" | ||
29 | #include "pinctrl-imx233.h" | ||
30 | #include "dcp-imx233.h" | ||
31 | #include "logf.h" | ||
32 | #ifndef BOOTLOADER | ||
33 | #include "button.h" | ||
34 | #include "font.h" | ||
35 | #include "action.h" | ||
36 | #endif | ||
37 | |||
38 | #ifdef HAVE_LCD_ENABLE | ||
39 | static bool lcd_on; | ||
40 | #endif | ||
41 | |||
42 | static void lcd_write_reg(uint16_t reg, uint16_t value) | ||
43 | { | ||
44 | imx233_lcdif_set_data_swizzle(3); | ||
45 | imx233_lcdif_pio_send(false, 2, ®); | ||
46 | if(reg != 0x22) | ||
47 | imx233_lcdif_pio_send(true, 2, &value); | ||
48 | } | ||
49 | |||
50 | void lcd_init_device(void) | ||
51 | { | ||
52 | /* clock at 24MHZ */ | ||
53 | imx233_clkctrl_enable(CLK_PIX, false); | ||
54 | imx233_clkctrl_set_div(CLK_PIX, 3); | ||
55 | imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */ | ||
56 | imx233_clkctrl_enable(CLK_PIX, true); | ||
57 | imx233_lcdif_init(); | ||
58 | imx233_lcdif_setup_system_pins(8); | ||
59 | imx233_lcdif_set_timings(2, 2, 2, 2); | ||
60 | imx233_lcdif_set_word_length(8); | ||
61 | |||
62 | lcd_write_reg(0, 1); | ||
63 | lcd_write_reg(3, 0); | ||
64 | |||
65 | lcd_write_reg(3, 0x510); | ||
66 | lcd_write_reg(9, 8); | ||
67 | lcd_write_reg(0xc, 0); | ||
68 | lcd_write_reg(0xd, 0); | ||
69 | lcd_write_reg(0xe, 0); | ||
70 | lcd_write_reg(0x5b, 4); | ||
71 | lcd_write_reg(0xd, 0x10); | ||
72 | lcd_write_reg(9, 0); | ||
73 | lcd_write_reg(3, 0x10); | ||
74 | lcd_write_reg(0xd, 0x14); | ||
75 | lcd_write_reg(0xe, 0x2b12); | ||
76 | lcd_write_reg(1, 0x21f); | ||
77 | lcd_write_reg(2, 0x700); | ||
78 | lcd_write_reg(5, 0x30); | ||
79 | lcd_write_reg(6, 0); | ||
80 | lcd_write_reg(8, 0x202); | ||
81 | lcd_write_reg(0xa, 0x3); // OF uses 0xc0003 with 3 transfers/pixels | ||
82 | lcd_write_reg(0xb, 0); | ||
83 | lcd_write_reg(0xf, 0); | ||
84 | lcd_write_reg(0x10, 0); | ||
85 | lcd_write_reg(0x11, 0); | ||
86 | lcd_write_reg(0x14, 0x9f00); | ||
87 | lcd_write_reg(0x15, 0x9f00); | ||
88 | lcd_write_reg(0x16, 0x7f00); | ||
89 | lcd_write_reg(0x17, 0x9f00); | ||
90 | lcd_write_reg(0x20, 0); | ||
91 | lcd_write_reg(0x21, 0); | ||
92 | lcd_write_reg(0x23, 0); | ||
93 | lcd_write_reg(0x24, 0); | ||
94 | lcd_write_reg(0x25, 0); | ||
95 | lcd_write_reg(0x26, 0); | ||
96 | lcd_write_reg(0x30, 0x707); | ||
97 | lcd_write_reg(0x31, 0x504); | ||
98 | lcd_write_reg(0x32, 7); | ||
99 | lcd_write_reg(0x33, 0x307); | ||
100 | lcd_write_reg(0x34, 7); | ||
101 | lcd_write_reg(0x35, 0x400); | ||
102 | lcd_write_reg(0x36, 0x607); | ||
103 | lcd_write_reg(0x37, 0x703); | ||
104 | lcd_write_reg(0x3a, 0x1a0d); | ||
105 | lcd_write_reg(0x3b, 0x1309); | ||
106 | |||
107 | lcd_write_reg(9, 4); | ||
108 | lcd_write_reg(7, 5); | ||
109 | lcd_write_reg(7, 0x25); | ||
110 | lcd_write_reg(7, 0x27); | ||
111 | lcd_write_reg(0x5b, 0); | ||
112 | lcd_write_reg(7, 0x37); | ||
113 | #ifdef HAVE_LCD_ENABLE | ||
114 | lcd_on = true; | ||
115 | #endif | ||
116 | } | ||
117 | |||
118 | #ifdef HAVE_LCD_ENABLE | ||
119 | bool lcd_active(void) | ||
120 | { | ||
121 | return lcd_on; | ||
122 | } | ||
123 | |||
124 | void lcd_enable(bool enable) | ||
125 | { | ||
126 | if(lcd_on == enable) | ||
127 | return; | ||
128 | |||
129 | lcd_on = enable; | ||
130 | } | ||
131 | #endif | ||
132 | |||
133 | void lcd_update(void) | ||
134 | { | ||
135 | lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
136 | } | ||
137 | |||
138 | void lcd_update_rect(int x, int y, int w, int h) | ||
139 | { | ||
140 | #ifdef HAVE_LCD_ENABLE | ||
141 | if(!lcd_on) | ||
142 | return; | ||
143 | #endif | ||
144 | |||
145 | imx233_lcdif_wait_ready(); | ||
146 | lcd_write_reg(0x16, x | (x + w - 1) << 8); | ||
147 | lcd_write_reg(0x17, y | (y + h - 1) << 8); | ||
148 | lcd_write_reg(0x21, y * LCD_WIDTH + x); | ||
149 | lcd_write_reg(0x22, 0); | ||
150 | for(int yy = y; yy < y + h; yy++) | ||
151 | imx233_lcdif_pio_send(true, 2 * w, FBADDR(x, yy)); | ||
152 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c new file mode 100644 index 0000000000..1bed2ffcca --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "system.h" | ||
23 | #include "power.h" | ||
24 | #include "tuner.h" | ||
25 | #include "fmradio_i2c.h" | ||
26 | #include "pinctrl-imx233.h" | ||
27 | #include "power-imx233.h" | ||
28 | |||
29 | static bool tuner_enable = false; | ||
30 | static bool initialised = false; | ||
31 | |||
32 | static void init(void) | ||
33 | { | ||
34 | /* CE is B2P15 (active high) */ | ||
35 | imx233_pinctrl_acquire(2, 15, "tuner power"); | ||
36 | imx233_pinctrl_set_function(2, 15, PINCTRL_FUNCTION_GPIO); | ||
37 | imx233_pinctrl_enable_gpio(2, 15, true); | ||
38 | initialised = true; | ||
39 | } | ||
40 | |||
41 | bool tuner_power(bool enable) | ||
42 | { | ||
43 | if(!initialised) | ||
44 | init(); | ||
45 | if(tuner_enable != enable) | ||
46 | { | ||
47 | imx233_pinctrl_set_gpio(2, 15, enable); | ||
48 | sleep(HZ / 5); | ||
49 | tuner_enable = enable; | ||
50 | } | ||
51 | return tuner_enable; | ||
52 | } | ||
53 | |||
54 | bool tuner_powered(void) | ||
55 | { | ||
56 | return tuner_enable; | ||
57 | } \ No newline at end of file | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h new file mode 100644 index 0000000000..57a6b82ec9 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef POWERMGMT_TARGET_H | ||
22 | #define POWERMGMT_TARGET_H | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "powermgmt-imx233.h" | ||
26 | |||
27 | /* ZEN Mozaic OF settings: | ||
28 | * - current ramp slope: | ||
29 | * - conditioning threshold voltage: | ||
30 | * - conditioning max voltage: | ||
31 | * - conditioning current: | ||
32 | * - conditioning timeout: | ||
33 | * - charging voltage: | ||
34 | * - charging current: | ||
35 | * - charging threshold current: | ||
36 | * - charging timeout: | ||
37 | * - top off period: | ||
38 | * - high die temperature: | ||
39 | * - low die temperature: | ||
40 | * - safe die temperature current: | ||
41 | * - battery temperature channel: | ||
42 | * - high battery temperature: | ||
43 | * - low battery temperature: | ||
44 | * - safe battery temperature current: | ||
45 | * - low DCDC battery voltage: | ||
46 | */ | ||
47 | |||
48 | #define IMX233_CHARGE_CURRENT 200 | ||
49 | #define IMX233_STOP_CURRENT 30 | ||
50 | #define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ) | ||
51 | #define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ) | ||
52 | #define IMX233_DIE_TEMP_HIGH 71 | ||
53 | #define IMX233_DIE_TEMP_LOW 56 | ||
54 | |||
55 | #endif /* POWERMGMT_TARGET_H */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c new file mode 100644 index 0000000000..1e986813f9 --- /dev/null +++ b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "powermgmt-target.h" | ||
23 | #include "power-imx233.h" | ||
24 | |||
25 | #warning FIXME calibrate | ||
26 | |||
27 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
28 | { | ||
29 | 0 | ||
30 | }; | ||
31 | |||
32 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
33 | { | ||
34 | 0 | ||
35 | }; | ||
36 | |||
37 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
38 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
39 | { | ||
40 | /* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */ | ||
41 | { 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 }, | ||
42 | }; | ||
43 | |||
44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
45 | const unsigned short percent_to_volt_charge[11] = | ||
46 | { | ||
47 | /* Sansa Fuze+ Li Ion 600mAH figured from charge curve */ | ||
48 | 3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335 | ||
49 | }; \ No newline at end of file | ||
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c index 7caff7b466..15eeed1371 100644 --- a/firmware/target/arm/imx233/sdmmc-imx233.c +++ b/firmware/target/arm/imx233/sdmmc-imx233.c | |||
@@ -127,6 +127,13 @@ struct sdmmc_config_t sdmmc_config[] = | |||
127 | .ssp = 1, | 127 | .ssp = 1, |
128 | .mode = SD_MODE, | 128 | .mode = SD_MODE, |
129 | }, | 129 | }, |
130 | #elif defined(CREATIVE_ZENMOZAIC) | ||
131 | { | ||
132 | .name = "internal/SD", | ||
133 | .flags = WINDOW, | ||
134 | .ssp = 2, | ||
135 | .mode = SD_MODE, | ||
136 | } | ||
130 | #elif defined(SONY_NWZE370) || defined(SONY_NWZE360) | 137 | #elif defined(SONY_NWZE370) || defined(SONY_NWZE360) |
131 | /* The Sony NWZ-E370 uses #B1P29 for power */ | 138 | /* The Sony NWZ-E370 uses #B1P29 for power */ |
132 | { | 139 | { |
diff --git a/tools/configure b/tools/configure index ad702aab60..7746044396 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -2280,6 +2280,26 @@ fi | |||
2280 | arm926ejscc | 2280 | arm926ejscc |
2281 | ;; | 2281 | ;; |
2282 | 2282 | ||
2283 | 97|creativezenmozaic) | ||
2284 | target_id=87 | ||
2285 | modelname="creativezenmozaic" | ||
2286 | target="CREATIVE_ZENMOZAIC" | ||
2287 | memory=32 | ||
2288 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | ||
2289 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" | ||
2290 | tool="$rootdir/tools/scramble -add=zmoz" | ||
2291 | output="rockbox.creative" | ||
2292 | bootoutput="bootloader-zenmozaic.creative" | ||
2293 | appextra="gui:recorder:radio" | ||
2294 | plugins="" | ||
2295 | swcodec="yes" | ||
2296 | toolset=$scramblebitmaptools | ||
2297 | t_cpu="arm" | ||
2298 | t_manufacturer="imx233" | ||
2299 | t_model="creative-zenmozaic" | ||
2300 | arm926ejscc | ||
2301 | ;; | ||
2302 | |||
2283 | 50|sansae200) | 2303 | 50|sansae200) |
2284 | target_id=23 | 2304 | target_id=23 |
2285 | modelname="sansae200" | 2305 | modelname="sansae200" |
diff --git a/tools/scramble.c b/tools/scramble.c index c29634bb6c..e37bec8195 100644 --- a/tools/scramble.c +++ b/tools/scramble.c | |||
@@ -365,6 +365,8 @@ int main (int argc, char** argv) | |||
365 | modelnum = 82; | 365 | modelnum = 82; |
366 | else if (!strcmp(&argv[1][5], "zxf3")) /* Creative Zen X-Fi3 */ | 366 | else if (!strcmp(&argv[1][5], "zxf3")) /* Creative Zen X-Fi3 */ |
367 | modelnum = 83; | 367 | modelnum = 83; |
368 | else if (!strcmp(&argv[1][5], "zmoz")) /* Creative ZEN Mozaic*/ | ||
369 | modelnum = 87; | ||
368 | else if (!strcmp(&argv[1][5], "e370")) /* Sony NWZ-E370 series */ | 370 | else if (!strcmp(&argv[1][5], "e370")) /* Sony NWZ-E370 series */ |
369 | modelnum = 88; | 371 | modelnum = 88; |
370 | else if (!strcmp(&argv[1][5], "e360")) /* Sony NWZ-E360 series */ | 372 | else if (!strcmp(&argv[1][5], "e360")) /* Sony NWZ-E360 series */ |