link jaudio os

This commit is contained in:
Prakxo
2024-06-08 17:52:24 +02:00
parent de15fde935
commit dd463a6e6f
4 changed files with 97 additions and 2 deletions
+2
View File
@@ -84,6 +84,8 @@ jaudio_NES/internal/neosthread.c:
.bss: [0x80180020, 0x80186440]
.sdata: [0x80217be0, 0x80217be8]
.sbss: [0x80218460, 0x80218478]
jaudio_NES/internal/os.c:
.text: [0x80026120, 0x80026300]
Famicom/famicom.cpp:
.text: [0x80041614, 0x80046888] # TODO: get ~J2DOrthoGraph's dtor in here somehow? 0x800468fc, also add in JUTGamePad::getPortStatus when JUTGamePad is linked?
.rodata: [0x800aa9a8, 0x800aaa30]
+9 -1
View File
@@ -4,6 +4,14 @@
#include "types.h"
#include "libultra/libultra.h"
extern int Z_osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 block);
extern void Z_osWritebackDCacheAll();
extern void osInvalDCache2(void* src, s32 size);
extern void osWritebackDCache2(void* src, s32 size);
extern void Z_osCreateMesgQueue (OSMesgQueue* mq, OSMesg* msg, s32 count );
extern s32 Z_osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags );
extern s32 Z_osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags );
extern s32 Z_osEPiStartDma (OSPiHandle * handler, OSIoMesg* msg, s32 dir);
extern void Z_bcopy (void* dst, void* src, size_t size);
#endif
+4 -1
View File
@@ -5,12 +5,15 @@
#include "dolphin/os/OSThread.h"
#include "dolphin/os/OSMessage.h"
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
typedef void* OSMesg;
typedef struct OSMesgQueue_s {
/* 0x00 */ OSThread* mtqueue;
/* 0x04 */ OSThread* fullqueue;
/* 0x08 */ int validCount;
/* 0x08 */ volatile int validCount;
/* 0x0C */ int first;
/* 0x10 */ int msgCount;
/* 0x14 */ OSMesg* msg;
+82
View File
@@ -0,0 +1,82 @@
#include "jaudio_NES/os.h"
#include "dolphin/os.h"
#include "jaudio_NES/dummyrom.h"
#include "jaudio_NES/sample.h"
extern void Z_osWritebackDCacheAll(){
}
extern void osInvalDCache2(void* src, s32 size){
DCInvalidateRange(src,size);
}
extern void osWritebackDCache2(void* src, s32 size){
DCStoreRange(src,size);
}
extern void Z_osCreateMesgQueue (OSMesgQueue* mq, OSMesg* msg, s32 count ){
mq->msg = msg;
mq->msgCount = count;
mq->validCount = 0;
mq->first = 0;
}
extern s32 Z_osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags ){
int msgCount = mq->msgCount;
if (mq->validCount == mq->msgCount) {
return -1;
}
int count = mq->first + mq->validCount;
if(count >= mq->msgCount){
count -= mq->msgCount;
}
mq->msg[count] = msg;
mq->validCount++;
return 0;
}
extern s32 Z_osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags ){
if(flags == OS_MESG_BLOCK){
while(!mq->validCount){
};
}
if(mq->validCount == 0){
if(msg != NULL){
*msg = NULL;
}
return -1;
}
mq->validCount -= 1;
if(msg != NULL){
*msg = mq->msg[mq->first];
}
mq->first++;
if(mq->first == mq->msgCount){
mq->first = 0;
}
return 0;
}
extern s32 Z_osEPiStartDma (OSPiHandle * handler, OSIoMesg* msg, s32 dir){
ARAMStartDMAmesg(1, (uintptr_t)msg->dramAddr, msg->devAddr, msg->size, 0, msg->hdr.retQueue);
return 0;
}
void Z_bcopy (void* dst, void* src, size_t size){
Jac_bcopy(dst,src,size);
}