mirror of
https://github.com/joel16/uofw.git
synced 2024-11-26 21:10:38 +00:00
usbacc: Implement sceUsbAcc_internal_79A1C743
This commit is contained in:
parent
a44be8816d
commit
68717e82fc
@ -1,9 +1,13 @@
|
||||
#include <common_imp.h>
|
||||
#include <interruptman.h>
|
||||
#include <sysmem_utils_kernel.h>
|
||||
|
||||
SCE_MODULE_INFO("sceUSB_Acc_Driver", SCE_MODULE_KERNEL | SCE_MODULE_ATTR_EXCLUSIVE_LOAD | SCE_MODULE_ATTR_EXCLUSIVE_START, 1, 3);
|
||||
SCE_SDK_VERSION(SDK_VERSION);
|
||||
|
||||
#define SCE_ERROR_USB_DRIVER_NOT_FOUND 0x80243005
|
||||
// Error codes are derived from -> https://github.com/xerpi/psp-uvc-usb-video-class/blob/master/include/usb.h
|
||||
#define SCE_ERROR_USB_DRIVER_NOT_FOUND 0x80243005
|
||||
#define SCE_ERROR_USB_BUS_DRIVER_NOT_STARTED 0x80243007
|
||||
|
||||
/** USB driver endpoint */
|
||||
struct UsbEndpoint
|
||||
@ -95,25 +99,64 @@ struct UsbDriver
|
||||
struct UsbDriver *link;
|
||||
};
|
||||
|
||||
/** USB device request, used by ::sceUsbbdReqSend and ::sceUsbbdReqRecv. */
|
||||
struct UsbdDeviceReq
|
||||
{
|
||||
/** Pointer to the endpoint to queue request on */
|
||||
struct UsbEndpoint *endp;
|
||||
/** Pointer to the data buffer to use in the request */
|
||||
void *data;
|
||||
/** Size of the data buffer (send == size of data, recv == size of max receive) */
|
||||
int size;
|
||||
/** Unknown */
|
||||
int unkc;
|
||||
/** Pointer to the function to call on completion */
|
||||
void *func;
|
||||
/** Resultant size (send == size of data sent, recv == size of data received) */
|
||||
int recvsize;
|
||||
/** Return code of the request, 0 == success, -3 == cancelled */
|
||||
int retcode;
|
||||
/** Unknown */
|
||||
int unk1c;
|
||||
/** A user specified pointer for the device request */
|
||||
void *arg;
|
||||
/** Link pointer to next request used by the driver, set it to NULL */
|
||||
void *link;
|
||||
};
|
||||
|
||||
// Function prototypes
|
||||
s32 sceUsbAcc_79A1C743(void) __attribute__((alias("sceUsbAcc_internal_79A1C743")));
|
||||
s32 sceUsbAcc_driver_79A1C743(void) __attribute__((alias("sceUsbAcc_internal_79A1C743")));
|
||||
s32 sceUsbAcc_0CD7D4AA(void) __attribute__((alias("sceUsbAcc_internal_0CD7D4AA")));
|
||||
s32 sceUsbAcc_driver_0CD7D4AA(void) __attribute__((alias("sceUsbAcc_internal_0CD7D4AA")));
|
||||
|
||||
int sceUsbBus_driver_B1644BE7(struct UsbDriver *drv);
|
||||
int sceUsbBus_driver_C1E2A540(struct UsbDriver *drv);
|
||||
int sceUsbBus_driver_B1644BE7(struct UsbDriver *drv); // sceUsbbdRegister
|
||||
int sceUsbBus_driver_C1E2A540(struct UsbDriver *drv); // sceUsbbdUnregister
|
||||
int sceUsbBus_driver_23E51D8F(struct UsbdDeviceReq *req); // sceUsbbdReqSend
|
||||
int sceUsbBus_driver_8A3EB5D2(void);
|
||||
|
||||
// Globals
|
||||
struct UsbDriver drv; // 0x00000CC4
|
||||
u16 unk1; // 0x00000D60
|
||||
u8 unk2; // 0x00000D62
|
||||
struct UsbDriver g_drv; // 0x00000CC4
|
||||
u8 unk0; // 0x00000D53
|
||||
u16 unk1; // 0x00000D60
|
||||
u8 unk2; // 0x00000D62
|
||||
struct UsbdDeviceReq g_req; // 0x00000CAC
|
||||
|
||||
// Subroutine sceUsbAcc_internal_79A1C743 - Address 0x00000000 - Aliases: sceUsbAcc_79A1C743, sceUsbAcc_driver_79A1C743
|
||||
// Subroutine sceUsbAcc_internal_79A1C743 - Address 0x00000000 - Aliases: sceUsbAcc_79A1C743, sceUsbAcc_driver_79A1C743 -- sceUsbAccGetAuthStat
|
||||
// Exported in sceUsbAcc_internal, sceUsbAcc and sceUsbAcc_driver
|
||||
s32 sceUsbAcc_internal_79A1C743(void)
|
||||
{
|
||||
return 0;
|
||||
int intr = sceKernelCpuSuspendIntr();
|
||||
s32 ret = SCE_ERROR_USB_BUS_DRIVER_NOT_STARTED;
|
||||
|
||||
if (unk0) {
|
||||
ret = 0;
|
||||
if (sceUsbBus_driver_8A3EB5D2() == 0)
|
||||
ret = 0x80243701;
|
||||
}
|
||||
|
||||
sceKernelCpuResumeIntr(intr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Subroutine sceUsbAcc_internal_0CD7D4AA - Address 0x00000068 - Aliases: sceUsbAcc_0CD7D4AA, sceUsbAcc_driver_0CD7D4AA
|
||||
@ -162,7 +205,7 @@ s32 sceUsbAcc_internal_18B04C82(u16 type)
|
||||
s32 module_start(SceSize args __attribute__((unused)), void *argp __attribute__((unused)))
|
||||
{
|
||||
s32 ret = 0;
|
||||
if ((ret = sceUsbBus_driver_B1644BE7(&drv)) >= 0) {
|
||||
if ((ret = sceUsbBus_driver_B1644BE7(&g_drv)) >= 0) {
|
||||
unk1 = 0;
|
||||
unk2 = 0;
|
||||
}
|
||||
@ -173,6 +216,6 @@ s32 module_start(SceSize args __attribute__((unused)), void *argp __attribute__(
|
||||
// Subroutine module_stop - Address 0x00000558
|
||||
s32 module_stop(SceSize args __attribute__((unused)), void *argp __attribute__((unused)))
|
||||
{
|
||||
int ret = sceUsbBus_driver_C1E2A540(&drv);
|
||||
int ret = sceUsbBus_driver_C1E2A540(&g_drv);
|
||||
return (ret < 0)? 1 : 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user