sm64coopdx/include/PR/os_pi.h

88 lines
2 KiB
C
Raw Normal View History

2019-08-25 04:46:40 +00:00
#ifndef _ULTRA64_PI_H_
#define _ULTRA64_PI_H_
#include <ultra64.h>
2019-08-25 04:46:40 +00:00
/* Ultra64 Parallel Interface */
/* Types */
2020-02-03 05:51:26 +00:00
typedef struct {
#if !defined(VERSION_EU)
2019-08-25 04:46:40 +00:00
u32 errStatus;
2020-02-03 05:51:26 +00:00
#endif
2019-08-25 04:46:40 +00:00
void *dramAddr;
void *C2Addr;
u32 sectorSize;
u32 C1ErrNum;
u32 C1ErrSector[4];
} __OSBlockInfo;
2020-02-03 05:51:26 +00:00
typedef struct {
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
s32 sectorNum; // 8
uintptr_t devAddr; // c
#if defined(VERSION_EU)
u32 errStatus; //error status added moved to blockinfo
2020-02-03 05:51:26 +00:00
#endif
u32 bmCtlShadow; // 10
u32 seqCtlShadow; // 14
__OSBlockInfo block[2]; // 18
2019-08-25 04:46:40 +00:00
} __OSTranxInfo;
2020-02-03 05:51:26 +00:00
typedef struct OSPiHandle_s {
2019-08-25 04:46:40 +00:00
struct OSPiHandle_s *next;
u8 type;
u8 latency;
u8 pageSize;
u8 relDuration;
u8 pulse;
u8 domain;
u32 baseAddress;
u32 speed;
__OSTranxInfo transferInfo;
} OSPiHandle;
2020-02-03 05:51:26 +00:00
typedef struct {
2019-08-25 04:46:40 +00:00
u8 type;
2019-10-05 19:08:05 +00:00
uintptr_t address;
2019-08-25 04:46:40 +00:00
} OSPiInfo;
2020-02-03 05:51:26 +00:00
typedef struct {
2019-08-25 04:46:40 +00:00
u16 type;
u8 pri;
u8 status;
OSMesgQueue *retQueue;
} OSIoMesgHdr;
2020-02-03 05:51:26 +00:00
typedef struct {
2019-08-25 04:46:40 +00:00
/*0x00*/ OSIoMesgHdr hdr;
/*0x08*/ void *dramAddr;
2019-10-05 19:08:05 +00:00
/*0x0C*/ uintptr_t devAddr;
/*0x10*/ size_t size;
2020-03-02 03:42:52 +00:00
#if defined(VERSION_EU) || defined(VERSION_SH)
2020-02-03 05:51:26 +00:00
OSPiHandle *piHandle; // from the official definition
#endif
2019-08-25 04:46:40 +00:00
} OSIoMesg;
/* Definitions */
#define OS_READ 0 // device -> RDRAM
#define OS_WRITE 1 // device <- RDRAM
#define OS_MESG_PRI_NORMAL 0
#define OS_MESG_PRI_HIGH 1
/* Functions */
2022-04-17 02:12:12 +00:00
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq);
2020-02-03 05:51:26 +00:00
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
2019-08-25 04:46:40 +00:00
OSMesgQueue *osPiGetCmdQueue(void);
2019-10-05 19:08:05 +00:00
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
2020-06-20 23:21:46 +00:00
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
2019-08-25 04:46:40 +00:00
#endif