psxbios: Fix card_status function as to use card_active_chan.
[pcsx_rearmed.git] / frontend / plat_pandora.c
CommitLineData
799b0b87 1/*
2 * (C) notaz, 2011
3 *
4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
8#include <stdio.h>
799b0b87 9#include <linux/input.h>
799b0b87 10
cc56203b 11#include "libpicofe/input.h"
12#include "libpicofe/linux/in_evdev.h"
13#include "libpicofe/plat.h"
799b0b87 14#include "plugin_lib.h"
ab423939 15#include "plat_omap.h"
8f892648 16#include "main.h"
ab423939 17#include "menu.h"
799b0b87 18
b07c18e8 19static const struct in_default_bind in_evdev_defbinds[] = {
799b0b87 20 { KEY_UP, IN_BINDTYPE_PLAYER12, DKEY_UP },
21 { KEY_DOWN, IN_BINDTYPE_PLAYER12, DKEY_DOWN },
22 { KEY_LEFT, IN_BINDTYPE_PLAYER12, DKEY_LEFT },
23 { KEY_RIGHT, IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
799b0b87 24 { KEY_PAGEUP, IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
25 { KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, DKEY_CROSS },
26 { KEY_END, IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
27 { KEY_HOME, IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
28 { KEY_LEFTALT, IN_BINDTYPE_PLAYER12, DKEY_START },
29 { KEY_LEFTCTRL, IN_BINDTYPE_PLAYER12, DKEY_SELECT },
30 { KEY_RIGHTSHIFT,IN_BINDTYPE_PLAYER12, DKEY_L1 },
31 { KEY_RIGHTCTRL, IN_BINDTYPE_PLAYER12, DKEY_R1 },
32 { KEY_Q, IN_BINDTYPE_PLAYER12, DKEY_L2 },
33 { KEY_P, IN_BINDTYPE_PLAYER12, DKEY_R2 },
4ea086f6 34 { KEY_MENU, IN_BINDTYPE_EMU, SACTION_MINIMIZE },
8f892648 35 { KEY_SPACE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
36 { KEY_1, IN_BINDTYPE_EMU, SACTION_SAVE_STATE },
37 { KEY_2, IN_BINDTYPE_EMU, SACTION_LOAD_STATE },
38 { KEY_3, IN_BINDTYPE_EMU, SACTION_PREV_SSLOT },
39 { KEY_4, IN_BINDTYPE_EMU, SACTION_NEXT_SSLOT },
40 { KEY_5, IN_BINDTYPE_EMU, SACTION_TOGGLE_FSKIP },
29a8c4f3 41 { KEY_6, IN_BINDTYPE_EMU, SACTION_SCREENSHOT },
dde7da71 42 { KEY_7, IN_BINDTYPE_EMU, SACTION_TOGGLE_FPS },
456f1b86 43 { KEY_8, IN_BINDTYPE_EMU, SACTION_SWITCH_DISPMODE },
dde7da71 44 { KEY_BACKSPACE,IN_BINDTYPE_EMU, SACTION_FAST_FORWARD },
799b0b87 45 { 0, 0, 0 }
46};
47
bcfc48e3 48static const struct menu_keymap key_pbtn_map[] =
49{
50 { KEY_UP, PBTN_UP },
51 { KEY_DOWN, PBTN_DOWN },
52 { KEY_LEFT, PBTN_LEFT },
53 { KEY_RIGHT, PBTN_RIGHT },
54 /* Pandora */
55 { KEY_END, PBTN_MOK },
56 { KEY_PAGEDOWN, PBTN_MBACK },
57 { KEY_HOME, PBTN_MA2 },
58 { KEY_PAGEUP, PBTN_MA3 },
59 { KEY_LEFTCTRL, PBTN_MENU },
60 { KEY_RIGHTSHIFT, PBTN_L },
61 { KEY_RIGHTCTRL, PBTN_R },
62 /* "normal" keyboards */
63 { KEY_ENTER, PBTN_MOK },
64 { KEY_ESC, PBTN_MBACK },
65 { KEY_SEMICOLON, PBTN_MA2 },
66 { KEY_APOSTROPHE, PBTN_MA3 },
67 { KEY_BACKSLASH, PBTN_MENU },
68 { KEY_LEFTBRACE, PBTN_L },
69 { KEY_RIGHTBRACE, PBTN_R },
70};
71
72static const struct in_pdata pandora_evdev_pdata = {
73 .defbinds = in_evdev_defbinds,
74 .key_map = key_pbtn_map,
75 .kmap_size = sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]),
76};
77
ab423939 78int plat_init(void)
799b0b87 79{
ab423939 80 plat_omap_init();
cc56203b 81 plat_target_init();
ab423939 82
bcfc48e3 83 in_evdev_init(&pandora_evdev_pdata);
ef94866c 84 in_probe();
cc56203b 85 plat_target_setup_input();
86
1b0c5139 87 in_adev[0] = in_name_to_id("evdev:nub0");
88 in_adev[1] = in_name_to_id("evdev:nub1");
2c5d0a55 89 in_adev_is_nublike[0] = in_adev_is_nublike[1] = 1;
799b0b87 90
91 return 0;
92}
55b0eeea 93
ab423939 94void plat_finish(void)
95{
96 plat_omap_finish();
cc56203b 97 plat_target_finish();
ab423939 98}
99
100void plat_gvideo_open(int is_pal)
101{
cc56203b 102 plat_target_lcdrate_set(is_pal);
5b9aa749 103 plat_target_hwfilter_set(plat_target.hwfilter);
cc56203b 104 plat_target_gamma_set(g_gamma, 0);
ab423939 105
106 plat_omap_gvideo_open();
107}
55b0eeea 108
d71c7095 109void plat_trigger_vibrate(int pad, int low, int high)
ab423939 110{
111}