ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libmtap.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int mtapInit (void)
 
int mtapPortOpen (int port)
 
int mtapPortClose (int port)
 
int mtapGetConnection (int port)
 

Detailed Description

Functions to provide access to multi-taps.

Definition in file libmtap.h.

Function Documentation

◆ mtapGetConnection()

int mtapGetConnection ( int  port)

Checks if a multitap is connected to an opened port.

Parameters
portis the port to be checked.
Returns
1 if a multitap exists on the specified port; !1 if there isno multitap on the specified port.

Definition at line 87 of file libmtap.c.

88 {
89  if(!mtapInited) return -1;
90 
91  mtapRpcBuffer[0] = port;
93 
94  return mtapRpcBuffer[1];
95 }
static int mtapInited
Definition: libmtap.c:32
static struct t_SifRpcClientData clientGetConnection
Definition: libmtap.c:31
static unsigned int mtapRpcBuffer[32]
Definition: libmtap.c:28
s32 port
Definition: libpad.c:176
int SifCallRpc(SifRpcClientData_t *client, int rpc_number, int mode, void *send, int ssize, void *receive, int rsize, SifRpcEndFunc_t end_function, void *end_param)
#define NULL
Definition: tamtypes.h:91

References clientGetConnection, mtapInited, mtapRpcBuffer, NULL, port, and SifCallRpc().

Referenced by find_controllers(), and pad_open().

◆ mtapInit()

int mtapInit ( void  )

Initialise the multitap library.

Returns
1 on success; 1 on failure

Definition at line 34 of file libmtap.c.

35 {
36  if(mtapInited) return -1;
37 
38  while(1)
39  {
40  if (SifBindRpc(&clientPortOpen, MTAPSERV_PORT_OPEN, 0) < 0) return -1;
41  if (clientPortOpen.server != 0) break;
42 
43  nopdelay();
44  }
45 
46  while(1)
47  {
48  if (SifBindRpc(&clientPortClose, MTAPSERV_PORT_CLOSE, 0) < 0) return -1;
49  if (clientPortClose.server != 0) break;
50 
51  nopdelay();
52  }
53 
54  while(1)
55  {
57  if (clientGetConnection.server != 0) break;
58 
59  nopdelay();
60  }
61 
62  mtapInited = 1;
63 
64  return 1;
65 }
static void nopdelay(void)
Definition: kernel.h:141
#define MTAPSERV_GET_CONNECTION
Definition: libmtap.c:26
static struct t_SifRpcClientData clientPortClose
Definition: libmtap.c:30
#define MTAPSERV_PORT_CLOSE
Definition: libmtap.c:25
static struct t_SifRpcClientData clientPortOpen
Definition: libmtap.c:29
#define MTAPSERV_PORT_OPEN
Definition: libmtap.c:24
int SifBindRpc(SifRpcClientData_t *client, int rpc_number, int mode)

References clientGetConnection, clientPortClose, clientPortOpen, mtapInited, MTAPSERV_GET_CONNECTION, MTAPSERV_PORT_CLOSE, MTAPSERV_PORT_OPEN, nopdelay(), and SifBindRpc().

Referenced by main().

◆ mtapPortClose()

int mtapPortClose ( int  port)

Closes a port for the multitap.

Parameters
portis a port that is to be closed (must have been previously opened by mtapPortOpen).
Returns
1 on success; !1 on failure.

Definition at line 77 of file libmtap.c.

78 {
79  if(!mtapInited) return -1;
80 
81  mtapRpcBuffer[0] = port;
83 
84  return mtapRpcBuffer[1];
85 }

References clientPortClose, mtapInited, mtapRpcBuffer, NULL, port, and SifCallRpc().

◆ mtapPortOpen()

int mtapPortOpen ( int  port)

Open a port for the multitap.

Parameters
portspecifies the port that is to be monitored as a multitap connection destination.
Returns
1 on success; !1 on failure.

Definition at line 67 of file libmtap.c.

68 {
69  if(!mtapInited) return -1;
70 
71  mtapRpcBuffer[0] = port;
73 
74  return mtapRpcBuffer[1];
75 }

References clientPortOpen, mtapInited, mtapRpcBuffer, NULL, port, and SifCallRpc().

Referenced by main().