PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ps2mouse.c File Reference
#include "types.h"
#include "iomanX.h"
#include "loadcore.h"
#include "stdio.h"
#include "sifcmd.h"
#include "sifrpc.h"
#include "sysclib.h"
#include "sysmem.h"
#include "usbd.h"
#include "usbd_macro.h"
#include "thbase.h"
#include "thevent.h"
#include "thsemap.h"
#include "ps2mouse.h"
+ Include dependency graph for ps2mouse.c:

Go to the source code of this file.

Data Structures

struct  _mouse_data_recv
 
struct  _mouse_dev
 
struct  _string_descriptor
 

Macros

#define MODNAME   "PS2 USB mouse driver"
 
#define PS2MOUSE_VERSION   0x100
 
#define USB_SUBCLASS_BOOT   1
 
#define USB_HIDPROTO_MOUSE   2
 
#define PS2MOUSE_MAXDEV   2
 
#define PS2MOUSE_MAXBUTTONS   3
 
#define PS2MOUSE_DEFDBLCLICK   500
 
#define PS2MOUSE_DEFACCEL   (1 << 16)
 
#define PS2MOUSE_DEFTHRES   65536;
 
#define ABS(x)   (x < 0 ? -x : x)
 

Typedefs

typedef struct _mouse_data_recv mouse_data_recv
 
typedef struct _mouse_dev mouse_dev
 
typedef struct _string_descriptor string_descriptor
 

Functions

 IRX_ID (MODNAME, 1, 1)
 
static SifRpcDataQueue_t ps2mouse_queue __attribute__ ((aligned(16)))
 
static int _rpc_buffer[512] __attribute__ ((__aligned__(4)))
 
void rpcMainThread (void *param)
 
void * rpcCommandHandler (u32 command, void *buffer, int size)
 
int ps2mouse_init ()
 
void ps2mouse_config_set (int resultCode, int bytes, void *arg)
 
void ps2mouse_data_recv (int resultCode, int bytes, void *arg)
 
int ps2mouse_probe (int devId)
 
int ps2mouse_connect (int devId)
 
int ps2mouse_disconnect (int devId)
 
void usb_getstring (int endp, int index, char *desc)
 
int _start (int argc, char *argv[])
 
void ps2mouse_getstring_set (int resultCode, int bytes, void *arg)
 
void do_ps2mouse_read (u8 *data, int size)
 
void do_ps2mouse_setreadmode (const u32 *data, int size)
 
void do_ps2mouse_getreadmode (u32 *data, int size)
 
void do_ps2mouse_setthres (const u32 *data, int size)
 
void do_ps2mouse_getthres (u32 *data, int size)
 
void do_ps2mouse_setaccel (const u32 *data, int size)
 
void do_ps2mouse_getaccel (u32 *data, int size)
 
void do_ps2mouse_setboundary (const s32 *data, int size)
 
void do_ps2mouse_getboundary (s32 *data, int size)
 
void do_ps2mouse_setposition (const s32 *data, int size)
 
void do_ps2mouse_reset ()
 
void do_ps2mouse_enum (u32 *data, int size)
 
void do_ps2mouse_setdblclicktime (const u32 *data, int size)
 
void do_ps2mouse_getdblclicktime (u32 *data, int size)
 
void do_ps2mouse_getversion (u32 *data, int size)
 

Variables

int mouse_readmode
 
int mousex_min
 
int mousex_max
 
int mousey_min
 
int mousey_max
 
int mouse_thres
 
int mouse_accel
 
int mouse_dblclicktime
 
int mouse_sema
 
mouse_data mouse
 
mouse_devdevices [PS2MOUSE_MAXDEV]
 
int dev_count
 
sceUsbdLddOps mouse_driver = { NULL, NULL, "PS2Mouse", ps2mouse_probe, ps2mouse_connect, ps2mouse_disconnect, 0, 0, 0, 0, 0, NULL }
 

Detailed Description

USB Mouse Driver for PS2

Definition in file ps2mouse.c.


Data Structure Documentation

