PS2SDK
PS2 Homebrew Libraries
freepad.h File Reference
#include "irx.h"
#include "types.h"
+ Include dependency graph for freepad.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vblankData_t
 
struct  ee_paddata_t
 
struct  ee_old_paddata_t
 
struct  padState_t
 
union  padState_t.actData
 
union  padState_t.combData
 
union  padState_t.modeTable
 
union  padState_t.ee_actDirectData
 
union  padState_t.ee_actAlignData
 

Macros

#define MODNAME   "freepad"
 
#define M_PRINTF(format, args...)   printf(MODNAME ": " format, ## args)
 
#define M_KPRINTF(format, args...)   Kprintf(MODNAME ": " format, ## args)
 
#define D_PRINTF(a...)   (void)0
 
#define PADMAN_THPRI_LO   46
 
#define PADMAN_THPRI_HI   20
 
#define SB_STAT   *((volatile unsigned int*)0xBD000040)
 
#define PAD_STATE_DISCONN   0x00
 
#define PAD_STATE_FINDPAD   0x01
 
#define PAD_STATE_FINDCTP1   0x02
 
#define PAD_STATE_EXECCMD   0x05
 
#define PAD_STATE_STABLE   0x06
 
#define PAD_STATE_ERROR   0x07
 
#define PAD_RSTAT_COMPLETE   0x00
 
#define PAD_RSTAT_FAILED   0x01
 
#define PAD_RSTAT_BUSY   0x02
 
#define PAD_TYPE_NEJICON   0x2
 
#define PAD_TYPE_KONAMIGUN   0x3
 
#define PAD_TYPE_DIGITAL   0x4
 
#define PAD_TYPE_ANALOG   0x5
 
#define PAD_TYPE_NAMCOGUN   0x6
 
#define PAD_TYPE_DUALSHOCK   0x7
 
#define PAD_MODEL_DUALSHOCK   0x1
 
#define PAD_MODEL_DUALSHOCK2   0x3
 
#define MODE_CONFIG_NO_PAD   0x0
 
#define MODE_CONFIG_QUERY_PAD   0x1
 
#define MODE_CONFIG_READY   0x2
 
#define TASK_NONE   0
 
#define TASK_UPDATE_PAD   1
 
#define TASK_QUERY_PAD   2
 
#define TASK_PORT_CLOSE   3
 
#define TASK_SET_MAIN_MODE   4
 
#define TASK_SET_ACT_ALIGN   5
 
#define TASK_SET_BUTTON_INFO   6
 
#define TASK_SET_VREF_PARAM   7
 
#define EF_UPDATE_PAD   0x0001
 
#define EF_QUERY_PAD   0x0002
 
#define EF_SET_MAIN_MODE   0x0008
 
#define EF_SET_ACT_ALIGN   0x0010
 
#define EF_SET_SET_BUTTON_INFO   0x0020
 
#define EF_SET_VREF_PARAM   0x0040
 
#define EF_PAD_TRANSFER_START   0x0080
 
#define EF_PAD_TRANSFER_DONE   0x0100
 
#define EF_TASK_DONE   0x0200
 
#define EF_PORT_CLOSE   0x0400
 
#define EF_EXIT_THREAD   0x1000
 
#define EF_VB_TRANSFER   0x0001
 
#define EF_VB_TRANSFER_DONE   0x0004
 
#define EF_VB_WAIT_THREAD_EXIT   0x0008
 

Functions

void WaitClearEvent (int eventflag, u32 bits, int mode, u32 *resbits_out)
 
int VblankStart (void *arg)
 
int VblankEnd (void *arg)
 
s32 padInit (void *ee_addr)
 
s32 padEnd (void)
 
s32 padPortClose (s32 port, s32 slot, s32 wait)
 
s32 padPortOpen (s32 port, s32 slot, s32 pad_area_ee_addr, u32 *buf)
 
