Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
gamecon.c File Reference
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/parport.h>
#include <linux/input.h>
#include <linux/mutex.h>
#include <linux/slab.h>

Go to the source code of this file.

Data Structures

struct  gc_config
 
struct  gc_pad
 
struct  gc
 
struct  gc_subdev
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define GC_MAX_PORTS   3
 
#define GC_MAX_DEVICES   5
 
#define GC_REFRESH_TIME   HZ/100
 
#define GC_N64_LENGTH   32 /* N64 bit length, not including stop bit */
 
#define GC_N64_STOP_LENGTH   5 /* Length of encoded stop bit */
 
#define GC_N64_CMD_00   0x11111111UL
 
#define GC_N64_CMD_01   0xd1111111UL
 
#define GC_N64_CMD_03   0xdd111111UL
 
#define GC_N64_CMD_1b   0xdd1dd111UL
 
#define GC_N64_CMD_c0   0x111111ddUL
 
#define GC_N64_CMD_80   0x1111111dUL
 
#define GC_N64_STOP_BIT   0x1d /* Encoded stop bit */
 
#define GC_N64_REQUEST_DATA   GC_N64_CMD_01 /* the request data command */
 
#define GC_N64_DELAY   133 /* delay between transmit request, and response ready (us) */
 
#define GC_N64_DWS   3 /* delay between write segments (required for sound playback because of ISA DMA) */
 
#define GC_N64_POWER_W   0xe2 /* power during write (transmit request) */
 
#define GC_N64_POWER_R   0xfd /* power during read */
 
#define GC_N64_OUT   0x1d /* output bits to the 4 pads */
 
#define GC_N64_CLOCK   0x02 /* clock bits for read */
 
#define GC_NES_DELAY   6 /* Delay between bits - 6us */
 
#define GC_NES_LENGTH   8 /* The NES pads use 8 bits of data */
 
#define GC_SNES_LENGTH
 
#define GC_SNESMOUSE_LENGTH
 
#define GC_NES_POWER   0xfc
 
#define GC_NES_CLOCK   0x01
 
#define GC_NES_LATCH   0x02
 
#define GC_MULTI_LENGTH   5 /* Multi system joystick packet length is 5 */
 
#define GC_MULTI2_LENGTH   6 /* One more bit for one more button */
 
#define GC_PSX_DELAY   25 /* 25 usec */
 
#define GC_PSX_LENGTH   8 /* talk to the controller in bits */
 
#define GC_PSX_BYTES   6 /* the maximum number of bytes to read off the controller */
 
#define GC_PSX_MOUSE   1 /* Mouse */
 
#define GC_PSX_NEGCON   2 /* NegCon */
 
#define GC_PSX_NORMAL   4 /* Digital / Analog or Rumble in Digital mode */
 
#define GC_PSX_ANALOG   5 /* Analog in Analog mode / Rumble in Green mode */
 
#define GC_PSX_RUMBLE   7 /* Rumble in Red mode */
 
#define GC_PSX_CLOCK   0x04 /* Pin 4 */
 
#define GC_PSX_COMMAND   0x01 /* Pin 2 */
 
#define GC_PSX_POWER   0xf8 /* Pins 5-9 */
 
#define GC_PSX_SELECT   0x02 /* Pin 3 */
 
#define GC_PSX_ID(x)   ((x) >> 4) /* High nibble is device type */
 
#define GC_PSX_LEN(x)   (((x) & 0xf) << 1) /* Low nibble is length in bytes/2 */
 

Enumerations

enum  gc_type {
  GC_NONE = 0, GC_SNES, GC_NES, GC_NES4,
  GC_MULTI, GC_MULTI2, GC_N64, GC_PSX,
  GC_DDR, GC_SNESMOUSE, GC_MAX
}
 