◆ _mouse_data_recv

struct _mouse_data_recv

Definition at line 66 of file ps2mouse.c.

Data Fields
unsigned char buttons
char x
char y
char wheel

◆ _mouse_dev

struct _mouse_dev

Definition at line 73 of file ps2mouse.c.

+ Collaboration diagram for _mouse_dev:
Data Fields
int configEndp
int dataEndp
int packetSize
int devId
mouse_data_recv data

Holds the data for the transfers

u32 timer[PS2MOUSE_MAXBUTTONS]

Array to hold timers for double click

◆ _string_descriptor

struct _string_descriptor

Definition at line 323 of file ps2kbd.c.

Data Fields
u8 buf[200]
char * desc

Macro Definition Documentation

◆ MODNAME

#define MODNAME   "PS2 USB mouse driver"

Definition at line 32 of file ps2mouse.c.

◆ PS2MOUSE_VERSION

#define PS2MOUSE_VERSION   0x100

Definition at line 36 of file ps2mouse.c.

◆ USB_SUBCLASS_BOOT

#define USB_SUBCLASS_BOOT   1

Definition at line 38 of file ps2mouse.c.

◆ USB_HIDPROTO_MOUSE

#define USB_HIDPROTO_MOUSE   2

Definition at line 39 of file ps2mouse.c.

◆ PS2MOUSE_MAXDEV

#define PS2MOUSE_MAXDEV   2

Definition at line 41 of file ps2mouse.c.

◆ PS2MOUSE_MAXBUTTONS

#define PS2MOUSE_MAXBUTTONS   3

Definition at line 42 of file ps2mouse.c.

◆ PS2MOUSE_DEFDBLCLICK

#define PS2MOUSE_DEFDBLCLICK   500

Definition at line 44 of file ps2mouse.c.

◆ PS2MOUSE_DEFACCEL

#define PS2MOUSE_DEFACCEL   (1 << 16)

Definition at line 46 of file ps2mouse.c.

◆ PS2MOUSE_DEFTHRES

#define PS2MOUSE_DEFTHRES   65536;

Definition at line 47 of file ps2mouse.c.

◆ ABS

#define ABS (   x)    (x < 0 ? -x : x)

Definition at line 53 of file ps2mouse.c.

Function Documentation

◆ rpcMainThread()

void rpcMainThread ( void *  param)

Definition at line 128 of file ps2mouse.c.

◆ rpcCommandHandler()

void * rpcCommandHandler ( u32  command,
void *  buffer,
int  size 
)

Definition at line 757 of file ps2mouse.c.

◆ ps2mouse_init()

int ps2mouse_init ( )

Definition at line 502 of file ps2mouse.c.

◆ ps2mouse_config_set()

void ps2mouse_config_set ( int  resultCode,
int  bytes,
void *  arg 
)

Definition at line 385 of file ps2mouse.c.

◆ ps2mouse_data_recv()

void ps2mouse_data_recv ( int  resultCode,
int  bytes,
void *  arg 
)

Definition at line 407 of file ps2mouse.c.

◆ ps2mouse_probe()

int ps2mouse_probe ( int  devId)

Definition at line 145 of file ps2mouse.c.

◆ ps2mouse_connect()

int ps2mouse_connect ( int  devId)

Definition at line 220 of file ps2mouse.c.

◆ ps2mouse_disconnect()

int ps2mouse_disconnect ( int  devId)

Definition at line 306 of file ps2mouse.c.

◆ usb_getstring()

void usb_getstring ( int  endp,
int  index,
char *  desc 
)

Definition at line 361 of file ps2mouse.c.

◆ _start()

int _start ( int  argc,
char *  argv[] 
)

Definition at line 104 of file ps2mouse.c.

◆ ps2mouse_getstring_set()

void ps2mouse_getstring_set ( int  resultCode,
int  bytes,
void *  arg 
)

Definition at line 335 of file ps2mouse.c.

◆ do_ps2mouse_read()

void do_ps2mouse_read ( u8 *  data,
int  size 
)