u32 padSetMainMode (u32 port, u32 slot, u32 mode, u32 lock)
 
u32 padSetActDirect (u32 port, u32 slot, u8 *actData)
 
u32 padSetActAlign (u32 port, u32 slot, const u8 *actData)
 
u32 padGetButtonMask (u32 port, u32 slot)
 
u32 padSetButtonInfo (u32 port, u32 slot, u32 info)
 
u32 padSetVrefParam (u32 port, u32 slot, const u8 *vparam)
 
s32 padInfoAct (u32 port, u32 slot, s32 act, u32 val)
 
s32 padInfoComb (u32 port, u32 slot, s32 listno, u32 offs)
 
s32 padInfoMode (u32 port, u32 slot, s32 term, u32 offs)
 
u32 padGetPortMax (void)
 
u32 padGetSlotMax (u32 port)
 
u32 padGetModVersion (void)
 

Detailed Description

IOP pad driver

Definition in file freepad.h.


Data Structure Documentation

◆ vblankData_t

struct vblankData_t

Definition at line 97 of file freepad.h.

Data Fields
int padEnd
int eventflag
int init
int stopTransfer
int tid_1
int tid_2

◆ ee_paddata_t

struct ee_paddata_t

Definition at line 107 of file freepad.h.

Data Fields
u8 data[32]
u32 actDirData[2]
u32 actAlignData[2]
u32 actData[4]
u32 combData[4]
u32 modeTable[2]
u32 frame
u32 findPadRetries
u32 length
u8 modeConfig
u8 modeCurId
u8 model
u8 buttonDataReady
u8 nrOfModes
u8 modeCurOffs
u8 nrOfActuators
u8 numActComb
u8 val_c6
u8 mode
u8 lock
u8 actDirSize
u8 state
u8 reqState
u8 currentTask
u8 runTask
u8 stat70bit
u8 padding[11]

◆ ee_old_paddata_t

struct ee_old_paddata_t

Definition at line 138 of file freepad.h.

Data Fields
u32 frame
u8 state
u8 reqState
u8 ok
u8 unkn7
u8 data[32]
u32 length
u8 request
u8 CTP

CTP=1/no config; CTP=2/config, acts...

u8 model

1, 2 or 3

u8 correction

the data in the buffer is already corrected

u8 errorCount
u8 unk49[15]

◆ padState_t.actData

union padState_t.actData

Definition at line 170 of file freepad.h.

Data Fields
u8 data[4][4]
u32 data32[4]

◆ padState_t.combData

union padState_t.combData

Definition at line 174 of file freepad.h.

Data Fields
u8 data[4][4]
u32 data32[4]

◆ padState_t.modeTable

union padState_t.modeTable

Definition at line 178 of file freepad.h.

Data Fields
u16 data[4]
u32 data32[2]

◆ padState_t.ee_actDirectData

union padState_t.ee_actDirectData

Definition at line 193 of file freepad.h.

Data Fields
u8 data[8]
u32 data32[8/sizeof(u32)]

◆ padState_t.ee_actAlignData

union padState_t.ee_actAlignData

Definition at line 198 of file freepad.h.

Data Fields
u8 data[8]
u32 data32[8/sizeof(u32)]

Function Documentation

◆ padEnd()

s32 padEnd ( void  )

Ends all pad communication Note: PADMAN from release 1.3.4 does not have padPortInit implemented. As a result, it is impossible to reinitialize libpad after calling padEnd(). This was known as padClose in the really early official SDK releases.

Returns
== 1 => OK

Definition at line 431 of file libpad.c.

◆ padGetPortMax()

u32 padGetPortMax ( void  )

Returns # slots on the PS2 (usally 2)

Definition at line 741 of file libpad.c.

◆ padGetModVersion()

u32 padGetModVersion ( void  )

Returns the padman.irx version NOT SUPPORTED on module rom0:padman

Definition at line 792 of file libpad.c.