2019-08-25 06:46:40 +02:00
|
|
|
#ifndef _ULTRA64_PI_H_
|
|
|
|
#define _ULTRA64_PI_H_
|
|
|
|
|
|
|
|
/* Ultra64 Parallel Interface */
|
|
|
|
|
|
|
|
/* Types */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u32 errStatus;
|
|
|
|
void *dramAddr;
|
|
|
|
void *C2Addr;
|
|
|
|
u32 sectorSize;
|
|
|
|
u32 C1ErrNum;
|
|
|
|
u32 C1ErrSector[4];
|
|
|
|
} __OSBlockInfo;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u32 cmdType;
|
|
|
|
u16 transferMode;
|
|
|
|
u16 blockNum;
|
|
|
|
s32 sectorNum;
|
2019-10-05 21:08:05 +02:00
|
|
|
uintptr_t devAddr;
|
2019-08-25 06:46:40 +02:00
|
|
|
u32 bmCtlShadow;
|
|
|
|
u32 seqCtlShadow;
|
|
|
|
__OSBlockInfo block[2];
|
|
|
|
} __OSTranxInfo;
|
|
|
|
|
|
|
|
typedef struct OSPiHandle_s
|
|
|
|
{
|
|
|
|
struct OSPiHandle_s *next;
|
|
|
|
u8 type;
|
|
|
|
u8 latency;
|
|
|
|
u8 pageSize;
|
|
|
|
u8 relDuration;
|
|
|
|
u8 pulse;
|
|
|
|
u8 domain;
|
|
|
|
u32 baseAddress;
|
|
|
|
u32 speed;
|
|
|
|
__OSTranxInfo transferInfo;
|
|
|
|
} OSPiHandle;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u8 type;
|
2019-10-05 21:08:05 +02:00
|
|
|
uintptr_t address;
|
2019-08-25 06:46:40 +02:00
|
|
|
} OSPiInfo;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u16 type;
|
|
|
|
u8 pri;
|
|
|
|
u8 status;
|
|
|
|
OSMesgQueue *retQueue;
|
|
|
|
} OSIoMesgHdr;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/*0x00*/ OSIoMesgHdr hdr;
|
|
|
|
/*0x08*/ void *dramAddr;
|
2019-10-05 21:08:05 +02:00
|
|
|
/*0x0C*/ uintptr_t devAddr;
|
|
|
|
/*0x10*/ size_t size;
|
2019-08-25 06:46:40 +02:00
|
|
|
//OSPiHandle *piHandle; //from the official definition
|
|
|
|
} 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 */
|
|
|
|
|
|
|
|
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction,
|
2019-10-05 21:08:05 +02:00
|
|
|
uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq);
|
2019-08-25 06:46:40 +02:00
|
|
|
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf,
|
|
|
|
s32 cmdMsgCnt);
|
|
|
|
OSMesgQueue *osPiGetCmdQueue(void);
|
2019-10-05 21:08:05 +02:00
|
|
|
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
|
|
|
|
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
|
2019-08-25 06:46:40 +02:00
|
|
|
|
|
|
|
#endif
|