Example #1
0
int diva_poll(SceUID fd, SceInt64 *res) {
    int ret;
    u32 k1;

    if(wait_fd >= 0 && fd == datafd) {
        kprintf("polling for fd: %08X\n", wait_fd);
        k1 = pspSdkSetK1(0);
        ret = sceIoPollAsync(wait_fd, res);
        if(ret <= 0) {
            if(ret == 0) {
                kprintf("Async read completed: %i bytes\n", (u32)*res);
                *res = wait_size;
            } else {
                kprintf("polling error: %08X\n", ret);
            }
            sceIoClose(wait_fd);
            wait_fd = -1;
        } else {
            kprintf("poll result: %08X\n", ret);
        }
        pspSdkSetK1(k1);
        return ret;
    }
    return sceIoPollAsync(fd, res);
}
Example #2
0
void checkIo(int doDispatch) {
	char temp[128];
	SceUID fd = sceIoOpen("dispatch.prx", PSP_O_RDONLY, 0777);
	dispatchCheckpoint("sceIoOpen: %08x", fd >= 0 ? 1 : fd);
	dispatchCheckpoint("sceIoRead: %08x", sceIoRead(fd, temp, sizeof(temp)));
	dispatchCheckpoint("sceIoClose: %08x", sceIoClose(fd));

	int state;
	if (doDispatch) {
		++ignoreResched;
		state = sceKernelSuspendDispatchThread();
		dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state);
	}
	fd = sceIoOpen("dispatch.prx", PSP_O_RDONLY, 0777);
	dispatchCheckpoint("sceIoOpen: %08x", fd >= 0 ? 1 : fd);
	dispatchCheckpoint("sceIoRead: %08x", sceIoRead(fd, temp, sizeof(temp)));
	dispatchCheckpoint("sceIoClose: %08x", sceIoClose(fd));
	if (doDispatch) {
		dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state));
		--ignoreResched;
	}

	SceInt64 res = -1;
	int result = -1;
	fd = sceIoOpenAsync("dispatch.prx", PSP_O_RDONLY, 0777);
	dispatchCheckpoint("sceIoOpenAsync: %08x", fd >= 0 ? 1 : fd);
	if (doDispatch) {
		++ignoreResched;
		state = sceKernelSuspendDispatchThread();
		dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state);
	}
	result = sceIoPollAsync(fd, &res);
	dispatchCheckpoint("sceIoPollAsync: %08x / %016llx", result, res >= 0 ? 1LL : res);
	result = sceIoGetAsyncStat(fd, 1, &res);
	dispatchCheckpoint("sceIoGetAsyncStat: %08x / %016llx", result, res >= 0 ? 1LL : res);
	result = sceIoGetAsyncStat(fd, 0, &res);
	dispatchCheckpoint("sceIoGetAsyncStat: %08x / %016llx", result, res >= 0 ? 1LL : res);
	result = sceIoWaitAsync(fd, &res);
	dispatchCheckpoint("sceIoWaitAsync: %08x / %016llx", result, res >= 0 ? 1LL : res);
	if (doDispatch) {
		dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state));
		--ignoreResched;
	}
	result = sceIoWaitAsync(fd, &res);
	dispatchCheckpoint("sceIoWaitAsync: %08x / %016llx", result, res >= 0 ? 1LL : res);
	if (doDispatch) {
		++ignoreResched;
		state = sceKernelSuspendDispatchThread();
		dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state);
	}
	dispatchCheckpoint("sceIoRead: %08x", sceIoRead(fd, temp, sizeof(temp)));
	dispatchCheckpoint("sceIoWrite: %08x", sceIoWrite(1, "Hello.", sizeof("Hello.")));
	if (doDispatch) {
		dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state));
		--ignoreResched;
	}
	dispatchCheckpoint("sceIoCloseAsync: %08x", sceIoCloseAsync(fd));
	result = sceIoWaitAsync(fd, &res);
	dispatchCheckpoint("sceIoWaitAsync: %08x / %016llx", result, res);
}
Example #3
0
int myIoPollAsync( SceUID fd, SceIores *result)
{
	int ret;

	ret = sceIoPollAsync(fd, result);

	{
		struct NoDrmFd *fds;

		fds = find_nodrm_fd(fd);

		if(fds != NULL && fds->asyncKeySetup) {
			fds->asyncKeySetup = 0;
			*result = 0LL;
			ret = 0;
		}
	}

//	printk("%s: %d -> 0x%08X\r\n", __func__, fd, ret);

	return ret;
}