ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libpad.c
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
18 #include <tamtypes.h>
19 #include <kernel.h>
20 #include <stdio.h>
21 #include <string.h>
22 #include <sifrpc.h>
23 #include <sifcmd.h>
24 #include "libpad.h"
25 
26 /*
27  * Defines
28  */
29 
30 #ifdef _XPAD
31 #define PAD_BIND_RPC_ID1 0x80000100
32 #define PAD_BIND_RPC_ID2 0x80000101
33 
34 #define PAD_RPCCMD_OPEN 0x01
35 #define PAD_RPCCMD_SET_MMODE 0x06
36 #define PAD_RPCCMD_SET_ACTDIR 0x07
37 #define PAD_RPCCMD_SET_ACTALIGN 0x08
38 #define PAD_RPCCMD_GET_BTNMASK 0x09
39 #define PAD_RPCCMD_SET_BTNINFO 0x0A
40 #define PAD_RPCCMD_SET_VREF 0x0B
41 #define PAD_RPCCMD_GET_PORTMAX 0x0C
42 #define PAD_RPCCMD_GET_SLOTMAX 0x0D
43 #define PAD_RPCCMD_CLOSE 0x0E
44 #define PAD_RPCCMD_END 0x0F
45 #define PAD_RPCCMD_INIT 0x10
46 #define PAD_RPCCMD_GET_MODVER 0x12
47 #else
48 #define PAD_BIND_RPC_ID1 0x8000010f
49 #define PAD_BIND_RPC_ID2 0x8000011f
50 
51 #define PAD_RPCCMD_OPEN 0x80000100
52 #define PAD_RPCCMD_INFO_ACT 0x80000102
53 #define PAD_RPCCMD_INFO_COMB 0x80000103
54 #define PAD_RPCCMD_INFO_MODE 0x80000104
55 #define PAD_RPCCMD_SET_MMODE 0x80000105
56 #define PAD_RPCCMD_SET_ACTDIR 0x80000106
57 #define PAD_RPCCMD_SET_ACTALIGN 0x80000107
58 #define PAD_RPCCMD_GET_BTNMASK 0x80000108
59 #define PAD_RPCCMD_SET_BTNINFO 0x80000109
60 #define PAD_RPCCMD_SET_VREF 0x8000010a
61 #define PAD_RPCCMD_GET_PORTMAX 0x8000010b
62 #define PAD_RPCCMD_GET_SLOTMAX 0x8000010c
63 #define PAD_RPCCMD_CLOSE 0x8000010d
64 #define PAD_RPCCMD_END 0x8000010e
65 #define PAD_RPCCMD_INIT 0x00000100
66 #endif
67 
68 /*
69  * Types
70  */
71 
72 struct pad_state
73 {
74  int open;
75  unsigned int port;
76  unsigned int slot;
77  struct pad_data *padData;
78  unsigned char *padBuf;
79 };
80 
81 #ifdef _XPAD
82 struct pad_data
83 {
84  u8 data[32];
85  u32 actDirData[2];
86  u32 actAlignData[2];
87  u8 actData[32];
88  u16 modeTable[4];
89  u32 frame;
90  u32 findPadRetries;
91  u32 length;
92  u8 modeConfig;
93  u8 modeCurId;
94  u8 model;
95  u8 buttonDataReady;
96  u8 nrOfModes;
97  u8 modeCurOffs;
98  u8 nrOfActuators;
99  u8 numActComb;
100  u8 val_c6;
101  u8 mode;
102  u8 lock;
103  u8 actDirSize;
104  u8 state;
105  u8 reqState;
106  u8 currentTask;
107  u8 runTask;
108  u8 stat70bit;
109  u8 padding[11];
110 };
111 
112 struct open_slot
113 {
114  u32 frame;
115  u32 openSlots[2];
116  u8 padding[116];
117 };
118 #else
119 // rom0:padman has only 64 byte of pad data
120 struct pad_data
121 {
122  unsigned int frame;
123  unsigned char state;
124  unsigned char reqState;
125  unsigned char ok;
126  unsigned char unkn7;
127  unsigned char data[32];
128  unsigned int length;
129  unsigned char request;
131  unsigned char CTP;
133  unsigned char model;
135  unsigned char correction;
136  unsigned char errorCount;
137  unsigned char unk49[15];
138 };
139 #endif
140 
141 extern int _iop_reboot_count;
142 /*
143  * Pad variables etc.
144  */
145 
146 static const char padStateString[8][16] = {"DISCONNECT", "FINDPAD",
147  "FINDCTP1", "", "", "EXECCMD",
148  "STABLE", "ERROR"};
149 static const char padReqStateString[3][16] = {"COMPLETE", "FAILED", "BUSY"};
150 
151 static int padInitialised = 0;
152 
153 // pad rpc call
154 static SifRpcClientData_t padsif[2] __attribute__((aligned(64)));
155 static union {
157 #ifdef _XPAD
158  struct {
159  s32 command;
160  s32 unused[3];
161  void *statBuf;
162  } padInitArgs;
163 #endif
164  struct {
168  void *padBuf;
170  struct {
171  s32 unknown[3];
172  s32 result;
174  struct {
175  s32 command;
177  s32 unknown;
178  void *padArea;
180  struct {
181  s32 command;
182  s32 port, slot;
183  s32 unknown;
186  struct {
187  s32 command;
188  s32 port;
190  struct {
191  s32 command;
192  s32 port, slot;
196  struct {
197  s32 command;
198  s32 port, slot;
199  s32 mode;
202  struct {
203  s32 unknown[5];
204  s32 result;
206  struct {
207  s32 command;
208  s32 port, slot;
210  struct {
211  s32 command;
212  s32 port, slot;
215  struct {
216  s32 unknown[4];
217  s32 result;
219  struct {
220  s32 command;
221  s32 port, slot;
222 #ifndef _XPAD
226  struct {
227  s32 command;
228  s32 port, slot;
229 #endif
230  s8 align[6];
232  char buffer[128];
233 }
234 #ifdef _XPAD
235 buffer __attribute__((aligned(64)));
236 #else
237 buffer __attribute__((aligned(16)));
238 #endif
239 
241 #ifdef _XPAD
242 static struct open_slot openSlot[2] __attribute__((aligned(64)));
243 #endif
244 static struct pad_state PadState[2][8];
245 
246 
247 /*
248  * Local functions
249  */
250 
252 static struct pad_data*
254 {
255  struct pad_data *pdata;
256 
257  pdata = PadState[port][slot].padData;
258  SyncDCache(pdata, (u8 *)pdata + 256);
259 
260  if(pdata[0].frame < pdata[1].frame) {
261  return &pdata[1];
262  }
263  else {
264  return &pdata[0];
265  }
266 }
267 
268 #ifdef _XPAD
273 static struct open_slot*
274 padGetConnDmaStr(void)
275 {
276  SyncDCache(openSlot, (u8*)openSlot + sizeof(openSlot));
277 
278  if(openSlot[0].frame < openSlot[1].frame)
279  return &openSlot[1];
280  else
281  return &openSlot[0];
282 }
283 #endif
284 
285 /*
286  * Global functions
287  */
288 
289 /*
290  * Functions not implemented here
291  * padGetFrameCount() <- dunno if it's useful for someone..
292  * padInfoComb() <- see above
293  * padSetVrefParam() <- dunno
294  */
295 
296 int
298 {
299  // Version check isn't used by default
300  // int ver;
301  static int _rb_count = 0;
302 
303  if (_rb_count != _iop_reboot_count)
304  {
305  _rb_count = _iop_reboot_count;
306  padInitialised = 0;
307  }
308 
309  if(padInitialised)
310  return 0;
311 
312  padInitialised = 1;
313 
314  padsif[0].server = NULL;
315  padsif[1].server = NULL;
316 
317  do {
318  if (SifBindRpc(&padsif[0], PAD_BIND_RPC_ID1, 0) < 0) {
319  return -1;
320  }
321  nopdelay();
322  } while(!padsif[0].server);
323 
324  do {
325  if (SifBindRpc(&padsif[1], PAD_BIND_RPC_ID2, 0) < 0) {
326  return -3;
327  }
328  nopdelay();
329  } while(!padsif[1].server);
330 
331  // If you require a special version of the padman, check for that here (uncomment)
332  // ver = padGetModVersion();
333 
334  //At v1.3.4, this used to return 1 (and padPortInit is not used). But we are interested in the better design from release 1.4.
335  return padPortInit(mode);
336 }
337 
339 {
340 #ifdef _XPAD //Unofficial: libpad EE client from v1.3.4 has this RPC function implemented, but is not implemented within its PADMAN module.
341  int ret;
342 #endif
343  int i;
344 
345  for(i = 0; i<8; i++)
346  {
347  PadState[0][i].open = 0;
348  PadState[0][i].port = 0;
349  PadState[0][i].slot = 0;
350  PadState[1][i].open = 0;
351  PadState[1][i].port = 0;
352  PadState[1][i].slot = 0;
353  }
354 
355 #ifdef _XPAD //Unofficial: libpad EE client from v1.3.4 has this RPC function implemented, but is not implemented within its PADMAN module.
356 
357 #ifdef _XPAD
358  buffer.padInitArgs.command = PAD_RPCCMD_INIT;
359  buffer.padInitArgs.statBuf = openSlot;
360 #else
361  buffer.command = PAD_RPCCMD_INIT;
362 #endif
363  ret = SifCallRpc( &padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL);
364 
365  return(ret >= 0 ? buffer.padResult.result : 0);
366 #else
367  return 1;
368 #endif
369 }
370 
371 int
372 padEnd(void)
373 {
374 
375  int ret;
376 
377 
378  buffer.command=PAD_RPCCMD_END;
379 
380  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
381  return -1;
382 
383  ret = buffer.padResult.result;
384  if (ret == 1) {
385  padInitialised = 0;
386  }
387 
388  return ret;
389 }
390 
391 int
392 padPortOpen(int port, int slot, void *padArea)
393 {
394 
395  int i;
396  struct pad_data *dma_buf = (struct pad_data *)padArea;
397 
398 #ifndef _XPAD
399  // Check 16 byte alignment
400  if((u32)padArea & 0xf) {
401  printf("Address is not 16-byte aligned.\n");
402  return 0;
403  }
404 #else
405  // Check 64 byte alignment
406  if((u32)padArea & 0x3f) {
407  printf("Address is not 16-byte aligned.\n");
408  return 0;
409  }
410 #endif
411 
412  for (i=0; i<2; i++) { // Pad data is double buffered
413  memset(dma_buf[i].data, 0xff, 32); // 'Clear' data area
414  dma_buf[i].frame = 0;
415  dma_buf[i].length = 0;
416  dma_buf[i].state = PAD_STATE_EXECCMD;
417  dma_buf[i].reqState = PAD_RSTAT_BUSY;
418 #ifndef _XPAD
419  dma_buf[i].ok = 0;
420 #endif
421 #ifdef _XPAD
422  dma_buf[i].currentTask = 0;
423 #endif
424  dma_buf[i].length = 0;
425 #ifdef _XPAD
426  dma_buf[i].buttonDataReady = 0; // Should be cleared in newer padman
427 #endif
428  }
429 
430 
431  buffer.padOpenArgs.command = PAD_RPCCMD_OPEN;
432  buffer.padOpenArgs.port = port;
433  buffer.padOpenArgs.slot = slot;
434  buffer.padOpenArgs.padArea = padArea;
435 
436  if(SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
437  {
438  return 0;
439  }
440 
441  PadState[port][slot].open = 1;
443  PadState[port][slot].padBuf = buffer.padOpenResult.padBuf;
444 
445  return buffer.padOpenResult.result;
446 }
447 
448 int
450 {
451 
452  int ret;
453 
454  buffer.padCloseArgs.command = PAD_RPCCMD_CLOSE;
455  buffer.padCloseArgs.port = port;
456  buffer.padCloseArgs.slot = slot;
457  buffer.padCloseArgs.mode = 1;
458 
459  ret = SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL);
460 
461  if(ret < 0)
462  return ret;
463  else {
464  PadState[port][slot].open = 0;
465  return buffer.padResult.result;
466  }
467 }
468 
469 unsigned char
471 {
472 
473  struct pad_data *pdata;
474 
475  pdata = padGetDmaStr(port, slot);
476 
477  memcpy(data, pdata->data, pdata->length);
478  return pdata->length;
479 }
480 
481 int
483 {
484  struct pad_data *pdata;
485  unsigned char state;
486 
487 
488  pdata = padGetDmaStr(port, slot);
489 
490  state = pdata->state;
491 
492 #ifdef _XPAD
493  if (state == PAD_STATE_ERROR)
494  {
495  if (pdata->findPadRetries)
496  {
497  return PAD_STATE_FINDPAD;
498  }
499  }
500 #endif
501 
502  if (state == PAD_STATE_STABLE) { // Ok
504  return PAD_STATE_EXECCMD;
505  }
506  }
507  return state;
508 }
509 
510 unsigned char
512 {
513 
514  struct pad_data *pdata;
515 
516  pdata = padGetDmaStr(port, slot);
517  return pdata->reqState;
518 }
519 
520 int
522 {
523 
524  struct pad_data *pdata;
525 
526  pdata = padGetDmaStr(port, slot);
527  pdata->reqState = state;
528  return 1;
529 }
530 
531 void
532 padStateInt2String(int state, char buf[16])
533 {
534 
535  if(state < 8) {
536  strcpy(buf, padStateString[state]);
537  }
538 }
539 
540 void
541 padReqStateInt2String(int state, char buf[16])
542 {
543  if(state < 4)
544  strcpy(buf, padReqStateString[state]);
545 }
546 
547 int
549 {
550 
551  buffer.command = PAD_RPCCMD_GET_PORTMAX;
552 
553  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
554  return -1;
555 
556  return buffer.padResult.result;
557 }
558 
559 int
561 {
562 
563  buffer.padSlotMaxArgs.command = PAD_RPCCMD_GET_SLOTMAX;
564  buffer.padSlotMaxArgs.port = port;
565 
566  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
567  return -1;
568 
569  return buffer.padResult.result;
570 }
571 
572 int
574 {
575 #ifdef _XPAD
576  buffer.command = PAD_RPCCMD_GET_MODVER;
577 
578  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
579  return -1;
580 
581  return buffer.padResult.result;
582 #else
583  return 1; // Well.. return a low version #
584 #endif
585 }
586 
587 int
588 padInfoMode(int port, int slot, int infoMode, int index)
589 {
590 #ifdef _XPAD
591  struct pad_data *pdata;
592 
593  pdata = padGetDmaStr(port, slot);
594 
595  if (pdata->currentTask != 1)
596  return 0;
597  if (pdata->reqState == PAD_RSTAT_BUSY)
598  return 0;
599 
600  switch(infoMode) {
601  case PAD_MODECURID:
602  if (pdata->modeCurId == 0xF3)
603  return 0;
604  else
605  return (pdata->modeCurId >> 4);
606  break;
607 
608  case PAD_MODECUREXID:
609  if (pdata->modeConfig == pdata->currentTask)
610  return 0;
611  return pdata->modeTable[pdata->modeCurOffs];
612  break;
613 
614  case PAD_MODECUROFFS:
615  if (pdata->modeConfig != 0)
616  return pdata->modeCurOffs;
617  else
618  return 0;
619  break;
620 
621  case PAD_MODETABLE:
622  if (pdata->modeConfig != 0) {
623  if(index == -1) {
624  return pdata->nrOfModes;
625  }
626  else if (index < pdata->nrOfModes) {
627  return pdata->modeTable[index];
628  }
629  else {
630  return 0;
631  }
632  }
633  else
634  return 0;
635  break;
636  }
637  return 0;
638 #else
639  buffer.padInfoModeArgs.command = PAD_RPCCMD_INFO_MODE;
640  buffer.padInfoModeArgs.port = port;
641  buffer.padInfoModeArgs.slot = slot;
642  buffer.padInfoModeArgs.infoMode = infoMode;
643  buffer.padInfoModeArgs.index = index;
644 
645  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
646  return 0;
647 
648  if (buffer.padModeResult.result == 1) {
650  }
651  return buffer.padModeResult.result;
652 #endif
653 }
654 
655 int
656 padSetMainMode(int port, int slot, int mode, int lock)
657 {
658 
659  buffer.padSetMainModeArgs.command = PAD_RPCCMD_SET_MMODE;
660  buffer.padSetMainModeArgs.port = port;
661  buffer.padSetMainModeArgs.slot = slot;
662  buffer.padSetMainModeArgs.mode = mode;
663  buffer.padSetMainModeArgs.lock = lock;
664 
665  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
666  return 0;
667 
668  if (buffer.padModeResult.result == 1) {
670  }
671  return buffer.padModeResult.result;
672 }
673 
674 int
676 {
677  int mask;
678 
679  mask = padGetButtonMask(port, slot);
680 
681  if (mask^0x3ffff) {
682  return 0;
683  }
684  else {
685  return 1;
686  }
687 }
688 
689 int
691 {
692  return padSetButtonInfo(port, slot, 0xFFF);
693 }
694 
695 int
697 {
698  return padSetButtonInfo(port, slot, 0);
699 
700 }
701 
702 int
704 {
705 
706  buffer.padGetButtonMaskArgs.command = PAD_RPCCMD_GET_BTNMASK;
707  buffer.padGetButtonMaskArgs.port = port;
708  buffer.padGetButtonMaskArgs.slot = slot;
709 
710  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
711  return 0;
712 
713  return buffer.padResult.result;
714 }
715 
716 int
718 {
719  int val;
720 
721  buffer.padSetButtonInfoArgs.command = PAD_RPCCMD_SET_BTNINFO;
722  buffer.padSetButtonInfoArgs.port = port;
723  buffer.padSetButtonInfoArgs.slot = slot;
724  buffer.padSetButtonInfoArgs.buttonInfo = buttonInfo;
725 
726  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
727  return 0;
728 
729  val = buffer.padSetButtonInfoResult.result;
730 
731  if (val == 1) {
733  }
734  return buffer.padSetButtonInfoResult.result;
735 }
736 
737 unsigned char
738 padInfoAct(int port, int slot, int actuator, int cmd)
739 {
740 #ifdef _XPAD
741  struct pad_data *pdata;
742 
743  pdata = padGetDmaStr(port, slot);
744 
745  if (pdata->currentTask != 1)
746  return 0;
747  if (pdata->modeConfig < 2)
748  return 0;
749  if (actuator >= pdata->nrOfActuators)
750  return 0;
751 
752  if (actuator == -1)
753  return pdata->nrOfActuators; // # of acutators?
754 
755  if (cmd >= 4)
756  return 0;
757 
758  return pdata->actData[actuator*4+cmd];
759 #else
760  buffer.padInfoActArgs.command = PAD_RPCCMD_INFO_ACT;
761  buffer.padInfoActArgs.port = port;
762  buffer.padInfoActArgs.slot = slot;
763  buffer.padInfoActArgs.actuator = actuator;
764  buffer.padInfoActArgs.act_cmd = cmd;
765 
766  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
767  return 0;
768 
769  if (buffer.padModeResult.result == 1) {
771  }
772  return buffer.padModeResult.result;
773 #endif
774 }
775 
776 int
777 padSetActAlign(int port, int slot, char actAlign[6])
778 {
779  int i;
780  s8 *ptr;
781 
782  buffer.padActDirAlignArgs.command = PAD_RPCCMD_SET_ACTALIGN;
783  buffer.padActDirAlignArgs.port = port;
784  buffer.padActDirAlignArgs.slot = slot;
785 
786  ptr = buffer.padActDirAlignArgs.align;
787  for (i=0; i<6; i++)
788  ptr[i]=actAlign[i];
789 
790  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
791  return 0;
792 
793  if (buffer.padModeResult.result == 1) {
795  }
796  return buffer.padModeResult.result;
797 }
798 
799 int
800 padSetActDirect(int port, int slot, char actAlign[6])
801 {
802  int i;
803  s8 *ptr;
804 
805  buffer.padActDirAlignArgs.command = PAD_RPCCMD_SET_ACTDIR;
806  buffer.padActDirAlignArgs.port = port;
807  buffer.padActDirAlignArgs.slot = slot;
808 
809  ptr = buffer.padActDirAlignArgs.align;
810  for (i=0; i<6; i++)
811  ptr[i]=actAlign[i];
812 
813  if (SifCallRpc(&padsif[0], 1, 0, &buffer, 128, &buffer, 128, NULL, NULL) < 0)
814  return 0;
815 
816  return buffer.padModeResult.result;
817 }
818 
819 /*
820  * This seems to have been removed from the official SDKs, very early during the PS2's lifetime.
821  */
822 int
824 {
825 #ifdef _XPAD
826  struct open_slot *oslot;
827 
828  oslot = padGetConnDmaStr();
829 
830  return ((oslot->openSlots[port] >> slot) & 0x1);
831 #else
832  return 1;
833 #endif
834 }
static void nopdelay(void)
Definition: kernel.h:141
void SyncDCache(void *start, void *end)
u32 data
Definition: libmouse.c:36
s8 align[6]
Definition: libpad.c:230
#define PAD_RPCCMD_SET_ACTALIGN
Definition: libpad.c:57
int padGetPortMax(void)
Definition: libpad.c:548
struct @31::@40 padGetButtonMaskArgs
int padPortOpen(int port, int slot, void *padArea)
Definition: libpad.c:392
s32 buttonInfo
Definition: libpad.c:213
int padPortInit(int mode)
Definition: libpad.c:338
struct @31::@43 padInfoActArgs
s32 index
Definition: libpad.c:194
#define PAD_RPCCMD_SET_ACTDIR
Definition: libpad.c:56
struct @31::@32 padOpenResult
struct @31::@38 padSetMainModeArgs
struct @31::@39 padModeResult
struct @31::@42 padSetButtonInfoResult
#define PAD_RPCCMD_GET_PORTMAX
Definition: libpad.c:61
s32 unknown2
Definition: libpad.c:167
#define PAD_RPCCMD_INFO_MODE
Definition: libpad.c:54
unsigned char padRead(int port, int slot, struct padButtonStatus *data)
Definition: libpad.c:470
s32 act_cmd
Definition: libpad.c:224
int padInfoMode(int port, int slot, int infoMode, int index)
Definition: libpad.c:588
int padSetActAlign(int port, int slot, char actAlign[6])
Definition: libpad.c:777
unsigned char padInfoAct(int port, int slot, int actuator, int cmd)
Definition: libpad.c:738
int padGetButtonMask(int port, int slot)
Definition: libpad.c:703
s32 command
Definition: libpad.c:156
int padExitPressMode(int port, int slot)
Definition: libpad.c:696
int padGetModVersion()
Definition: libpad.c:573
s32 unknown[3]
Definition: libpad.c:165
struct @31::@41 padSetButtonInfoArgs
#define PAD_RPCCMD_GET_BTNMASK
Definition: libpad.c:58
#define PAD_RPCCMD_INIT
Definition: libpad.c:65
struct @31::@33 padResult
struct @31::@36 padSlotMaxArgs
int padInit(int mode)
Definition: libpad.c:297
int _iop_reboot_count
#define PAD_RPCCMD_CLOSE
Definition: libpad.c:63
int padSetButtonInfo(int port, int slot, int buttonInfo)
Definition: libpad.c:717
int padGetConnection(int port, int slot)
Definition: libpad.c:823
static int padInitialised
Definition: libpad.c:151
void padReqStateInt2String(int state, char buf[16])
Definition: libpad.c:541
s32 infoMode
Definition: libpad.c:193
#define PAD_RPCCMD_OPEN
Definition: libpad.c:51
struct @31::@34 padOpenArgs
int padSetActDirect(int port, int slot, char actAlign[6])
Definition: libpad.c:800
s32 slot
Definition: libpad.c:176
int padSetReqState(int port, int slot, int state)
Definition: libpad.c:521
int padPortClose(int port, int slot)
Definition: libpad.c:449
struct @31::@37 padInfoModeArgs
void * padBuf
Definition: libpad.c:168
int padEnd(void)
Definition: libpad.c:372
int padGetState(int port, int slot)
Definition: libpad.c:482
static struct pad_data * padGetDmaStr(int port, int slot)
Definition: libpad.c:253
unsigned char padGetReqState(int port, int slot)
Definition: libpad.c:511
#define PAD_RPCCMD_GET_SLOTMAX
Definition: libpad.c:62
static const char padReqStateString[3][16]
Definition: libpad.c:149
s32 actuator
Definition: libpad.c:223
void * padArea
Definition: libpad.c:178
#define PAD_RPCCMD_INFO_ACT
Definition: libpad.c:52
s32 mode
Definition: libpad.c:184
static struct pad_state PadState[2][8]
Definition: libpad.c:244
static const char padStateString[8][16]
Definition: libpad.c:146
int padInfoPressMode(int port, int slot)
Definition: libpad.c:675
struct @31::@35 padCloseArgs
s32 lock
Definition: libpad.c:200
#define PAD_RPCCMD_SET_MMODE
Definition: libpad.c:55
void padStateInt2String(int state, char buf[16])
Definition: libpad.c:532
int padSetMainMode(int port, int slot, int mode, int lock)
Definition: libpad.c:656
#define PAD_BIND_RPC_ID1
Definition: libpad.c:48
static SifRpcClientData_t padsif[2]
Definition: libpad.c:154
char buffer[128]
Definition: libpad.c:232
int padEnterPressMode(int port, int slot)
Definition: libpad.c:690
struct @31::@44 padActDirAlignArgs
int padGetSlotMax(int port)
Definition: libpad.c:560
#define PAD_BIND_RPC_ID2
Definition: libpad.c:49
#define PAD_RPCCMD_SET_BTNINFO
Definition: libpad.c:59
s32 port
Definition: libpad.c:176
s32 result
Definition: libpad.c:166
#define PAD_RPCCMD_END
Definition: libpad.c:64
#define PAD_MODECUREXID
Definition: libpad.h:73
#define PAD_STATE_ERROR
Definition: libpad.h:48
#define PAD_STATE_EXECCMD
Definition: libpad.h:46
#define PAD_RSTAT_BUSY
Definition: libpad.h:55
#define PAD_MODECUROFFS
Definition: libpad.h:74
#define PAD_STATE_FINDPAD
Definition: libpad.h:44
#define PAD_STATE_STABLE
Definition: libpad.h:47
#define PAD_MODECURID
Definition: libpad.h:72
#define PAD_MODETABLE
Definition: libpad.h:75
static char actAlign[6]
Definition: pad.c:30
int SifBindRpc(SifRpcClientData_t *client, int rpc_number, int mode)
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)
struct t_SifRpcServerData * server
Definition: sifrpc.h:142
unsigned char unk49[15]
Definition: libpad.c:137
unsigned char unkn7
Definition: libpad.c:126
unsigned char correction
Definition: libpad.c:135
unsigned char ok
Definition: libpad.c:125
unsigned char request
Definition: libpad.c:129
unsigned char CTP
Definition: libpad.c:131
unsigned int frame
Definition: libpad.c:122
unsigned char data[32]
Definition: libpad.c:127
unsigned char errorCount
Definition: libpad.c:136
unsigned char state
Definition: libpad.c:123
unsigned int length
Definition: libpad.c:128
unsigned char model
Definition: libpad.c:133
unsigned char reqState
Definition: libpad.c:124
struct pad_data * padData
Definition: libpad.c:77
unsigned int port
Definition: libpad.c:75
unsigned int slot
Definition: libpad.c:76
int open
Definition: libpad.c:74
unsigned char * padBuf
Definition: libpad.c:78
#define NULL
Definition: tamtypes.h:91
signed int s32
Definition: tamtypes.h:58
unsigned int u32
Definition: tamtypes.h:30
signed char s8
Definition: tamtypes.h:51
unsigned short u16
Definition: tamtypes.h:24
unsigned char u8
Definition: tamtypes.h:23