coastline 0.0.4
Loading...
Searching...
No Matches
piint.h
Go to the documentation of this file.
1#ifndef LIBULTRA_IO_PIINT_H
2#define LIBULTRA_IO_PIINT_H
3
8
9#include <ultra64.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
22extern u32 __osPiAccessQueueEnabled;
23
30extern OSMesgQueue __osPiAccessQueue;
31
38extern OSMesg piAccessBuf[1];
39
46extern OSPiHandle *__osCurrentHandle[2];
47
54extern OSDevMgr __osPiDevMgr;
55
62extern OSPiHandle *__osPiTable;
63
70extern OSThread piThread;
71
78extern u64 piThreadStack[0x1000 / sizeof(u64)];
79
86extern OSMesgQueue piEventQueue;
87
94extern OSMesg piEventBuf[1];
95
102extern OSPiHandle CartRomHandle;
103
110extern OSPiHandle LeoDiskHandle;
111
118extern OSPiHandle *__osDiskHandle;
120
127void __osPiCreateAccessQueue(void);
128
135void __osPiGetAccess(void);
136
143void __osPiRelAccess(void);
144
151void __osDevMgrMain(void *arg);
152
157#define WAIT_ON_IOBUSY(stat) \
158 stat = IO_READ(PI_STATUS_REG); \
159 while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \
160 stat = IO_READ(PI_STATUS_REG)
161
162/* The registers of the 64DD. */
163#define LEO_BASE_REG 0x05000000
164#define LEO_C2_BUFF (LEO_BASE_REG + 0x000)
165#define LEO_SECTOR_BUFF (LEO_BASE_REG + 0x400)
166#define LEO_STATUS (LEO_BASE_REG + 0x508)
167#define LEO_BM_CTL (LEO_BASE_REG + 0x510)
168#define LEO_BM_STATUS (LEO_BASE_REG + 0x510)
169
170/* Bits of the status register. */
171#define LEO_STATUS_DATA_REQUEST 0x40000000
172#define LEO_STATUS_C2_TRANSFER 0x10000000
173#define LEO_STATUS_BUFFER_MANAGER_ERROR 0x08000000
174#define LEO_STATUS_MECHANIC_INTERRUPT 0x02000000
175
176/* Bits of the buffer manager control. */
177#define LEO_BM_CTL_START 0x80000000
178#define LEO_BM_CTL_RESET 0x10000000
179#define LEO_BM_CTL_CLR_MECHANIC_INTR 0x01000000
180
181/* Bits of the buffer manager status. */
182#define LEO_BM_STATUS_MICRO 0x02000000
183#define LEO_BM_STATUS_C1DOUBLE 0x00400000
184#define LEO_BM_STATUS_C1SINGLE 0x00200000
185
186/* Transfer commands and modes. */
187#define LEO_CMD_TYPE_0 0
188#define LEO_CMD_TYPE_1 1
189#define LEO_CMD_TYPE_2 2
190#define LEO_TRACK_MODE 2
191#define LEO_SECTOR_MODE 3
192
193/* Results of a block transfer. */
194#define LEO_ERROR_GOOD 0
195#define LEO_ERROR_4 4
196#define LEO_ERROR_22 22
197#define LEO_ERROR_23 23
198#define LEO_ERROR_24 24
199#define LEO_ERROR_29 29
200
207s32 __osLeoInterrupt(void);
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* LIBULTRA_IO_PIINT_H */
struct OSPiHandle_s OSPiHandle
A device on the peripheral interface, with the timing of its PI domain.
struct OSThread_s OSThread
A thread: its place in the queues, its state, and the registers saved when it last stopped.
struct OSMesgQueue_s OSMesgQueue
A message queue: a ring of messages and the threads blocked sending or receiving.
void * OSMesg
Definition os.h:73
A device manager: the thread and queues that serve the I/O requests of one interface.
Definition os.h:219
Umbrella header of the reconstructed libultra.
unsigned int u32
Definition ultratypes.h:20
int s32
Definition ultratypes.h:25
unsigned long long u64
Definition ultratypes.h:21