20 void (*readdata)(u8 *);
21 u32 (*getportctrl1)(u32, u32);
22 u32 (*getportctrl2)(u32);
23 u32 (*reg_data)(void);
26 u32 (*enterconfigmode)(u8 *);
27 u32 (*exitconfigmode)(u8 *);
28 u32 (*querymodel)(u8 *);
29 u32 (*queryact)(u8 *);
30 u32 (*querycomb)(u8 *);
31 u32 (*querymode)(u8 *);
32 u32 (*querybuttonmask)(u8 *);
33 u32 (*setbuttoninfo)(u8 *);
34 u32 (*setvrefparam)(u8 *);
35 u32 (*setmainmode)(u8 *);
36 u32 (*setactalign)(u8 *);
40static int numControllers;
42void sio2cmdReset(
void)
46 for(i=0; i < SIO2_CMD_MAX; i++)
54 if( ((numControllers+1) < SIO2_CMD_MAX) && (s != NULL) )
56 if(numControllers > 0)
63 if(s->id == sio2Cmds[i].id)
67 }
while(numControllers > i);
71 int i = numControllers;
73 sio2Cmds[i].id = s->id;
74 sio2Cmds[i].readdata = s->readdata;
75 sio2Cmds[i].getportctrl1 = s->getportctrl1;
76 sio2Cmds[i].getportctrl2 = s->getportctrl2;
77 sio2Cmds[i].reg_data = s->reg_data;
78 sio2Cmds[i].size1 = s->size1;
79 sio2Cmds[i].size2 = s->size2;
80 sio2Cmds[i].enterconfigmode = s->enterconfigmode;
81 sio2Cmds[i].exitconfigmode = s->exitconfigmode;
82 sio2Cmds[i].querymodel = s->querymodel;
83 sio2Cmds[i].queryact = s->queryact;
84 sio2Cmds[i].querycomb = s->querycomb;
85 sio2Cmds[i].querymode = s->querymode;
86 sio2Cmds[i].querybuttonmask = s->querybuttonmask;
87 sio2Cmds[i].setbuttoninfo = s->setbuttoninfo;
88 sio2Cmds[i].setvrefparam = s->setvrefparam;
89 sio2Cmds[i].setmainmode = s->setmainmode;
90 sio2Cmds[i].setactalign = s->setactalign;
106static void FindPadsReadData(u8 *a)
115static u32 FindPadsGetPortCtrl1(u32 a, u32 b)
125static u32 FindPadsGetPortCtrl2(u32 a)
133static u32 FindPadsGetSize1(
void)
138static u32 FindPadsGetSize2(
void)
143static u32 FindPadsRegData(
void)
147 res1 = FindPadsGetSize1();
149 res1 = ((res1 & 0x1FF) << 8) | 0x40;
151 res2 = FindPadsGetSize2();
153 res2 = (res2 & 0x1FF) << 18;
155 return (res1 | res2);
158static u32 FindPadsEnterConfigMode(u8 *a)
165void sio2cmdInitFindPads(
void)
169 s.id = PAD_ID_HI(PAD_ID_FINDPADS);
171 s.readdata = &FindPadsReadData;
172 s.getportctrl1 = &FindPadsGetPortCtrl1;
173 s.getportctrl2 = &FindPadsGetPortCtrl2;
174 s.reg_data = &FindPadsRegData;
175 s.size1 = &FindPadsGetSize1;
176 s.size2 = &FindPadsGetSize2;
177 s.enterconfigmode = &FindPadsEnterConfigMode;
178 s.exitconfigmode = NULL;
183 s.querybuttonmask = NULL;
184 s.setbuttoninfo = NULL;
185 s.setvrefparam = NULL;
186 s.setmainmode = NULL;
187 s.setactalign = NULL;
196static void MouseReadData(u8* a)
207static u32 MouseGetPortCtrl1(u32 a, u32 b)
217static u32 MouseGetPortCtrl2(u32 a)
225static u32 MouseRegData(
void)
230static u32 MouseSize1(
void)
235static u32 MouseSize2(
void)
240static u32 MouseEnterConfigMode(u8 *a)
253void sio2cmdInitMouse(
void)
257 s.id = PAD_ID_HI(PAD_ID_MOUSE);
259 s.readdata = &MouseReadData;
260 s.getportctrl1 = &MouseGetPortCtrl1;
261 s.getportctrl2 = &MouseGetPortCtrl2;
262 s.reg_data = &MouseRegData;
263 s.size1 = &MouseSize1;
264 s.size2 = &MouseSize2;
265 s.enterconfigmode = &MouseEnterConfigMode;
266 s.exitconfigmode = NULL;
271 s.querybuttonmask = NULL;
272 s.setbuttoninfo = NULL;
273 s.setvrefparam = NULL;
274 s.setmainmode = NULL;
275 s.setactalign = NULL;
285static void NegiconReadData(u8* a)
298static u32 NegiconGetPortCtrl1(u32 a, u32 b)
309static u32 NegiconGetPortCtrl2(u32 a)
317static u32 NegiconRegData(
void)
322static u32 NegiconSize1(
void)
327static u32 NegiconSize2(
void)
332static u32 NegiconEnterConfigMode(u8 *a)
347void sio2cmdInitNegicon(
void)
351 s.id = PAD_ID_HI(PAD_ID_NEGICON);
353 s.readdata = &NegiconReadData;
354 s.getportctrl1 = &NegiconGetPortCtrl1;
355 s.getportctrl2 = &NegiconGetPortCtrl2;
356 s.reg_data = &NegiconRegData;
357 s.size1 = &NegiconSize1;
358 s.size2 = &NegiconSize2;
359 s.enterconfigmode = &NegiconEnterConfigMode;
360 s.exitconfigmode = NULL;
365 s.querybuttonmask = NULL;
366 s.setbuttoninfo = NULL;
367 s.setvrefparam = NULL;
368 s.setmainmode = NULL;
369 s.setactalign = NULL;
378static void KonamiGunReadData(u8* a)
387static u32 KonamiGunGetPortCtrl1(u32 a, u32 b)
397static u32 KonamiGunGetPortCtrl2(u32 a)
405static u32 KonamiGunRegData(
void)
410static u32 KonamiGunSize1(
void)
415static u32 KonamiGunSize2(
void)
420static u32 KonamiGunEnterConfigMode(u8 *a)
431void sio2cmdInitKonamiGun(
void)
435 s.id = PAD_ID_HI( PAD_ID_KONAMIGUN );
437 s.readdata = &KonamiGunReadData;
438 s.getportctrl1 = &KonamiGunGetPortCtrl1;
439 s.getportctrl2 = &KonamiGunGetPortCtrl2;
440 s.reg_data = &KonamiGunRegData;
441 s.size1 = &KonamiGunSize1;
442 s.size2 = &KonamiGunSize2;
443 s.enterconfigmode = &KonamiGunEnterConfigMode;
444 s.exitconfigmode = NULL;
449 s.querybuttonmask = NULL;
450 s.setbuttoninfo = NULL;
451 s.setvrefparam = NULL;
452 s.setmainmode = NULL;
453 s.setactalign = NULL;
462static void DigitalReadData(u8* a)
471static u32 DigitalGetPortCtrl1(u32 a, u32 b)
481static u32 DigitalGetPortCtrl2(u32 a)
489static u32 DigitalRegData(
void)
494static u32 DigitalSize1(
void)
499static u32 DigitalSize2(
void)
504static u32 DigitalEnterConfigMode(u8 *a)
515void sio2cmdInitDigital(
void)
519 s.id = PAD_ID_HI(PAD_ID_DIGITAL);
521 s.readdata = &DigitalReadData;
522 s.getportctrl1 = &DigitalGetPortCtrl1;
523 s.getportctrl2 = &DigitalGetPortCtrl2;
524 s.reg_data = &DigitalRegData;
525 s.size1 = &DigitalSize1;
526 s.size2 = &DigitalSize2;
527 s.enterconfigmode = &DigitalEnterConfigMode;
528 s.exitconfigmode = NULL;
533 s.querybuttonmask = NULL;
534 s.setbuttoninfo = NULL;
535 s.setvrefparam = NULL;
536 s.setmainmode = NULL;
537 s.setactalign = NULL;
546static void JoystickReadData(u8* a)
559static u32 JoystickGetPortCtrl1(u32 a, u32 b)
569static u32 JoystickGetPortCtrl2(u32 a)
577static u32 JoystickRegData(
void)
582static u32 JoystickSize1(
void)
587static u32 JoystickSize2(
void)
592static u32 JoystickEnterConfigMode(u8 *a)
607void sio2cmdInitJoystick(
void)
611 s.id = PAD_ID_HI( PAD_ID_JOYSTICK );
613 s.readdata = &JoystickReadData;
614 s.getportctrl1 = &JoystickGetPortCtrl1;
615 s.getportctrl2 = &JoystickGetPortCtrl2;
616 s.reg_data = &JoystickRegData;
617 s.size1 = &JoystickSize1;
618 s.size2 = &JoystickSize2;
619 s.enterconfigmode = &JoystickEnterConfigMode;
620 s.exitconfigmode = NULL;
625 s.querybuttonmask = NULL;
626 s.setbuttoninfo = NULL;
627 s.setvrefparam = NULL;
628 s.setmainmode = NULL;
629 s.setactalign = NULL;
638static void NamcoGunReadData(u8* a)
651static u32 NamcoGunGetPortCtrl1(u32 a, u32 b)
661static u32 NamcoGunGetPortCtrl2(u32 a)
669static u32 NamcoGunRegData(
void)
674static u32 NamcoGunSize1(
void)
679static u32 NamcoGunSize2(
void)
684static u32 NamcoGunEnterConfigMode(u8 *a)
699void sio2cmdInitNamcoGun(
void)
703 s.id = PAD_ID_HI(PAD_ID_NAMCOGUN);
705 s.readdata = &NamcoGunReadData;
706 s.getportctrl1 = &NamcoGunGetPortCtrl1;
707 s.getportctrl2 = &NamcoGunGetPortCtrl2;
708 s.reg_data = &NamcoGunRegData;
709 s.size1 = &NamcoGunSize1;
710 s.size2 = &NamcoGunSize2;
711 s.enterconfigmode = &NamcoGunEnterConfigMode;
712 s.exitconfigmode = NULL;
717 s.querybuttonmask = NULL;
718 s.setbuttoninfo = NULL;
719 s.setvrefparam = NULL;
720 s.setmainmode = NULL;
721 s.setactalign = NULL;
730static void AnalogReadData(u8* a)
749static u32 AnalogGetPortCtrl1(u32 a, u32 b)
755 u32 val1, val2, val3 ;
769 val3 = val1 | ( val2 << 8);
777 val3 = val3 | (val1 << 16) | 0xFF000000;
783static u32 AnalogGetPortCtrl2(u32 a)
791static u32 AnalogEnterConfigMode(u8 *a)
812void sio2cmdInitAnalog(
void)
816 s.id = PAD_ID_HI(PAD_ID_ANALOG);
818 s.readdata = &AnalogReadData;
819 s.getportctrl1 = &AnalogGetPortCtrl1;
820 s.getportctrl2 = &AnalogGetPortCtrl2;
824 s.enterconfigmode = &AnalogEnterConfigMode;
825 s.exitconfigmode = NULL;
830 s.querybuttonmask = NULL;
831 s.setbuttoninfo = NULL;
832 s.setvrefparam = NULL;
833 s.setmainmode = NULL;
834 s.setactalign = NULL;
843static void JogconReadData(u8* a)
860static u32 JogconGetPortCtrl1(u32 a, u32 b)
870static u32 JogconGetPortCtrl2(u32 a)
878static u32 JogconRegData(
void)
883static u32 JogconSize1(
void)
888static u32 JogconSize2(
void)
893static u32 JogconEnterConfigMode(u8 *a)
912void sio2cmdInitJogcon(
void)
916 s.id = PAD_ID_HI(PAD_ID_JOGCON);
918 s.readdata = &JogconReadData;
919 s.getportctrl1 = &JogconGetPortCtrl1;
920 s.getportctrl2 = &JogconGetPortCtrl2;
921 s.reg_data = &JogconRegData;
922 s.size1 = &JogconSize1;
923 s.size2 = &JogconSize2;
924 s.enterconfigmode = &JogconEnterConfigMode;
925 s.exitconfigmode = NULL;
930 s.querybuttonmask = NULL;
931 s.setbuttoninfo = NULL;
932 s.setvrefparam = NULL;
933 s.setmainmode = NULL;
934 s.setactalign = NULL;
943static void ConfigReadData(u8* a)
956static u32 ConfigGetPortCtrl1(u32 a, u32 b)
966static u32 ConfigGetPortCtrl2(u32 a)
974static u32 ConfigRegData(
void)
979static u32 ConfigSize1(
void)
984static u32 ConfigSize2(
void)
989static u32 ConfigExitConfigMode(u8 *a)
1004static u32 ConfigQueryModel(u8 *a)
1019static u32 ConfigQueryAct(u8 *a)
1034static u32 ConfigQueryComb(u8 *a)
1049static u32 ConfigQueryMode(u8 *a)
1064static u32 ConfigQueryButtonMask(u8 *a)
1079static u32 ConfigSetButtonInfo(u8 *a)
1094static u32 ConfigSetVrefParam(u8 *a)
1109static u32 ConfigSetMainMode(u8 *a)
1124static u32 ConfigSetSetActAlign(u8 *a)
1139void sio2cmdInitConfig(
void)
1143 s.id = PAD_ID_HI( PAD_ID_CONFIG );
1145 s.readdata = &ConfigReadData;
1146 s.getportctrl1 = &ConfigGetPortCtrl1;
1147 s.getportctrl2 = &ConfigGetPortCtrl2;
1148 s.reg_data = &ConfigRegData;
1149 s.size1 = &ConfigSize1;
1150 s.size2 = &ConfigSize2;
1151 s.enterconfigmode = NULL;
1152 s.exitconfigmode = &ConfigExitConfigMode;
1153 s.querymodel = &ConfigQueryModel;
1154 s.queryact = &ConfigQueryAct;
1155 s.querycomb = &ConfigQueryComb;
1156 s.querymode = &ConfigQueryMode;
1157 s.querybuttonmask = &ConfigQueryButtonMask;
1158 s.setbuttoninfo = &ConfigSetButtonInfo;
1159 s.setvrefparam = &ConfigSetVrefParam;
1160 s.setmainmode = &ConfigSetMainMode;
1161 s.setactalign = &ConfigSetSetActAlign;
1169u32 sio2cmdCheckId(u8
id)
1174 for(i=0; i < numControllers; i++)
1176 if( sio2Cmds[i].
id ==
id )
1184u32 sio2CmdGetPortCtrl1(u8
id, u32 b, u8 c)
1189 for(i=0; i < numControllers; i++)
1191 if(sio2Cmds[i].
id ==
id)
1193 if(sio2Cmds[i].getportctrl1 != NULL)
1194 return sio2Cmds[i].getportctrl1(b, c);
1201u32 sio2CmdGetPortCtrl2(u32
id, u32 b)
1206 for(i=0; i < numControllers; i++)
1208 if(sio2Cmds[i].
id ==
id)
1210 if(sio2Cmds[i].getportctrl2 != NULL)
1211 return sio2Cmds[i].getportctrl2(b);
1218void sio2CmdSetReadData(u32
id, u8 *buf)
1223 for(i=0; i < numControllers; i++)
1225 if(sio2Cmds[i].
id ==
id)
1227 if(sio2Cmds[i].readdata != NULL)
1229 sio2Cmds[i].readdata(buf);
1236u32 sio2CmdSetEnterConfigMode(u32
id, u8 *buf)
1241 for(i=0; i < numControllers; i++)
1243 if(sio2Cmds[i].
id ==
id)
1245 if(sio2Cmds[i].enterconfigmode != NULL)
1246 return sio2Cmds[i].enterconfigmode(buf);
1254u32 sio2CmdSetQueryModel(u32
id, u8 *buf)
1259 for(i=0; i < numControllers; i++)
1261 if( sio2Cmds[i].
id ==
id )
1263 if( sio2Cmds[i].querymodel != NULL)
1264 return sio2Cmds[i].querymodel(buf);
1271u32 sio2CmdSetSetMainMode(u32
id, u8 *buf)
1276 for(i=0; i < numControllers; i++)
1278 if( sio2Cmds[i].
id ==
id )
1280 if( sio2Cmds[i].setmainmode != NULL)
1281 return sio2Cmds[i].setmainmode(buf);
1288u32 sio2CmdSetQueryAct(u32
id, u8 *buf)
1293 for(i=0; i < numControllers; i++)
1295 if( sio2Cmds[i].
id ==
id )
1297 if( sio2Cmds[i].queryact != NULL)
1298 return sio2Cmds[i].queryact(buf);
1305u32 sio2CmdSetQueryComb(u32
id, u8 *buf)
1310 for(i=0; i < numControllers; i++)
1312 if( sio2Cmds[i].
id ==
id )
1314 if( sio2Cmds[i].querycomb != NULL)
1315 return sio2Cmds[i].querycomb(buf);
1322u32 sio2CmdSetQueryMode(u32
id, u8 *buf)
1327 for(i=0; i < numControllers; i++)
1329 if( sio2Cmds[i].
id ==
id )
1331 if( sio2Cmds[i].querymode != NULL)
1332 return sio2Cmds[i].querymode(buf);
1339u32 sio2CmdSetExitConfigMode(u32
id, u8 *buf)
1344 for(i=0; i < numControllers; i++)
1346 if( sio2Cmds[i].
id ==
id )
1348 if( sio2Cmds[i].exitconfigmode != NULL)
1349 return sio2Cmds[i].exitconfigmode(buf);
1356u32 sio2CmdSetSetActAlign(u32
id, u8 *buf)
1361 for(i=0; i < numControllers; i++)
1363 if( sio2Cmds[i].
id ==
id )
1365 if( sio2Cmds[i].setactalign != NULL)
1366 return sio2Cmds[i].setactalign(buf);
1373u32 sio2CmdSetQueryButtonMask(u32
id, u8 *buf)
1378 for(i=0; i < numControllers; i++)
1380 if( sio2Cmds[i].
id ==
id )
1382 if( sio2Cmds[i].querybuttonmask != NULL)
1383 return sio2Cmds[i].querybuttonmask(buf);
1390u32 sio2CmdSetSetVrefParam(u32
id, u8 *buf)
1395 for(i=0; i < numControllers; i++)
1397 if( sio2Cmds[i].
id ==
id )
1399 if( sio2Cmds[i].setvrefparam != NULL)
1400 return sio2Cmds[i].setvrefparam(buf);
1408u32 sio2CmdSetSetButtonInfo(u32
id, u8 *buf)
1413 for(i=0; i < numControllers; i++)
1415 if( sio2Cmds[i].
id ==
id )
1417 if( sio2Cmds[i].setbuttoninfo != NULL)
1418 return sio2Cmds[i].setbuttoninfo(buf);