Functions

 MODULE_AUTHOR ("Vojtech Pavlik <[email protected]>")
 
 MODULE_DESCRIPTION ("NES, SNES, N64, MultiSystem, PSX gamepad driver")
 
 MODULE_LICENSE ("GPL")
 
 module_param_array_named (map, gc_cfg[0].args, int,&gc_cfg[0].nargs, 0)
 
 MODULE_PARM_DESC (map,"Describes first set of devices (<parport#>,<pad1>,<pad2>,..<pad5>)")
 
 module_param_array_named (map2, gc_cfg[1].args, int,&gc_cfg[1].nargs, 0)
 
 MODULE_PARM_DESC (map2,"Describes second set of devices")
 
 module_param_array_named (map3, gc_cfg[2].args, int,&gc_cfg[2].nargs, 0)
 
 MODULE_PARM_DESC (map3,"Describes third set of devices")
 
 module_param_named (psx_delay, gc_psx_delay, uint, 0)
 
 MODULE_PARM_DESC (psx_delay,"Delay when accessing Sony PSX controller (usecs)")
 
 module_init (gc_init)
 
 module_exit (gc_exit)
 

Macro Definition Documentation

#define GC_MAX_DEVICES   5

Definition at line 49 of file gamecon.c.

#define GC_MAX_PORTS   3

Definition at line 48 of file gamecon.c.

#define GC_MULTI2_LENGTH   6 /* One more bit for one more button */

Definition at line 467 of file gamecon.c.

#define GC_MULTI_LENGTH   5 /* Multi system joystick packet length is 5 */

Definition at line 466 of file gamecon.c.

#define GC_N64_CLOCK   0x02 /* clock bits for read */

Definition at line 141 of file gamecon.c.

#define GC_N64_CMD_00   0x11111111UL

Definition at line 124 of file gamecon.c.

#define GC_N64_CMD_01   0xd1111111UL

Definition at line 125 of file gamecon.c.

#define GC_N64_CMD_03   0xdd111111UL

Definition at line 126 of file gamecon.c.

#define GC_N64_CMD_1b   0xdd1dd111UL

Definition at line 127 of file gamecon.c.

#define GC_N64_CMD_80   0x1111111dUL

Definition at line 129 of file gamecon.c.

#define GC_N64_CMD_c0   0x111111ddUL

Definition at line 128 of file gamecon.c.

#define GC_N64_DELAY   133 /* delay between transmit request, and response ready (us) */

Definition at line 132 of file gamecon.c.

#define GC_N64_DWS   3 /* delay between write segments (required for sound playback because of ISA DMA) */

Definition at line 133 of file gamecon.c.

#define GC_N64_LENGTH   32 /* N64 bit length, not including stop bit */

Definition at line 122 of file gamecon.c.

#define GC_N64_OUT   0x1d /* output bits to the 4 pads */

Definition at line 137 of file gamecon.c.

#define GC_N64_POWER_R   0xfd /* power during read */

Definition at line 136 of file gamecon.c.

#define GC_N64_POWER_W   0xe2 /* power during write (transmit request) */

Definition at line 135 of file gamecon.c.

#define GC_N64_REQUEST_DATA   GC_N64_CMD_01 /* the request data command */

Definition at line 131 of file gamecon.c.

#define GC_N64_STOP_BIT   0x1d /* Encoded stop bit */

Definition at line 130 of file gamecon.c.

#define GC_N64_STOP_LENGTH   5 /* Length of encoded stop bit */

Definition at line 123 of file gamecon.c.

#define GC_NES_CLOCK   0x01

Definition at line 339 of file gamecon.c.

#define GC_NES_DELAY   6 /* Delay between bits - 6us */

Definition at line 333 of file gamecon.c.

#define GC_NES_LATCH   0x02

Definition at line 340 of file gamecon.c.

#define GC_NES_LENGTH   8 /* The NES pads use 8 bits of data */

Definition at line 334 of file gamecon.c.

#define GC_NES_POWER   0xfc

Definition at line 338 of file gamecon.c.

