sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
iop_regs.h
Go to the documentation of this file.
1
6
7
#ifndef __IOP_REGS_H__
8
#define __IOP_REGS_H__
9
10
#include <
tamtypes.h
>
11
12
#define A_IOP_SIF0_HANDLER ((vu32 *)(0x000003C0))
13
#define A_IOP_SIF1_HANDLER ((vu32 *)(0x000003D0))
14
#define A_IOP_SIF2_HANDLER ((vu32 *)(0x000003E0))
15
16
#define M_reg8(___base, ___reg_num) ((vu8 *)(___base + (___reg_num)))
17
19
#define R_CDVD_N_CMD M_reg8(A_CDVD_REG_BASE, 0x04)
20
35
#define R_CDVD_N_CMD_STATUS M_reg8(A_CDVD_REG_BASE, 0x05)
36
#define R_CDVD_N_CMD_PARAM_FIFO M_reg8(A_CDVD_REG_BASE, 0x05)
37
38
#define R_CDVD_LAST_ERROR M_reg8(A_CDVD_REG_BASE, 0x06)
39
40
// 0x01 is written to this register to cause a "break" to occur, along with an interrupt.
41
#define R_CDVD_REG07 M_reg8(A_CDVD_REG_BASE, 0x07)
42
43
/* TRAY_STAT is read to get the status of the drive tray.
44
* Tray status:
45
* bit explaination
46
* --- ------------
47
* 0 Tray Open(1 if tray is open, 0 if closed)
48
* 1-7 Unknown
49
*/
50
#define R_CDVD_TRAY_STATUS M_reg8(A_CDVD_REG_BASE, 0x0A)
51
53
#define CDVD_TRAY_STAT_OPEN (1 << 0)
54
55
#define R_CDVD_DISK_TYPE M_reg8(A_CDVD_REG_BASE, 0x0F)
56
61
#define R_CDVD_S_CMD M_reg8(A_CDVD_REG_BASE, 0x16)
62
63
/* CDVD Register 0x17 is written to add a parameter to the S-command param FIFO
64
* and read to determine command status.
65
* Command status:
66
* bit explaination
67
* --- ------------
68
* 0 Unknown
69
* 1 Unknown
70
* 2 Unknown
71
* 3 Unknown
72
* 4 Unknown
73
* 5 Unknown
74
* 6 result FIFO empty(0 = result in FIFO, 1 = result FIFO is empty)
75
* 7 busy(1 if currently processing a command)
76
*/
77
#define R_CDVD_S_STATUS M_reg8(A_CDVD_REG_BASE, 0x17)
78
#define R_CDVD_S_PARAM_FIFO M_reg8(A_CDVD_REG_BASE, 0x17)
79
80
#define CDVD_S_STAT_RFIFO_EMPTY (1 << 6)
81
#define CDVD_S_STAT_BUSY (1 << 7)
82
84
#define R_CDVD_S_RES_FIFO M_reg8(A_CDVD_REG_BASE, 0x18)
85
86
#define R_CDVD_KEY_DATA0 M_reg8(A_CDVD_REG_BASE, 0x20)
87
#define R_CDVD_KEY_DATA1 M_reg8(A_CDVD_REG_BASE, 0x21)
88
#define R_CDVD_KEY_DATA2 M_reg8(A_CDVD_REG_BASE, 0x22)
89
#define R_CDVD_KEY_DATA3 M_reg8(A_CDVD_REG_BASE, 0x23)
90
#define R_CDVD_KEY_DATA4 M_reg8(A_CDVD_REG_BASE, 0x24)
91
92
#define R_CDVD_KEY_DATA5 M_reg8(A_CDVD_REG_BASE, 0x28)
93
#define R_CDVD_KEY_DATA6 M_reg8(A_CDVD_REG_BASE, 0x29)
94
#define R_CDVD_KEY_DATA7 M_reg8(A_CDVD_REG_BASE, 0x2A)
95
#define R_CDVD_KEY_DATA8 M_reg8(A_CDVD_REG_BASE, 0x2B)
96
#define R_CDVD_KEY_DATA9 M_reg8(A_CDVD_REG_BASE, 0x2C)
97
98
#define R_CDVD_KEY_DATAA M_reg8(A_CDVD_REG_BASE, 0x30)
99
#define R_CDVD_KEY_DATAB M_reg8(A_CDVD_REG_BASE, 0x31)
100
#define R_CDVD_KEY_DATAC M_reg8(A_CDVD_REG_BASE, 0x32)
101
#define R_CDVD_KEY_DATAD M_reg8(A_CDVD_REG_BASE, 0x33)
102
#define R_CDVD_KEY_DATAE M_reg8(A_CDVD_REG_BASE, 0x34)
103
108
#define R_CDVD_KEY_FLAGS M_reg8(A_CDVD_REG_BASE, 0x38)
109
113
#define R_CDVD_KEY_XOR M_reg8(A_CDVD_REG_BASE, 0x39)
114
125
#define R_CDVD_DEC_CTRL M_reg8(A_CDVD_REG_BASE, 0x3A)
126
127
// bits for CDVD_DEC_CTRL(bits 4-7 are "rotate left number")
128
#define CDVD_DEC_XOR_EN (1 << 0)
129
#define CDVD_DEC_ROTL_EN (1 << 1)
130
#define CDVD_DEC_UNK_EN (1 << 2)
131
#define CDVD_DEC_SWAP_EN (1 << 3)
132
133
134
#define A_IOP_IRQ_CTRL 0xBF801450
135
#define A_IOP_REG_1454 0xBF801454
136
138
#define A_PS1_1F801018 0x1F801018
139
141
#define A_PS1_1F801020 0x1F801020
142
143
144
#define A_PS1_SIO0_DATA 0x1F801040
145
#define A_PS1_SIO0_STAT 0x1F801044
146
#define A_PS1_SIO0_MODE 0x1F801048
147
#define A_PS1_SIO0_CTRL 0x1F80104A
148
#define A_PS1_SIO0_BAUD 0x1F80104E
149
150
#define A_PS1_SIO1_DATA 0x1F801050
151
#define A_PS1_SIO1_STAT 0x1F801054
152
#define A_PS1_SIO1_MODE 0x1F801058
153
#define A_PS1_SIO1_CTRL 0x1F80105A
154
#define A_PS1_SIO1_BAUD 0x1F80105E
155
156
#define A_PS1_RAM_SIZE 0x1F801060
157
158
#define A_IOP_I_STAT 0xBF801070
159
#define A_IOP_I_MASK 0xBF801074
160
161
#define A_IOP_IREG_1078 0xBF801078
162
#define A_IOP_IREG_107C 0xBF80107C
163
164
#define A_IOP_D0_MADR 0xBF801080
165
#define A_IOP_D0_BCR 0xBF801084
166
#define A_IOP_D0_CHCR 0xBF801088
167
168
#define A_IOP_D1_MADR 0xBF801090
169
#define A_IOP_D1_BCR 0xBF801094
170
#define A_IOP_D1_CHCR 0xBF801098
171
172
#define A_IOP_D2_MADR 0xBF8010A0
173
#define A_IOP_D2_BCR 0xBF8010A4
174
#define A_IOP_D2_CHCR 0xBF8010A8
175
176
#define A_IOP_D3_MADR 0xBF8010B0
177
#define A_IOP_D3_BCR 0xBF8010B4
178
#define A_IOP_D3_CHCR 0xBF8010B8
179
180
#define A_IOP_D4_MADR 0xBF8010C0
181
#define A_IOP_D4_BCR 0xBF8010C4
182
#define A_IOP_D4_CHCR 0xBF8010C8
183
#define A_IOP_D4_TADR 0xBF8010CC
184
185
#define A_IOP_D5_MADR 0xBF8010D0
186
#define A_IOP_D5_BCR 0xBF8010D4
187
#define A_IOP_D5_CHCR 0xBF8010D8
188
189
#define A_IOP_D6_MADR 0xBF8010E0
190
#define A_IOP_D6_BCR 0xBF8010E4
191
#define A_IOP_D6_CHCR 0xBF8010E8
192
193
#define A_IOP_SIF_1450 0xBF801450
194
#define A_IOP_SIF_1454 0xBF801454
195
196
#define A_IOP_BF80146E 0xBF80146E
197
#define A_IOP_BF801470 0xBF801470
198
#define A_IOP_BF801472 0xBF801472
199
200
#define A_IOP_D7_MADR 0xBF801500
201
#define A_IOP_D7_BCR 0xBF801504
202
#define A_IOP_D7_CHCR 0xBF801508
203
204
#define A_IOP_D8_MADR 0xBF801510
205
#define A_IOP_D8_BCR 0xBF801514
206
#define A_IOP_D8_CHCR 0xBF801518
207
208
#define A_IOP_D9_MADR 0xBF801520
209
#define A_IOP_D9_BCR 0xBF801524
210
#define A_IOP_D9_CHCR 0xBF801528
211
#define A_IOP_D9_TADR 0xBF80152C
212
213
#define A_IOP_D10_MADR 0xBF801530
214
#define A_IOP_D10_BCR 0xBF801534
215
#define A_IOP_D10_CHCR 0xBF801538
216
217
#define A_IOP_D11_MADR 0xBF801540
218
#define A_IOP_D11_BCR 0xBF801544
219
#define A_IOP_D11_CHCR 0xBF801548
220
221
#define A_IOP_D12_MADR 0xBF801550
222
#define A_IOP_D12_BCR 0xBF801554
223
#define A_IOP_D12_CHCR 0xBF801558
224
225
#define A_IOP_DMAC_1560 0xBF801560
226
#define A_IOP_DMAC_1564 0xBF801564
227
#define A_IOP_DMAC_1568 0xBF801568
228
229
#define A_IOP_DPCR 0xBF8010F0
230
#define A_IOP_DPCR2 0xBF801570
231
#define A_IOP_DPCR3 0xBF8015F0
232
233
#define A_IOP_DICR 0xBF8010F4
234
#define A_IOP_DICR2 0xBF801574
235
#define A_IOP_DICR3 0xBF80157C
236
237
#define A_IOP_DMAC_1578 0xBF801578
238
239
#define A_PS1_CD_REG0 0x1F801800
240
#define A_PS1_CD_REG1 0x1F801801
241
#define A_PS1_CD_REG2 0x1F801802
242
#define A_PS1_CD_REG3 0x1F801803
243
244
#define A_IOP_GPU_DATA 0x1F801810
245
#define A_IOP_GPU_CTRL 0x1F801814
246
247
// $1f801c00-$1f801dff
248
#define A_IOP_SPU1_BASE 0x1F801C00
249
250
#define A_IOP_UNK_2070 0xBF802070
251
252
#define A_IOP_BF803200 0xBF803200
253
#define A_IOP_BF803204 0xBF803204
254
#define A_IOP_BF803218 0xBF803218
255
#define A_IOP_BF808400 0xBF808400
256
#define A_IOP_BF808414 0xBF808414
257
#define A_IOP_BF80844C 0xBF80844C
258
#define A_IOP_BF808420 0xBF808420
259
#define A_IOP_BF808428 0xBF808428
260
#define A_IOP_BF808430 0xBF808430
261
#define A_IOP_BF80847C 0xBF80847C
262
263
#define A_IOP_SBUS_REG_BASE 0xBD000000
264
265
// Register pointer definitions
266
267
// IOP/EE IRQ control?
268
#define R_IOP_IRQ_CTRL ((vu32 *)(A_IOP_IRQ_CTRL))
269
270
// ??? related to IOP/EE communication?
271
#define R_IOP_REG_1454 ((vu32 *)(A_IOP_REG_1454))
272
273
// PS1 SIO0(pad/card slots) All 16-bit?
274
#define R_PS1_SIO0_DATA ((vu16 *)(A_PS1_SIO0_DATA))
275
#define R_PS1_SIO0_STAT ((vu16 *)(A_PS1_SIO0_STAT))
276
#define R_PS1_SIO0_MODE ((vu16 *)(A_PS1_SIO0_MODE))
277
#define R_PS1_SIO0_CTRL ((vu16 *)(A_PS1_SIO0_CTRL))
278
#define R_PS1_SIO0_BAUD ((vu16 *)(A_PS1_SIO0_BAUD))
279
280
// PS1 SIO1(serial port) All 16-bit?
281
// note: these are just duplicated from SIO0 infos!
282
#define R_PS1_SIO1_DATA ((vu16 *)(A_PS1_SIO1_DATA))
283
#define R_PS1_SIO1_STAT ((vu16 *)(A_PS1_SIO1_STAT))
284
#define R_PS1_SIO1_MODE ((vu16 *)(A_PS1_SIO1_MODE))
285
#define R_PS1_SIO1_CTRL ((vu16 *)(A_PS1_SIO1_CTRL))
286
#define R_PS1_SIO1_BAUD ((vu16 *)(A_PS1_SIO1_BAUD))
287
288
// ??
289
#define R_PS1_RAM_SIZE ((vu32 *)(A_PS1_RAM_SIZE))
290
291
#define R_IOP_I_STAT ((vu32 *)(A_IOP_I_STAT))
292
#define R_IOP_I_MASK ((vu32 *)(A_IOP_I_MASK))
293
294
// unknown functions, likely interrupt/dma related.
295
#define R_IOP_IREG_1078 ((vu32 *)(A_IOP_IREG_1078))
296
#define R_IOP_IREG_107C ((vu32 *)(A_IOP_IREG_107C))
297
298
// IOP DMAC Registers
299
#define R_IOP_D0_MADR ((vu32 *)(A_IOP_D0_MADR))
300
#define R_IOP_D0_BCR ((vu32 *)(A_IOP_D0_BCR))
301
#define R_IOP_D0_CHCR ((vu32 *)(A_IOP_D0_CHCR))
302
303
#define R_IOP_D1_MADR ((vu32 *)(A_IOP_D1_MADR))
304
#define R_IOP_D1_BCR ((vu32 *)(A_IOP_D1_BCR))
305
#define R_IOP_D1_CHCR ((vu32 *)(A_IOP_D1_CHCR))
306
307
#define R_IOP_D2_MADR ((vu32 *)(A_IOP_D2_MADR))
308
#define R_IOP_D2_BCR ((vu32 *)(A_IOP_D2_BCR))
309
#define R_IOP_D2_BCR_BS ((vu16 *)(A_IOP_D2_BCR + 0x00))
310
#define R_IOP_D2_BCR_BC ((vu16 *)(A_IOP_D2_BCR + 0x02))
311
#define R_IOP_D2_CHCR ((vu32 *)(A_IOP_D2_CHCR))
312
313
#define R_IOP_D3_MADR ((vu32 *)(A_IOP_D3_MADR))
314
#define R_IOP_D3_BCR ((vu32 *)(A_IOP_D3_BCR))
315
#define R_IOP_D3_CHCR ((vu32 *)(A_IOP_D3_CHCR))
316
317
#define R_IOP_D4_MADR ((vu32 *)(A_IOP_D4_MADR))
318
#define R_IOP_D4_BCR ((vu32 *)(A_IOP_D4_BCR))
319
#define R_IOP_D4_CHCR ((vu32 *)(A_IOP_D4_CHCR))
320
#define R_IOP_D4_TADR ((vu32 *)(A_IOP_D4_TADR))
321
322
#define R_IOP_D5_MADR ((vu32 *)(A_IOP_D5_MADR))
323
#define R_IOP_D5_BCR ((vu32 *)(A_IOP_D5_BCR))
324
#define R_IOP_D5_CHCR ((vu32 *)(A_IOP_D5_CHCR))
325
326
#define R_IOP_D6_MADR ((vu32 *)(A_IOP_D6_MADR))
327
#define R_IOP_D6_BCR ((vu32 *)(A_IOP_D6_BCR))
328
#define R_IOP_D6_CHCR ((vu32 *)(A_IOP_D6_CHCR))
329
330
#define R_IOP_D7_MADR ((vu32 *)(A_IOP_D7_MADR))
331
#define R_IOP_D7_BCR ((vu32 *)(A_IOP_D7_BCR))
332
#define R_IOP_D7_CHCR ((vu32 *)(A_IOP_D7_CHCR))
333
334
#define R_IOP_D8_MADR ((vu32 *)(A_IOP_D8_MADR))
335
#define R_IOP_D8_BCR ((vu32 *)(A_IOP_D8_BCR))
336
#define R_IOP_D8_CHCR ((vu32 *)(A_IOP_D8_CHCR))
337
338
#define R_IOP_D9_MADR ((vu32 *)(A_IOP_D9_MADR))
339
#define R_IOP_D9_BCR ((vu32 *)(A_IOP_D9_BCR))
340
#define R_IOP_D9_CHCR ((vu32 *)(A_IOP_D9_CHCR))
341
#define R_IOP_D9_TADR ((vu32 *)(A_IOP_D9_TADR))
342
343
#define R_IOP_D10_MADR ((vu32 *)(A_IOP_D10_MADR))
344
#define R_IOP_D10_BCR ((vu32 *)(A_IOP_D10_BCR))
345
#define R_IOP_D10_CHCR ((vu32 *)(A_IOP_D10_CHCR))
346
347
#define R_IOP_D11_MADR ((vu32 *)(A_IOP_D11_MADR))
348
#define R_IOP_D11_BCR ((vu32 *)(A_IOP_D11_BCR))
349
#define R_IOP_D11_CHCR ((vu32 *)(A_IOP_D11_CHCR))
350
351
#define R_IOP_D12_MADR ((vu32 *)(A_IOP_D12_MADR))
352
#define R_IOP_D12_BCR ((vu32 *)(A_IOP_D12_BCR))
353
#define R_IOP_D12_CHCR ((vu32 *)(A_IOP_D12_CHCR))
354
355
// These are some type of extended DMA control/address
356
// Reg 1560 is for SIF0(CH9), 1564 is for SIF1(CH10) and 1568 is for "SPU"(CH4) though "SPU" seems odd, perhaps SIF2??
357
#define R_IOP_DMAC_1560 ((vu32 *)(A_IOP_DMAC_1560))
358
#define R_IOP_DMAC_1564 ((vu32 *)(A_IOP_DMAC_1564))
359
#define R_IOP_DMAC_1568 ((vu32 *)(A_IOP_DMAC_1568))
360
361
#define R_IOP_DPCR ((vu32 *)(A_IOP_DPCR))
362
#define R_IOP_DPCR2 ((vu32 *)(A_IOP_DPCR2))
363
#define R_IOP_DPCR3 ((vu32 *)(A_IOP_DPCR3))
364
365
#define R_IOP_DICR ((vu32 *)(A_IOP_DICR))
366
#define R_IOP_DICR2 ((vu32 *)(A_IOP_DICR2))
367
#define R_IOP_DICR3 ((vu32 *)(A_IOP_DICR3))
368
370
#define R_IOP_DMAC_1578 ((vu32 *)(A_IOP_DMAC_1578))
371
372
// SIF/SBUS
373
374
#define R_IOP_SIF_1450 ((vu32 *)(A_IOP_SIF_1450))
375
#define R_IOP_SIF_1454 ((vu32 *)(A_IOP_SIF_1454))
376
377
378
379
#define R_PS1_CD_REG0 ((vu8 *)(A_PS1_CD_REG0))
380
#define R_PS1_CD_REG1 ((vu8 *)(A_PS1_CD_REG1))
381
#define R_PS1_CD_REG2 ((vu8 *)(A_PS1_CD_REG2))
382
#define R_PS1_CD_REG3 ((vu8 *)(A_PS1_CD_REG3))
383
384
#define R_IOP_GPU_DATA ((vu32 *)(A_IOP_GPU_DATA))
385
#define R_IOP_GPU_CTRL ((vu32 *)(A_IOP_GPU_CTRL))
386
387
#define R_IOP_UNK_2070 ((vu32 *)(A_IOP_UNK_2070))
388
390
#define R_IOP_SBUS_REG_BASE ((vu32 *)(A_IOP_SBUS_REG_BASE))
391
392
// Accessed by EECONF.IRX:
393
394
// accessed as 8-bit
395
#define R_IOP_BF80146E ((vu8 *)(A_IOP_BF80146E))
396
397
// accessed as 16-bit
398
#define R_IOP_BF801470 ((vu16 *)(A_IOP_BF801470))
399
#define R_IOP_BF801472 ((vu16 *)(A_IOP_BF801472))
400
401
// accessed as 8-bit
402
#define R_IOP_BF803200 ((vu8 *)(A_IOP_BF803200))
403
#define R_IOP_BF803204 ((vu8 *)(A_IOP_BF803204))
404
#define R_IOP_BF803218 ((vu8 *)(A_IOP_BF803218))
405
406
// 32-bit??
407
#define R_IOP_BF808400 ((vu32 *)(A_IOP_BF808400))
408
#define R_IOP_BF808414 ((vu32 *)(A_IOP_BF808414))
409
#define R_IOP_BF80844C ((vu32 *)(A_IOP_BF80844C))
410
#define R_IOP_BF808420 ((vu32 *)(A_IOP_BF808420))
411
#define R_IOP_BF808428 ((vu32 *)(A_IOP_BF808428))
412
#define R_IOP_BF808430 ((vu32 *)(A_IOP_BF808430))
413
#define R_IOP_BF80847C ((vu32 *)(A_IOP_BF80847C))
414
416
#define IOP_CHCR_30 (1 << 30)
417
419
#define IOP_CHCR_TR (1 << 24)
420
422
#define IOP_CHCR_LI (1 << 10)
423
425
#define IOP_CHCR_CO (1 << 9)
426
427
// Unknown
428
#define IOP_CHCR_08 (1 << 8)
429
431
#define IOP_CHCR_DR (1 << 0)
432
433
#define IOP_TO_MEM 0
434
#define IOP_FROM_MEM 1
435
436
#define IOP_I_STAT_VB (1 << 0)
437
#define IOP_I_STAT_SBUS (1 << 1)
438
439
//Borrowed from XPARAM patch applier by krat0s
440
//Bit 31 of GM_IF is for the IOP type.
441
#define GM_IF ((vu32 *)0x1F801450)
442
#define GM_IOP_TYPE (0x80000000)
443
444
#define IOP_CPU_TYPE (*GM_IF & GM_IOP_TYPE)
445
#define IOP_TYPE_MIPSR3000 0
446
#define IOP_TYPE_POWERPC 1
447
448
#endif
/* __IOP_REGS_H__ */
tamtypes.h
core
common
include
iop_regs.h
Generated by
1.18.0