libmad: Optimize away 2 instructions from coldfire III_imdct, no measurable speed...
[kugel-rb.git] / apps / keymaps / keymap-ondavx747.c
blob812b16274a05288fef429622580fe877864cf669
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 by Maurus Cuelenaere
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 /* Button Code Definitions for the Onda VX747 target */
23 /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
25 #include <stdio.h>
26 #include <string.h>
27 #include <stdlib.h>
29 #include "config.h"
30 #include "action.h"
31 #include "button.h"
32 #include "settings.h"
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
41 static const struct button_mapping button_context_standard[] = {
42 { ACTION_STD_PREV, BUTTON_VOL_DOWN, BUTTON_NONE },
43 { ACTION_STD_PREVREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
44 { ACTION_STD_NEXT, BUTTON_VOL_UP, BUTTON_NONE },
45 { ACTION_STD_NEXTREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
47 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
48 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
50 { ACTION_STD_QUICKSCREEN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
51 { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
53 LAST_ITEM_IN_LIST
54 }; /* button_context_standard */
57 static const struct button_mapping button_context_wps[] = {
59 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
60 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
61 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
62 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
63 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
64 { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
66 { ACTION_WPS_MENU, BUTTON_POWER, BUTTON_NONE },
68 LAST_ITEM_IN_LIST
69 }; /* button_context_wps */
71 static const struct button_mapping button_context_list[] = {
72 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
73 }; /* button_context_list */
75 static const struct button_mapping button_context_tree[] = {
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
77 }; /* button_context_tree */
79 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
80 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
83 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
87 static const struct button_mapping button_context_settings[] = {
88 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
89 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
90 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
91 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
92 { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE },
93 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
95 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
96 }; /* button_context_settings */
98 static const struct button_mapping button_context_settings_right_is_inc[] = {
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
101 }; /* button_context_settingsgraphical */
103 static const struct button_mapping button_context_yesno[] = {
104 { ACTION_YESNO_ACCEPT, BUTTON_MENU, BUTTON_NONE },
105 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
106 }; /* button_context_settings_yesno */
108 static const struct button_mapping button_context_colorchooser[] = {
109 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
110 }; /* button_context_colorchooser */
112 static const struct button_mapping button_context_eq[] = {
113 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
114 }; /* button_context_eq */
116 /** Bookmark Screen **/
117 static const struct button_mapping button_context_bmark[] = {
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
119 }; /* button_context_bmark */
121 static const struct button_mapping button_context_time[] = {
122 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
123 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
124 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
125 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
126 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
127 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
129 }; /* button_context_time */
131 static const struct button_mapping button_context_quickscreen[] = {
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
134 }; /* button_context_quickscreen */
136 static const struct button_mapping button_context_pitchscreen[] = {
138 { ACTION_PS_INC_SMALL, BUTTON_VOL_UP, BUTTON_NONE },
139 { ACTION_PS_INC_SMALL, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
140 { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN, BUTTON_NONE },
141 { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
142 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
144 }; /* button_context_pitchcreen */
146 /** FM Radio Screen **/
147 static const struct button_mapping button_context_radio[] = {
148 { ACTION_STD_PREV, BUTTON_VOL_DOWN, BUTTON_NONE },
149 { ACTION_STD_PREVREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
150 { ACTION_STD_NEXT, BUTTON_VOL_UP, BUTTON_NONE },
151 { ACTION_STD_NEXTREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_FM_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
153 { ACTION_FM_PRESET, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
154 { ACTION_FM_MODE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
155 { ACTION_FM_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
156 //{ ACTION_FM_QUICKSCREEN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
157 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
158 }; /* button_context_radio */
160 static const struct button_mapping button_context_keyboard[] = {
161 { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE },
162 { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE },
163 { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
164 { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_UP, BUTTON_NONE },
165 { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
166 { ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
167 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
169 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
170 }; /* button_context_keyboard */
172 #ifdef USB_ENABLE_HID
173 static const struct button_mapping button_context_usb_hid[] = {
174 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
175 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
177 LAST_ITEM_IN_LIST
178 }; /* button_context_usb_hid */
180 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
181 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
182 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
183 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
184 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
185 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_VOL_DOWN|BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_VOL_DOWN|BUTTON_VOL_UP },
186 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
187 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_MENU|BUTTON_LEFT|BUTTON_REL, BUTTON_MENU|BUTTON_LEFT },
188 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REL, BUTTON_MENU|BUTTON_RIGHT },
190 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
191 }; /* button_context_usb_hid_mode_multimedia */
193 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
194 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
195 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
196 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_VOL_DOWN },
197 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_VOL_UP|BUTTON_REL, BUTTON_VOL_UP },
198 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_VOL_DOWN },
199 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_VOL_UP },
200 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_VOL_DOWN|BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_VOL_DOWN|BUTTON_VOL_UP },
202 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
203 }; /* button_context_usb_hid_mode_presentation */
205 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
206 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_DOWN, BUTTON_NONE },
207 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
208 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_UP, BUTTON_NONE },
209 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
210 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_MENU|BUTTON_VOL_UP|BUTTON_REL, BUTTON_MENU|BUTTON_VOL_UP },
211 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_MENU|BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_MENU|BUTTON_VOL_DOWN },
212 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
214 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
215 }; /* button_context_usb_hid_mode_browser */
216 #endif
218 const struct button_mapping* target_get_context_mapping(int context)
220 switch (context)
222 case CONTEXT_STD:
223 return button_context_standard;
224 case CONTEXT_WPS:
225 return button_context_wps;
227 case CONTEXT_LIST:
228 return button_context_list;
229 case CONTEXT_MAINMENU:
230 case CONTEXT_TREE:
231 if (global_settings.hold_lr_for_scroll_in_list)
232 return button_context_listtree_scroll_without_combo;
233 else
234 return button_context_listtree_scroll_with_combo;
235 case CONTEXT_CUSTOM|CONTEXT_TREE:
236 return button_context_tree;
238 case CONTEXT_SETTINGS:
239 return button_context_settings;
240 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
241 case CONTEXT_SETTINGS_RECTRIGGER:
242 return button_context_settings_right_is_inc;
244 case CONTEXT_SETTINGS_COLOURCHOOSER:
245 return button_context_colorchooser;
246 case CONTEXT_SETTINGS_EQ:
247 return button_context_eq;
249 case CONTEXT_SETTINGS_TIME:
250 return button_context_time;
252 case CONTEXT_YESNOSCREEN:
253 return button_context_yesno;
254 case CONTEXT_FM:
255 return button_context_radio;
256 case CONTEXT_BOOKMARKSCREEN:
257 return button_context_bmark;
258 case CONTEXT_QUICKSCREEN:
259 return button_context_quickscreen;
260 case CONTEXT_PITCHSCREEN:
261 return button_context_pitchscreen;
262 case CONTEXT_KEYBOARD:
263 return button_context_keyboard;
264 #ifdef USB_ENABLE_HID
265 case CONTEXT_USB_HID:
266 return button_context_usb_hid;
267 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
268 return button_context_usb_hid_mode_multimedia;
269 case CONTEXT_USB_HID_MODE_PRESENTATION:
270 return button_context_usb_hid_mode_presentation;
271 case CONTEXT_USB_HID_MODE_BROWSER:
272 return button_context_usb_hid_mode_browser;
273 #endif
275 return button_context_standard;