PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
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)]

Macro Definition Documentation

◆ MODNAME

#define MODNAME   "freepad"

Definition at line 18 of file freepad.h.

◆ M_PRINTF

#define M_PRINTF (   format,
  args... 
)    printf(MODNAME ": " format, ## args)

Definition at line 19 of file freepad.h.

◆ M_KPRINTF

#define M_KPRINTF (   format,
  args... 
)    Kprintf(MODNAME ": " format, ## args)

Definition at line 20 of file freepad.h.

◆ D_PRINTF

#define D_PRINTF (   a...)    (void)0

Definition at line 25 of file freepad.h.

◆ PADMAN_THPRI_LO

#define PADMAN_THPRI_LO   46

Definition at line 28 of file freepad.h.

◆ PADMAN_THPRI_HI

#define PADMAN_THPRI_HI   20

Definition at line 29 of file freepad.h.

◆ SB_STAT

#define SB_STAT   *((volatile unsigned int*)0xBD000040)

Definition at line 31 of file freepad.h.

◆ PAD_STATE_DISCONN

#define PAD_STATE_DISCONN   0x00

Definition at line 36 of file freepad.h.

◆ PAD_STATE_FINDPAD

#define PAD_STATE_FINDPAD   0x01

Definition at line 37 of file freepad.h.

◆ PAD_STATE_FINDCTP1

#define PAD_STATE_FINDCTP1   0x02

Definition at line 38 of file freepad.h.

◆ PAD_STATE_EXECCMD

#define PAD_STATE_EXECCMD   0x05

Definition at line 39 of file freepad.h.

◆ PAD_STATE_STABLE

#define PAD_STATE_STABLE   0x06

Definition at line 40 of file freepad.h.

◆ PAD_STATE_ERROR

#define PAD_STATE_ERROR   0x07

Definition at line 41 of file freepad.h.

◆ PAD_RSTAT_COMPLETE

#define PAD_RSTAT_COMPLETE   0x00

Definition at line 46 of file freepad.h.

◆ PAD_RSTAT_FAILED

#define PAD_RSTAT_FAILED   0x01

Definition at line 47 of file freepad.h.

◆ PAD_RSTAT_BUSY

#define PAD_RSTAT_BUSY   0x02

Definition at line 48 of file freepad.h.

◆ PAD_TYPE_NEJICON

#define PAD_TYPE_NEJICON   0x2

Definition at line 53 of file freepad.h.

◆ PAD_TYPE_KONAMIGUN

#define PAD_TYPE_KONAMIGUN   0x3

Definition at line 54 of file freepad.h.

◆ PAD_TYPE_DIGITAL

#define PAD_TYPE_DIGITAL   0x4

Definition at line 55 of file freepad.h.

◆ PAD_TYPE_ANALOG

#define PAD_TYPE_ANALOG   0x5

Definition at line 56 of file freepad.h.

◆ PAD_TYPE_NAMCOGUN

#define PAD_TYPE_NAMCOGUN   0x6

Definition at line 57 of file freepad.h.

◆ PAD_TYPE_DUALSHOCK

#define PAD_TYPE_DUALSHOCK   0x7

Definition at line 58 of file freepad.h.

◆ PAD_MODEL_DUALSHOCK

#define PAD_MODEL_DUALSHOCK   0x1

Definition at line 60 of file freepad.h.

◆ PAD_MODEL_DUALSHOCK2

#define PAD_MODEL_DUALSHOCK2   0x3

Definition at line 61 of file freepad.h.

◆ MODE_CONFIG_NO_PAD

#define MODE_CONFIG_NO_PAD   0x0

Definition at line 63 of file freepad.h.

◆ MODE_CONFIG_QUERY_PAD

#define MODE_CONFIG_QUERY_PAD   0x1

Definition at line 64 of file freepad.h.

◆ MODE_CONFIG_READY

#define MODE_CONFIG_READY   0x2

Definition at line 65 of file freepad.h.

◆ TASK_NONE

#define TASK_NONE   0

Definition at line 68 of file freepad.h.

◆ TASK_UPDATE_PAD

#define TASK_UPDATE_PAD   1

Definition at line 69 of file freepad.h.

◆ TASK_QUERY_PAD

#define TASK_QUERY_PAD   2

Definition at line 70 of file freepad.h.

◆ TASK_PORT_CLOSE

#define TASK_PORT_CLOSE   3

Definition at line 71 of file freepad.h.

◆ TASK_SET_MAIN_MODE

#define TASK_SET_MAIN_MODE   4

Definition at line 72 of file freepad.h.

◆ TASK_SET_ACT_ALIGN

#define TASK_SET_ACT_ALIGN   5

Definition at line 73 of file freepad.h.

◆ TASK_SET_BUTTON_INFO

#define TASK_SET_BUTTON_INFO   6

Definition at line 74 of file freepad.h.

◆ TASK_SET_VREF_PARAM

#define TASK_SET_VREF_PARAM   7

Definition at line 75 of file freepad.h.

◆ EF_UPDATE_PAD

#define EF_UPDATE_PAD   0x0001

Definition at line 78 of file freepad.h.

◆ EF_QUERY_PAD

#define EF_QUERY_PAD   0x0002

Definition at line 79 of file freepad.h.

◆ EF_SET_MAIN_MODE

#define EF_SET_MAIN_MODE   0x0008

Definition at line 81 of file freepad.h.

◆ EF_SET_ACT_ALIGN

#define EF_SET_ACT_ALIGN   0x0010

Definition at line 82 of file freepad.h.

◆ EF_SET_SET_BUTTON_INFO

#define EF_SET_SET_BUTTON_INFO   0x0020

Definition at line 83 of file freepad.h.

◆ EF_SET_VREF_PARAM

#define EF_SET_VREF_PARAM   0x0040

Definition at line 84 of file freepad.h.

◆ EF_PAD_TRANSFER_START

#define EF_PAD_TRANSFER_START   0x0080

Definition at line 85 of file freepad.h.

◆ EF_PAD_TRANSFER_DONE

#define EF_PAD_TRANSFER_DONE   0x0100

Definition at line 86 of file freepad.h.

◆ EF_TASK_DONE

#define EF_TASK_DONE   0x0200

Definition at line 87 of file freepad.h.

◆ EF_PORT_CLOSE

#define EF_PORT_CLOSE   0x0400

Definition at line 88 of file freepad.h.

◆ EF_EXIT_THREAD

#define EF_EXIT_THREAD   0x1000

Definition at line 89 of file freepad.h.

◆ EF_VB_TRANSFER

#define EF_VB_TRANSFER   0x0001

Definition at line 92 of file freepad.h.

◆ EF_VB_TRANSFER_DONE

#define EF_VB_TRANSFER_DONE   0x0004

Definition at line 93 of file freepad.h.

◆ EF_VB_WAIT_THREAD_EXIT

#define EF_VB_WAIT_THREAD_EXIT   0x0008

Definition at line 94 of file freepad.h.

Function Documentation

◆ WaitClearEvent()

void WaitClearEvent ( int  eventflag,
u32  bits,
int  mode,
u32 *  resbits_out 
)

Definition at line 134 of file freepad.c.

◆ VblankStart()

int VblankStart ( void *  arg)

Definition at line 644 of file padInit.c.

◆ VblankEnd()

int VblankEnd ( void *  arg)

Definition at line 669 of file padInit.c.

◆ padInit()

s32 padInit ( void *  ee_addr)

Definition at line 677 of file padInit.c.

◆ 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 374 of file libpad.c.

References padPortClose().

◆ padPortClose()

s32 padPortClose ( s32  port,
s32  slot,
s32  wait 
)

Definition at line 75 of file padMiscFuncs.c.

◆ padPortOpen()

s32 padPortOpen ( s32  port,
s32  slot,
s32  pad_area_ee_addr,
u32 *  buf 
)

Definition at line 662 of file padPortOpen.c.

◆ padSetMainMode()

u32 padSetMainMode ( u32  port,
u32  slot,
u32  mode,
u32  lock 
)

Definition at line 105 of file padMiscFuncs.c.

◆ padSetActDirect()

u32 padSetActDirect ( u32  port,
u32  slot,
u8 *  actData 
)

Definition at line 294 of file padMiscFuncs.c.

◆ padSetActAlign()

u32 padSetActAlign ( u32  port,
u32  slot,
const u8 *  actData 
)

Definition at line 318 of file padMiscFuncs.c.

◆ padGetButtonMask()

u32 padGetButtonMask ( u32  port,
u32  slot 
)

Definition at line 340 of file padMiscFuncs.c.

◆ padSetButtonInfo()

u32 padSetButtonInfo ( u32  port,
u32  slot,
u32  info 
)

Definition at line 358 of file padMiscFuncs.c.

◆ padSetVrefParam()

u32 padSetVrefParam ( u32  port,
u32  slot,
const u8 *  vparam 
)

Definition at line 391 of file padMiscFuncs.c.

◆ padInfoAct()

s32 padInfoAct ( u32  port,
u32  slot,
s32  act,
u32  val 
)

Definition at line 127 of file padMiscFuncs.c.

◆ padInfoComb()

s32 padInfoComb ( u32  port,
u32  slot,
s32  listno,
u32  offs 
)

Definition at line 157 of file padMiscFuncs.c.

◆ padInfoMode()

s32 padInfoMode ( u32  port,
u32  slot,
s32  term,
u32  offs 
)

Definition at line 187 of file padMiscFuncs.c.

◆ padGetPortMax()

u32 padGetPortMax ( void  )

Returns # slots on the PS2 (usally 2)

Definition at line 550 of file libpad.c.

◆ padGetSlotMax()

u32 padGetSlotMax ( u32  port)

Definition at line 421 of file padMiscFuncs.c.

◆ padGetModVersion()

u32 padGetModVersion ( void  )

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

Definition at line 575 of file libpad.c.