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