|
From: <sen...@us...> - 2009-02-15 09:55:30
|
Revision: 355
http://open2x.svn.sourceforge.net/open2x/?rev=355&view=rev
Author: senquack
Date: 2009-02-15 09:55:25 +0000 (Sun, 15 Feb 2009)
Log Message:
-----------
Added low-level stick-click emulation and also added control remapping for /dev/GPIO
Modified Paths:
--------------
trunk/kernel/linux-open2x-2.4.26_FW2-3/drivers/char/mmsp2-key.c
trunk/kernel/linux-open2x-2.4.26_FW2-3/include/asm-arm/arch-mmsp2/mmsp20.h
trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sched.c
trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sys.c
Modified: trunk/kernel/linux-open2x-2.4.26_FW2-3/drivers/char/mmsp2-key.c
===================================================================
--- trunk/kernel/linux-open2x-2.4.26_FW2-3/drivers/char/mmsp2-key.c 2009-02-02 21:39:54 UTC (rev 354)
+++ trunk/kernel/linux-open2x-2.4.26_FW2-3/drivers/char/mmsp2-key.c 2009-02-15 09:55:25 UTC (rev 355)
@@ -41,8 +41,10 @@
#define VOL_UP GPIO_D7
#define VOL_DOWN GPIO_D6
+//senquack - moved this outside the ifdef below for stick click emulation purposes:
+#define TACT_SW GPIO_D11
+
#ifndef CONFIG_MACH_GP2XF200
-#define TACT_SW GPIO_D11
#else
#define USB_CHECK GPIO_F5
#define USB_TO_SD GPIO_F2
@@ -59,28 +61,53 @@
#endif
/* IOCTL CMD*/
-#define BACK_LIGHT_OFF 0
-#define BACK_LIGHT_ON 1
-#define BATT_LED_ON 2
-#define BATT_LED_OFF 3
+//senquack - GPH's ioctl interface is here utterly broken, unused, and braindead. Replacing
+//it with my own.
+//#define BACK_LIGHT_OFF 0
+//#define BACK_LIGHT_ON 1
+//#define BATT_LED_ON 2
+//#define BATT_LED_OFF 3
+//
+//#define FCLK_200 10
+//#define FCLK_166 11
+//#define FCLK_133 12
+//#define FCLK_100 13
+//#define FCLK_78 14
+//#define FCLK_64 15
+//#define FCLK_DEFUALT 16
+//#define SD_CLK_MODE_0 17 /* 5Mhz */
+//#define SD_CLK_MODE_1 18 /* 15Mhz */
+//#define SD_CLK_MODE_2 19 /* 25Mhz */
+//#define GP2X_INFO_LSB 20
+//#define GP2X_INFO_MSB 21
+//#define GP2X_GET_USBHCHK 30
+//#define USB_CONNECT_START 31
+//#define USB_CONNECT_END 32
+//senquack - new stick-click emulation controllable by these new ioctl commands:
+#define GP2X_SET_STICK_CLICK_EMULATION_MODE 40
+// senquack - new /dev/GPIO button remapping controllable by these commands:
+#define GP2X_REMAP_BUTTON_00 50
+#define GP2X_REMAP_BUTTON_01 51
+#define GP2X_REMAP_BUTTON_02 52
+#define GP2X_REMAP_BUTTON_03 53
+#define GP2X_REMAP_BUTTON_04 54
+#define GP2X_REMAP_BUTTON_05 55
+#define GP2X_REMAP_BUTTON_06 56
+#define GP2X_REMAP_BUTTON_07 57
+#define GP2X_REMAP_BUTTON_08 58
+#define GP2X_REMAP_BUTTON_09 59
+#define GP2X_REMAP_BUTTON_10 60
+#define GP2X_REMAP_BUTTON_11 61
+#define GP2X_REMAP_BUTTON_12 62
+#define GP2X_REMAP_BUTTON_13 63
+#define GP2X_REMAP_BUTTON_14 64
+#define GP2X_REMAP_BUTTON_15 65
+#define GP2X_REMAP_BUTTON_16 66
+#define GP2X_REMAP_BUTTON_17 67
+#define GP2X_REMAP_BUTTON_18 68
+#define GP2X_DISABLE_REMAPPING 69
-#define FCLK_200 10
-#define FCLK_166 11
-#define FCLK_133 12
-#define FCLK_100 13
-#define FCLK_78 14
-#define FCLK_64 15
-#define FCLK_DEFUALT 16
-#define SD_CLK_MODE_0 17 /* 5Mhz */
-#define SD_CLK_MODE_1 18 /* 15Mhz */
-#define SD_CLK_MODE_2 19 /* 25Mhz */
-#define GP2X_INFO_LSB 20
-#define GP2X_INFO_MSB 21
-#define GP2X_GET_USBHCHK 30
-#define USB_CONNECT_START 31
-#define USB_CONNECT_END 32
-
/* UCLK = 95.xxxMHz. It's default value. */
#define U_MDIV (0x60)
#define U_PDIV (0x0)
@@ -91,7 +118,6 @@
#define A_PDIV 0x0
#define A_SDIV 0x2
-
struct timeval cur_tv;
static unsigned int old_tv_usec = 0;
@@ -194,104 +220,238 @@
keyTemp=0;
keyTemp|=read_gpio_bit(VOL_UP);
keyTemp|=read_gpio_bit(VOL_DOWN)<<1;
- keyTemp=(~keyTemp)& 0x03;
+ //senquack - added emulation of stick click so we now *do* check for TACT_SW:
+// keyTemp=(~keyTemp)& 0x03;
+ if (g_stick_click_mode == OPEN2X_STICK_CLICK_DISABLED)
+ {
+ // force stick-click to be unpressed when emulation disabled on F200s
+ keyTemp |= 1 << 2;
+ }
+ else
+ {
+ keyTemp |= read_gpio_bit(TACT_SW) << 2;
+ }
+
+ keyTemp = (~keyTemp) & 0x07;
+
+
keyTemp|=read_gpio_bit(USB_CHECK)<<3;
keyValue|=(unsigned long) keyTemp << 16;
#endif
- copy_to_user( Putbuf, &keyValue, 4);
+
+ //senquack - new support for button remapping:
+ if (g_button_remapping)
+ {
+ unsigned long remapped_keyValue = (keyTemp & 0x80000); // Store away lone USB_CHECK bit
+ for (i = 18; i >= 0; i--)
+ {
+ // check if button is even enabled:
+ if (g_button_mapping[i] != -1)
+ remapped_keyValue |= ((keyValue >> i) & 0x1) << g_button_mapping[i];
+ }
+ copy_to_user( Putbuf, &remapped_keyValue, 4);
+ }
+ else
+ {
+ copy_to_user( Putbuf, &keyValue, 4);
+ }
return length;
}
-int MMSP2key_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,unsigned long arg)
+//senquack - as far as I can tell, this ioctl interface is completely and utterly broken
+// and unused by even GPH themselves. I am redoing it with my own commands.
+//int MMSP2key_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,unsigned long arg)
+//{
+// MMSP20_CLOCK_POWER *pPMR_REG;
+// pPMR_REG = MMSP20_GetBase_CLOCK_POWER();
+//
+// switch(arg)
+// {
+// case 0:
+//#ifndef CONFIG_MACH_GP2XF200
+// write_gpio_bit(GPIO_H1,0); //LCD VGH oFF
+// write_gpio_bit(GPIO_H2,0); //LCD Back oFF
+//#else
+// write_gpio_bit(GPIO_H1,0); //5V OFF
+// write_gpio_bit(GPIO_L11,0); //LCD Back oFF
+//#endif
+// break;
+// case 1:
+//#ifndef CONFIG_MACH_GP2XF200
+// write_gpio_bit(GPIO_H1,1); //LCD VGH on
+// write_gpio_bit(GPIO_H2,1); //LCD Back on
+//#else
+// write_gpio_bit(GPIO_H1,1); //5V ON
+// write_gpio_bit(GPIO_L11,1); //LCD Back ON
+//#endif
+// break;
+// case BATT_LED_ON:
+//#ifndef CONFIG_MACH_GP2XF200
+// write_gpio_bit(GPIO_H4,0); //Batt LED on
+//#endif
+// break;
+// case BATT_LED_OFF:
+//#ifndef CONFIG_MACH_GP2XF200
+// write_gpio_bit(GPIO_H4,1); //Batt LED oFF
+//#endif
+// break;
+// case GP2X_INFO_LSB:
+// //senquack - this seems to be extraneous.. cannot find this function anywhere:
+//// return GetGp2xInfo(1);
+// case GP2X_INFO_MSB:
+// //senquack - this seems to be extraneous.. cannot find this function anywhere:
+//// return GetGp2xInfo(0);
+// case FCLK_200:
+// pPMR_REG->FPLLSETVREG = ((0x49 << 8) + (1 << 2) + 0);
+// udelay(4000);
+// break;
+// case FCLK_166:
+// pPMR_REG->FPLLSETVREG = ((0x3B << 8) + (1 << 2) + 0);
+// udelay(4000);
+// break;
+// case FCLK_133:
+// pPMR_REG->FPLLSETVREG = ((0x2E << 8) + (1 << 2) + 0);
+// udelay(4000);
+// break;
+// case FCLK_100:
+// pPMR_REG->FPLLSETVREG = ((0x20 << 8) + (1 << 2) + 0);
+// udelay(4000);
+// printk("fclk 100MHZ\n");
+// break;
+// case FCLK_78:
+// pPMR_REG->FPLLSETVREG = ((0x18 << 8) + (1 << 2) + 0);
+// udelay(4000);
+// break;
+// case FCLK_64:
+// pPMR_REG->FPLLSETVREG = ((0x12 << 8) + (1 << 2) + 0);
+// udelay(4000);
+// break;
+//#ifdef CONFIG_MACH_GP2XF200
+// case USB_CONNECT_START:
+// /* Usb to SD mode */
+// write_gpio_bit(CPU_TO_SD,1);
+// write_gpio_bit(USB_TO_SD,0);
+// write_gpio_bit(USB_CPU_RESET,1);
+// udelay(50);
+// break;
+// case USB_CONNECT_END:
+// /* SD to usb mode */
+// write_gpio_bit(USB_CPU_RESET,0);
+// write_gpio_bit(CPU_TO_SD,0);
+// write_gpio_bit(USB_TO_SD,1);
+// break;
+//#endif
+// case GP2X_GET_USBHCHK:
+// //senquack - this is not defined using the current headers, I am disabling it because
+// //it probably never worked anyway:
+//// return GetUshHcon();
+//
+// //senquack - new stick click emulation:
+////#define GP2X_STICK_CLICK_EMULATION_DISABLED 43
+////#define GP2X_STICK_CLICK_EMULATION_DPAD 44
+////#define GP2X_STICK_CLICK_EMULATION_VOLUPDOWN 45
+////int g_stick_click_mode = OPEN2X_STICK_CLICK_DISABLED;
+// case GP2X_STICK_CLICK_EMULATION_DISABLED:
+// // g_stick_click_mode global is buried in kernel/sys.c:
+// // (cannot store globals here, they get trashed)
+// printk("kernel: stick click emulation disabled\n");
+// g_stick_click_mode = OPEN2X_STICK_CLICK_DISABLED;
+// set_gpio_ctrl(TACT_SW,GPIOMD_IN,GPIOPU_EN); // original GPH GPIO configuration
+// break;
+// case GP2X_STICK_CLICK_EMULATION_DPAD:
+// printk("kernel: stick click emulation DPAD\n");
+// g_stick_click_mode = OPEN2X_STICK_CLICK_DPAD;
+// set_gpio_ctrl(TACT_SW,GPIOMD_OUT,GPIOPU_DIS); // new GPIO configuration for emulation
+// break;
+// case GP2X_STICK_CLICK_EMULATION_VOLUPDOWN:
+// printk("kernel: stick click emulation VOLUP+DOWN\n");
+// g_stick_click_mode = OPEN2X_STICK_CLICK_VOLUPDOWN;
+// set_gpio_ctrl(TACT_SW,GPIOMD_OUT,GPIOPU_DIS); // new GPIO configuration for emulation
+// break;
+// case FCLK_DEFUALT:
+// break;
+// }
+//
+// return 0;
+//}
+//#define GP2X_SET_STICK_CLICK_EMULATION_MODE 40
+int MMSP2key_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
{
- MMSP20_CLOCK_POWER *pPMR_REG;
- pPMR_REG = MMSP20_GetBase_CLOCK_POWER();
+ int int_param;
- switch(arg)
+ switch (cmd)
{
- case 0:
-#ifndef CONFIG_MACH_GP2XF200
- write_gpio_bit(GPIO_H1,0); //LCD VGH oFF
- write_gpio_bit(GPIO_H2,0); //LCD Back oFF
-#else
- write_gpio_bit(GPIO_H1,0); //5V OFF
- write_gpio_bit(GPIO_L11,0); //LCD Back oFF
-#endif
+ case GP2X_SET_STICK_CLICK_EMULATION_MODE:
+ // g_stick_click_mode global is buried in kernel/sys.c:
+ // (cannot store globals here, they get trashed)
+ printk("kernel: set stick click emulation mode\n");
+ if (get_user(int_param, (int *)arg))
+ return -EFAULT;
+ if (int_param == OPEN2X_STICK_CLICK_DISABLED)
+ {
+ printk("kernel: stick click emulation disabled\n");
+ g_stick_click_mode = int_param;
+ set_gpio_ctrl(TACT_SW,GPIOMD_IN,GPIOPU_EN); // original GPH GPIO configuration
+ }
+ else if (int_param == OPEN2X_STICK_CLICK_DPAD)
+ {
+ printk("kernel: stick click emulation DPAD\n");
+ g_stick_click_mode = int_param;
+ set_gpio_ctrl(TACT_SW,GPIOMD_OUT,GPIOPU_DIS); // new GPIO configuration for emulation
+ }
+ else if (int_param == OPEN2X_STICK_CLICK_VOLUPDOWN)
+ {
+ printk("kernel: stick click emulation VOLUP+DOWN\n");
+ g_stick_click_mode = int_param;
+ set_gpio_ctrl(TACT_SW,GPIOMD_OUT,GPIOPU_DIS); // new GPIO configuration for emulation
+ }
break;
- case 1:
-#ifndef CONFIG_MACH_GP2XF200
- write_gpio_bit(GPIO_H1,1); //LCD VGH on
- write_gpio_bit(GPIO_H2,1); //LCD Back on
-#else
- write_gpio_bit(GPIO_H1,1); //5V ON
- write_gpio_bit(GPIO_L11,1); //LCD Back ON
-#endif
+ case GP2X_REMAP_BUTTON_00:
+ case GP2X_REMAP_BUTTON_01:
+ case GP2X_REMAP_BUTTON_02:
+ case GP2X_REMAP_BUTTON_03:
+ case GP2X_REMAP_BUTTON_04:
+ case GP2X_REMAP_BUTTON_05:
+ case GP2X_REMAP_BUTTON_06:
+ case GP2X_REMAP_BUTTON_07:
+ case GP2X_REMAP_BUTTON_08:
+ case GP2X_REMAP_BUTTON_09:
+ case GP2X_REMAP_BUTTON_10:
+ case GP2X_REMAP_BUTTON_11:
+ case GP2X_REMAP_BUTTON_12:
+ case GP2X_REMAP_BUTTON_13:
+ case GP2X_REMAP_BUTTON_14:
+ case GP2X_REMAP_BUTTON_15:
+ case GP2X_REMAP_BUTTON_16:
+ case GP2X_REMAP_BUTTON_17:
+ case GP2X_REMAP_BUTTON_18:
+//extern int g_button_mapping[19]; // array of gp2x button mappings used in mmsp2-key.c (in kernel/sys.c)
+//extern int g_button_remapping; // When this is 0, remapping is off, 1 is on (in kernel/sys.c)
+ if (get_user(int_param, (int *)arg))
+ return -EFAULT;
+ if (int_param >= -1 && int_param <= 18)
+ {
+ // FYI: if user passed -1, that signifies the button is disabled
+ g_button_remapping = 1;
+ g_button_mapping[cmd - 50] = int_param;
+ }
break;
- case BATT_LED_ON:
-#ifndef CONFIG_MACH_GP2XF200
- write_gpio_bit(GPIO_H4,0); //Batt LED on
-#endif
+ case GP2X_DISABLE_REMAPPING:
+ g_button_remapping = 0;
+ int i;
+ for (i = 0; i < 19; i++)
+ {
+ g_button_mapping[i] = i;
+ }
break;
- case BATT_LED_OFF:
-#ifndef CONFIG_MACH_GP2XF200
- write_gpio_bit(GPIO_H4,1); //Batt LED oFF
-#endif
+ default:
break;
- case GP2X_INFO_LSB:
- return GetGp2xInfo(1);
- case GP2X_INFO_MSB:
- return GetGp2xInfo(0);
- case FCLK_200:
- pPMR_REG->FPLLSETVREG = ((0x49 << 8) + (1 << 2) + 0);
- udelay(4000);
- break;
- case FCLK_166:
- pPMR_REG->FPLLSETVREG = ((0x3B << 8) + (1 << 2) + 0);
- udelay(4000);
- break;
- case FCLK_133:
- pPMR_REG->FPLLSETVREG = ((0x2E << 8) + (1 << 2) + 0);
- udelay(4000);
- break;
- case FCLK_100:
- pPMR_REG->FPLLSETVREG = ((0x20 << 8) + (1 << 2) + 0);
- udelay(4000);
- printk("fclk 100MHZ\n");
- break;
- case FCLK_78:
- pPMR_REG->FPLLSETVREG = ((0x18 << 8) + (1 << 2) + 0);
- udelay(4000);
- break;
- case FCLK_64:
- pPMR_REG->FPLLSETVREG = ((0x12 << 8) + (1 << 2) + 0);
- udelay(4000);
- break;
-#ifdef CONFIG_MACH_GP2XF200
- case USB_CONNECT_START:
- /* Usb to SD mode */
- write_gpio_bit(CPU_TO_SD,1);
- write_gpio_bit(USB_TO_SD,0);
- write_gpio_bit(USB_CPU_RESET,1);
- udelay(50);
- break;
- case USB_CONNECT_END:
- /* SD to usb mode */
- write_gpio_bit(USB_CPU_RESET,0);
- write_gpio_bit(CPU_TO_SD,0);
- write_gpio_bit(USB_TO_SD,1);
- break;
-#endif
- case GP2X_GET_USBHCHK:
- return GetUshHcon();
- case FCLK_DEFUALT:
- break;
}
return 0;
}
-
struct file_operations MMSP2key_fops = {
open: MMSP2key_open,
read: MMSP2key_read,
@@ -321,6 +481,8 @@
set_gpio_ctrl(VOL_UP,GPIOMD_IN,GPIOPU_EN);
set_gpio_ctrl(VOL_DOWN,GPIOMD_IN,GPIOPU_EN);
+ //senquack - new stick-click emulation:
+
#ifndef CONFIG_MACH_GP2XF200
set_gpio_ctrl(TACT_SW,GPIOMD_IN,GPIOPU_EN);
#else
@@ -328,6 +490,14 @@
set_gpio_ctrl(CPU_TO_SD,GPIOMD_OUT,GPIOPU_EN);
set_gpio_ctrl(USB_TO_SD,GPIOMD_OUT,GPIOPU_EN);
set_gpio_ctrl(USB_CPU_RESET,GPIOMD_OUT,GPIOPU_EN);
+
+ //senquack - stick click emulation:
+// printk("Enabling F200 stick-click emulation\n");
+// set_gpio_ctrl(TACT_SW,GPIOMD_OUT,GPIOPU_DIS);
+ // configure this the same was as F100s initially.. it can be changed later to
+ // GPIOMD_OUT and GPIOPU_DIS when stick-click emulation is enabled after kernel boot:
+ set_gpio_ctrl(TACT_SW,GPIOMD_IN,GPIOPU_EN);
+
/* Cpu to sd mode */
write_gpio_bit(CPU_TO_SD,0);
write_gpio_bit(USB_TO_SD,1);
Modified: trunk/kernel/linux-open2x-2.4.26_FW2-3/include/asm-arm/arch-mmsp2/mmsp20.h
===================================================================
--- trunk/kernel/linux-open2x-2.4.26_FW2-3/include/asm-arm/arch-mmsp2/mmsp20.h 2009-02-02 21:39:54 UTC (rev 354)
+++ trunk/kernel/linux-open2x-2.4.26_FW2-3/include/asm-arm/arch-mmsp2/mmsp20.h 2009-02-15 09:55:25 UTC (rev 355)
@@ -19,6 +19,17 @@
//#include <asm/hardware.h> // mmsp2 register map in kernel src
+//senquack - added new defines for stick-click emulation (mostly used in sched.c)
+#define OPEN2X_STICK_CLICK_DISABLED 0 // stick-click emulation disabled (default)
+#define OPEN2X_STICK_CLICK_DPAD 1 // stick-click emulated by pressing UP+DOWN+LEFT+RIGHT
+#define OPEN2X_STICK_CLICK_VOLUPDOWN 2 // stick click emulated by pressing VOLUP+VOLDOWN
+//senquack - global that defines if we are emulating stick-click or not and if so
+// what button combo is used to trigger it:
+extern int g_stick_click_mode; // defined in kernel/sys.c, sue me, it works..
+extern int g_button_mapping[19]; // array of gp2x button mappings used in mmsp2-key.c (in kernel/sys.c)
+extern int g_button_remapping; // When this is 0, remapping is off, 1 is on (in kernel/sys.c)
+
+
#define MMSP20_UART_CHANNELS 4
/* MMSP20 only supports 512 Byte HW ECC */
Modified: trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sched.c
===================================================================
--- trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sched.c 2009-02-02 21:39:54 UTC (rev 354)
+++ trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sched.c 2009-02-15 09:55:25 UTC (rev 355)
@@ -33,6 +33,20 @@
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
+//senquack - for stick-click emulation:
+#define GP2X_VOLUME_UP GPIO_D7
+#define GP2X_VOLUME_DOWN GPIO_D6
+#define GP2X_UP GPIO_M0
+#define GP2X_DOWN GPIO_M4
+#define GP2X_LEFT GPIO_M2
+#define GP2X_RIGHT GPIO_M6
+#define GP2X_STICK_BUTTON GPIO_D11
+#include <asm/arch/proto_gpio.h>
+#include <asm/hardware.h>
+#include <asm/arch/mmsp20.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/mmsp20_type.h>
+
extern void timer_bh(void);
extern void tqueue_bh(void);
extern void immediate_bh(void);
@@ -546,6 +560,54 @@
*/
asmlinkage void schedule(void)
{
+ //senquack - GPIO is setup in mmsp2-key.c for now, seems to work OK.
+ //senquack - stick click emulation for F200 GP2Xes
+// set_gpio_ctrl(GP2X_STICK_BUTTON,GPIOMD_OUT,GPIOPU_EN);
+//
+// static int initialized_gpio = 0;
+// static int old_stick_click_mode = -1;
+
+// if (!initialized_gpio)
+
+// // have we just started the kernel? if so, initialize GPIO to default mode
+// if (old_stick_click_mode == -1)
+// {
+// set_gpio_ctrl(GP2X_STICK_BUTTON,GPIOMD_OUT,0);
+// old_stick_click_mode = g_stick_click_mode;
+// }
+
+ if (g_stick_click_mode == OPEN2X_STICK_CLICK_DPAD)
+ {
+ unsigned char active_pins;
+ active_pins = read_gpio_bit(GP2X_UP);
+ active_pins |= read_gpio_bit(GP2X_DOWN) << 1;
+ active_pins |= read_gpio_bit(GP2X_LEFT) << 2;
+ active_pins |= read_gpio_bit(GP2X_RIGHT) << 3;
+
+ if ((active_pins & 0xF) == 0)
+ {
+// printk("up+down+left+right, emulating stick-click\n");
+ write_gpio_bit(GP2X_STICK_BUTTON, 0);
+ }
+ else
+ {
+ // printk("nope\n");
+ write_gpio_bit(GP2X_STICK_BUTTON, 1);
+ }
+ }
+ else if (g_stick_click_mode == OPEN2X_STICK_CLICK_VOLUPDOWN)
+ {
+ if ( !read_gpio_bit(GP2X_VOLUME_UP) && !read_gpio_bit(GP2X_VOLUME_DOWN) )
+ {
+// printk("volup+voldown, emulating stick-click\n");
+ write_gpio_bit(GP2X_STICK_BUTTON, 0);
+ }
+ else
+ {
+ write_gpio_bit(GP2X_STICK_BUTTON, 1);
+ }
+ }
+
struct schedule_data * sched_data;
struct task_struct *prev, *next, *p;
struct list_head *tmp;
Modified: trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sys.c
===================================================================
--- trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sys.c 2009-02-02 21:39:54 UTC (rev 354)
+++ trunk/kernel/linux-open2x-2.4.26_FW2-3/kernel/sys.c 2009-02-15 09:55:25 UTC (rev 355)
@@ -20,6 +20,9 @@
#include <asm/uaccess.h>
#include <asm/io.h>
+//senquack - for stick-click emulation:
+#include <asm/arch/mmsp20.h>
+
#ifndef SET_UNALIGN_CTL
# define SET_UNALIGN_CTL(a,b) (-EINVAL)
#endif
@@ -52,6 +55,13 @@
// issue these ioctl calls from scripts and such.
int g_volume_scale = 100; // sue me, it works
+//senquack - added stick-click emulation for F200s and F100s with DPAD mod:
+int g_stick_click_mode = OPEN2X_STICK_CLICK_DISABLED;
+
+//senquack - array used my mmsp2-key.c to remap GP2X buttons reported by /dev/GPIO
+int g_button_mapping[19] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 };
+int g_button_remapping = 0; // When this is 0, remapping is off, 1 is on
+
/*
* this is where the system-wide overflow UID and GID are defined, for
* architectures that now have 32-bit UID/GID but didn't in the past
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|