USB: importing some references, updating handlers and c exports

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-11-02 14:53:01 +01:00 committed by refractionpcsx2
parent 2788198b75
commit de314d253e
6 changed files with 32 additions and 50 deletions

View File

@ -285,6 +285,7 @@ typedef void(CALLBACK *_PADgsDriverInfo)(GSdriverInfo *info);
typedef s32(CALLBACK *_PADsetSlot)(u8 port, u8 slot); typedef s32(CALLBACK *_PADsetSlot)(u8 port, u8 slot);
typedef s32(CALLBACK *_PADqueryMtap)(u8 port); typedef s32(CALLBACK *_PADqueryMtap)(u8 port);
typedef void(CALLBACK *_PADWriteEvent)(keyEvent &evt); typedef void(CALLBACK *_PADWriteEvent)(keyEvent &evt);
#endif
#ifdef PLUGINfuncs #ifdef PLUGINfuncs

View File

@ -350,7 +350,7 @@ set(pcsx2USBSources
USB/usb-mic/usb-mic-logitech.cpp USB/usb-mic/usb-mic-logitech.cpp
USB/usb-mic/usb-headset.cpp USB/usb-mic/usb-headset.cpp
USB/usb-eyetoy/jpgd/jpgd.cpp USB/usb-eyetoy/jpgd/jpgd.cpp
USB/usb-eyetoy/jo_mpeg.c USB/usb-eyetoy/jo_mpeg.cpp
USB/usb-eyetoy/usb-eyetoy-webcam.cpp USB/usb-eyetoy/usb-eyetoy-webcam.cpp
USB/usb-hid/usb-hid.cpp USB/usb-hid/usb-hid.cpp
USB/shared/shared.cpp USB/shared/shared.cpp

View File

@ -41,5 +41,3 @@ extern void spu2DMA7Irq();
extern void iopIntcIrq( uint irqType ); extern void iopIntcIrq( uint irqType );
extern void iopTestIntc(); extern void iopTestIntc();
extern USBhandler usbHandler;

View File

@ -60,7 +60,6 @@ typedef struct {
} USBfreezeData; } USBfreezeData;
u8 *ram = 0; u8 *ram = 0;
USBcallback _USBirq;
FILE *usbLog; FILE *usbLog;
int64_t usb_frame_time; int64_t usb_frame_time;
int64_t usb_bit_time; int64_t usb_bit_time;
@ -83,13 +82,6 @@ Config::Config(): Log(0)
memset(&WheelType, 0, sizeof(WheelType)); memset(&WheelType, 0, sizeof(WheelType));
} }
void USBirq(int cycles)
{
//USB_LOG("USBirq.\n");
_USBirq(cycles);
}
void __Log(const char *fmt, ...) { void __Log(const char *fmt, ...) {
va_list list; va_list list;
@ -195,7 +187,7 @@ void CreateDevices()
} }
} }
EXPORT_C_(s32) USBinit() { s32 USBinit() {
OSDebugOut(TEXT("USBinit\n")); OSDebugOut(TEXT("USBinit\n"));
RegisterDevice::Register(); RegisterDevice::Register();
@ -223,7 +215,7 @@ EXPORT_C_(s32) USBinit() {
return 0; return 0;
} }
EXPORT_C_(void) USBshutdown() { void USBshutdown() {
OSDebugOut(TEXT("USBshutdown\n")); OSDebugOut(TEXT("USBshutdown\n"));
DestroyDevices(); DestroyDevices();
@ -241,7 +233,7 @@ EXPORT_C_(void) USBshutdown() {
//#endif //#endif
} }
EXPORT_C_(s32) USBopen(void *pDsp) { s32 USBopen(void *pDsp) {
if (conf.Log && !usbLog) if (conf.Log && !usbLog)
{ {
@ -299,7 +291,7 @@ EXPORT_C_(s32) USBopen(void *pDsp) {
return 0; return 0;
} }
EXPORT_C_(void) USBclose() { void USBclose() {
OSDebugOut(TEXT("USBclose\n")); OSDebugOut(TEXT("USBclose\n"));
if(usb_device[0] && usb_device[0]->klass.close) if(usb_device[0] && usb_device[0]->klass.close)
@ -312,17 +304,17 @@ EXPORT_C_(void) USBclose() {
} }
EXPORT_C_(u8) USBread8(u32 addr) { u8 USBread8(u32 addr) {
USB_LOG("* Invalid 8bit read at address %lx\n", addr); USB_LOG("* Invalid 8bit read at address %lx\n", addr);
return 0; return 0;
} }
EXPORT_C_(u16) USBread16(u32 addr) { u16 USBread16(u32 addr) {
USB_LOG("* Invalid 16bit read at address %lx\n", addr); USB_LOG("* Invalid 16bit read at address %lx\n", addr);
return 0; return 0;
} }
EXPORT_C_(u32) USBread32(u32 addr) { u32 USBread32(u32 addr) {
u32 hard; u32 hard;
hard=ohci_mem_read(qemu_ohci,addr); hard=ohci_mem_read(qemu_ohci,addr);
@ -332,42 +324,27 @@ EXPORT_C_(u32) USBread32(u32 addr) {
return hard; return hard;
} }
EXPORT_C_(void) USBwrite8(u32 addr, u8 value) { void USBwrite8(u32 addr, u8 value) {
USB_LOG("* Invalid 8bit write at address %lx value %x\n", addr, value); USB_LOG("* Invalid 8bit write at address %lx value %x\n", addr, value);
} }
EXPORT_C_(void) USBwrite16(u32 addr, u16 value) { void USBwrite16(u32 addr, u16 value) {
USB_LOG("* Invalid 16bit write at address %lx value %x\n", addr, value); USB_LOG("* Invalid 16bit write at address %lx value %x\n", addr, value);
} }
EXPORT_C_(void) USBwrite32(u32 addr, u32 value) { void USBwrite32(u32 addr, u32 value) {
USB_LOG("* Known 32bit write at address %lx value %lx\n", addr, value); USB_LOG("* Known 32bit write at address %lx value %lx\n", addr, value);
ohci_mem_write(qemu_ohci,addr,value); ohci_mem_write(qemu_ohci,addr,value);
} }
EXPORT_C_(void) USBirqCallback(USBcallback callback) {
_USBirq = callback;
}
extern u32 bits; extern u32 bits;
EXPORT_C_(int) _USBirqHandler(void) void USBsetRAM(void *mem) {
{
//fprintf(stderr," * USB: IRQ Acknowledged.\n");
//qemu_ohci->intr_status&=~bits;
return 1;
}
EXPORT_C_(USBhandler) USBirqHandler(void) {
return (USBhandler)_USBirqHandler;
}
EXPORT_C_(void) USBsetRAM(void *mem) {
ram = (u8*)mem; ram = (u8*)mem;
Reset(); Reset();
} }
EXPORT_C_(s32) USBfreeze(int mode, freezeData *data) { s32 USBfreeze(int mode, freezeData *data) {
USBfreezeData usbd = { 0 }; USBfreezeData usbd = { 0 };
//TODO FREEZE_SIZE mismatch causes loading to fail in PCSX2 beforehand //TODO FREEZE_SIZE mismatch causes loading to fail in PCSX2 beforehand
@ -608,7 +585,7 @@ EXPORT_C_(s32) USBfreeze(int mode, freezeData *data) {
return 0; return 0;
} }
EXPORT_C_(void) USBasync(u32 cycles) void USBasync(u32 cycles)
{ {
remaining += cycles; remaining += cycles;
clocks += remaining; clocks += remaining;
@ -643,10 +620,6 @@ EXPORT_C_(void) USBasync(u32 cycles)
//} //}
} }
EXPORT_C_(s32) USBtest() {
return 0;
}
int cpu_physical_memory_rw(u32 addr, u8 *buf, size_t len, int is_write) int cpu_physical_memory_rw(u32 addr, u8 *buf, size_t len, int is_write)
{ {
//OSDebugOut(TEXT("%s addr %08X, len %d\n"), is_write ? TEXT("write") : TEXT("read "), addr, len); //OSDebugOut(TEXT("%s addr %08X, len %d\n"), is_write ? TEXT("write") : TEXT("read "), addr, len);

View File

@ -18,9 +18,6 @@
#pragma once #pragma once
#ifndef __PS2USB_H__
#define __PS2USB_H__
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <string> #include <string>
@ -36,12 +33,26 @@ extern u8 *ram;
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
extern USBcallback _USBirq;
void USBirq(int);
void DestroyDevices(); void DestroyDevices();
void CreateDevices(); void CreateDevices();
s32 USBinit();
void USBasync(u32 cycles);
void USBshutdown();
void USBclose();
s32 USBopen(void *pDsp);
s32 USBfreeze(int mode, freezeData *data);
u8 USBread8(u32 addr);
u16 USBread16(u32 addr);
u32 USBread32(u32 addr);
void USBwrite8(u32 addr, u8 value);
void USBwrite16(u32 addr, u16 value);
void USBwrite32(u32 addr, u32 value);
void USBsetRAM(void *mem);
extern FILE *usbLog; extern FILE *usbLog;
s64 get_clock(); s64 get_clock();
@ -55,4 +66,3 @@ void UninitWindow();
# endif # endif
#endif #endif
#endif