Пример #1
0
/** Unloads all pads. Use to terminate the usage of the pads. */
void unloadPads() {
	int i;
	
	for (i = 0; i < pad_count; ++i)
		unloadPad(&pad_data[i]);
	
	padReset();
}
Пример #2
0
/*
 * Initialise padman
 * a = 0 should work..
 */
int
padInit(int a)
{
    // Version check isn't used by default
    // int ver;
    int i;
    static int _rb_count = 0;

    if (_rb_count != _iop_reboot_count)
    {
        _rb_count = _iop_reboot_count;
        padReset();
    }

    if(padInitialised)
        return 0;

    padsif[0].server = NULL;
    padsif[1].server = NULL;

    do {
        if (SifBindRpc(&padsif[0], PAD_BIND_RPC_ID1, 0) < 0) {
            return -1;
        }
        nopdelay();
    } while(!padsif[0].server);

    do {
        if (SifBindRpc(&padsif[1], PAD_BIND_RPC_ID2, 0) < 0) {
            return -3;
        }
        nopdelay();
    } while(!padsif[1].server);

    // If you require a special version of the padman, check for that here (uncomment)
    // ver = padGetModVersion();

    for(i = 0; i<8; i++)
    {
        PadState[0][i].open = 0;
        PadState[0][i].port = 0;
        PadState[0][i].slot = 0;
        PadState[1][i].open = 0;
        PadState[1][i].port = 0;
        PadState[1][i].slot = 0;
    }

    ((u32 *)(&buffer[0]))[0]=PAD_RPCCMD_INIT;
    ((u32 *)(&buffer[0]))[4]=(u32)openSlot;
    if (SifCallRpc( &padsif[0], 1, 0, buffer, 128, buffer, 128, NULL, NULL) < 0)
        return -1;

    padInitialised = 1;
    return 0;

}