X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fin_gp2x.c;h=bfa2df156516edb3e0c6e73d178bd1197ba59ba9;hb=HEAD;hp=196f1218ece8037c387fc159aacc4f05c5ec670c;hpb=e99d80480196f551f7e6c06deae3750de19b4c0e;p=libpicofe.git diff --git a/gp2x/in_gp2x.c b/gp2x/in_gp2x.c index 196f121..bfa2df1 100644 --- a/gp2x/in_gp2x.c +++ b/gp2x/in_gp2x.c @@ -1,3 +1,14 @@ +/* + * (C) Gražvydas "notaz" Ignotas, 2006-2012 + * + * This work is licensed under the terms of any of these licenses + * (at your option): + * - GNU GPL, version 2 or later. + * - GNU LGPL, version 2.1 or later. + * - MAME license. + * See the COPYING file in the top-level directory. + */ + #include #include #include @@ -6,13 +17,15 @@ #include #include -#include "../common/input.h" +#include "../input.h" +#include "soc.h" +#include "plat_gp2x.h" #include "in_gp2x.h" #define IN_GP2X_PREFIX "gp2x:" #define IN_GP2X_NBUTTONS 32 -/* note: in_gp2x hadles combos (if 2 btns have the same bind, +/* note: in_gp2x handles combos (if 2 btns have the same bind, * both must be pressed for action to happen) */ static int in_gp2x_combo_keys = 0; static int in_gp2x_combo_acts = 0; @@ -36,15 +49,14 @@ static const char *in_gp2x_keys[IN_GP2X_NBUTTONS] = { static int in_gp2x_get_mmsp2_bits(void) { - extern volatile unsigned short *gp2x_memregs; int value; - value = gp2x_memregs[0x1198>>1] & 0xff; // GPIO M + value = memregs[0x1198>>1] & 0xff; // GPIO M if (value == 0xFD) value = 0xFA; if (value == 0xF7) value = 0xEB; if (value == 0xDF) value = 0xAF; if (value == 0x7F) value = 0xBE; - value |= gp2x_memregs[0x1184>>1] & 0xFF00; // GPIO C - value |= gp2x_memregs[0x1186>>1] << 16; // GPIO D + value |= memregs[0x1184>>1] & 0xFF00; // GPIO C + value |= memregs[0x1186>>1] << 16; // GPIO D value = ~value & 0x08c0ff55; return value; @@ -76,18 +88,7 @@ static int in_gp2x_get_wiz_bits(void) return value; } -#ifdef FAKE_IN_GP2X -volatile unsigned short *gp2x_memregs; -int gp2x_dev_id = -1; - -static int in_gp2x_get_fake_bits(void) -{ - extern int current_keys; - return current_keys; -} -#endif - -static void in_gp2x_probe(void) +static void in_gp2x_probe(const in_drv_t *drv) { switch (gp2x_dev_id) { @@ -104,10 +105,6 @@ static void in_gp2x_probe(void) break; // we'll use evdev for Caanoo default: -#ifdef FAKE_IN_GP2X - in_gp2x_get_bits = in_gp2x_get_fake_bits; - break; -#endif return; } @@ -124,7 +121,7 @@ static void in_gp2x_free(void *drv_data) } static const char * const * -in_gp2x_get_key_names(int *count) +in_gp2x_get_key_names(const in_drv_t *drv, int *count) { *count = IN_GP2X_NBUTTONS; return in_gp2x_keys; @@ -197,7 +194,7 @@ static const struct { #define KEY_PBTN_MAP_SIZE (sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0])) -static int in_gp2x_menu_translate(void *drv_data, int keycode) +static int in_gp2x_menu_translate(void *drv_data, int keycode, char *charcode) { int i; if (keycode < 0) @@ -306,6 +303,6 @@ void in_gp2x_init(const struct in_default_bind *defbinds) in_gp2x_combo_keys = in_gp2x_combo_acts = 0; - in_register_driver(&in_gp2x_drv, defbinds); + in_register_driver(&in_gp2x_drv, defbinds, NULL); }