Definition at line 541 of file ps2mouse.c.

◆ do_ps2mouse_setreadmode()

void do_ps2mouse_setreadmode ( const u32 *  data,
int  size 
)

Definition at line 564 of file ps2mouse.c.

◆ do_ps2mouse_getreadmode()

void do_ps2mouse_getreadmode ( u32 *  data,
int  size 
)

Definition at line 590 of file ps2mouse.c.

◆ do_ps2mouse_setthres()

void do_ps2mouse_setthres ( const u32 *  data,
int  size 
)

Definition at line 599 of file ps2mouse.c.

◆ do_ps2mouse_getthres()

void do_ps2mouse_getthres ( u32 *  data,
int  size 
)

Definition at line 608 of file ps2mouse.c.

◆ do_ps2mouse_setaccel()

void do_ps2mouse_setaccel ( const u32 *  data,
int  size 
)

Definition at line 617 of file ps2mouse.c.

◆ do_ps2mouse_getaccel()

void do_ps2mouse_getaccel ( u32 *  data,
int  size 
)

Definition at line 626 of file ps2mouse.c.

◆ do_ps2mouse_setboundary()

void do_ps2mouse_setboundary ( const s32 *  data,
int  size 
)

Definition at line 635 of file ps2mouse.c.

◆ do_ps2mouse_getboundary()

void do_ps2mouse_getboundary ( s32 *  data,
int  size 
)

Definition at line 660 of file ps2mouse.c.

◆ do_ps2mouse_setposition()

void do_ps2mouse_setposition ( const s32 *  data,
int  size 
)

Definition at line 672 of file ps2mouse.c.

◆ do_ps2mouse_reset()

void do_ps2mouse_reset ( )

Definition at line 709 of file ps2mouse.c.

◆ do_ps2mouse_enum()

void do_ps2mouse_enum ( u32 *  data,
int  size 
)

Definition at line 721 of file ps2mouse.c.

◆ do_ps2mouse_setdblclicktime()

void do_ps2mouse_setdblclicktime ( const u32 *  data,
int  size 
)

Definition at line 730 of file ps2mouse.c.

◆ do_ps2mouse_getdblclicktime()

void do_ps2mouse_getdblclicktime ( u32 *  data,
int  size 
)

Definition at line 739 of file ps2mouse.c.

◆ do_ps2mouse_getversion()

void do_ps2mouse_getversion ( u32 *  data,
int  size 
)

Definition at line 748 of file ps2mouse.c.

Variable Documentation

◆ mouse_readmode

int mouse_readmode

Definition at line 88 of file ps2mouse.c.

◆ mousex_min

int mousex_min

Definition at line 89 of file ps2mouse.c.

◆ mousex_max

int mousex_max

Definition at line 90 of file ps2mouse.c.

◆ mousey_min

int mousey_min

Definition at line 91 of file ps2mouse.c.

◆ mousey_max

int mousey_max

Definition at line 92 of file ps2mouse.c.

◆ mouse_thres

int mouse_thres

Definition at line 93 of file ps2mouse.c.

◆ mouse_accel

int mouse_accel

Definition at line 94 of file ps2mouse.c.

◆ mouse_dblclicktime

int mouse_dblclicktime

Definition at line 95 of file ps2mouse.c.

◆ mouse_sema

int mouse_sema

Definition at line 96 of file ps2mouse.c.

◆ mouse

mouse_data mouse

Holds the current mouse information

Definition at line 98 of file ps2mouse.c.

◆ devices

mouse_dev* devices[PS2MOUSE_MAXDEV]

Holds a list of current devices

Definition at line 100 of file ps2mouse.c.

◆ dev_count

int dev_count

Definition at line 101 of file ps2mouse.c.

◆ mouse_driver

sceUsbdLddOps mouse_driver = { NULL, NULL, "PS2Mouse", ps2mouse_probe, ps2mouse_connect, ps2mouse_disconnect, 0, 0, 0, 0, 0, NULL }

Definition at line 102 of file ps2mouse.c.