PS2SDK
PS2 Homebrew Libraries
rsd_main.c
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
11 #include "rs_i.h"
12 
13 IRX_ID("rspu2_driver", 1, 3);
14 
15 int _start(int ac, char **av)
16 {
17  const int *BootMode;
18  iop_thread_t param;
19  int th;
20 
21  (void)ac;
22  (void)av;
23  FlushDcache();
24  BootMode = QueryBootMode(3);
25  if ( BootMode && (BootMode[1] & 2) != 0 )
26  return MODULE_NO_RESIDENT_END;
27  CpuEnableIntr();
28  param.attr = TH_C;
29  param.thread = create_th;
30  param.priority = 32;
31 #ifdef LIB_OSD_100
32  param.stacksize = 512;
33 #else
34  param.stacksize = 1024;
35 #endif
36  param.option = 0;
37  th = CreateThread(&param);
38  if ( th <= 0 )
39  return MODULE_NO_RESIDENT_END;
40  StartThread(th, 0);
41  return MODULE_RESIDENT_END;
42 }
43 
44 void create_th(void *userdata)
45 {
46  iop_thread_t param;
47  int th;
48 
49  (void)userdata;
50 
51  if ( !sceSifCheckInit() )
52  sceSifInit();
53  sceSifInitRpc(0);
54  param.attr = TH_C;
55  param.thread = sce_spu2_loop;
56  param.priority = 34;
57 #ifdef LIB_OSD_100
58  param.stacksize = 2048;
59 #else
60  param.stacksize = 4096;
61 #endif
62  param.option = 0;
63  th = CreateThread(&param);
64  StartThread(th, 0);
65 #if 0
66  param.attr = TH_C;
67  param.thread = sce_osd_spu2_loop;
68  param.priority = 35;
69 #ifdef LIB_OSD_100
70  param.stacksize = 4096;
71 #else
72  param.stacksize = 0x2000;
73 #endif
74  param.option = 0;
75  gSth = CreateThread(&param);
76  StartThread(gSth, 0);
77 #endif
78  SleepThread();
79 }
CpuEnableIntr
int CpuEnableIntr()
Definition: intrman.c:240
_iop_thread
Definition: thbase.h:39