PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
sifcmd.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 __SIFCMD_H__
17#define __SIFCMD_H__
18
19#include <types.h>
20#include <irx.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27typedef struct t_SifCmdHeader {
29 u32 psize:8;
31 u32 dsize:24;
33 void *dest;
35 int cid;
37 u32 opt;
39
40/* System functions */
41#define SIF_CMD_ID_SYSTEM 0x80000000
42
43#define SIF_CMD_CHANGE_SADDR (SIF_CMD_ID_SYSTEM | 0)
44#define SIF_CMD_SET_SREG (SIF_CMD_ID_SYSTEM | 1)
45#define SIF_CMD_INIT_CMD (SIF_CMD_ID_SYSTEM | 2)
46#define SIF_CMD_RESET_CMD (SIF_CMD_ID_SYSTEM | 3)
47#define SIF_CMD_RPC_END (SIF_CMD_ID_SYSTEM | 8)
48#define SIF_CMD_RPC_BIND (SIF_CMD_ID_SYSTEM | 9)
49#define SIF_CMD_RPC_CALL (SIF_CMD_ID_SYSTEM | 10)
50#define SIF_CMD_RPC_RDATA (SIF_CMD_ID_SYSTEM | 12)
51
52//System SREG
53#define SIF_SREG_RPCINIT 0
54
58typedef struct t_SifCmdSRegData {
59 SifCmdHeader_t header;
60 int index;
61 unsigned int value;
63
64typedef void (*SifCmdHandler_t)(void *data, void *harg);
65
66typedef struct t_SifCmdHandlerData {
67 SifCmdHandler_t handler;
68 void *harg;
70
72{
73 SifCmdHandler_t handler;
74 void *harg;
75 void *unknown08;
77
78void sceSifInitCmd(void);
79void sceSifExitCmd(void);
80unsigned int sceSifGetSreg(int index);
81void sceSifSetSreg(int index, unsigned int value);
82void sceSifSetCmdBuffer(SifCmdHandlerData_t *cmdBuffer, int size);
83void sceSifSetSysCmdBuffer(SifCmdSysHandlerData_t *sysCmdBuffer, int size);
84void sceSifAddCmdHandler(int cid, SifCmdHandler_t handler, void *harg);
85
86/* SIF RPC. */
87
88/* Modes for bind() and call() */
90#define SIF_RPC_M_NOWAIT 0x01
92#define SIF_RPC_M_NOWBDC 0x02
93
94typedef void * (*SifRpcFunc_t)(int fno, void *buffer, int length);
95typedef void (*SifRpcEndFunc_t)(void *end_param);
96
97typedef struct t_SifRpcPktHeader
98{
99 struct t_SifCmdHeader sifcmd;
100 int rec_id;
101 void *pkt_addr;
102 int rpc_id;
104
105typedef struct t_SifRpcRendPkt
106{
107 struct t_SifCmdHeader sifcmd;
108 int rec_id; /* 04 */
109 void *pkt_addr; /* 05 */
110 int rpc_id; /* 06 */
111
112 struct t_SifRpcClientData *client; /* 7 */
113 u32 cid; /* 8 */
114 struct t_SifRpcServerData *server; /* 9 */
115 void *buff, /* 10 */
116 *cbuff; /* 11 */
118
119typedef struct t_SifRpcOtherDataPkt
120{
121 struct t_SifCmdHeader sifcmd;
122 int rec_id; /* 04 */
123 void *pkt_addr; /* 05 */
124 int rpc_id; /* 06 */
125
126 struct t_SifRpcReceiveData *receive; /* 07 */
127 void *src; /* 08 */
128 void *dest; /* 09 */
129 int size; /* 10 */
131
132typedef struct t_SifRpcBindPkt
133{
134 struct t_SifCmdHeader sifcmd;
135 int rec_id; /* 04 */
136 void *pkt_addr; /* 05 */
137 int rpc_id; /* 06 */
138 struct t_SifRpcClientData *client; /* 07 */
139 int sid; /* 08 */
141
142typedef struct t_SifRpcCallPkt
143{
144 struct t_SifCmdHeader sifcmd;
145 int rec_id; /* 04 */
146 void *pkt_addr; /* 05 */
147 int rpc_id; /* 06 */
148 struct t_SifRpcClientData *client; /* 07 */
149 int rpc_number; /* 08 */
150 int send_size; /* 09 */
151 void *receive; /* 10 */
152 int recv_size; /* 11 */
153 int rmode; /* 12 */
154 struct t_SifRpcServerData *server; /* 13 */
156
157typedef struct t_SifRpcServerData {
158 int sid;
159
160 SifRpcFunc_t func;
161 void *buff;
162 int size;
163
164 SifRpcFunc_t cfunc;
165 void *cbuff;
166 int size2;
167
168 struct t_SifRpcClientData *client;
169 void *pkt_addr;
170 int rpc_number;
171
172 void *receive;
173 int rsize;
174 int rmode;
175 int rid;
176
177 struct t_SifRpcServerData *link;
178 struct t_SifRpcServerData *next;
179 struct t_SifRpcDataQueue *base;
181
182typedef struct t_SifRpcHeader {
183 void *pkt_addr;
184 u32 rpc_id;
185 int sema_id;
186 u32 mode;
188
189typedef struct t_SifRpcClientData {
190 struct t_SifRpcHeader hdr;
191 u32 command;
192 void *buff;
193 void *cbuff;
194 SifRpcEndFunc_t end_function;
195 void *end_param;
196 struct t_SifRpcServerData *server;
198
199typedef struct t_SifRpcReceiveData {
200 struct t_SifRpcHeader hdr;
201 void *src;
202 void *dest;
203 int size;
205
206typedef struct t_SifRpcDataQueue {
207 int thread_id;
208 int active;
209 struct t_SifRpcServerData *link;
210 struct t_SifRpcServerData *start;
211 struct t_SifRpcServerData *end;
212 struct t_SifRpcDataQueue *next;
214
215
216void sceSifRemoveCmdHandler(int cid);
217unsigned int sceSifSendCmd(int cmd, void *packet, int packet_size, void *src_extra,
218 void *dest_extra, int size_extra);
219unsigned int isceSifSendCmd(int cmd, void *packet, int packet_size, void *src_extra,
220 void *dest_extra, int size_extra);
221
222void sceSifInitRpc(int mode);
223int sceSifBindRpc(SifRpcClientData_t * client, int rpc_number, int mode);
224int sceSifCallRpc(SifRpcClientData_t * client, int rpc_number, int mode, void *send,
225 int ssize, void *receive, int rsize, SifRpcEndFunc_t end_function, void *end_param);
226
227void sceSifRegisterRpc(SifRpcServerData_t *sd, int sid, SifRpcFunc_t func, void *buf,
228 SifRpcFunc_t cfunc, void *cbuf, SifRpcDataQueue_t *qd);
229
230int sceSifCheckStatRpc(SifRpcClientData_t * cd);
231
232SifRpcDataQueue_t * sceSifSetRpcQueue(SifRpcDataQueue_t *q, int thread_id);
233SifRpcServerData_t *sceSifGetNextRequest(SifRpcDataQueue_t * qd);
234void sceSifExecRequest(SifRpcServerData_t * srv);
235void sceSifRpcLoop(SifRpcDataQueue_t *qd);
236
237int sceSifGetOtherData(SifRpcReceiveData_t *rd, void *src, void *dest, int size, int mode);
238
240SifRpcDataQueue_t *sceSifRemoveRpcQueue(SifRpcDataQueue_t *qd);
241void sceSifSetSif1CB(void (*func)(void *userdata), void *userdata);
242void sceSifClearSif1CB(void);
243unsigned int sceSifSendCmdIntr(int cmd, void *packet, int packet_size, void *src_extra,
244 void *dest_extra, int size_extra, void (*completioncb)(void *userdata), void *userdata);
245unsigned int isceSifSendCmdIntr(int cmd, void *packet, int packet_size, void *src_extra,
246 void *dest_extra, int size_extra, void (*completioncb)(void *userdata), void *userdata);
247
248/* Compatibility names for use with ps2lib. */
249#define SifInitRpc sceSifInitRpc
250#define SifBindRpc sceSifBindRpc
251#define SifCallRpc sceSifCallRpc
252
253#define SifRegisterRpc sceSifRegisterRpc
254
255#define SifCheckStatRpc sceSifCheckStatRpc
256
257#define SifSetRpcQueue sceSifSetRpcQueue
258#define SifGetNextRequest sceSifGetNextRequest
259#define SifExecRequest sceSifExecRequest
260#define SifRpcLoop sceSifRpcLoop
261
262#define SifRpcGetOtherData sceSifGetOtherData
263
264#define sifcmd_IMPORTS_start DECLARE_IMPORT_TABLE(sifcmd, 1, 1)
265#define sifcmd_IMPORTS_end END_IMPORT_TABLE
266
267#define I_sceSifInitCmd DECLARE_IMPORT(4, sceSifInitCmd)
268#define I_sceSifExitCmd DECLARE_IMPORT(5, sceSifExitCmd)
269#define I_sceSifGetSreg DECLARE_IMPORT(6, sceSifGetSreg)
270#define I_sceSifSetSreg DECLARE_IMPORT(7, sceSifSetSreg)
271#define I_sceSifSetCmdBuffer DECLARE_IMPORT(8, sceSifSetCmdBuffer)
272#define I_sceSifSetSysCmdBuffer DECLARE_IMPORT(9, sceSifSetSysCmdBuffer)
273#define I_sceSifAddCmdHandler DECLARE_IMPORT(10, sceSifAddCmdHandler)
274#define I_sceSifRemoveCmdHandler DECLARE_IMPORT(11, sceSifRemoveCmdHandler)
275#define I_sceSifSendCmd DECLARE_IMPORT(12, sceSifSendCmd)
276#define I_isceSifSendCmd DECLARE_IMPORT(13, isceSifSendCmd)
277#define I_sceSifInitRpc DECLARE_IMPORT(14, sceSifInitRpc)
278#define I_sceSifBindRpc DECLARE_IMPORT(15, sceSifBindRpc)
279#define I_sceSifCallRpc DECLARE_IMPORT(16, sceSifCallRpc)
280#define I_sceSifRegisterRpc DECLARE_IMPORT(17, sceSifRegisterRpc)
281#define I_sceSifCheckStatRpc DECLARE_IMPORT(18, sceSifCheckStatRpc)
282#define I_sceSifSetRpcQueue DECLARE_IMPORT(19, sceSifSetRpcQueue)
283#define I_sceSifGetNextRequest DECLARE_IMPORT(20, sceSifGetNextRequest)
284#define I_sceSifExecRequest DECLARE_IMPORT(21, sceSifExecRequest)
285#define I_sceSifRpcLoop DECLARE_IMPORT(22, sceSifRpcLoop)
286#define I_sceSifGetOtherData DECLARE_IMPORT(23, sceSifGetOtherData)
287#define I_sceSifRemoveRpc DECLARE_IMPORT(24, sceSifRemoveRpc)
288#define I_sceSifRemoveRpcQueue DECLARE_IMPORT(25, sceSifRemoveRpcQueue)
289#define I_sceSifSetSif1CB DECLARE_IMPORT(26, sceSifSetSif1CB)
290#define I_sceSifClearSif1CB DECLARE_IMPORT(27, sceSifClearSif1CB)
291#define I_sceSifSendCmdIntr DECLARE_IMPORT(28, sceSifSendCmdIntr)
292#define I_isceSifSendCmdIntr DECLARE_IMPORT(29, isceSifSendCmdIntr)
293
294#ifdef __cplusplus
295}
296#endif
297
298#endif /* __SIFCMD_H__ */
struct t_SifCmdSRegData SifCmdSRegData_t
void * dest
Definition sifcmd.h:29