summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-05-19 16:09:46 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-05-19 16:10:52 +0200
commit12c64a4b79e043d8e8d77a278b340310f867a588 (patch)
treeb34b56131d6eb0e06340a8a6d7e32843027d0f59
parente09c1e3d43665d04ae0ce2f288ba695b5abc3622 (diff)
downloadrockbox-12c64a4b79e043d8e8d77a278b340310f867a588.tar.gz
rockbox-12c64a4b79e043d8e8d77a278b340310f867a588.zip
Initial commit for the Creative ZEN X-Fi2 and X-Fi3 ports
These are really similar devices so one commit for both is ok. Change-Id: I8bd1d3fef1eb6d00aaadfb7af56c771f62d0c9c3
-rw-r--r--apps/SOURCES4
-rw-r--r--apps/keymaps/keymap-zenxfi2.c184
-rw-r--r--apps/keymaps/keymap-zenxfi3.c327
-rw-r--r--apps/lang/english.lang6
-rw-r--r--apps/plugins/battery_bench.c6
-rw-r--r--apps/plugins/lib/pluginlib_actions.c7
-rw-r--r--firmware/SOURCES34
-rw-r--r--firmware/export/config.h8
-rw-r--r--firmware/export/config/creativezenxfi2.h202
-rw-r--r--firmware/export/config/creativezenxfi3.h208
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/adc-target.h32
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c40
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/audio-zenxfi2.c55
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/backlight-target.h29
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/backlight-zenxfi2.c58
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/button-target.h59
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c119
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/debug-zenxfi2.c28
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/lcd-target.h24
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c512
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/power-zenxfi2.c42
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/powermgmt-target.h60
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/powermgmt-zenxfi2.c46
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/adc-target.h32
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c40
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c61
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/backlight-target.h33
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c85
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/button-target.h54
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c171
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/debug-zenxfi3.c28
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/lcd-target.h24
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c490
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/power-zenxfi3.c42
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/powermgmt-target.h58
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c46
-rw-r--r--firmware/target/arm/imx233/sd-imx233.c22
-rw-r--r--firmware/target/arm/system-arm.c2
-rw-r--r--firmware/target/hosted/sdl/sim-ui-defines.h7
-rwxr-xr-xtools/configure83
-rw-r--r--tools/scramble.c6
-rw-r--r--uisimulator/bitmaps/UI-creativezenxfi3.bmpbin0 -> 275854 bytes
-rw-r--r--uisimulator/buttonmap/SOURCES2
-rw-r--r--uisimulator/buttonmap/creative-zenxfi3.c74
44 files changed, 3424 insertions, 26 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 1fe66f93a3..8749c36c87 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -236,6 +236,10 @@ keymaps/keymap-meizu-m6sp.c
236keymaps/keymap-creativezvm.c 236keymaps/keymap-creativezvm.c
237#elif CONFIG_KEYPAD == CREATIVEZV_PAD 237#elif CONFIG_KEYPAD == CREATIVEZV_PAD
238keymaps/keymap-creativezv.c 238keymaps/keymap-creativezv.c
239#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
240keymaps/keymap-zenxfi2.c
241#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
242keymaps/keymap-zenxfi3.c
239#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD 243#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
240keymaps/keymap-sa9200.c 244keymaps/keymap-sa9200.c
241#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD 245#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
diff --git a/apps/keymaps/keymap-zenxfi2.c b/apps/keymaps/keymap-zenxfi2.c
new file mode 100644
index 0000000000..7bffa10a33
--- /dev/null
+++ b/apps/keymaps/keymap-zenxfi2.c
@@ -0,0 +1,184 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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/* Button Code Definitions for the Creative ZEN X-Fi2 target */
23/* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
24
25#include <stdio.h>
26#include <string.h>
27#include <stdlib.h>
28
29#include "config.h"
30#include "action.h"
31#include "button.h"
32#include "settings.h"
33
34/*
35 * The format of the list is as follows
36 * { Action Code, Button code, Prereq button code }
37 * if there's no need to check the previous button's value, use BUTTON_NONE
38 * Insert LAST_ITEM_IN_LIST at the end of each mapping
39 */
40
41static const struct button_mapping button_context_standard[] = {
42 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
43 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
44
45 { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
46
47 LAST_ITEM_IN_LIST
48}; /* button_context_standard */
49
50
51static const struct button_mapping button_context_wps[] = {
52 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
53 { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
54
55 LAST_ITEM_IN_LIST
56}; /* button_context_wps */
57
58static const struct button_mapping button_context_list[] = {
59 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
60}; /* button_context_list */
61
62static const struct button_mapping button_context_tree[] = {
63
64 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
65}; /* button_context_tree */
66
67static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
68 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
69};
70
71static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
72 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
73};
74
75static const struct button_mapping button_context_settings[] = {
76 { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE },
77 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
78
79 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
80}; /* button_context_settings */
81
82static const struct button_mapping button_context_settings_right_is_inc[] = {
83
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
85}; /* button_context_settingsgraphical */
86
87static const struct button_mapping button_context_yesno[] = {
88 { ACTION_YESNO_ACCEPT, BUTTON_MENU, BUTTON_NONE },
89
90 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
91}; /* button_context_settings_yesno */
92
93static const struct button_mapping button_context_colorchooser[] = {
94 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
95}; /* button_context_colorchooser */
96
97static const struct button_mapping button_context_eq[] = {
98 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
99}; /* button_context_eq */
100
101/** Bookmark Screen **/
102static const struct button_mapping button_context_bmark[] = {
103 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
104}; /* button_context_bmark */
105
106static const struct button_mapping button_context_time[] = {
107 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
108}; /* button_context_time */
109
110static const struct button_mapping button_context_quickscreen[] = {
111 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
112 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
113
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
115}; /* button_context_quickscreen */
116
117static const struct button_mapping button_context_pitchscreen[] = {
118 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
119 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
120}; /* button_context_pitchcreen */
121
122static const struct button_mapping button_context_keyboard[] = {
123 { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE },
124
125 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
126}; /* button_context_keyboard */
127
128static const struct button_mapping button_context_radio[] = {
129 { ACTION_FM_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
130 { ACTION_FM_PRESET, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
131 { ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE },
132
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
134}; /* button_context_radio */
135
136const struct button_mapping* target_get_context_mapping(int context)
137{
138 switch (context)
139 {
140 case CONTEXT_STD:
141 return button_context_standard;
142 case CONTEXT_WPS:
143 return button_context_wps;
144
145 case CONTEXT_LIST:
146 return button_context_list;
147 case CONTEXT_MAINMENU:
148 case CONTEXT_TREE:
149 if (global_settings.hold_lr_for_scroll_in_list)
150 return button_context_listtree_scroll_without_combo;
151 else
152 return button_context_listtree_scroll_with_combo;
153 case CONTEXT_CUSTOM|CONTEXT_TREE:
154 return button_context_tree;
155
156 case CONTEXT_SETTINGS:
157 return button_context_settings;
158 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
159 case CONTEXT_SETTINGS_RECTRIGGER:
160 return button_context_settings_right_is_inc;
161
162 case CONTEXT_SETTINGS_COLOURCHOOSER:
163 return button_context_colorchooser;
164 case CONTEXT_SETTINGS_EQ:
165 return button_context_eq;
166
167 case CONTEXT_SETTINGS_TIME:
168 return button_context_time;
169
170 case CONTEXT_YESNOSCREEN:
171 return button_context_yesno;
172 case CONTEXT_FM:
173 return button_context_radio;
174 case CONTEXT_BOOKMARKSCREEN:
175 return button_context_bmark;
176 case CONTEXT_QUICKSCREEN:
177 return button_context_quickscreen;
178 case CONTEXT_PITCHSCREEN:
179 return button_context_pitchscreen;
180 case CONTEXT_KEYBOARD:
181 return button_context_keyboard;
182 }
183 return button_context_standard;
184}
diff --git a/apps/keymaps/keymap-zenxfi3.c b/apps/keymaps/keymap-zenxfi3.c
new file mode 100644
index 0000000000..1a9be54a06
--- /dev/null
+++ b/apps/keymaps/keymap-zenxfi3.c
@@ -0,0 +1,327 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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/* Button Code Definitions for the Creative ZEN X-Fi3 target */
23
24#include <stdio.h>
25#include <string.h>
26#include <stdlib.h>
27
28#include "config.h"
29#include "action.h"
30#include "button.h"
31#include "settings.h"
32
33/*
34 * The format of the list is as follows
35 * { Action Code, Button code, Prereq button code }
36 * if there's no need to check the previous button's value, use BUTTON_NONE
37 * Insert LAST_ITEM_IN_LIST at the end of each mapping
38 */
39
40static const struct button_mapping button_context_standard[] = {
41 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
42 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
43 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
44 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
45
46 { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
47
48 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
49 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
50 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
51
52 { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
53
54 LAST_ITEM_IN_LIST
55}; /* button_context_standard */
56
57static const struct button_mapping button_context_wps[] = {
58 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
59 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
60
61 { ACTION_WPS_SKIPNEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
62 { ACTION_WPS_SEEKFWD, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
63 { ACTION_WPS_SKIPPREV, BUTTON_UP|BUTTON_REL, BUTTON_UP },
64 { ACTION_WPS_SEEKBACK, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
65 { ACTION_WPS_STOPSEEK, BUTTON_UP|BUTTON_REL, BUTTON_UP|BUTTON_REPEAT },
66 { ACTION_WPS_STOPSEEK, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN|BUTTON_REPEAT },
67
68 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
69 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
70
71 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
72 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
73
74 { ACTION_WPS_MENU, BUTTON_BACK, BUTTON_NONE },
75
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
77}; /* button_context_wps */
78
79static const struct button_mapping button_context_keyboard[] = {
80 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
81 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
82 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
83 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
85 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
87 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
88
89 { ACTION_KBD_SELECT, BUTTON_MENU, BUTTON_NONE },
90 { ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
91 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
92
93 { ACTION_KBD_MORSE_INPUT, BUTTON_VOL_UP, BUTTON_NONE },
94 { ACTION_KBD_MORSE_SELECT, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_NONE },
95
96 LAST_ITEM_IN_LIST
97}; /* button_context_keyboard */
98
99static const struct button_mapping button_context_quickscreen[] = {
100 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
101 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
102 { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
103 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
104 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
105 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
106
107 LAST_ITEM_IN_LIST
108}; /* button_context_quickscreen */
109
110static const struct button_mapping button_context_tree[] = {
111
112 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
113}; /* button_context_tree */
114
115static const struct button_mapping button_context_list[] = {
116#ifdef HAVE_VOLUME_IN_LIST
117 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
118 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
119 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
120 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
121#endif
122
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
124}; /* button_context_list */
125
126#ifdef CONFIG_TUNER
127static const struct button_mapping button_context_radio[] = {
128 { ACTION_FM_MENU, BUTTON_MENU, BUTTON_NONE },
129 { ACTION_FM_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
130 { ACTION_FM_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
131
132 { ACTION_FM_EXIT, BUTTON_BACK, BUTTON_NONE },
133
134 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
135}; /* button_context_radio */
136#endif
137
138#ifdef HAVE_RECORDING
139static const struct button_mapping button_context_recscreen[] = {
140 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
141 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
142 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
143 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
144 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
145
146 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
147}; /* button_context_recscreen */
148#endif
149
150static const struct button_mapping button_context_settings[] = {
151 /* we overwrite this to avoid select from std */
152 { ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
153
154 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
155 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
157 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
158
159 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
160 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
161 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
162 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
163
164 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
165 { ACTION_SETTINGS_RESET, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
166
167 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
168}; /* button_context_settings */
169
170static const struct button_mapping button_context_time[] = {
171
172 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
173 { ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
174
175 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
176}; /* button_context_time */
177
178static const struct button_mapping button_context_colorchooser[] = {
179 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
180 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
181
182 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
183}; /* button_context_colorchooser */
184
185static const struct button_mapping button_context_eq[] = {
186 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
187
188 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
189}; /* button_context_eq */
190
191/* Bookmark Screen */
192static const struct button_mapping button_context_bmark[] = {
193 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
194
195 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
196}; /* button_context_bmark */
197
198static const struct button_mapping button_context_pitchscreen[] = {
199
200 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
201 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
202 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
203 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
204
205 { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
206 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
207
208 LAST_ITEM_IN_LIST
209}; /* button_context_pitchcreen */
210
211static const struct button_mapping button_context_yesno[] = {
212 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
213
214 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
215}; /* button_context_yesno */
216
217#ifdef USB_ENABLE_HID
218static const struct button_mapping button_context_usb_hid[] = {
219 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
220 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
221
222 LAST_ITEM_IN_LIST
223}; /* button_context_usb_hid */
224
225static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
226
227 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
228 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
229 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
230 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
231 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
232 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
233 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
234 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_UP|BUTTON_REL, BUTTON_UP },
235 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
236
237 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
238}; /* button_context_usb_hid_mode_multimedia */
239
240
241static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
242 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
243 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
244 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_UP|BUTTON_REL, BUTTON_UP },
245 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
246
247 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
248}; /* button_context_usb_hid_mode_presentation */
249
250static const struct button_mapping button_context_usb_hid_mode_browser[] = {
251
252 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
253}; /* button_context_usb_hid_mode_browser */
254
255#ifdef HAVE_USB_HID_MOUSE
256static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
257
258 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
259}; /* button_context_usb_hid_mode_mouse */
260#endif
261#endif
262
263/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
264const struct button_mapping* get_context_mapping(int context)
265{
266 switch (context)
267 {
268 case CONTEXT_STD:
269 return button_context_standard;
270 case CONTEXT_MAINMENU:
271 return button_context_tree;
272 case CONTEXT_SETTINGS:
273 return button_context_settings;
274 case CONTEXT_WPS:
275 return button_context_wps;
276 case CONTEXT_YESNOSCREEN:
277 return button_context_yesno;
278 case CONTEXT_SETTINGS_TIME:
279 return button_context_time;
280 case CONTEXT_KEYBOARD:
281 case CONTEXT_MORSE_INPUT:
282 return button_context_keyboard;
283#ifdef CONFIG_TUNER
284 case CONTEXT_FM:
285 return button_context_radio;
286#endif
287 case CONTEXT_LIST:
288 return button_context_list;
289 case CONTEXT_TREE:
290 return button_context_tree;
291 case CONTEXT_SETTINGS_EQ:
292 return button_context_eq;
293#ifdef HAVE_RECORDING
294 case CONTEXT_RECSCREEN:
295 return button_context_recscreen;
296#endif
297 case CONTEXT_QUICKSCREEN:
298 return button_context_quickscreen;
299 case CONTEXT_BOOKMARKSCREEN:
300 return button_context_bmark;
301 case CONTEXT_PITCHSCREEN:
302 return button_context_pitchscreen;
303 case CONTEXT_SETTINGS_COLOURCHOOSER:
304 return button_context_colorchooser;
305 case CONTEXT_SETTINGS_RECTRIGGER:
306 return button_context_settings;
307 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
308 return button_context_settings;
309#ifdef USB_ENABLE_HID
310 case CONTEXT_USB_HID:
311 return button_context_usb_hid;
312 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
313 return button_context_usb_hid_mode_multimedia;
314 case CONTEXT_USB_HID_MODE_PRESENTATION:
315 return button_context_usb_hid_mode_presentation;
316 case CONTEXT_USB_HID_MODE_BROWSER:
317 return button_context_usb_hid_mode_browser;
318#ifdef HAVE_USB_HID_MOUSE
319 case CONTEXT_USB_HID_MODE_MOUSE:
320 return button_context_usb_hid_mode_mouse;
321#endif
322#endif
323 default:
324 return button_context_standard;
325 }
326 return button_context_standard;
327}
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index a70bb8b923..fc575a3764 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12465,15 +12465,15 @@
12465 user: core 12465 user: core
12466 <source> 12466 <source>
12467 *: none 12467 *: none
12468 gigabeats,mpiohd200,mpiohd300,sansafuzeplus: "3-D Enhancement" 12468 gigabeats,mpiohd200,mpiohd300,sansafuzeplus,creativezenxfi2,creativezenxfi3: "3-D Enhancement"
12469 </source> 12469 </source>
12470 <dest> 12470 <dest>
12471 *: none 12471 *: none
12472 gigabeats,mpiohd200,mpiohd300,sansafuzeplus: "3-D Enhancement" 12472 gigabeats,mpiohd200,mpiohd300,sansafuzeplus,creativezenxfi2,creativezenxfi3: "3-D Enhancement"
12473 </dest> 12473 </dest>
12474 <voice> 12474 <voice>
12475 *: none 12475 *: none
12476 gigabeats,mpiohd200,mpiohd300,sansafuzeplus: "3-D Enhancement" 12476 gigabeats,mpiohd200,mpiohd300,sansafuzeplus,creativezenxfi2,creativezenxfi3: "3-D Enhancement"
12477 </voice> 12477 </voice>
12478</phrase> 12478</phrase>
12479<phrase> 12479<phrase>
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index cd863fafcb..8a5ff2fcdf 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -240,10 +240,16 @@
240#define BATTERY_ON_TXT "SELECT - start" 240#define BATTERY_ON_TXT "SELECT - start"
241#define BATTERY_OFF_TXT "POWER" 241#define BATTERY_OFF_TXT "POWER"
242 242
243#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
244#define BATTERY_ON BUTTON_PLAY
245#define BATTERY_OFF BUTTON_POWER
246#define BATTERY_ON_TXT "PLAY - start"
247
243#elif (CONFIG_KEYPAD == HM60X_PAD) || (CONFIG_KEYPAD == HM801_PAD) 248#elif (CONFIG_KEYPAD == HM60X_PAD) || (CONFIG_KEYPAD == HM801_PAD)
244#define BATTERY_ON BUTTON_SELECT 249#define BATTERY_ON BUTTON_SELECT
245#define BATTERY_OFF BUTTON_POWER 250#define BATTERY_OFF BUTTON_POWER
246#define BATTERY_ON_TXT "SELECT - start" 251#define BATTERY_ON_TXT "SELECT - start"
252
247#define BATTERY_OFF_TXT "POWER" 253#define BATTERY_OFF_TXT "POWER"
248 254
249#else 255#else
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c
index 9505668d7f..b351955e9c 100644
--- a/apps/plugins/lib/pluginlib_actions.c
+++ b/apps/plugins/lib/pluginlib_actions.c
@@ -118,6 +118,7 @@ const struct button_mapping pla_main_ctx[] =
118 || (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD) \ 118 || (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD) \
119 || (CONFIG_KEYPAD == SANSA_CONNECT_PAD) \ 119 || (CONFIG_KEYPAD == SANSA_CONNECT_PAD) \
120 || (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD) \ 120 || (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD) \
121 || (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD) \
121 || (CONFIG_KEYPAD == HM60X_PAD) \ 122 || (CONFIG_KEYPAD == HM60X_PAD) \
122 || (CONFIG_KEYPAD == HM801_PAD)) 123 || (CONFIG_KEYPAD == HM801_PAD))
123 { PLA_UP, BUTTON_UP, BUTTON_NONE }, 124 { PLA_UP, BUTTON_UP, BUTTON_NONE },
@@ -417,6 +418,12 @@ const struct button_mapping pla_main_ctx[] =
417 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE}, 418 {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
418 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT}, 419 {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
419 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE}, 420 {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
421#elif (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD)
422 {PLA_CANCEL, BUTTON_VOL_DOWN, BUTTON_NONE},
423 {PLA_EXIT, BUTTON_POWER, BUTTON_NONE},
424 {PLA_SELECT, BUTTON_VOL_UP, BUTTON_NONE},
425 {PLA_SELECT_REL, BUTTON_VOL_UP|BUTTON_REL, BUTTON_VOL_UP},
426 {PLA_SELECT_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
420#else 427#else
421# ifndef HAVE_TOUCHSCREEN 428# ifndef HAVE_TOUCHSCREEN
422# error pluginlib_actions: No actions defined 429# error pluginlib_actions: No actions defined
diff --git a/firmware/SOURCES b/firmware/SOURCES
index c81ecf3294..f6d7c2b69f 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -332,6 +332,9 @@ drivers/tuner/ipod_remote_tuner.c
332#if (CONFIG_TUNER & RDA5802) 332#if (CONFIG_TUNER & RDA5802)
333drivers/tuner/rda5802.c 333drivers/tuner/rda5802.c
334#endif /* (CONFIG_TUNER & RDA5802) */ 334#endif /* (CONFIG_TUNER & RDA5802) */
335#if (CONFIG_TUNER & STFM1000)
336drivers/tuner/stfm1000.c
337#endif /* (CONFIG_TUNER & STFM1000) */
335#if defined(HAVE_RDS_CAP) 338#if defined(HAVE_RDS_CAP)
336drivers/rds.c 339drivers/rds.c
337#endif /* HAVE_RDS_CAP */ 340#endif /* HAVE_RDS_CAP */
@@ -504,8 +507,12 @@ target/arm/imx233/clkctrl-imx233.c
504target/arm/imx233/system-imx233.c 507target/arm/imx233/system-imx233.c
505target/arm/imx233/timrot-imx233.c 508target/arm/imx233/timrot-imx233.c
506target/arm/imx233/kernel-imx233.c 509target/arm/imx233/kernel-imx233.c
510# if (CONFIG_STORAGE & STORAGE_SD)
507target/arm/imx233/sd-imx233.c 511target/arm/imx233/sd-imx233.c
512# endif
513# if (CONFIG_STORAGE & STORAGE_MMC)
508target/arm/imx233/mmc-imx233.c 514target/arm/imx233/mmc-imx233.c
515# endif
509target/arm/imx233/partitions-imx233.c 516target/arm/imx233/partitions-imx233.c
510target/arm/imx233/ssp-imx233.c 517target/arm/imx233/ssp-imx233.c
511target/arm/imx233/dma-imx233.c 518target/arm/imx233/dma-imx233.c
@@ -1124,6 +1131,33 @@ target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c
1124target/arm/tms320dm320/creative-zvm/usb-creativezvm.c 1131target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
1125#endif /* CREATIVE_ZVx */ 1132#endif /* CREATIVE_ZVx */
1126 1133
1134#ifdef CREATIVE_ZENXFI2
1135target/arm/imx233/creative-zenxfi2/backlight-zenxfi2.c
1136target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
1137target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
1138target/arm/imx233/creative-zenxfi2/debug-zenxfi2.c
1139target/arm/imx233/creative-zenxfi2/power-zenxfi2.c
1140target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c
1141target/arm/imx233/creative-zenxfi2/powermgmt-zenxfi2.c
1142#ifndef BOOTLOADER
1143target/arm/imx233/creative-zenxfi2/audio-zenxfi2.c
1144#endif
1145#endif
1146
1147#ifdef CREATIVE_ZENXFI3
1148drivers/mpr121.c
1149target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c
1150target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
1151target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
1152target/arm/imx233/creative-zenxfi3/debug-zenxfi3.c
1153target/arm/imx233/creative-zenxfi3/power-zenxfi3.c
1154target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c
1155target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
1156#ifndef BOOTLOADER
1157target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c
1158#endif
1159#endif
1160
1127#ifdef SANSA_CONNECT 1161#ifdef SANSA_CONNECT
1128drivers/lcd-memframe.c 1162drivers/lcd-memframe.c
1129target/arm/tms320dm320/sdmmc-dm320.c 1163target/arm/tms320dm320/sdmmc-dm320.c
diff --git a/firmware/export/config.h b/firmware/export/config.h
index e17b152e39..f654609966 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -145,6 +145,8 @@
145#define HM801_PAD 51 145#define HM801_PAD 51
146#define SANSA_CONNECT_PAD 52 146#define SANSA_CONNECT_PAD 52
147#define SAMSUNG_YPR0_PAD 53 147#define SAMSUNG_YPR0_PAD 53
148#define CREATIVE_ZENXFI2_PAD 54
149#define CREATIVE_ZENXFI3_PAD 55
148 150
149/* CONFIG_REMOTE_KEYPAD */ 151/* CONFIG_REMOTE_KEYPAD */
150#define H100_REMOTE 1 152#define H100_REMOTE 1
@@ -244,6 +246,8 @@
244#define LCD_CONNECT 45 /* as used by the Sandisk Sansa Connect */ 246#define LCD_CONNECT 45 /* as used by the Sandisk Sansa Connect */
245#define LCD_GIGABEATS 46 247#define LCD_GIGABEATS 46
246#define LCD_YPR0 47 248#define LCD_YPR0 47
249#define LCD_CREATIVEZXFI2 48 /* as used by the Creative Zen X-Fi2 */
250#define LCD_CREATIVEZXFI3 49 /* as used by the Creative Zen X-Fi3 */
247 251
248/* LCD_PIXELFORMAT */ 252/* LCD_PIXELFORMAT */
249#define HORIZONTAL_PACKING 1 253#define HORIZONTAL_PACKING 1
@@ -417,6 +421,10 @@ Lyre prototype 1 */
417#include "config/zenvisionm60gb.h" 421#include "config/zenvisionm60gb.h"
418#elif defined(CREATIVE_ZV) 422#elif defined(CREATIVE_ZV)
419#include "config/zenvision.h" 423#include "config/zenvision.h"
424#elif defined(CREATIVE_ZENXFI2)
425#include "config/creativezenxfi2.h"
426#elif defined(CREATIVE_ZENXFI3)
427#include "config/creativezenxfi3.h"
420#elif defined(PHILIPS_SA9200) 428#elif defined(PHILIPS_SA9200)
421#include "config/gogearsa9200.h" 429#include "config/gogearsa9200.h"
422#elif defined(PHILIPS_HDD1630) 430#elif defined(PHILIPS_HDD1630)
diff --git a/firmware/export/config/creativezenxfi2.h b/firmware/export/config/creativezenxfi2.h
new file mode 100644
index 0000000000..432d7949d3
--- /dev/null
+++ b/firmware/export/config/creativezenxfi2.h
@@ -0,0 +1,202 @@
1/*
2 * This config file is for the Creative Zen X-Fi2
3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
6/* For Rolo and boot loader */
7#define MODEL_NUMBER 82
8#define MODEL_NAME "Creative Zen X-Fi2"
9
10#define HW_SAMPR_CAPS SAMPR_CAP_ALL
11
12/* define this if you have recording possibility */
13#define HAVE_RECORDING
14
15#define REC_SAMPR_CAPS SAMPR_CAP_ALL
16
17/* Default recording levels */
18#define DEFAULT_REC_MIC_GAIN 23
19#define DEFAULT_REC_LEFT_GAIN 23
20#define DEFAULT_REC_RIGHT_GAIN 23
21
22/* Define bitmask of input sources - recordable bitmask can be defined
23 explicitly if different */
24#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
25
26/* define this if you have a bitmap LCD display */
27#define HAVE_LCD_BITMAP
28/* define this if you have a colour LCD */
29#define HAVE_LCD_COLOR
30
31#ifndef BOOTLOADER
32#define HAVE_ALBUMART
33
34/* define this to enable bitmap scaling */
35#define HAVE_BMP_SCALING
36
37/* define this to enable JPEG decoding */
38#define HAVE_JPEG
39
40/* Define this if a programmable hotkey is mapped */
41#define HAVE_HOTKEY
42
43/* define this if you have access to the quickscreen */
44#define HAVE_QUICKSCREEN
45
46/* define this if you have access to the pitchscreen */
47#define HAVE_PITCHSCREEN
48
49/* define this if you would like tagcache to build on this target */
50#define HAVE_TAGCACHE
51
52/* define this if the target has volume keys which can be used in the lists */
53#define HAVE_VOLUME_IN_LIST
54
55/* define this if you have LCD enable function */
56#define HAVE_LCD_ENABLE
57
58/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
59 should be defined as well.
60#define HAVE_LCD_SLEEP
61#define HAVE_LCD_SLEEP_SETTING
62*/
63
64/* define this if you can flip your LCD
65#define HAVE_LCD_FLIP
66*/
67
68/* define this if you can invert the colours on your LCD
69#define HAVE_LCD_INVERT
70*/
71
72/* define this if you have a real-time clock */
73#define CONFIG_RTC RTC_IMX233
74
75/* define this if you have a real-time clock with alarm facilities */
76#define HAVE_RTC_ALARM
77
78#endif /* !BOOTLOADER */
79
80/* define this if you have an i.MX23 codec */
81#define HAVE_IMX233_CODEC
82
83#define CONFIG_TUNER STFM1000
84
85/* There is no hardware tone control */
86#define HAVE_SW_TONE_CONTROLS
87
88#define CONFIG_KEYPAD CREATIVE_ZENXFI2_PAD
89#define HAVE_TOUCHSCREEN
90#define HAVE_BUTTON_DATA
91
92/* Define this to enable morse code input */
93#define HAVE_MORSE_INPUT
94
95/* Define this if you do software codec */
96#define CONFIG_CODEC SWCODEC
97
98/* LCD dimensions */
99#define LCD_WIDTH 240
100#define LCD_HEIGHT 400
101#define LCD_DEPTH 16 /* 65536 colours */
102#define LCD_PIXELFORMAT RGB565 /* rgb565 */
103#define LCD_DPI 150
104
105/* Define this if you have a software controlled poweroff */
106#define HAVE_SW_POWEROFF
107
108/* Some Sansa Fuzes seem to be FAT16 formatted */
109#define HAVE_FAT16SUPPORT
110
111/* The number of bytes reserved for loadable codecs */
112#define CODEC_SIZE 0x100000
113
114/* The number of bytes reserved for loadable plugins */
115#define PLUGIN_BUFFER_SIZE 0x80000
116
117#define AB_REPEAT_ENABLE
118
119/* Define this for LCD backlight available */
120#define HAVE_BACKLIGHT
121#define HAVE_BACKLIGHT_BRIGHTNESS
122
123/* Main LCD backlight brightness range and defaults */
124#define MIN_BRIGHTNESS_SETTING 0
125#define MAX_BRIGHTNESS_SETTING 100
126#define DEFAULT_BRIGHTNESS_SETTING 50
127
128/* Which backlight fading type? */
129#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
130
131/* define this if you have a flash memory storage */
132#define HAVE_FLASH_STORAGE
133
134/* define this if the flash memory uses the SecureDigital Memory Card protocol */
135#define CONFIG_STORAGE (/*STORAGE_NAND |*/ STORAGE_SD)
136#define NUM_DRIVES 1
137#define HAVE_MULTIDRIVE
138#define HAVE_MULTIVOLUME
139#define HAVE_HOTSWAP_STORAGE_AS_MAIN
140#define HAVE_HOTSWAP
141#define CONFIG_NAND NAND_IMX233
142
143/* todo */
144#define BATTERY_CAPACITY_DEFAULT 550 /* default battery capacity */
145#define BATTERY_CAPACITY_MIN 550 /* min. capacity selectable */
146#define BATTERY_CAPACITY_MAX 550 /* max. capacity selectable */
147#define BATTERY_CAPACITY_INC 0 /* capacity increment */
148#define BATTERY_TYPES_COUNT 1 /* only one type */
149
150#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
151
152/* Charging implemented in a target-specific algorithm */
153#define CONFIG_CHARGING CHARGING_TARGET
154
155/* define this if the unit can be powered or charged via USB */
156#define HAVE_USB_POWER
157
158/* Define this if you have an IMX233*/
159#define CONFIG_CPU IMX233
160
161/* Define this if you want to use the IMX233 i2c interface */
162#define CONFIG_I2C I2C_IMX233
163
164/* define current usage levels (based on battery bench) */
165#define CURRENT_NORMAL 35
166#define CURRENT_BACKLIGHT 30
167#define CURRENT_RECORD CURRENT_NORMAL
168
169/* maximum charging current */
170#define CURRENT_MAX_CHG 200
171
172/* Define this to the CPU frequency */
173#define CPU_FREQ 454000000
174
175/* Type of LCD */
176#define CONFIG_LCD LCD_CREATIVEZXFI2
177
178/* Offset ( in the firmware file's header ) to the file CRC and data. These are
179 only used when loading the old format rockbox.e200 file */
180#define FIRMWARE_OFFSET_FILE_CRC 0x0
181#define FIRMWARE_OFFSET_FILE_DATA 0x8
182
183/* USB On-the-go */
184#define CONFIG_USBOTG USBOTG_ARC
185
186/* enable these for the experimental usb stack */
187#define HAVE_USBSTACK
188//#define USB_HANDLED_BY_OF
189#define USE_ROCKBOX_USB
190#define USB_VENDOR_ID 0x041e
191#define USB_PRODUCT_ID 0x2020
192#define HAVE_USB_HID_MOUSE
193#define HAVE_BOOTLOADER_USB_MODE
194
195/* Define this if you have adjustable CPU frequency */
196#define HAVE_ADJUSTABLE_CPU_FREQ
197
198#define BOOTFILE_EXT "creative"
199#define BOOTFILE "rockbox." BOOTFILE_EXT
200#define BOOTDIR "/.rockbox"
201
202#define INCLUDE_TIMEOUT_API
diff --git a/firmware/export/config/creativezenxfi3.h b/firmware/export/config/creativezenxfi3.h
new file mode 100644
index 0000000000..61ee9ed4bf
--- /dev/null
+++ b/firmware/export/config/creativezenxfi3.h
@@ -0,0 +1,208 @@
1/*
2 * This config file is for the Creative Zen X-Fi3
3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
6/* For Rolo and boot loader */
7#define MODEL_NUMBER 83
8#define MODEL_NAME "Creative Zen X-Fi3"
9
10#define HW_SAMPR_CAPS SAMPR_CAP_ALL
11
12/* define this if you have recording possibility */
13#define HAVE_RECORDING
14
15#define REC_SAMPR_CAPS SAMPR_CAP_ALL
16
17/* Default recording levels */
18#define DEFAULT_REC_MIC_GAIN 23
19#define DEFAULT_REC_LEFT_GAIN 23
20#define DEFAULT_REC_RIGHT_GAIN 23
21
22/* Define bitmask of input sources - recordable bitmask can be defined
23 explicitly if different */
24#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
25
26/* define this if you have a bitmap LCD display */
27#define HAVE_LCD_BITMAP
28/* define this if you have a colour LCD */
29#define HAVE_LCD_COLOR
30
31#ifndef BOOTLOADER
32#define HAVE_ALBUMART
33
34/* define this to enable bitmap scaling */
35#define HAVE_BMP_SCALING
36
37/* define this to enable JPEG decoding */
38#define HAVE_JPEG
39
40/* Define this if a programmable hotkey is mapped */
41#define HAVE_HOTKEY
42
43/* define this if you have access to the quickscreen */
44#define HAVE_QUICKSCREEN
45
46/* define this if you have a light associated with the buttons */
47#define HAVE_BUTTON_LIGHT
48#define HAVE_BUTTONLIGHT_BRIGHTNESS
49
50/* define this if you have access to the pitchscreen */
51#define HAVE_PITCHSCREEN
52
53/* define this if you would like tagcache to build on this target */
54#define HAVE_TAGCACHE
55
56/* define this if the target has volume keys which can be used in the lists */
57#define HAVE_VOLUME_IN_LIST
58
59/* define this if you have LCD enable function */
60#define HAVE_LCD_ENABLE
61
62/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
63 should be defined as well.
64#define HAVE_LCD_SLEEP
65#define HAVE_LCD_SLEEP_SETTING
66*/
67
68/* define this if you can flip your LCD
69#define HAVE_LCD_FLIP
70*/
71
72/* define this if you can invert the colours on your LCD
73#define HAVE_LCD_INVERT
74*/
75
76/* define this if you have a real-time clock */
77#define CONFIG_RTC RTC_IMX233
78
79/* define this if you have a real-time clock with alarm facilities */
80#define HAVE_RTC_ALARM
81
82#endif /* !BOOTLOADER */
83
84/* define this if you have an i.MX23 codec */
85#define HAVE_IMX233_CODEC
86
87#define CONFIG_TUNER STFM1000
88
89/* There is no hardware tone control */
90#define HAVE_SW_TONE_CONTROLS
91
92#define CONFIG_KEYPAD CREATIVE_ZENXFI3_PAD
93
94/* Define this to enable morse code input */
95#define HAVE_MORSE_INPUT
96
97/* Define this if you do software codec */
98#define CONFIG_CODEC SWCODEC
99
100/* LCD dimensions */
101#define LCD_WIDTH 176
102#define LCD_HEIGHT 220
103#define LCD_DEPTH 16 /* 65536 colours */
104#define LCD_PIXELFORMAT RGB565 /* rgb565 */
105
106/* Define this if you have a software controlled poweroff */
107#define HAVE_SW_POWEROFF
108
109/* Some Sansa Fuzes seem to be FAT16 formatted */
110#define HAVE_FAT16SUPPORT
111
112/* The number of bytes reserved for loadable codecs */
113#define CODEC_SIZE 0x100000
114
115/* The number of bytes reserved for loadable plugins */
116#define PLUGIN_BUFFER_SIZE 0x80000
117
118#define AB_REPEAT_ENABLE
119
120/* Define this for LCD backlight available */
121#define HAVE_BACKLIGHT
122#define HAVE_BACKLIGHT_BRIGHTNESS
123
124/* Main LCD backlight brightness range and defaults */
125#define MIN_BRIGHTNESS_SETTING 0
126#define MAX_BRIGHTNESS_SETTING 100
127#define DEFAULT_BRIGHTNESS_SETTING 50
128
129/* Which backlight fading type? */
130#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
131
132/* define this if you have a flash memory storage */
133#define HAVE_FLASH_STORAGE
134
135/* define this if the flash memory uses the SecureDigital Memory Card protocol */
136#define CONFIG_STORAGE STORAGE_SD
137#define NUM_DRIVES 2
138#define HAVE_MULTIDRIVE
139#define HAVE_MULTIVOLUME
140#define HAVE_HOTSWAP
141
142/* Extra threads: touchpad */
143#define TARGET_EXTRA_THREADS 1
144
145/* todo */
146#define BATTERY_CAPACITY_DEFAULT 550 /* default battery capacity */
147#define BATTERY_CAPACITY_MIN 550 /* min. capacity selectable */
148#define BATTERY_CAPACITY_MAX 550 /* max. capacity selectable */
149#define BATTERY_CAPACITY_INC 0 /* capacity increment */
150#define BATTERY_TYPES_COUNT 1 /* only one type */
151
152#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
153
154/* Charging implemented in a target-specific algorithm */
155#define CONFIG_CHARGING CHARGING_TARGET
156
157/* define this if the unit can be powered or charged via USB */
158#define HAVE_USB_POWER
159
160/* Define this if you have an IMX233*/
161#define CONFIG_CPU IMX233
162
163/* Define this if you want to use the IMX233 i2c interface */
164#define CONFIG_I2C I2C_IMX233
165
166/* define current usage levels (based on battery bench) */
167#define CURRENT_NORMAL 35
168#define CURRENT_BACKLIGHT 30
169#define CURRENT_RECORD CURRENT_NORMAL
170
171/* maximum charging current */
172#define CURRENT_MAX_CHG 200
173
174/* Define this to the CPU frequency */
175#define CPU_FREQ 454000000
176
177/* Type of LCD */
178#define CONFIG_LCD LCD_CREATIVEZXFI3
179
180/* Offset ( in the firmware file's header ) to the file CRC and data. These are
181 only used when loading the old format rockbox.e200 file */
182#define FIRMWARE_OFFSET_FILE_CRC 0x0
183#define FIRMWARE_OFFSET_FILE_DATA 0x8
184
185/* USB On-the-go */
186#define CONFIG_USBOTG USBOTG_ARC
187
188/* enable these for the experimental usb stack */
189#define HAVE_USBSTACK
190//#define USB_HANDLED_BY_OF
191#define USE_ROCKBOX_USB
192#define USB_VENDOR_ID 0x041e
193#define USB_PRODUCT_ID 0x2020
194#define HAVE_USB_HID_MOUSE
195#define HAVE_BOOTLOADER_USB_MODE
196
197/* The fuze+ actually interesting partition table does not use 512-byte sector
198 * (usually 2048 logical sector size) */
199#define MAX_LOG_SECTOR_SIZE 2048
200
201/* Define this if you have adjustable CPU frequency */
202#define HAVE_ADJUSTABLE_CPU_FREQ
203
204#define BOOTFILE_EXT "creative"
205#define BOOTFILE "rockbox." BOOTFILE_EXT
206#define BOOTDIR "/.rockbox"
207
208#define INCLUDE_TIMEOUT_API
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/adc-target.h b/firmware/target/arm/imx233/creative-zenxfi2/adc-target.h
new file mode 100644
index 0000000000..79b281b892
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/adc-target.h
@@ -0,0 +1,32 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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 5
25
26#define ADC_BATTERY 0
27#define ADC_DIE_TEMP 1
28#define ADC_VDDIO 2
29#define ADC_5V 3
30#define ADC_BATT_TEMP 4
31
32#endif
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c
new file mode 100644
index 0000000000..50ed498cc6
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c
@@ -0,0 +1,40 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
24int imx233_adc_mapping[] =
25{
26 [ADC_BATTERY] = IMX233_ADC_BATTERY,
27 [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP,
28 [ADC_VDDIO] = IMX233_ADC_VDDIO,
29 [ADC_5V] = HW_LRADC_CHANNEL_5V,
30 [ADC_BATT_TEMP] = IMX233_ADC_BATT_TEMP,
31};
32
33const char *imx233_adc_channel_name[] =
34{
35 "Battery(raw)",
36 "Die temperature(°C)",
37 "VddIO",
38 "Vdd5V",
39 "Battery temperature(raw)",
40};
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/audio-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/audio-zenxfi2.c
new file mode 100644
index 0000000000..810f1c156f
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/audio-zenxfi2.c
@@ -0,0 +1,55 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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 "system.h"
23#include "audiohw.h"
24#include "audio.h"
25#include "audioout-imx233.h"
26#include "audioin-imx233.h"
27
28static int input_source = AUDIO_SRC_PLAYBACK;
29static unsigned input_flags = 0;
30static int output_source = AUDIO_SRC_PLAYBACK;
31
32static void select_audio_path(void)
33{
34 if(input_source == AUDIO_SRC_PLAYBACK)
35 imx233_audioout_select_hp_input(false);
36 else
37 imx233_audioout_select_hp_input(true);
38}
39
40void audio_input_mux(int source, unsigned flags)
41{
42 (void) source;
43 (void) flags;
44 input_source = source;
45 input_flags = flags;
46 select_audio_path();
47}
48
49void audio_set_output_source(int source)
50{
51 (void) source;
52 output_source = source;
53 select_audio_path();
54}
55
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/backlight-target.h b/firmware/target/arm/imx233/creative-zenxfi2/backlight-target.h
new file mode 100644
index 0000000000..e3766965d8
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/backlight-target.h
@@ -0,0 +1,29 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
24bool _backlight_init(void);
25void _backlight_on(void);
26void _backlight_off(void);
27void _backlight_set_brightness(int brightness);
28
29#endif /* BACKLIGHT_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/backlight-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/backlight-zenxfi2.c
new file mode 100644
index 0000000000..8fcdd8ba32
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/backlight-zenxfi2.c
@@ -0,0 +1,58 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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 "lcd.h"
25#include "backlight.h"
26#include "backlight-target.h"
27#include "pwm-imx233.h"
28
29void _backlight_set_brightness(int brightness)
30{
31 imx233_pwm_setup_channel(4, 1024, HW_PWM_PERIODx__CDIV__DIV_1,
32 0, HW_PWM_PERIODx__STATE__HIGH,
33 (brightness * 1024) / 100, HW_PWM_PERIODx__STATE__LOW);
34 imx233_pwm_enable_channel(4, true);
35}
36
37bool _backlight_init(void)
38{
39 _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
40 return true;
41}
42
43void _backlight_on(void)
44{
45#ifdef HAVE_LCD_ENABLE
46 lcd_enable(true); /* power on lcd + visible display */
47#endif
48 /* don't do anything special, the core will set the brightness */
49}
50
51void _backlight_off(void)
52{
53 /* there is no real on/off but we can set to 0 brightness */
54 _backlight_set_brightness(0);
55#ifdef HAVE_LCD_ENABLE
56 lcd_enable(false); /* power off visible display */
57#endif
58}
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/button-target.h b/firmware/target/arm/imx233/creative-zenxfi2/button-target.h
new file mode 100644
index 0000000000..8f4cda85d8
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/button-target.h
@@ -0,0 +1,59 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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#include "config.h"
26
27void button_init_device(void);
28int button_read_device(int *data);
29bool button_debug_screen(void);
30
31/* Main unit's buttons */
32#define BUTTON_POWER 0x00000001
33#define BUTTON_MENU 0x00000002
34/* For compatibility */
35#define BUTTON_LEFT BUTTON_MIDLEFT
36#define BUTTON_RIGHT BUTTON_MIDRIGHT
37#define BUTTON_UP BUTTON_TOPMIDDLE
38#define BUTTON_DOWN BUTTON_BOTTOMMIDDLE
39
40/* Touch Screen Area Buttons */
41#define BUTTON_TOPLEFT 0x00000010
42#define BUTTON_TOPMIDDLE 0x00000020
43#define BUTTON_TOPRIGHT 0x00000040
44#define BUTTON_MIDLEFT 0x00000080
45#define BUTTON_CENTER 0x00000100
46#define BUTTON_MIDRIGHT 0x00000200
47#define BUTTON_BOTTOMLEFT 0x00000400
48#define BUTTON_BOTTOMMIDDLE 0x00000800
49#define BUTTON_BOTTOMRIGHT 0x00001000
50
51#define BUTTON_MAIN 0x1fff
52
53#define BUTTON_REMOTE 0
54
55/* Software power-off */
56#define POWEROFF_BUTTON BUTTON_POWER
57#define POWEROFF_COUNT 10
58
59#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
new file mode 100644
index 0000000000..d6a4209292
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
@@ -0,0 +1,119 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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 "string.h"
27#include "usb.h"
28#include "touchscreen.h"
29#include "touchscreen-imx233.h"
30
31struct touch_calibration_point
32{
33 short px_x; /* known pixel value */
34 short px_y;
35 short val_x; /* touchscreen value at the known pixel */
36 short val_y;
37};
38
39static struct touch_calibration_point topleft, bottomright;
40
41/* Amaury Pouly: values on my device
42 * Portait: (x and y are swapped)
43 * (0,0) = 200, 300
44 * (240,400) = 3900, 3800
45 * Landscape:
46 * (0,0) = 200, 3800
47 * (400,240) = 3900, 300
48*/
49void button_init_device(void)
50{
51#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
52 topleft.val_x = 300;
53 topleft.val_y = 200;
54
55 bottomright.val_x = 3800;
56 bottomright.val_y = 3900;
57#else
58 topleft.val_x = 300;
59 topleft.val_y = 3900;
60
61 bottomright.val_x = 3800;
62 bottomright.val_y = 200;
63#endif
64 topleft.px_x = 0;
65 topleft.px_y = 0;
66
67 bottomright.px_x = LCD_WIDTH;
68 bottomright.px_y = LCD_HEIGHT;
69
70 imx233_touchscreen_init();
71 imx233_touchscreen_enable(true);
72}
73
74static int touch_to_pixels(int *val_x, int *val_y)
75{
76 short x,y;
77
78#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
79 x = *val_y;
80 y = *val_x;
81#else
82 x = *val_x;
83 y = *val_y;
84#endif
85
86 x = (x - topleft.val_x) * (bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x;
87 y = (y - topleft.val_y) * (bottomright.px_y - topleft.px_y) / (bottomright.val_y - topleft.val_y) + topleft.px_y;
88
89 x = MAX(0, MIN(x, LCD_WIDTH - 1));
90 y = MAX(0, MIN(y, LCD_HEIGHT - 1));
91
92 *val_x = x;
93 *val_y = y;
94
95 return (x<<16)|y;
96}
97
98static int touchscreen_read_device(int *data)
99{
100 int x, y;
101 if(!imx233_touchscreen_get_touch(&x, &y))
102 return 0;
103 if(data)
104 *data = touch_to_pixels(&x, &y);
105 return touchscreen_to_pixels(x, y, data);
106}
107
108int button_read_device(int *data)
109{
110 int res = 0;
111 /* B0P11: #power
112 * B0P14: #select */
113 uint32_t mask = imx233_get_gpio_input_mask(0, 0x4800);
114 if(!(mask & 0x800))
115 res |= BUTTON_POWER;
116 if(!(mask & 0x4000))
117 res |= BUTTON_MENU;
118 return res | touchscreen_read_device(data);
119}
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/debug-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/debug-zenxfi2.c
new file mode 100644
index 0000000000..a18704243e
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/debug-zenxfi2.c
@@ -0,0 +1,28 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
25bool dbg_hw_target_info(void)
26{
27 return false;
28}
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/lcd-target.h b/firmware/target/arm/imx233/creative-zenxfi2/lcd-target.h
new file mode 100644
index 0000000000..5c1ecdd406
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/lcd-target.h
@@ -0,0 +1,24 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2011 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#endif /* LCD_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
new file mode 100644
index 0000000000..277c7120e1
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
@@ -0,0 +1,512 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2011 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 "logf.h"
31
32#ifdef HAVE_LCD_ENABLE
33static bool lcd_on;
34#endif
35static unsigned lcd_yuv_options = 0;
36
37static void setup_parameters(void)
38{
39 imx233_lcdif_reset();
40 imx233_lcdif_set_lcd_databus_width(HW_LCDIF_CTRL__LCD_DATABUS_WIDTH_18_BIT);
41 imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_18_BIT);
42 imx233_lcdif_set_timings(2, 2, 3, 3);
43}
44
45static void setup_lcd_pins(bool use_lcdif)
46{
47 if(use_lcdif)
48 {
49 imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_MAIN); /* lcd_vsync */
50 imx233_set_pin_function(1, 21, PINCTRL_FUNCTION_MAIN); /* lcd_cs */
51 imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_MAIN); /* lcd_dotclk */
52 imx233_set_pin_function(1, 23, PINCTRL_FUNCTION_MAIN); /* lcd_enable */
53 imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_MAIN); /* lcd_hsync */
54 imx233_set_pin_function(1, 18, PINCTRL_FUNCTION_MAIN); /* lcd_reset */
55 imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_MAIN); /* lcd_rs */
56 imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_MAIN); /* lcd_d16 */
57 imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_MAIN); /* lcd_d17 */
58 imx233_set_pin_function(1, 20, PINCTRL_FUNCTION_MAIN); /* lcd_wr */
59 __REG_CLR(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */
60 }
61 else
62 {
63 __REG_SET(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */
64 imx233_enable_gpio_output_mask(1, 0x3ffffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,dotclk,enable,hsync,vsync} */
65 imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */
66 imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */
67 imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */
68 imx233_set_pin_function(1, 20, PINCTRL_FUNCTION_GPIO); /* lcd_wr */
69 imx233_set_pin_function(1, 21, PINCTRL_FUNCTION_GPIO); /* lcd_cs */
70 imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO); /* lcd_dotclk */
71 imx233_set_pin_function(1, 23, PINCTRL_FUNCTION_GPIO); /* lcd_enable */
72 imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO); /* lcd_hsync */
73 imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */
74 }
75}
76
77static void common_lcd_enable(bool enable)
78{
79 imx233_lcdif_enable(enable);
80 setup_lcd_pins(enable); /* use GPIO pins when disable */
81}
82
83static void setup_lcdif(void)
84{
85 setup_parameters();
86 common_lcd_enable(true);
87 imx233_lcdif_enable_bus_master(true);
88}
89
90static inline uint32_t encode_16_to_18(uint32_t a)
91{
92 return ((a & 0xff) << 1) | (((a >> 8) & 0xff) << 10);
93}
94
95static inline uint32_t decode_18_to_16(uint32_t a)
96{
97 return ((a >> 1) & 0xff) | ((a >> 2) & 0xff00);
98}
99
100static void setup_lcdif_clock(void)
101{
102 /* the LCD seems to work at 24Mhz, so use the xtal clock with no divider */
103 imx233_clkctrl_enable_clock(CLK_PIX, false);
104 imx233_clkctrl_set_clock_divisor(CLK_PIX, 1);
105 imx233_clkctrl_set_bypass_pll(CLK_PIX, true); /* use XTAL */
106 imx233_clkctrl_enable_clock(CLK_PIX, true);
107}
108
109static void lcd_write_reg(uint32_t reg, uint32_t data)
110{
111 uint32_t old_reg = reg;
112 /* get back to 18-bit word length */
113 imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_18_BIT);
114 reg = encode_16_to_18(reg);
115 data = encode_16_to_18(data);
116
117 imx233_lcdif_pio_send(false, 2, &reg);
118 if(old_reg != 0 && old_reg != 0x202)
119 imx233_lcdif_pio_send(true, 2, &data);
120}
121
122#define REG_MDELAY 0xffffffff
123struct lcd_sequence_entry_t
124{
125 uint32_t reg, data;
126};
127
128static void lcd_send_sequence(struct lcd_sequence_entry_t *seq, unsigned count)
129{
130 for(;count-- > 0; seq++)
131 {
132 if(seq->reg == REG_MDELAY)
133 mdelay(seq->data);
134 else
135 lcd_write_reg(seq->reg, seq->data);
136 }
137}
138
139#define _begin_seq() static struct lcd_sequence_entry_t __seq[] = {
140#define _mdelay(a) {REG_MDELAY, a},
141#define _lcd_write_reg(a, b) {a, b},
142#define _end_seq() }; lcd_send_sequence(__seq, sizeof(__seq) / sizeof(__seq[0]));
143
144static void lcd_init_seq(void)
145{
146 _begin_seq()
147 _lcd_write_reg(0, 0)
148 _lcd_write_reg(0, 0)
149 _lcd_write_reg(0, 0)
150 _lcd_write_reg(0, 0)
151 _mdelay(100)
152 _lcd_write_reg(8, 0x808)
153 _lcd_write_reg(0x10, 0x10)
154 _lcd_write_reg(0x400, 0x6200)
155 _lcd_write_reg(0x300, 0xc0a)
156 _lcd_write_reg(0x301, 0x4c11)
157 _lcd_write_reg(0x302, 0x906)
158 _lcd_write_reg(0x303, 0x1417)
159 _lcd_write_reg(0x304, 0x3333)
160 _lcd_write_reg(0x305, 0x150d)
161 _lcd_write_reg(0x306, 0x740a)
162 _lcd_write_reg(0x307, 0x100c)
163 _lcd_write_reg(0x308, 0x60c)
164 _lcd_write_reg(0x309, 0)
165 _lcd_write_reg(0x100, 0x730)
166 _lcd_write_reg(0x101, 0x237)
167 _lcd_write_reg(0x103, 0x2b00)
168 _lcd_write_reg(0x280, 0x4000)
169 _lcd_write_reg(0x102, 0x81b0)
170 _mdelay(400)
171 _lcd_write_reg(1, 0x100)
172 _lcd_write_reg(2, 0x100)
173 _lcd_write_reg(3, 0x5028)
174 _lcd_write_reg(9, 1)
175 _lcd_write_reg(0xc, 0)
176 _lcd_write_reg(0x11, 0x202)
177 _lcd_write_reg(0x12, 0x101)
178 _lcd_write_reg(0x13, 1)
179 _lcd_write_reg(0x90, 0x8000)
180 _lcd_write_reg(0x210, 0)
181 _lcd_write_reg(0x211, 0xef)
182 _lcd_write_reg(0x212, 0)
183 _lcd_write_reg(0x213, 0x18f)
184 _lcd_write_reg(0x200, 0)
185 _lcd_write_reg(0x201, 0)
186 _lcd_write_reg(0x401, 1)
187 _lcd_write_reg(0x404, 0)
188 _mdelay(400)
189 _lcd_write_reg(7, 0x100)
190 _mdelay(400)
191 _lcd_write_reg(3, 0x1030)
192 _end_seq()
193}
194
195void lcd_init_device(void)
196{
197 setup_lcdif();
198 setup_lcdif_clock();
199
200 // reset device
201 __REG_SET(HW_LCDIF_CTRL1) = HW_LCDIF_CTRL1__RESET;
202 mdelay(50);
203 __REG_CLR(HW_LCDIF_CTRL1) = HW_LCDIF_CTRL1__RESET;
204 mdelay(10);
205 __REG_SET(HW_LCDIF_CTRL1) = HW_LCDIF_CTRL1__RESET;
206
207 lcd_init_seq();
208#ifdef HAVE_LCD_ENABLE
209 lcd_on = true;
210#endif
211}
212
213#ifdef HAVE_LCD_ENABLE
214bool lcd_active(void)
215{
216 return lcd_on;
217}
218
219static void lcd_enable_seq(bool enable)
220{
221 if(!enable)
222 {
223 _begin_seq()
224 _end_seq()
225 }
226 else
227 {
228 _begin_seq()
229 _end_seq()
230 }
231}
232
233void lcd_enable(bool enable)
234{
235 if(lcd_on == enable)
236 return;
237
238 lcd_on = enable;
239
240 if(enable)
241 common_lcd_enable(true);
242 lcd_enable_seq(enable);
243 if(!enable)
244 common_lcd_enable(false);
245}
246#endif
247
248void lcd_update(void)
249{
250 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
251}
252
253void lcd_update_rect(int x, int y, int w, int h)
254{
255#ifdef HAVE_LCD_ENABLE
256 if(!lcd_on)
257 return;
258#endif
259 /* make sure the rectangle is included in the screen */
260 x = MIN(x, LCD_WIDTH);
261 y = MIN(y, LCD_HEIGHT);
262 w = MIN(w, LCD_WIDTH - x);
263 h = MIN(h, LCD_HEIGHT - y);
264
265 imx233_lcdif_wait_ready();
266 lcd_write_reg(0x210, x);
267 lcd_write_reg(0x211, x + w - 1);
268 lcd_write_reg(0x212, y);
269 lcd_write_reg(0x213, y + h - 1);
270 lcd_write_reg(0x200, 0);
271 lcd_write_reg(0x201, 0);
272 lcd_write_reg(0x202, 0);
273 imx233_lcdif_wait_ready();
274 imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_16_BIT);
275 imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */
276 imx233_lcdif_set_data_format(false, false, false); /* RGB565, don't care, don't care */
277
278 /* there are two cases here:
279 * - either width = LCD_WIDTH and we can directly memcopy a part of lcd_framebuffer to FRAME
280 * and send it
281 * - either width != LCD_WIDTH and we have to build a contiguous copy of the rectangular area
282 * into FRAME before sending it (which is slower and doesn't use the hardware)
283 * In all cases, FRAME just acts as a temporary buffer.
284 * NOTE It's more interesting to do a copy to FRAME in all cases since in system mode
285 * the clock runs at 24MHz which provides barely 10MB/s bandwidth compared to >100MB/s
286 * for memcopy operations
287 */
288 if(w == LCD_WIDTH)
289 {
290 memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
291 }
292 else
293 {
294 for(int i = 0; i < h; i++)
295 memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
296 }
297 /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
298 * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
299 * field must be a multiple of 2. Furthermore, it seems the lcd controller doesn't
300 * really like when both w and h are even, probably because the writes to the GRAM
301 * are done on several words and the controller requires dummy writes.
302 * The workaround is to always make sure that we send a number of pixels which is
303 * a multiple of 4 so that both the lcdif and the controller are happy. If any
304 * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
305 * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
306 */
307 if(w % 2 == 1 || h % 2 == 1)
308 {
309 /* copy three pixel after the last one */
310 for(int i = 0; i < 3; i++)
311 *((fb_data *)FRAME + w * h + i) = *((fb_data *)FRAME + i);
312 /* WARNING we need to update w and h to reflect the pixel count BUT it
313 * has no relation to w * h (it can even be 2 * prime). Hopefully, w <= 240 and
314 * h <= 320 so w * h <= 76800 and (w * h + 3) / 4 <= 38400 which fits into
315 * a 16-bit integer (horizontal count). */
316 h = (w * h + 3) / 4;
317 w = 4;
318 }
319 imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
320}
321
322void lcd_yuv_set_options(unsigned options)
323{
324 lcd_yuv_options = options;
325}
326
327#define YFAC (74)
328#define RVFAC (101)
329#define GUFAC (-24)
330#define GVFAC (-51)
331#define BUFAC (128)
332
333static inline int clamp(int val, int min, int max)
334{
335 if (val < min)
336 val = min;
337 else if (val > max)
338 val = max;
339 return val;
340}
341
342void lcd_blit_yuv(unsigned char * const src[3],
343 int src_x, int src_y, int stride,
344 int x, int y, int width, int height)
345{
346 const unsigned char *ysrc, *usrc, *vsrc;
347 int linecounter;
348 fb_data *dst, *row_end;
349 long z;
350
351 /* width and height must be >= 2 and an even number */
352 width &= ~1;
353 linecounter = height >> 1;
354
355 #if LCD_WIDTH >= LCD_HEIGHT
356 dst = FBADDR(x,y);
357 row_end = dst + width;
358 #else
359 dst = FBADDR(LCD_WIDTH - y - 1,x);
360 row_end = dst + LCD_WIDTH * width;
361 #endif
362
363 z = stride * src_y;
364 ysrc = src[0] + z + src_x;
365 usrc = src[1] + (z >> 2) + (src_x >> 1);
366 vsrc = src[2] + (usrc - src[1]);
367
368 /* stride => amount to jump from end of last row to start of next */
369 stride -= width;
370
371 /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
372
373 do
374 {
375 do
376 {
377 int y, cb, cr, rv, guv, bu, r, g, b;
378
379 y = YFAC*(*ysrc++ - 16);
380 cb = *usrc++ - 128;
381 cr = *vsrc++ - 128;
382
383 rv = RVFAC*cr;
384 guv = GUFAC*cb + GVFAC*cr;
385 bu = BUFAC*cb;
386
387 r = y + rv;
388 g = y + guv;
389 b = y + bu;
390
391 if ((unsigned)(r | g | b) > 64*256-1)
392 {
393 r = clamp(r, 0, 64*256-1);
394 g = clamp(g, 0, 64*256-1);
395 b = clamp(b, 0, 64*256-1);
396 }
397
398 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
399
400 #if LCD_WIDTH >= LCD_HEIGHT
401 dst++;
402 #else
403 dst += LCD_WIDTH;
404 #endif
405
406 y = YFAC*(*ysrc++ - 16);
407 r = y + rv;
408 g = y + guv;
409 b = y + bu;
410
411 if ((unsigned)(r | g | b) > 64*256-1)
412 {
413 r = clamp(r, 0, 64*256-1);
414 g = clamp(g, 0, 64*256-1);
415 b = clamp(b, 0, 64*256-1);
416 }
417
418 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
419
420 #if LCD_WIDTH >= LCD_HEIGHT
421 dst++;
422 #else
423 dst += LCD_WIDTH;
424 #endif
425 }
426 while (dst < row_end);
427
428 ysrc += stride;
429 usrc -= width >> 1;
430 vsrc -= width >> 1;
431
432 #if LCD_WIDTH >= LCD_HEIGHT
433 row_end += LCD_WIDTH;
434 dst += LCD_WIDTH - width;
435 #else
436 row_end -= 1;
437 dst -= LCD_WIDTH*width + 1;
438 #endif
439
440 do
441 {
442 int y, cb, cr, rv, guv, bu, r, g, b;
443
444 y = YFAC*(*ysrc++ - 16);
445 cb = *usrc++ - 128;
446 cr = *vsrc++ - 128;
447
448 rv = RVFAC*cr;
449 guv = GUFAC*cb + GVFAC*cr;
450 bu = BUFAC*cb;
451
452 r = y + rv;
453 g = y + guv;
454 b = y + bu;
455
456 if ((unsigned)(r | g | b) > 64*256-1)
457 {
458 r = clamp(r, 0, 64*256-1);
459 g = clamp(g, 0, 64*256-1);
460 b = clamp(b, 0, 64*256-1);
461 }
462
463 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
464
465 #if LCD_WIDTH >= LCD_HEIGHT
466 dst++;
467 #else
468 dst += LCD_WIDTH;
469 #endif
470
471 y = YFAC*(*ysrc++ - 16);
472 r = y + rv;
473 g = y + guv;
474 b = y + bu;
475
476 if ((unsigned)(r | g | b) > 64*256-1)
477 {
478 r = clamp(r, 0, 64*256-1);
479 g = clamp(g, 0, 64*256-1);
480 b = clamp(b, 0, 64*256-1);
481 }
482
483 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
484
485 #if LCD_WIDTH >= LCD_HEIGHT
486 dst++;
487 #else
488 dst += LCD_WIDTH;
489 #endif
490 }
491 while (dst < row_end);
492
493 ysrc += stride;
494 usrc += stride >> 1;
495 vsrc += stride >> 1;
496
497 #if LCD_WIDTH >= LCD_HEIGHT
498 row_end += LCD_WIDTH;
499 dst += LCD_WIDTH - width;
500 #else
501 row_end -= 1;
502 dst -= LCD_WIDTH*width + 1;
503 #endif
504 }
505 while (--linecounter > 0);
506
507 #if LCD_WIDTH >= LCD_HEIGHT
508 lcd_update_rect(x, y, width, height);
509 #else
510 lcd_update_rect(LCD_WIDTH - y - height, x, height, width);
511 #endif
512}
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/power-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/power-zenxfi2.c
new file mode 100644
index 0000000000..180b7f9d4c
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/power-zenxfi2.c
@@ -0,0 +1,42 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
28static bool tuner_enable = false;
29
30bool tuner_power(bool enable)
31{
32 if(enable != tuner_enable)
33 {
34 tuner_enable = enable;
35 }
36 return tuner_enable;
37}
38
39bool tuner_powered(void)
40{
41 return tuner_enable;
42}
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/powermgmt-target.h b/firmware/target/arm/imx233/creative-zenxfi2/powermgmt-target.h
new file mode 100644
index 0000000000..6790772704
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/powermgmt-target.h
@@ -0,0 +1,60 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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/* Creative ZEN X-Fi2 OF settings:
28 * - current ramp slope: 100 mA/s
29 * - conditioning threshold voltage: 3 V
30 * - conditioning max voltage: 3.1 V
31 * - conditioning current: 60 mA
32 * - conditioning timeout: 1 h
33 * - charging voltage: 4.2 V
34 * - charging current: 550 mA
35 * - charging threshold current: 60 mA
36 * - charging timeout: 4 h
37 * - top off period: 30 min
38 * - high die temperature: 74 °C
39 * - low die temperature: 56 °C
40 * - safe die temperature current: 30 mA
41 * - battery temperature channel: 1
42 * - high battery temperature: 440
43 * - low battery temperature: 605
44 * - safe battery temperature current: 0 mA
45 * - low DCDC battery voltage: 3.9 V
46 *
47 * FIXME is this an OF bug that low batt temp > high batt temp ?
48 */
49
50#define IMX233_CHARGE_CURRENT 550
51#define IMX233_STOP_CURRENT 60
52#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ)
53#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ)
54#define IMX233_DIE_TEMP_HIGH 74
55#define IMX233_DIE_TEMP_LOW 56
56#define IMX233_BATT_TEMP_SENSOR 1
57#define IMX233_BATT_TEMP_HIGH 440
58#define IMX233_BATT_TEMP_LOW 605
59
60#endif /* POWERMGMT_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/powermgmt-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/powermgmt-zenxfi2.c
new file mode 100644
index 0000000000..3e068f007d
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi2/powermgmt-zenxfi2.c
@@ -0,0 +1,46 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
24const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
25{
26 3659
27};
28
29const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
30{
31 3630
32};
33
34/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
35const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
36{
37 /* Toshiba Gigabeat S Li Ion 700mAH figured from discharge curve */
38 { 3659, 3719, 3745, 3761, 3785, 3813, 3856, 3926, 3984, 4040, 4121 },
39};
40
41/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
42const unsigned short percent_to_volt_charge[11] =
43{
44 /* Toshiba Gigabeat S Li Ion 700mAH figured from charge curve */
45 4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208
46};
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/adc-target.h b/firmware/target/arm/imx233/creative-zenxfi3/adc-target.h
new file mode 100644
index 0000000000..d946989c1c
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/adc-target.h
@@ -0,0 +1,32 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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 5
25
26#define ADC_BATTERY 0
27#define ADC_DIE_TEMP 1
28#define ADC_VDDIO 2
29#define ADC_5V 3
30#define ADC_BATT_TEMP 4
31
32#endif
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c
new file mode 100644
index 0000000000..6671c7202e
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c
@@ -0,0 +1,40 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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
24int imx233_adc_mapping[] =
25{
26 [ADC_BATTERY] = IMX233_ADC_BATTERY,
27 [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP,
28 [ADC_VDDIO] = IMX233_ADC_VDDIO,
29 [ADC_5V] = HW_LRADC_CHANNEL_5V,
30 [ADC_BATT_TEMP] = IMX233_ADC_BATT_TEMP,
31};
32
33const char *imx233_adc_channel_name[] =
34{
35 "Battery(raw)",
36 "Die temperature(°C)",
37 "VddIO",
38 "Vdd5V",
39 "Battery temperature(raw)",
40};
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c
new file mode 100644
index 0000000000..faf15242ab
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/audio-zenxfi3.c
@@ -0,0 +1,61 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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 "system.h"
23#include "audiohw.h"
24#include "audio.h"
25#include "audioout-imx233.h"
26#include "audioin-imx233.h"
27#include "pinctrl-imx233.h"
28
29static int input_source = AUDIO_SRC_PLAYBACK;
30static unsigned input_flags = 0;
31static int output_source = AUDIO_SRC_PLAYBACK;
32
33static void select_audio_path(void)
34{
35 /* route audio to HP */
36 imx233_set_pin_function(1, 30, PINCTRL_FUNCTION_GPIO);
37 imx233_enable_gpio_output(1, 30, true);
38 imx233_set_gpio_output(1, 30, true);
39
40 if(input_source == AUDIO_SRC_PLAYBACK)
41 imx233_audioout_select_hp_input(false);
42 else
43 imx233_audioout_select_hp_input(true);
44}
45
46void audio_input_mux(int source, unsigned flags)
47{
48 (void) source;
49 (void) flags;
50 input_source = source;
51 input_flags = flags;
52 select_audio_path();
53}
54
55void audio_set_output_source(int source)
56{
57 (void) source;
58 output_source = source;
59 select_audio_path();
60}
61
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/backlight-target.h b/firmware/target/arm/imx233/creative-zenxfi3/backlight-target.h
new file mode 100644
index 0000000000..c7508c87a3
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/backlight-target.h
@@ -0,0 +1,33 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
24bool _backlight_init(void);
25void _backlight_on(void);
26void _backlight_off(void);
27void _backlight_set_brightness(int brightness);
28
29void _buttonlight_on(void);
30void _buttonlight_off(void);
31void _buttonlight_set_brightness(int brightness);
32
33#endif /* BACKLIGHT_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c
new file mode 100644
index 0000000000..59c3c133aa
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/backlight-zenxfi3.c
@@ -0,0 +1,85 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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 "lcd.h"
25#include "backlight.h"
26#include "backlight-target.h"
27#include "pwm-imx233.h"
28#include "mpr121.h"
29
30void _backlight_set_brightness(int brightness)
31{
32 imx233_pwm_setup_channel(2, 1024, HW_PWM_PERIODx__CDIV__DIV_1,
33 0, HW_PWM_PERIODx__STATE__HIGH,
34 (brightness * 1024) / 100, HW_PWM_PERIODx__STATE__LOW);
35 imx233_pwm_enable_channel(2, true);
36}
37
38bool _backlight_init(void)
39{
40 _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
41 return true;
42}
43
44void _backlight_on(void)
45{
46#ifdef HAVE_LCD_ENABLE
47 lcd_enable(true); /* power on lcd + visible display */
48#endif
49 /* don't do anything special, the core will set the brightness */
50}
51
52void _backlight_off(void)
53{
54 /* there is no real on/off but we can set to 0 brightness */
55 _backlight_set_brightness(0);
56#ifdef HAVE_LCD_ENABLE
57 lcd_enable(false); /* power off visible display */
58#endif
59}
60
61/* ELE8 is the button light GPIO */
62void _buttonlight_on(void)
63{
64 /* assume mpr121 was initialized by button-zenxfi3.c */
65 mpr121_set_gpio_output(8, ELE_GPIO_SET);
66}
67
68void _buttonlight_off(void)
69{
70 /* assume mpr121 was initialized by button-zenxfi3.c */
71 mpr121_set_gpio_output(8, ELE_GPIO_CLR);
72}
73
74void _buttonlight_set_brightness(int brightness)
75{
76 /* assume mpr121 was initialized by button-zenxfi3.c */
77 /* since backlight brightness is the same for the screen and the button light,
78 * map [MIN_BRIGHTNESS_SETTING,MAX_BRIGHTNESS_SETTING] to
79 * [ELE_PWM_MIN_DUTY,ELE_PWM_MAX_DUTY] */
80 brightness = ELE_PWM_MIN_DUTY + (brightness - MIN_BRIGHTNESS_SETTING) *
81 (ELE_PWM_MAX_DUTY - ELE_PWM_MIN_DUTY + 1) /
82 (MAX_BRIGHTNESS_SETTING - MIN_BRIGHTNESS_SETTING + 1);
83 brightness = MIN(brightness, ELE_PWM_MAX_DUTY);
84 mpr121_set_gpio_pwm(8, brightness);
85}
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/button-target.h b/firmware/target/arm/imx233/creative-zenxfi3/button-target.h
new file mode 100644
index 0000000000..202e695eb3
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/button-target.h
@@ -0,0 +1,54 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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#include "config.h"
26
27void button_init_device(void);
28int button_read_device(void);
29bool button_debug_screen(void);
30
31#define HAS_BUTTON_HOLD
32
33/* Main unit's buttons */
34#define BUTTON_POWER 0x00000001
35#define BUTTON_MENU 0x00000002
36#define BUTTON_BACK 0x00000004
37#define BUTTON_PLAY 0x00000008
38#define BUTTON_UP 0x00000010
39#define BUTTON_DOWN 0x00000020
40#define BUTTON_VOL_UP 0x00000040
41#define BUTTON_VOL_DOWN 0x00000080
42/* For compatibility */
43#define BUTTON_LEFT BUTTON_BACK
44#define BUTTON_RIGHT BUTTON_PLAY
45
46#define BUTTON_MAIN 0xff
47
48#define BUTTON_REMOTE 0
49
50/* Software power-off */
51#define POWEROFF_BUTTON BUTTON_POWER
52#define POWEROFF_COUNT 10
53
54#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
new file mode 100644
index 0000000000..174ddc217c
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/button-zenxfi3.c
@@ -0,0 +1,171 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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 "string.h"
27#include "usb.h"
28#include "backlight.h"
29#include "mpr121.h"
30
31static struct mpr121_config_t config =
32{
33 .ele =
34 {
35 [0] = {.tth = 5, .rth = 4 },
36 [1] = {.tth = 5, .rth = 4 },
37 [2] = {.tth = 5, .rth = 4 },
38 [3] = {.tth = 5, .rth = 4 },
39 [4] = {.tth = 4, .rth = 3 },
40 [5] = {.tth = 4, .rth = 3 },
41 [6] = {.tth = 5, .rth = 4 },
42 [7] = {.tth = 5, .rth = 4 },
43 [8] = {.gpio = ELE_GPIO_OUTPUT_OPEN_LED },
44 },
45 .filters =
46 {
47 .ele =
48 {
49 .rising = {.mhd = 1, .nhd = 1, .ncl = 1, .fdl = 1 },
50 .falling = {.mhd = 1, .nhd = 1, .ncl = 0xff, .fdl = 2 },
51 }
52 },
53 .autoconf =
54 {
55 .en = true, .ren = true, .retry = RETRY_NEVER,
56 .usl = 0xc4, .lsl = 0x7f, .tl = 0xb0
57 },
58 .ele_en = ELE_EN0_x(7),
59 .cal_lock = CL_TRACK
60};
61
62#define MPR121_INTERRUPT 1
63
64static int touchpad_btns = 0;
65static long mpr121_stack[DEFAULT_STACK_SIZE/sizeof(long)];
66static const char mpr121_thread_name[] = "mpr121";
67static struct event_queue mpr121_queue;
68
69static void mpr121_irq_cb(int bank, int pin)
70{
71 (void) bank;
72 (void) pin;
73 /* the callback will not be fired until interrupt is enabled back so
74 * the queue will not overflow or contain multiple MPR121_INTERRUPT events */
75 queue_post(&mpr121_queue, MPR121_INTERRUPT, 0);
76}
77
78static void mpr121_thread(void)
79{
80 struct queue_event ev;
81
82 while(1)
83 {
84 queue_wait(&mpr121_queue, &ev);
85 /* handle usb connect and ignore all messages except rmi interrupts */
86 if(ev.id == SYS_USB_CONNECTED)
87 {
88 usb_acknowledge(SYS_USB_CONNECTED_ACK);
89 continue;
90 }
91 else if(ev.id != MPR121_INTERRUPT)
92 continue;
93 /* clear interrupt and get status */
94 unsigned status;
95 touchpad_btns = 0;
96 if(!mpr121_get_touch_status(&status))
97 {
98 /* ELE3: up
99 * ELE4: back
100 * ELE5: menu
101 * ELE6: down
102 * ELE7: play */
103 if(status & 0x8) touchpad_btns |= BUTTON_UP;
104 if(status & 0x10) touchpad_btns |= BUTTON_BACK;
105 if(status & 0x20) touchpad_btns |= BUTTON_MENU;
106 if(status & 0x40) touchpad_btns |= BUTTON_DOWN;
107 if(status & 0x80) touchpad_btns |= BUTTON_PLAY;
108 }
109 /* enable interrupt */
110 imx233_setup_pin_irq(0, 18, true, true, false, &mpr121_irq_cb);
111 }
112}
113
114/* B0P18 is #IRQ line of the touchpad */
115void button_init_device(void)
116{
117 mpr121_init(0xb4);
118 mpr121_soft_reset();
119 mpr121_set_config(&config);
120
121 queue_init(&mpr121_queue, true);
122 create_thread(mpr121_thread, mpr121_stack, sizeof(mpr121_stack), 0,
123 mpr121_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) IF_COP(, CPU));
124 /* enable interrupt */
125 imx233_set_pin_function(0, 18, PINCTRL_FUNCTION_GPIO);
126 imx233_enable_gpio_output(0, 18, false);
127 imx233_setup_pin_irq(0, 18, true, true, false, &mpr121_irq_cb);
128}
129
130bool button_hold(void)
131{
132 /* B0P04: #hold */
133 return !imx233_get_gpio_input_mask(0, 0x10);
134}
135
136int button_read_device(void)
137{
138 /* since sliding hold will usually trigger power, ignore power button
139 * for one second after hold is released */
140 static int power_ignore_counter = 0;
141 static bool old_hold;
142 /* light handling */
143 bool hold = button_hold();
144 if(hold != old_hold)
145 {
146 old_hold = hold;
147#ifndef BOOTLOADER
148 backlight_hold_changed(hold);
149#endif /* BOOTLOADER */
150 if(!hold)
151 power_ignore_counter = HZ;
152 }
153
154 if(power_ignore_counter)
155 power_ignore_counter--;
156
157 int res = 0;
158 /* B2P07: #volume-
159 * B2P08: #volume+
160 * PSWITCH: power */
161 uint32_t mask = imx233_get_gpio_input_mask(2, 0x180);
162 if(!(mask & 0x80))
163 res |= BUTTON_VOL_DOWN;
164 if(!(mask & 0x100))
165 res |= BUTTON_VOL_UP;
166 /* WARNING: it seems that the voltage on PSWITCH depends on whether
167 * usb is connected or not ! Thus the value of this field can be 1 or 3 */
168 if(__XTRACT(HW_POWER_STS, PSWITCH) != 0 && power_ignore_counter == 0)
169 res |= BUTTON_POWER;
170 return res | touchpad_btns;
171}
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/debug-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/debug-zenxfi3.c
new file mode 100644
index 0000000000..0f003bcd1e
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/debug-zenxfi3.c
@@ -0,0 +1,28 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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
25bool dbg_hw_target_info(void)
26{
27 return false;
28}
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/lcd-target.h b/firmware/target/arm/imx233/creative-zenxfi3/lcd-target.h
new file mode 100644
index 0000000000..931fcb32a0
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/lcd-target.h
@@ -0,0 +1,24 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2012 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#endif /* LCD_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
new file mode 100644
index 0000000000..3579f8306e
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/lcd-zenxfi3.c
@@ -0,0 +1,490 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2012 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 "logf.h"
31
32#ifdef HAVE_LCD_ENABLE
33static bool lcd_on;
34#endif
35static unsigned lcd_yuv_options = 0;
36
37static void setup_parameters(void)
38{
39 imx233_lcdif_reset();
40 imx233_lcdif_set_lcd_databus_width(HW_LCDIF_CTRL__LCD_DATABUS_WIDTH_16_BIT);
41 imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_16_BIT);
42 imx233_lcdif_set_timings(2, 2, 3, 3);
43}
44
45static void setup_lcd_pins(bool use_lcdif)
46{
47 if(use_lcdif)
48 {
49 imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_MAIN); /* lcd_vsync */
50 imx233_set_pin_function(1, 21, PINCTRL_FUNCTION_MAIN); /* lcd_cs */
51 imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_MAIN); /* lcd_dotclk */
52 imx233_set_pin_function(1, 23, PINCTRL_FUNCTION_MAIN); /* lcd_enable */
53 imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_MAIN); /* lcd_hsync */
54 imx233_set_pin_function(1, 18, PINCTRL_FUNCTION_MAIN); /* lcd_reset */
55 imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_MAIN); /* lcd_rs */
56 imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_MAIN); /* lcd_d16 */
57 imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_MAIN); /* lcd_d17 */
58 imx233_set_pin_function(1, 20, PINCTRL_FUNCTION_MAIN); /* lcd_wr */
59 __REG_CLR(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */
60 }
61 else
62 {
63 __REG_SET(HW_PINCTRL_MUXSEL(2)) = 0xffffffff; /* lcd_d{0-15} */
64 imx233_enable_gpio_output_mask(1, 0x3ffffff, false); /* lcd_{d{0-17},reset,rs,wr,cs,dotclk,enable,hsync,vsync} */
65 imx233_set_pin_function(1, 16, PINCTRL_FUNCTION_GPIO); /* lcd_d16 */
66 imx233_set_pin_function(1, 17, PINCTRL_FUNCTION_GPIO); /* lcd_d17 */
67 imx233_set_pin_function(1, 19, PINCTRL_FUNCTION_GPIO); /* lcd_rs */
68 imx233_set_pin_function(1, 20, PINCTRL_FUNCTION_GPIO); /* lcd_wr */
69 imx233_set_pin_function(1, 21, PINCTRL_FUNCTION_GPIO); /* lcd_cs */
70 imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO); /* lcd_dotclk */
71 imx233_set_pin_function(1, 23, PINCTRL_FUNCTION_GPIO); /* lcd_enable */
72 imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO); /* lcd_hsync */
73 imx233_set_pin_function(1, 25, PINCTRL_FUNCTION_GPIO); /* lcd_vsync */
74 }
75}
76
77static void common_lcd_enable(bool enable)
78{
79 imx233_lcdif_enable(enable);
80 setup_lcd_pins(enable); /* use GPIO pins when disable */
81}
82
83static void setup_lcdif(void)
84{
85 setup_parameters();
86 common_lcd_enable(true);
87 imx233_lcdif_enable_bus_master(true);
88}
89
90static void setup_lcdif_clock(void)
91{
92 /* the LCD seems to work at 24Mhz, so use the xtal clock with no divider */
93 imx233_clkctrl_enable_clock(CLK_PIX, false);
94 imx233_clkctrl_set_clock_divisor(CLK_PIX, 1);
95 imx233_clkctrl_set_bypass_pll(CLK_PIX, true); /* use XTAL */
96 imx233_clkctrl_enable_clock(CLK_PIX, true);
97}
98
99static void lcd_write_reg(uint32_t reg, uint32_t data)
100{
101 imx233_lcdif_pio_send(false, 2, &reg);
102 if(reg != 0x22)
103 imx233_lcdif_pio_send(true, 2, &data);
104}
105
106#define REG_UDELAY 0xffffffff
107struct lcd_sequence_entry_t
108{
109 uint32_t reg, data;
110};
111
112static void lcd_send_sequence(struct lcd_sequence_entry_t *seq, unsigned count)
113{
114 for(;count-- > 0; seq++)
115 {
116 if(seq->reg == REG_UDELAY)
117 udelay(seq->data);
118 else
119 lcd_write_reg(seq->reg, seq->data);
120 }
121}
122
123#define _begin_seq() static struct lcd_sequence_entry_t __seq[] = {
124#define _udelay(a) {REG_UDELAY, a},
125#define _lcd_write_reg(a, b) {a, b},
126#define _end_seq() }; lcd_send_sequence(__seq, sizeof(__seq) / sizeof(__seq[0]));
127
128static void lcd_init_seq(void)
129{
130 _begin_seq()
131 _lcd_write_reg(1, 0x11c)
132 _lcd_write_reg(2, 0x100)
133 _lcd_write_reg(3, 0x1030)
134 _lcd_write_reg(8, 0x808)
135 _lcd_write_reg(0xc, 0)
136 _lcd_write_reg(0xf, 0xc01)
137 _lcd_write_reg(0x20, 0)
138 _lcd_write_reg(0x21, 0)
139 _udelay(30)
140 _lcd_write_reg(0x10, 0xa00)
141 _lcd_write_reg(0x11, 0x1038)
142 _udelay(30)
143 _lcd_write_reg(0x12, 0x1010)
144 _lcd_write_reg(0x13, 0x50)
145 _lcd_write_reg(0x14, 0x4f58)
146 _lcd_write_reg(0x30, 0)
147 _lcd_write_reg(0x31, 0xdb)
148 _lcd_write_reg(0x32, 0)
149 _lcd_write_reg(0x33, 0)
150 _lcd_write_reg(0x34, 0xdb)
151 _lcd_write_reg(0x35, 0)
152 _lcd_write_reg(0x36, 0xaf)
153 _lcd_write_reg(0x37, 0)
154 _lcd_write_reg(0x38, 0xdb)
155 _lcd_write_reg(0x39, 0)
156 _lcd_write_reg(0x50, 0)
157 _lcd_write_reg(0x51, 0x705)
158 _lcd_write_reg(0x52, 0xe0a)
159 _lcd_write_reg(0x53, 0x300)
160 _lcd_write_reg(0x54, 0xa0e)
161 _lcd_write_reg(0x55, 0x507)
162 _lcd_write_reg(0x56, 0)
163 _lcd_write_reg(0x57, 3)
164 _lcd_write_reg(0x58, 0x90a)
165 _lcd_write_reg(0x59, 0xa09)
166 _udelay(30)
167 _lcd_write_reg(7, 0x1017)
168 _udelay(40)
169 _end_seq()
170}
171
172void lcd_init_device(void)
173{
174 setup_lcdif();
175 setup_lcdif_clock();
176
177 // reset device
178 __REG_SET(HW_LCDIF_CTRL1) = HW_LCDIF_CTRL1__RESET;
179 mdelay(50);
180 __REG_CLR(HW_LCDIF_CTRL1) = HW_LCDIF_CTRL1__RESET;
181 mdelay(10);
182 __REG_SET(HW_LCDIF_CTRL1) = HW_LCDIF_CTRL1__RESET;
183
184 lcd_init_seq();
185#ifdef HAVE_LCD_ENABLE
186 lcd_on = true;
187#endif
188}
189
190#ifdef HAVE_LCD_ENABLE
191bool lcd_active(void)
192{
193 return lcd_on;
194}
195
196static void lcd_enable_seq(bool enable)
197{
198 if(!enable)
199 {
200 _begin_seq()
201 _end_seq()
202 }
203 else
204 {
205 _begin_seq()
206 _end_seq()
207 }
208}
209
210void lcd_enable(bool enable)
211{
212 if(lcd_on == enable)
213 return;
214
215 lcd_on = enable;
216
217 if(enable)
218 common_lcd_enable(true);
219 lcd_enable_seq(enable);
220 if(!enable)
221 common_lcd_enable(false);
222}
223#endif
224
225void lcd_update(void)
226{
227 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
228}
229
230void lcd_update_rect(int x, int y, int w, int h)
231{
232#ifdef HAVE_LCD_ENABLE
233 if(!lcd_on)
234 return;
235#endif
236 /* make sure the rectangle is included in the screen */
237 x = MIN(x, LCD_WIDTH);
238 y = MIN(y, LCD_HEIGHT);
239 w = MIN(w, LCD_WIDTH - x);
240 h = MIN(h, LCD_HEIGHT - y);
241
242 imx233_lcdif_wait_ready();
243 lcd_write_reg(0x37, x);
244 lcd_write_reg(0x36, x + w - 1);
245 lcd_write_reg(0x39, y);
246 lcd_write_reg(0x38, y + h - 1);
247 lcd_write_reg(0x20, x);
248 lcd_write_reg(0x21, y);
249 lcd_write_reg(0x22, 0);
250
251 imx233_lcdif_wait_ready();
252 imx233_lcdif_set_word_length(HW_LCDIF_CTRL__WORD_LENGTH_16_BIT);
253 imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */
254 imx233_lcdif_set_data_format(false, false, false); /* RGB565, don't care, don't care */
255
256 /* there are two cases here:
257 * - either width = LCD_WIDTH and we can directly memcopy a part of lcd_framebuffer to FRAME
258 * and send it
259 * - either width != LCD_WIDTH and we have to build a contiguous copy of the rectangular area
260 * into FRAME before sending it (which is slower and doesn't use the hardware)
261 * In all cases, FRAME just acts as a temporary buffer.
262 * NOTE It's more interesting to do a copy to FRAME in all cases since in system mode
263 * the clock runs at 24MHz which provides barely 10MB/s bandwidth compared to >100MB/s
264 * for memcopy operations
265 */
266 if(w == LCD_WIDTH)
267 {
268 memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
269 }
270 else
271 {
272 for(int i = 0; i < h; i++)
273 memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
274 }
275 /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
276 * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
277 * field must be a multiple of 2. Furthermore, it seems the lcd controller doesn't
278 * really like when both w and h are even, probably because the writes to the GRAM
279 * are done on several words and the controller requires dummy writes.
280 * The workaround is to always make sure that we send a number of pixels which is
281 * a multiple of 4 so that both the lcdif and the controller are happy. If any
282 * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
283 * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
284 */
285 if(w % 2 == 1 || h % 2 == 1)
286 {
287 /* copy three pixel after the last one */
288 for(int i = 0; i < 3; i++)
289 *((fb_data *)FRAME + w * h + i) = *((fb_data *)FRAME + i);
290 /* WARNING we need to update w and h to reflect the pixel count BUT it
291 * has no relation to w * h (it can even be 2 * prime). Hopefully, w <= 240 and
292 * h <= 320 so w * h <= 76800 and (w * h + 3) / 4 <= 38400 which fits into
293 * a 16-bit integer (horizontal count). */
294 h = (w * h + 3) / 4;
295 w = 4;
296 }
297 imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
298}
299
300void lcd_yuv_set_options(unsigned options)
301{
302 lcd_yuv_options = options;
303}
304
305#define YFAC (74)
306#define RVFAC (101)
307#define GUFAC (-24)
308#define GVFAC (-51)
309#define BUFAC (128)
310
311static inline int clamp(int val, int min, int max)
312{
313 if (val < min)
314 val = min;
315 else if (val > max)
316 val = max;
317 return val;
318}
319
320void lcd_blit_yuv(unsigned char * const src[3],
321 int src_x, int src_y, int stride,
322 int x, int y, int width, int height)
323{
324 const unsigned char *ysrc, *usrc, *vsrc;
325 int linecounter;
326 fb_data *dst, *row_end;
327 long z;
328
329 /* width and height must be >= 2 and an even number */
330 width &= ~1;
331 linecounter = height >> 1;
332
333 #if LCD_WIDTH >= LCD_HEIGHT
334 dst = FBADDR(x,y);
335 row_end = dst + width;
336 #else
337 dst = FBADDR(LCD_WIDTH - y - 1,x);
338 row_end = dst + LCD_WIDTH * width;
339 #endif
340
341 z = stride * src_y;
342 ysrc = src[0] + z + src_x;
343 usrc = src[1] + (z >> 2) + (src_x >> 1);
344 vsrc = src[2] + (usrc - src[1]);
345
346 /* stride => amount to jump from end of last row to start of next */
347 stride -= width;
348
349 /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
350
351 do
352 {
353 do
354 {
355 int y, cb, cr, rv, guv, bu, r, g, b;
356
357 y = YFAC*(*ysrc++ - 16);
358 cb = *usrc++ - 128;
359 cr = *vsrc++ - 128;
360
361 rv = RVFAC*cr;
362 guv = GUFAC*cb + GVFAC*cr;
363 bu = BUFAC*cb;
364
365 r = y + rv;
366 g = y + guv;
367 b = y + bu;
368
369 if ((unsigned)(r | g | b) > 64*256-1)
370 {
371 r = clamp(r, 0, 64*256-1);
372 g = clamp(g, 0, 64*256-1);
373 b = clamp(b, 0, 64*256-1);
374 }
375
376 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
377
378 #if LCD_WIDTH >= LCD_HEIGHT
379 dst++;
380 #else
381 dst += LCD_WIDTH;
382 #endif
383
384 y = YFAC*(*ysrc++ - 16);
385 r = y + rv;
386 g = y + guv;
387 b = y + bu;
388
389 if ((unsigned)(r | g | b) > 64*256-1)
390 {
391 r = clamp(r, 0, 64*256-1);
392 g = clamp(g, 0, 64*256-1);
393 b = clamp(b, 0, 64*256-1);
394 }
395
396 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
397
398 #if LCD_WIDTH >= LCD_HEIGHT
399 dst++;
400 #else
401 dst += LCD_WIDTH;
402 #endif
403 }
404 while (dst < row_end);
405
406 ysrc += stride;
407 usrc -= width >> 1;
408 vsrc -= width >> 1;
409
410 #if LCD_WIDTH >= LCD_HEIGHT
411 row_end += LCD_WIDTH;
412 dst += LCD_WIDTH - width;
413 #else
414 row_end -= 1;
415 dst -= LCD_WIDTH*width + 1;
416 #endif
417
418 do
419 {
420 int y, cb, cr, rv, guv, bu, r, g, b;
421
422 y = YFAC*(*ysrc++ - 16);
423 cb = *usrc++ - 128;
424 cr = *vsrc++ - 128;
425
426 rv = RVFAC*cr;
427 guv = GUFAC*cb + GVFAC*cr;
428 bu = BUFAC*cb;
429
430 r = y + rv;
431 g = y + guv;
432 b = y + bu;
433
434 if ((unsigned)(r | g | b) > 64*256-1)
435 {
436 r = clamp(r, 0, 64*256-1);
437 g = clamp(g, 0, 64*256-1);
438 b = clamp(b, 0, 64*256-1);
439 }
440
441 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
442
443 #if LCD_WIDTH >= LCD_HEIGHT
444 dst++;
445 #else
446 dst += LCD_WIDTH;
447 #endif
448
449 y = YFAC*(*ysrc++ - 16);
450 r = y + rv;
451 g = y + guv;
452 b = y + bu;
453
454 if ((unsigned)(r | g | b) > 64*256-1)
455 {
456 r = clamp(r, 0, 64*256-1);
457 g = clamp(g, 0, 64*256-1);
458 b = clamp(b, 0, 64*256-1);
459 }
460
461 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
462
463 #if LCD_WIDTH >= LCD_HEIGHT
464 dst++;
465 #else
466 dst += LCD_WIDTH;
467 #endif
468 }
469 while (dst < row_end);
470
471 ysrc += stride;
472 usrc += stride >> 1;
473 vsrc += stride >> 1;
474
475 #if LCD_WIDTH >= LCD_HEIGHT
476 row_end += LCD_WIDTH;
477 dst += LCD_WIDTH - width;
478 #else
479 row_end -= 1;
480 dst -= LCD_WIDTH*width + 1;
481 #endif
482 }
483 while (--linecounter > 0);
484
485 #if LCD_WIDTH >= LCD_HEIGHT
486 lcd_update_rect(x, y, width, height);
487 #else
488 lcd_update_rect(LCD_WIDTH - y - height, x, height, width);
489 #endif
490}
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/power-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/power-zenxfi3.c
new file mode 100644
index 0000000000..26f2159cec
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/power-zenxfi3.c
@@ -0,0 +1,42 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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
28static bool tuner_enable = false;
29
30bool tuner_power(bool enable)
31{
32 if(enable != tuner_enable)
33 {
34 tuner_enable = enable;
35 }
36 return tuner_enable;
37}
38
39bool tuner_powered(void)
40{
41 return tuner_enable;
42}
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/powermgmt-target.h b/firmware/target/arm/imx233/creative-zenxfi3/powermgmt-target.h
new file mode 100644
index 0000000000..6c010a72d3
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/powermgmt-target.h
@@ -0,0 +1,58 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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/* Creative ZEN X-Fi3 OF settings:
28 * - current ramp slope: 10 mA/s
29 * - conditioning threshold voltage: 3 V
30 * - conditioning max voltage: 3.1 V
31 * - conditioning current: 60 mA
32 * - conditioning timeout: 1 h
33 * - charging voltage: 4.2 V
34 * - charging current: 260 mA
35 * - charging threshold current: 20 mA
36 * - charging timeout: 4 h
37 * - top off period: 30 min
38 * - high die temperature: 91 °C
39 * - low die temperature: 56 °C
40 * - safe die temperature current: 30 mA
41 * - battery temperature channel: 0
42 * - high battery temperature: 2400
43 * - low battery temperature: 2300
44 * - safe battery temperature current: 0 mA
45 * - low DCDC battery voltage: 3.9 V
46 */
47
48#define IMX233_CHARGE_CURRENT 260
49#define IMX233_STOP_CURRENT 20
50#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ)
51#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ)
52#define IMX233_DIE_TEMP_HIGH 91
53#define IMX233_DIE_TEMP_LOW 56
54#define IMX233_BATT_TEMP_SENSOR 0
55#define IMX233_BATT_TEMP_HIGH 2400
56#define IMX233_BATT_TEMP_LOW 2300
57
58#endif /* POWERMGMT_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
new file mode 100644
index 0000000000..2951df5f58
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
@@ -0,0 +1,46 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 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
24const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
25{
26 3659
27};
28
29const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
30{
31 3630
32};
33
34/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
35const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
36{
37 /* Toshiba Gigabeat S Li Ion 700mAH figured from discharge curve */
38 { 3659, 3719, 3745, 3761, 3785, 3813, 3856, 3926, 3984, 4040, 4121 },
39};
40
41/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
42const unsigned short percent_to_volt_charge[11] =
43{
44 /* Toshiba Gigabeat S Li Ion 700mAH figured from charge curve */
45 4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208
46};
diff --git a/firmware/target/arm/imx233/sd-imx233.c b/firmware/target/arm/imx233/sd-imx233.c
index d3c29ee5be..8928faf3f9 100644
--- a/firmware/target/arm/imx233/sd-imx233.c
+++ b/firmware/target/arm/imx233/sd-imx233.c
@@ -62,6 +62,28 @@ struct sd_config_t sd_config[] =
62 .power_pin = PIN(0, 8), 62 .power_pin = PIN(0, 8),
63 .ssp = 1 63 .ssp = 1
64 }, 64 },
65#elif defined(CREATIVE_ZENXFI2)
66 /* The Zen X-Fi2 uses pin B1P29 for power*/
67 {
68 .name = "microSD",
69 .flags = POWER_PIN | REMOVABLE | DETECT_INVERTED,
70 .power_pin = PIN(1, 29),
71 .ssp = 1,
72 },
73#elif defined(CREATIVE_ZENXFI3)
74 {
75 .name = "internal/SD",
76 .flags = WINDOW,
77 .ssp = 2
78 },
79 /* The Zen X-Fi3 uses pin #B0P07 for power*/
80 {
81 .name = "microSD",
82 .flags = POWER_PIN | POWER_INVERTED | REMOVABLE | POWER_DELAY,
83 .power_pin = PIN(0, 7),
84 .power_delay = HZ / 10, /* extra delay, to ramp up voltage? */
85 .ssp = 1
86 },
65#else 87#else
66#error You need to write the sd config! 88#error You need to write the sd config!
67#endif 89#endif
diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c
index e687e1d82b..c8d12e296a 100644
--- a/firmware/target/arm/system-arm.c
+++ b/firmware/target/arm/system-arm.c
@@ -148,7 +148,7 @@ void NORETURN_ATTR UIE(unsigned int pc, unsigned int num)
148 if (!triggered) 148 if (!triggered)
149 { 149 {
150 triggered = true; 150 triggered = true;
151 backtrace(pc, __get_sp(), &line); 151 //backtrace(pc, __get_sp(), &line);
152 } 152 }
153 153
154 lcd_update(); 154 lcd_update();
diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h
index b5667ec72a..38e3b10441 100644
--- a/firmware/target/hosted/sdl/sim-ui-defines.h
+++ b/firmware/target/hosted/sdl/sim-ui-defines.h
@@ -431,6 +431,13 @@
431#define UI_LCD_POSX 68 431#define UI_LCD_POSX 68
432#define UI_LCD_POSY 77 432#define UI_LCD_POSY 77
433 433
434#elif defined(CREATIVE_ZENXFI3)
435#define UI_TITLE "Creative ZEN X-Fi3"
436#define UI_WIDTH 262 /* width of GUI window */
437#define UI_HEIGHT 350 /* height of GUI window */
438#define UI_LCD_POSX 43
439#define UI_LCD_POSY 65
440
434#elif defined(APPLICATION) 441#elif defined(APPLICATION)
435#define UI_TITLE "Rockbox" 442#define UI_TITLE "Rockbox"
436#define UI_LCD_POSX 0 443#define UI_LCD_POSX 0
diff --git a/tools/configure b/tools/configure
index d09f43c611..4d3d746785 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1271,27 +1271,28 @@ cat <<EOF
1271 90) Zen Vision:M 30GB 100) GoGear SA9200 54) Sansa c100 1271 90) Zen Vision:M 30GB 100) GoGear SA9200 54) Sansa c100
1272 91) Zen Vision:M 60GB 101) GoGear HDD1630/ 55) Sansa Clip 1272 91) Zen Vision:M 60GB 101) GoGear HDD1630/ 55) Sansa Clip
1273 92) Zen Vision HDD1830 56) Sansa e200v2 1273 92) Zen Vision HDD1830 56) Sansa e200v2
1274 102) GoGear HDD6330 57) Sansa m200v4 1274 93) Zen X-Fi2 102) GoGear HDD6330 57) Sansa m200v4
1275 ==Onda== 58) Sansa Fuze 1275 94) Zen X-Fi3 58) Sansa Fuze
1276 120) VX747 ==Meizu== 59) Sansa c200v2 1276 ==Meizu== 59) Sansa c200v2
1277 121) VX767 110) M6SL 60) Sansa Clipv2 1277 ==Onda== 110) M6SL 60) Sansa Clipv2
1278 122) VX747+ 111) M6SP 61) Sansa View 1278 120) VX747 111) M6SP 61) Sansa View
1279 123) VX777 112) M3 62) Sansa Clip+ 1279 121) VX767 112) M3 62) Sansa Clip+
1280 63) Sansa Fuze v2 1280 122) VX747+ 63) Sansa Fuze v2
1281 ==Samsung== ==Tatung== 64) Sansa Fuze+ 1281 123) VX777 ==Tatung== 64) Sansa Fuze+
1282 140) YH-820 150) Elio TPJ-1022 65) Sansa Clip Zip 1282 150) Elio TPJ-1022 65) Sansa Clip Zip
1283 141) YH-920 66) Sansa Connect 1283 ==Samsung== 66) Sansa Connect
1284 142) YH-925 ==Packard Bell== 1284 140) YH-820 ==Packard Bell==
1285 143) YP-S3 160) Vibe 500 ==Logik== 1285 141) YH-920 160) Vibe 500 ==Logik==
1286 80) DAX 1GB MP3/DAB 1286 142) YH-925 80) DAX 1GB MP3/DAB
1287 ==Application== ==MPIO== 1287 143) YP-S3 ==MPIO==
1288 200) SDL 170) HD200 ==Lyre project== 1288 170) HD200 ==Lyre project==
1289 201) Android 171) HD300 130) Lyre proto 1 1289 ==Application== 171) HD300 130) Lyre proto 1
1290 202) Nokia N8xx 131) Mini2440 1290 200) SDL 131) Mini2440
1291 203) Nokia N900 ==ROCKCHIP== ==HiFiMAN== 1291 201) Android ==ROCKCHIP==
1292 204) Pandora 180) rk27xx generic 190) HM-60x 1292 202) Nokia N8xx 180) rk27xx generic ==HiFiMAN==
1293 205) Samsung YP-R0 191) HM-801 1293 203) Nokia N900 190) HM-60x
1294 1294 204) Pandora 191) HM-801
1295 205) Samsung YP-R0
1295EOF 1296EOF
1296 1297
1297 buildfor=`input`; 1298 buildfor=`input`;
@@ -2199,6 +2200,46 @@ fi
2199 t_model="creative-zvm" 2200 t_model="creative-zvm"
2200 ;; 2201 ;;
2201 2202
2203 93|creativezenxfi2)
2204 target_id=80
2205 modelname="creativezenxfi2"
2206 target="CREATIVE_ZENXFI2"
2207 memory=64
2208 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2209 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2210 tool="$rootdir/tools/scramble -add=zxf2"
2211 output="rockbox.creative"
2212 bootoutput="bootloader-zenxfi2.creative"
2213 appextra="gui:recorder:radio"
2214 plugins="yes"
2215 swcodec="yes"
2216 toolset=$scramblebitmaptools
2217 t_cpu="arm"
2218 t_manufacturer="imx233"
2219 t_model="creative-zenxfi2"
2220 arm926ejscc
2221 ;;
2222
2223 94|creativezenxfi3)
2224 target_id=81
2225 modelname="creativezenxfi3"
2226 target="CREATIVE_ZENXFI3"
2227 memory=64
2228 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2229 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2230 tool="$rootdir/tools/scramble -add=zxf3"
2231 output="rockbox.creative"
2232 bootoutput="bootloader-zenxfi3.creative"
2233 appextra="gui:recorder:radio"
2234 plugins="no"
2235 swcodec="yes"
2236 toolset=$scramblebitmaptools
2237 t_cpu="arm"
2238 t_manufacturer="imx233"
2239 t_model="creative-zenxfi3"
2240 arm926ejscc
2241 ;;
2242
2202 50|sansae200) 2243 50|sansae200)
2203 target_id=23 2244 target_id=23
2204 modelname="sansae200" 2245 modelname="sansae200"
diff --git a/tools/scramble.c b/tools/scramble.c
index c3b200c01e..c243d78b64 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -128,7 +128,7 @@ void usage(void)
128 "\t 9200, 1630, 6330, ldax, m200, c100, clip, e2v2,\n" 128 "\t 9200, 1630, 6330, ldax, m200, c100, clip, e2v2,\n"
129 "\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n" 129 "\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n"
130 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n" 130 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n"
131 "\t ip6g, rk27, clzp)\n"); 131 "\t ip6g, rk27, clzp, zxf2, zxf3)\n");
132 printf("\nNo option results in Archos standard player/recorder format.\n"); 132 printf("\nNo option results in Archos standard player/recorder format.\n");
133 133
134 exit(1); 134 exit(1);
@@ -361,6 +361,10 @@ int main (int argc, char** argv)
361 modelnum = 79; 361 modelnum = 79;
362 else if (!strcmp(&argv[1][5], "conn")) /* Sansa Connect */ 362 else if (!strcmp(&argv[1][5], "conn")) /* Sansa Connect */
363 modelnum = 81; 363 modelnum = 81;
364 else if (!strcmp(&argv[1][5], "zxf2")) /* Creative Zen X-Fi2 */
365 modelnum = 82;
366 else if (!strcmp(&argv[1][5], "zxf3")) /* Creative Zen X-Fi3 */
367 modelnum = 83;
364 else { 368 else {
365 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); 369 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
366 return 2; 370 return 2;
diff --git a/uisimulator/bitmaps/UI-creativezenxfi3.bmp b/uisimulator/bitmaps/UI-creativezenxfi3.bmp
new file mode 100644
index 0000000000..f20abdc24f
--- /dev/null
+++ b/uisimulator/bitmaps/UI-creativezenxfi3.bmp
Binary files differ
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES
index 7213d1cff3..7258490ec4 100644
--- a/uisimulator/buttonmap/SOURCES
+++ b/uisimulator/buttonmap/SOURCES
@@ -67,6 +67,8 @@ mpio-hd200.c
67mpio-hd300.c 67mpio-hd300.c
68#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD 68#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
69sansa-fuzeplus.c 69sansa-fuzeplus.c
70#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
71creative-zenxfi3.c
70#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD 72#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
71sansa-connect.c 73sansa-connect.c
72#endif 74#endif
diff --git a/uisimulator/buttonmap/creative-zenxfi3.c b/uisimulator/buttonmap/creative-zenxfi3.c
new file mode 100644
index 0000000000..fcf78a3e90
--- /dev/null
+++ b/uisimulator/buttonmap/creative-zenxfi3.c
@@ -0,0 +1,74 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
23#include <SDL.h>
24#include "button.h"
25#include "buttonmap.h"
26
27int key_to_button(int keyboard_button)
28{
29 int new_btn = BUTTON_NONE;
30 switch (keyboard_button)
31 {
32 case SDLK_KP4:
33 case SDLK_LEFT:
34 new_btn = BUTTON_LEFT;
35 break;
36 case SDLK_KP6:
37 case SDLK_RIGHT:
38 new_btn = BUTTON_RIGHT;
39 break;
40 case SDLK_KP8:
41 case SDLK_UP:
42 new_btn = BUTTON_UP;
43 break;
44 case SDLK_KP2:
45 case SDLK_DOWN:
46 new_btn = BUTTON_DOWN;
47 break;
48 case SDLK_PAGEDOWN:
49 case SDLK_KP3:
50 new_btn = BUTTON_MENU;
51 break;
52 case SDLK_KP_PLUS:
53 new_btn = BUTTON_VOL_UP;
54 break;
55 case SDLK_KP_MINUS:
56 new_btn = BUTTON_VOL_DOWN;
57 break;
58 case SDLK_HOME:
59 new_btn = BUTTON_POWER;
60 break;
61 }
62 return new_btn;
63}
64
65struct button_map bm[] = {
66 { SDLK_LEFT, 69, 303, 10, "Left" },
67 { SDLK_RIGHT, 241, 172, 10, "Right" },
68 { SDLK_UP, 240, 87, 10, "Up" },
69 { SDLK_DOWN, 239, 264, 10, "Down" },
70 { SDLK_PAGEDOWN, 191, 303, 10, "Menu" },
71 { SDLK_KP_MINUS, 270, 150, 0, "Volume -" },
72 { SDLK_KP_PLUS, 270, 180, 0, "Volume +" },
73 { 0, 0, 0, 0, "None" }
74};