sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
sifman.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16
17#ifndef __SIFMAN_H__
18#define __SIFMAN_H__
19
20#include <types.h>
21#include <irx.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27typedef struct t_SifDmaTransfer
28{
29 void *src;
30 void *dest;
31 int size;
32 int attr;
33} SifDmaTransfer_t;
34
35/* Modes for DMA transfers */
36#define SIF_DMA_FROM_IOP 0x0
37#define SIF_DMA_TO_IOP 0x1
38#define SIF_DMA_FROM_EE 0x0
39#define SIF_DMA_TO_EE 0x1
40
41#define SIF_DMA_INT_I 0x2
42#define SIF_DMA_INT_O 0x4
43#define SIF_DMA_SPR 0x8
44#define SIF_DMA_BSN 0x10 /* ? what is this? */
45#define SIF_DMA_TAG 0x20
46
47#define SIF_REG_ID_SYSTEM 0x80000000
48
59
60//Status bits for the SM and MS SIF registers
62#define SIF_STAT_SIFINIT 0x10000
64#define SIF_STAT_CMDINIT 0x20000
66#define SIF_STAT_BOOTEND 0x40000
67
68/*
69 * Note: A lot of these names are _arbitrary_, since there was no debug info
70 * that gave away the "real" names. Even though I dislike the SCEI naming
71 * convention, I believe routines within the same module should be similarily
72 * named, so I've followed that convention.
73 *
74 * Perhaps someday, someone will come forward with the proper names, but I
75 * don't really care.
76 */
77
78extern void sceSifDma2Init();
79extern void sceSifInit();
80
81extern void sceSifSetDChain(void);
82
83extern int sceSifSetDma(SifDmaTransfer_t *dmat, int count);
84extern int sceSifDmaStat(int trid);
85
86/* Compatibility names for use with ps2lib. */
87#define SifSetDChain sceSifSetDChain
88#define SifSetDma sceSifSetDma
89#define SifDmaStat sceSifDmaStat
90
91/*
92 * All of these except sceSifCheckInit() & sceSifSetDmaIntr() have been
93 * aribitrarily named.
94 */
95extern void sceSifSetOneDma(SifDmaTransfer_t dmat);
96
97extern void sceSifSendSync();
98extern int sceSifIsSending();
99
100extern void sceSifDma0Transfer(void *addr, int size, int mode);
101extern void sceSifDma0Sync();
102extern int sceSifDma0Sending();
103
104extern void sceSifDma1Transfer(void *addr, int size, int mode);
105extern void sceSifDma1Sync();
106extern int sceSifDma1Sending();
107
108extern void sceSifDma2Transfer(void *addr, int size, int mode);
109extern void sceSifDma2Sync();
110extern int sceSifDma2Sending();
111
112/*
113 * SBUS Main->Sub CPU status register
114 */
115extern u32 sceSifGetMSFlag();
116extern u32 sceSifSetMSFlag(u32 val);
117
118/*
119 * SBUS Sub->Main CPU status register
120 */
121extern u32 sceSifGetSMFlag();
122extern u32 sceSifSetSMFlag(u32 val);
123
124/*
125 * SBUS Main CPU DMA receive address
126 */
127extern u32 sceSifGetMainAddr();
128
129/*
130 * SBUS Sub CPU DMA receive address
131 */
132extern u32 sceSifGetSubAddr();
133extern u32 sceSifSetSubAddr(u32 addr);
134
135/*
136 * Send a SBUS interrupt to the Main CPU
137 */
138extern void sceSifIntrMain();
139
140extern int sceSifCheckInit();
141
142extern void sceSifSetDmaIntrHandler(void (*handler)(void *userdata), void *arg);
143extern void sceSifResetDmaIntrHandler();
144
145// The following was implemented around SDK 2.2
146extern unsigned int sceSifSetDmaIntr(SifDmaTransfer_t *dmat, int count, void (*completioncb)(void *userdata), void *userdata);
147
148#define sifman_IMPORTS_start DECLARE_IMPORT_TABLE(sifman, 1, 1)
149#define sifman_IMPORTS_end END_IMPORT_TABLE
150
151#define I_sceSifDma2Init DECLARE_IMPORT(4, sceSifDma2Init)
152#define I_sceSifInit DECLARE_IMPORT(5, sceSifInit)
153#define I_sceSifSetDChain DECLARE_IMPORT(6, sceSifSetDChain)
154#define I_sceSifSetDma DECLARE_IMPORT(7, sceSifSetDma)
155#define I_sceSifDmaStat DECLARE_IMPORT(8, sceSifDmaStat)
156#define I_sceSifSetOneDma DECLARE_IMPORT(9, sceSifSetOneDma);
157#define I_sceSifSendSync DECLARE_IMPORT(10, sceSifSendSync);
158#define I_sceSifIsSending DECLARE_IMPORT(11, sceSifIsSending);
159#define I_sceSifDma0Transfer DECLARE_IMPORT(12, sceSifDma0Transfer)
160#define I_sceSifDma0Sync DECLARE_IMPORT(13, sceSifDma0Sync)
161#define I_sceSifDma0Sending DECLARE_IMPORT(14, sceSifDma0Sending)
162#define I_sceSifDma1Transfer DECLARE_IMPORT(15, sceSifDma1Transfer)
163#define I_sceSifDma1Sync DECLARE_IMPORT(16, sceSifDma1Sync)
164#define I_sceSifDma1Sending DECLARE_IMPORT(17, sceSifDma1Sending)
165#define I_sceSifDma2Transfer DECLARE_IMPORT(18, sceSifDma2Transfer)
166#define I_sceSifDma2Sync DECLARE_IMPORT(19, sceSifDma2Sync)
167#define I_sceSifDma2Sending DECLARE_IMPORT(20, sceSifDma2Sending)
168#define I_sceSifGetMSFlag DECLARE_IMPORT(21, sceSifGetMSFlag)
169#define I_sceSifSetMSFlag DECLARE_IMPORT(22, sceSifSetMSFlag)
170#define I_sceSifGetSMFlag DECLARE_IMPORT(23, sceSifGetSMFlag)
171#define I_sceSifSetSMFlag DECLARE_IMPORT(24, sceSifSetSMFlag)
172#define I_sceSifGetMainAddr DECLARE_IMPORT(25, sceSifGetMainAddr)
173#define I_sceSifGetSubAddr DECLARE_IMPORT(26, sceSifGetSubAddr)
174#define I_sceSifSetSubAddr DECLARE_IMPORT(27, sceSifSetSubAddr)
175#define I_sceSifIntrMain DECLARE_IMPORT(28, sceSifIntrMain)
176#define I_sceSifCheckInit DECLARE_IMPORT(29, sceSifCheckInit)
177#define I_sceSifSetDmaIntrHandler DECLARE_IMPORT(30, sceSifSetDmaIntrHandler)
178#define I_sceSifResetDmaIntrHandler DECLARE_IMPORT(31, sceSifResetDmaIntrHandler)
179#define I_sceSifSetDmaIntr DECLARE_IMPORT(32, sceSifSetDmaIntr)
180
181#ifdef __cplusplus
182}
183#endif
184
185#endif /* __SIFMAN_H__ */
_sif_regs
Definition sifdma.h:29
@ SIF_REG_MAINADDR
Definition sifdma.h:31
@ SIF_REG_SUBADDR
Definition sifdma.h:33
@ SIF_REG_MSFLAG
Definition sifdma.h:35
@ SIF_REG_SMFLAG
Definition sifdma.h:37
u32 count
start sector of fragmented bd/file