21s32 SifDmaBatch(u32 ee_addr,
void *iop_addr, u32 size)
28 dma.dest = (
void *)ee_addr;
33 dma_id = SifSetDma(&dma, SIF_DMA_TO_EE);
36 while(SifDmaStat(dma_id) >= 0);
38 if(dma_id == 0)
return -1;
43int sceSdProcBatch(
sceSdBatch *batch, u32 *rets, u32 num)
48 for(loop = 0; (u32)loop < num; loop++)
52 switch(batch[loop].func)
54 case SD_BATCH_SETPARAM:
55 sceSdSetParam(batch[loop].entry, batch[loop].value);
57 case SD_BATCH_GETPARAM:
58 ret = sceSdGetParam(batch[loop].entry);
60 case SD_BATCH_SETSWITCH:
61 sceSdSetSwitch(batch[loop].entry, batch[loop].value);
63 case SD_BATCH_GETSWITCH:
64 ret = sceSdGetSwitch(batch[loop].entry);
66 case SD_BATCH_SETADDR:
67 sceSdSetAddr(batch[loop].entry, batch[loop].value);
69 case SD_BATCH_GETADDR:
70 ret = sceSdGetAddr(batch[loop].entry);
72 case SD_BATCH_SETCORE:
73 sceSdSetCoreAttr(batch[loop].entry, batch[loop].value);
75 case SD_BATCH_GETCORE:
76 ret = sceSdGetCoreAttr(batch[loop].entry);
78 case SD_BATCH_WRITEIOP:
79 *((u32 *) batch[loop].value) = batch[loop].entry;
81 case SD_BATCH_WRITEEE:
82 BatchData = batch[loop].entry;
83 SifDmaBatch(batch[loop].value, &BatchData, 4);
85 case SD_BATCH_EERETURN:
86 SifDmaBatch(batch[loop].value, rets, batch[loop].entry);
92 if(rets) rets[loop] = ret;
98int sceSdProcBatchEx(
sceSdBatch *batch, u32 *rets, u32 num, u32 voice)
107 for(loop = 0; (u32)loop < num; loop++)
110 switch(batch[loop].func)
112 case SD_BATCH_SETPARAM:
114 if((batch[loop].entry & 0x3E) != 0x3E)
116 sceSdSetParam(batch[loop].entry, batch[loop].value);
120 for(voice_loop = 0; voice_loop < 24; voice_loop++)
122 if(voice & (1 << voice_loop))
124 sceSdSetParam((batch[loop].entry & 0xFFC1) | (1 << (voice_loop + 1)), batch[loop].value);
132 case SD_BATCH_GETPARAM:
134 if((batch[loop].entry & 0x3E) != 0x3E)
136 ret = sceSdGetParam(batch[loop].entry);
140 for(voice_loop = 0; voice_loop < 24; voice_loop++)
142 if(voice & (1 << voice_loop))
144 ret = sceSdGetParam((batch[loop].entry & 0xFFC1) | (1 << (voice_loop + 1)));
150 rets[cmd_count] = ret;
158 case SD_BATCH_SETSWITCH:
159 sceSdSetSwitch(batch[loop].entry, batch[loop].value);
162 case SD_BATCH_GETSWITCH:
163 ret = sceSdGetSwitch(batch[loop].entry);
166 case SD_BATCH_SETADDR:
168 if((batch[loop].entry & 0x3E) != 0x3E)
170 sceSdSetAddr(batch[loop].entry, batch[loop].value);
174 for(voice_loop = 0; voice_loop < 24; voice_loop++)
176 if(voice & (1 << voice_loop))
178 sceSdSetAddr((batch[loop].entry & 0xFFC1) | (1 << (voice_loop + 1)), batch[loop].value);
186 case SD_BATCH_GETADDR:
188 if((batch[loop].entry & 0x3E) != 0x3E)
190 ret = sceSdGetAddr(batch[loop].entry);
194 for(voice_loop = 0; voice_loop < 24; voice_loop++)
196 if(voice & (1 << voice_loop))
198 ret = sceSdGetAddr((batch[loop].entry & 0xFFC1) | (1 << (voice_loop + 1)));
204 rets[cmd_count] = ret;
211 case SD_BATCH_SETCORE:
212 sceSdSetCoreAttr(batch[loop].entry, batch[loop].value);
215 case SD_BATCH_GETCORE:
216 ret = sceSdGetCoreAttr(batch[loop].entry);
219 case SD_BATCH_WRITEIOP:
220 *((u32 *) batch[loop].value) = batch[loop].entry;
223 case SD_BATCH_WRITEEE:
224 BatchData = batch[loop].entry;
225 SifDmaBatch(batch[loop].value, &BatchData, 4);
228 case SD_BATCH_EERETURN:
229 SifDmaBatch(batch[loop].value, rets, batch[loop].entry);
232 return -1 - cmd_count;
237 rets[cmd_count] = ret;
int CpuResumeIntr(int state)
int CpuSuspendIntr(int *state)