mirror of https://github.com/PCSX2/pcsx2.git
Provide a DEV9async and use it to call irq
This commit is contained in:
parent
bd96a73580
commit
a0ec633c46
|
@ -702,6 +702,7 @@ typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
|
||||||
#endif
|
#endif
|
||||||
typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
|
typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
|
||||||
typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
|
typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
|
||||||
|
typedef void (CALLBACK* _DEV9async)(u32 cycles);
|
||||||
|
|
||||||
// USB
|
// USB
|
||||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||||
|
@ -820,6 +821,7 @@ extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
|
||||||
#endif
|
#endif
|
||||||
extern _DEV9irqCallback DEV9irqCallback;
|
extern _DEV9irqCallback DEV9irqCallback;
|
||||||
extern _DEV9irqHandler DEV9irqHandler;
|
extern _DEV9irqHandler DEV9irqHandler;
|
||||||
|
extern _DEV9async DEV9async;
|
||||||
|
|
||||||
// USB
|
// USB
|
||||||
extern _USBopen USBopen;
|
extern _USBopen USBopen;
|
||||||
|
|
|
@ -453,7 +453,10 @@ void psxRcntUpdate()
|
||||||
else c -= difference;
|
else c -= difference;
|
||||||
psxNextCounter = c;
|
psxNextCounter = c;
|
||||||
}
|
}
|
||||||
|
if (DEV9async)
|
||||||
|
{
|
||||||
|
DEV9async(1);
|
||||||
|
}
|
||||||
if(USBasync)
|
if(USBasync)
|
||||||
{
|
{
|
||||||
const s32 difference = psxRegs.cycle - psxCounters[7].sCycleT;
|
const s32 difference = psxRegs.cycle - psxCounters[7].sCycleT;
|
||||||
|
|
|
@ -320,6 +320,7 @@ _DEV9writeDMA8Mem DEV9writeDMA8Mem;
|
||||||
#endif
|
#endif
|
||||||
_DEV9irqCallback DEV9irqCallback;
|
_DEV9irqCallback DEV9irqCallback;
|
||||||
_DEV9irqHandler DEV9irqHandler;
|
_DEV9irqHandler DEV9irqHandler;
|
||||||
|
_DEV9async DEV9async;
|
||||||
|
|
||||||
// USB
|
// USB
|
||||||
_USBopen USBopen;
|
_USBopen USBopen;
|
||||||
|
@ -630,6 +631,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_DEV9[] =
|
||||||
|
|
||||||
static const LegacyApi_OptMethod s_MethMessOpt_DEV9[] =
|
static const LegacyApi_OptMethod s_MethMessOpt_DEV9[] =
|
||||||
{
|
{
|
||||||
|
{ "DEV9async", (vMeth**)&DEV9async },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -600,6 +600,10 @@ void CALLBACK DEV9irqCallback(void (*callback)(int cycles)) {
|
||||||
DEV9irq = callback;
|
DEV9irq = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CALLBACK DEV9async(u32 cycles)
|
||||||
|
{
|
||||||
|
smap_async(cycles);
|
||||||
|
}
|
||||||
|
|
||||||
// extended funcs
|
// extended funcs
|
||||||
|
|
||||||
|
|
|
@ -24,5 +24,6 @@ EXPORTS
|
||||||
DEV9about @19
|
DEV9about @19
|
||||||
DEV9irqCallback @20
|
DEV9irqCallback @20
|
||||||
DEV9irqHandler @21
|
DEV9irqHandler @21
|
||||||
|
DEV9async @22
|
||||||
|
|
||||||
DEV9setSettingsDir
|
DEV9setSettingsDir
|
|
@ -81,6 +81,7 @@ bool rx_fifo_can_rx()
|
||||||
//we can recv a packet !
|
//we can recv a packet !
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool fireIntR = false;
|
||||||
void rx_process(NetPacket* pk)
|
void rx_process(NetPacket* pk)
|
||||||
{
|
{
|
||||||
if (!rx_fifo_can_rx())
|
if (!rx_fifo_can_rx())
|
||||||
|
@ -118,7 +119,8 @@ void rx_process(NetPacket* pk)
|
||||||
//increase frame count
|
//increase frame count
|
||||||
dev9Ru8(SMAP_R_RXFIFO_FRAME_CNT)++;
|
dev9Ru8(SMAP_R_RXFIFO_FRAME_CNT)++;
|
||||||
//spams// emu_printf("Got packet, %d bytes (%d fifo)\n", pk->size,bytes);
|
//spams// emu_printf("Got packet, %d bytes (%d fifo)\n", pk->size,bytes);
|
||||||
_DEV9irq(SMAP_INTR_RXEND,0);//now ? or when the fifo is full ? i guess now atm
|
fireIntR = true;
|
||||||
|
//_DEV9irq(SMAP_INTR_RXEND,0);//now ? or when the fifo is full ? i guess now atm
|
||||||
//note that this _is_ wrong since the IOP interrupt system is not thread safe.. but nothing i can do about that
|
//note that this _is_ wrong since the IOP interrupt system is not thread safe.. but nothing i can do about that
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,3 +842,12 @@ void CALLBACK smap_writeDMA8Mem(u32* pMem, int size)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void CALLBACK smap_async(u32 cycles)
|
||||||
|
{
|
||||||
|
if (fireIntR)
|
||||||
|
{
|
||||||
|
fireIntR = false; //Thread unsafe?
|
||||||
|
//Is this used to signal each individual packet, or just when there are packets in the RX fifo?
|
||||||
|
_DEV9irq(SMAP_INTR_RXEND, 0); //Make the call to _DEV9irq in a thread safe way
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -26,3 +26,4 @@ void CALLBACK smap_write32(u32 addr, u32 value);
|
||||||
|
|
||||||
void CALLBACK smap_readDMA8Mem(u32 *pMem, int size);
|
void CALLBACK smap_readDMA8Mem(u32 *pMem, int size);
|
||||||
void CALLBACK smap_writeDMA8Mem(u32 *pMem, int size);
|
void CALLBACK smap_writeDMA8Mem(u32 *pMem, int size);
|
||||||
|
void CALLBACK smap_async(u32 cycles);
|
Loading…
Reference in New Issue