#define GC_PSX_ANALOG   5 /* Analog in Analog mode / Rumble in Green mode */

Definition at line 534 of file gamecon.c.

#define GC_PSX_BYTES   6 /* the maximum number of bytes to read off the controller */

Definition at line 529 of file gamecon.c.

#define GC_PSX_CLOCK   0x04 /* Pin 4 */

Definition at line 537 of file gamecon.c.

#define GC_PSX_COMMAND   0x01 /* Pin 2 */

Definition at line 538 of file gamecon.c.

#define GC_PSX_DELAY   25 /* 25 usec */

Definition at line 527 of file gamecon.c.

#define GC_PSX_ID (   x)    ((x) >> 4) /* High nibble is device type */

Definition at line 542 of file gamecon.c.

#define GC_PSX_LEN (   x)    (((x) & 0xf) << 1) /* Low nibble is length in bytes/2 */

Definition at line 543 of file gamecon.c.

#define GC_PSX_LENGTH   8 /* talk to the controller in bits */

Definition at line 528 of file gamecon.c.

#define GC_PSX_MOUSE   1 /* Mouse */

Definition at line 531 of file gamecon.c.

#define GC_PSX_NEGCON   2 /* NegCon */

Definition at line 532 of file gamecon.c.

#define GC_PSX_NORMAL   4 /* Digital / Analog or Rumble in Digital mode */

Definition at line 533 of file gamecon.c.

#define GC_PSX_POWER   0xf8 /* Pins 5-9 */

Definition at line 539 of file gamecon.c.

#define GC_PSX_RUMBLE   7 /* Rumble in Red mode */

Definition at line 535 of file gamecon.c.

#define GC_PSX_SELECT   0x02 /* Pin 3 */

Definition at line 540 of file gamecon.c.

#define GC_REFRESH_TIME   HZ/100

Definition at line 81 of file gamecon.c.

#define GC_SNES_LENGTH
Value:
12 /* The SNES true length is 16, but the
last 4 bits are unused */

Definition at line 335 of file gamecon.c.

#define GC_SNESMOUSE_LENGTH
Value:
32 /* The SNES mouse uses 32 bits, the first
16 bits are equivalent to a gamepad */

Definition at line 336 of file gamecon.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 33 of file gamecon.c.

Enumeration Type Documentation

enum gc_type
Enumerator:
GC_NONE 
GC_SNES 
GC_NES 
GC_NES4 
GC_MULTI 
GC_MULTI2 
GC_N64 
GC_PSX 
GC_DDR 
GC_SNESMOUSE 
GC_MAX 

Definition at line 67 of file gamecon.c.

Function Documentation

MODULE_AUTHOR ( "Vojtech Pavlik <[email protected]>"  )
MODULE_DESCRIPTION ( NES,
SNES  ,
N64  ,
MultiSystem  ,
PSX gamepad driver  
)
module_exit ( gc_exit  )
module_init ( gc_init  )
MODULE_LICENSE ( "GPL"  )
module_param_array_named ( map  ,
gc_cfg.  args[0],
int  ,
&gc_cfg.  nargs[0],
 
)
module_param_array_named ( map2  ,
gc_cfg.  args[1],
int  ,
&gc_cfg.  nargs[1],
 
)
module_param_array_named ( map3  ,
gc_cfg.  args[2],
int  ,
&gc_cfg.  nargs[2],
 
)
module_param_named ( psx_delay  ,
gc_psx_delay  ,
uint  ,
 
)
MODULE_PARM_DESC ( map  ,
"Describes first set of devices (<parport#>,<pad1>,<pad2>,..<pad5>)"   
)
MODULE_PARM_DESC ( map2  ,
"Describes second set of devices  
)
MODULE_PARM_DESC ( map3  ,
"Describes third set of devices  
)
MODULE_PARM_DESC ( psx_delay  ,
"Delay when accessing Sony PSX controller (usecs)"   
)