30IRX_ID(
"padman", 3, 6);
32extern int padman_init;
38static int ParseParams(
int argc,
char *argv[])
40 int new_thpri_hi, new_thpri_lo;
42 new_thpri_hi = PADMAN_THPRI_HI;
43 new_thpri_lo = PADMAN_THPRI_LO;
51 for(i = 1; i < argc; i++,argv++)
53 if(strncmp(
"thpri=", *argv, 6) == 0)
60 new_thpri_hi = strtol(param, NULL, 10);
63 while(isdigit(*param))
67 if(new_thpri_hi - 9 < 115)
74 new_thpri_lo = strtol(param, NULL, 10);
76 if(new_thpri_lo - 9 >= 115)
78 M_KPRINTF(
"invalid priority %d\n", new_thpri_lo);
83 if(new_thpri_lo < new_thpri_hi)
84 M_PRINTF(
"high prio thread must be higher than low prio thread\n");
88 M_KPRINTF(
"invalid priority %d\n", new_thpri_hi);
95 thpri_hi = new_thpri_hi;
96 thpri_lo = new_thpri_lo;
101int _start(
int argc,
char *argv[])
105 thpri_hi = PADMAN_THPRI_HI;
106 thpri_lo = PADMAN_THPRI_LO;
108 D_PRINTF(
"Debug Version\n");
111 ParseParams(argc, argv);
113 if(thpri_hi != PADMAN_THPRI_HI || thpri_lo != PADMAN_THPRI_LO)
114 M_PRINTF(
"thread priority: high=%d, low=%d\n", thpri_hi, thpri_lo);
116 if(RegisterLibraryEntries(&_exp_padman) != 0)
118 M_PRINTF(
"RegisterLibraryEntries failed.\n");
119 return MODULE_NO_RESIDENT_END;
122 if(InitRpcServers(thpri_lo) == 0)
124 M_PRINTF(
"Failed to init RPC servers.\n");
125 return MODULE_NO_RESIDENT_END;
128 printf(
"Pad Driver for OSD\n");
130 return MODULE_RESIDENT_END;
134void WaitClearEvent(
int eventflag, u32 bits,
int mode, u32 *resbits_out)
141 WaitEventFlag(eventflag, bits | EF_EXIT_THREAD, WEF_OR, &resbits);
143 if( resbits & EF_EXIT_THREAD )
147 ReferThreadStatus(
TH_SELF, &tinfo);
148 SetEventFlag(eventflag, EF_EXIT_THREAD);
152 ClearEventFlag(eventflag, ~bits);