static void idle(void *arg) { /* * Initialize video */ osCreateViManager(OS_PRIORITY_VIMGR); #if 1 osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]); osViSetSpecialFeatures(OS_VI_GAMMA_ON | OS_VI_GAMMA_DITHER_ON | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON); #endif #if 0 osViSetMode(&osViModeTable[OS_VI_NTSC_LPN1]); /* osViSetSpecialFeatures(OS_VI_GAMMA_ON | OS_VI_GAMMA_DITHER_ON | OS_VI_DIVOT_OFF | OS_VI_DITHER_FILTER_OFF); */ #endif /* * Start PI Mgr for access to cartridge */ osCreatePiManager((OSPri) OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages, NUM_PI_MSGS); /* * Start RMON for debugging & data xfer (make sure to start * PI Mgr first) */ osCreateThread(&rmonThread, 0, rmonMain, (void *) 0, (void *) (rmonStack + RMON_STACKSIZE / 8), (OSPri) OS_PRIORITY_RMON); osStartThread(&rmonThread); /* * Create main thread */ osCreateThread(&mainThread, 3, mainproc, arg, mainThreadStack + STACKSIZE / sizeof(u64), 10); if (!debugflag) osStartThread(&mainThread); /* * Become the idle thread */ osSetThreadPri(0, 0); for (;;) ; }
void boot(void) { osInitialize(); osCreateThread(&idleThread, 1, idle, (void *)0, idleThreadStack+STACKSIZE/sizeof(u64), 10); osStartThread(&idleThread); }
/*----------------------------------------------------------------------------- Create and start graphic thread -----------------------------------------------------------------------------*/ void gfxCreateGraphicThread(NNSched* sched) { osCreateThread(&gfxThread, GRAPHIC_THREAD_ID, gfxproc,(void *) sched, gfxThreadStack+STACKSIZE/sizeof(u64), GRAPHIC_THREAD_PRI); osStartThread(&gfxThread); }
static void idle(void *arg) { /* * Initialize video */ osCreateViManager(OS_PRIORITY_VIMGR); osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]); /* * Start PI Mgr for access to cartridge */ osCreatePiManager((OSPri) OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages, NUM_PI_MSGS); /* * Create main thread */ osCreateThread(&mainThread, 3, mainproc, NULL, mainThreadStack + STACKSIZE / sizeof(u64), 10); osStartThread(&mainThread); /* * Become the idle thread */ osSetThreadPri(0, 0); for (;;) ; }
/* * controller thread make * * priority: thread priority */ void controllerThreadMake(NNSched *sched) { osCreateThread(&controllerThread, 2, controllerProc, (void *)sched, controllerThreadStack+STACKSIZE/sizeof(u64), CONTROLLER_THREAD_PRI); osStartThread(&controllerThread); }
/* * mainproc -- invoked by boot. Sets up, then becomes idle thread. */ static void mainproc(void *arg) { /* Note: Not using TLB -- all our R4300 address are KSEG0 (physical) */ osCreateThread(&gameThread, GAME_ID, gameproc, arg, (void *)(gameStack+STACKSIZE/8), GAME_PRIORITY); /* Start VI Mgr (Video) */ osCreateViManager(OS_PRIORITY_VIMGR); /* Set video mode to Low Res; Anti-Aliased; Non-interlaced; 16 bits/pixel * Related values: 1) #define's for SCREEN_WD and HT in morphfaces.h * 2) Element sizes in cfb.c * 3) Address for cfb in 'spec' * 4) gsDP clear instructions in static.c */ #ifdef FB32BIT osViSetMode(&osViModeTable[OS_VI_NTSC_LAN2]); #else osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]); #endif /* Start PI Mgr for access to cartridge * This call creates the message queue, so we don't have to. */ osCreatePiManager((OSPri) OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages, PI_MSGQUEUE_SIZE); osStartThread(&gameThread); /* Become the idle thread and relinquish CPU */ osSetThreadPri(NULL, 0); for(;;); /* This in fact just spins, but OK since we're at priority 0 */ } /* mainproc */
int InitSatelliteImage() { has_init_bmdimage = 0; osCreateThread(init_bmdimage_thread,NULL,OS_PRIORITY_NORMAL); return 0; }
/*---------------------------------------------------------------------* * IDLE THREAD (Pri.= 0) *---------------------------------------------------------------------*/ static void idle(void *arg) { /* * Initialize Vi manager */ osCreateViManager(OS_PRIORITY_VIMGR); osViSetMode(&osViModeTable[OS_VI_NTSC_HPF1]); /* * Initialize Pi manager */ osCreatePiManager((OSPri)OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages, NUM_PI_MSGS); #ifdef _DEBUG /* * Create & start RMON thread */ osCreateThread(&rmonThread, 0, rmonMain, (void *)0, (void *)(rmonThreadStack+RMON_STACKSIZE/8), (OSPri)OS_PRIORITY_RMON ); osStartThread(&rmonThread); #endif /* * Setup message queue */ osCreateMesgQueue(&retraceMessageQ, &retraceMessageBuf, 1); osViSetEvent(&retraceMessageQ, NULL, 1); /* retrace */ /* * Create & start MAINPROC thread */ osCreateThread(&mainThread, TID_MAINPROC, mainproc, (void *)0, (void *)(mainThreadStack+STACKSIZE/8), 10); #ifndef DEBUG osStartThread(&mainThread); #endif /* * Now idling */ osSetThreadPri(0, 0); for(;;); }
/* * boot -- first routine called */ void boot(void *arg) { osInitialize(); #ifdef SN64 init_debug(); #endif handler = osCartRomInit(); osCreateThread(&mainThread, MAIN_ID, (void(*)(void *))mainproc, arg, (void *)(mainStack+STACKSIZE/8), (OSPri) MAIN_PRIORITY); osStartThread(&mainThread); } /* boot */
/*----------------------- Boot Program start here -----------------------*/ void boot(void) { /* initilize software and hardware */ osInitialize(); /* Source for PARTNER-N64 */ /* ptstart(); */ /* create and start idle thread */ osCreateThread(&idleThread,IDLE_THREAD_ID, idle, (void *)0, (idleThreadStack+STACKSIZE/sizeof(u64)), IDLE_THREAD_PRI); osStartThread(&idleThread); }
int main(int argc, char *argv[]) { int arg1 = 1; int arg2 = 2; OS_THREAD thread[2]; printf("main: Creating mutex...\n"); fflush(stdout); osCreateMutex(&mutex); printf("main: Creating first thread...\n"); fflush(stdout); osCreateThread(&thread[0], testme, &arg1); printf("main: Creating second thread...\n"); fflush(stdout); osCreateThread(&thread[1], testme, &arg2); printf("main: Sleeping...\n"); fflush(stdout); osSleep(35, 0); printf("Destroying mutex...\n"); fflush(stdout); osDestroyMutex(&mutex); /* printf("Creating...\n"); fflush(stdout); printf("STATUS: %d\n", osCreateMutex(&mutex)); fflush(stdout); printf("Locking...\n"); fflush(stdout); printf("STATUS: %d\n", osLockMutex(&mutex)); fflush(stdout); printf("Locking...\n"); fflush(stdout); printf("STATUS: %d\n", osLockMutex(&mutex)); fflush(stdout); printf("Trying lock...\n"); fflush(stdout); printf("STATUS: %d\n", osTryLockMutex(&mutex)); fflush(stdout); printf("Unlocking...\n"); fflush(stdout); printf("STATUS: %d\n", osUnlockMutex(&mutex)); fflush(stdout); printf("Destroying...\n"); fflush(stdout); printf("STATUS: %d\n", osDestroyMutex(&mutex)); fflush(stdout); */ exit(0); }
/*---------------------------------------------------------------------* * BOOT PART *---------------------------------------------------------------------*/ void boot(void) { /* * Initialize OS */ osInitialize(); /* * Create idle thread & start it */ osCreateThread(&idleThread, TID_IDLE, idle, (void*)0, idleThreadStack+STACKSIZE/8, 10); osStartThread(&idleThread); }
/*-------------------------- Idle Thread ---------------------------*/ static void idle(void *arg) { /* create and start PI manager thread */ osCreatePiManager((OSPri)OS_PRIORITY_PIMGR, &PiMessageQ, PiMessages, NUM_PI_MSGS); /* please remove this comment if rmon is used */ #ifdef USE_RMON osCreateThread(&rmonThread, 0, rmonMain, (void *)0, (void *)(rmonThreadStack+RMON_STACKSIZE/8), (OSPri) OS_PRIORITY_RMON ); osStartThread(&rmonThread); #endif /* USE_RMON */ /* start main thread */ osCreateThread(&mainThread, MAIN_THREAD_ID, mainproc,arg, (mainThreadStack+STACKSIZE/sizeof(u64)),MAIN_THREAD_PRI); osStartThread(&mainThread); /* Here there is an idle loop */ for(;;); }
void boot(void) { int i; char *ap; u32 *argp; u32 argbuf[16]; /* * notice that you can't call osSyncPrintf() until you set * up an idle thread. */ osInitialize(); /* * get arguments (options) */ argp = (u32 *) RAMROM_APP_WRITE_ADDR; for (i = 0; i < sizeof(argbuf) / 4; i++, argp++) { osPiRawReadIo((u32) argp, &argbuf[i]); /* Assume no DMA */ } /* * Parse the options */ ap = (char *) argbuf; while (*ap != '\0') { while (*ap == ' ') ap++; if (*ap == '-' && *(ap + 1) == 'd') { debugflag = 1; ap += 2; } else if (*ap == '-' && *(ap + 1) == 'r') { rdp_DRAM_io = 1; ap += 2; } } osCreateThread(&idleThread, 1, idle, (void *) 0, idleThreadStack + STACKSIZE / sizeof(u64), 10); osStartThread(&idleThread); /* * never reached */ }
void boot(void) { /* * notice that you can't call osSyncPrintf() until you set * * up the rmon thread. */ osInitialize(); #ifdef SN64 init_debug(); #endif osCreateThread( &idleThread, 1, idle, (void *) 0, idleThreadStack + STACKSIZE / sizeof(u64), 10 ); osStartThread(&idleThread); }
int main(int argc, char **argv) { OS_THREAD threads[100]; void *result; int i; int max; max = atoi(argv[1]); if (max > 100 || max < 1) max = 100; for (i = 0; i < max; i++) { long status = osCreateThread(&threads[i], tmain, (void *)i); if (status != eOK) { printf("Error Starting Thread: %s", osError()); } osSleep(1, 0); } osSleep(3600 * 24 * 365, 0); }
static void idle(void *arg) { /* Activate Vi Manager */ osCreateViManager(OS_PRIORITY_VIMGR); osViSetMode(&osViModeTable[OS_VI_NTSC_LPN1]); /* Turn OFF GAMMA Correction */ osViSetSpecialFeatures( OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON ); /* Activate Pi Manager */ osCreatePiManager((OSPri)OS_PRIORITY_PIMGR, &piMessageQ, piMessages, NUM_PI_MSGS); /* Activate Main Thread */ osCreateThread(&mainThread, 3, mainproc, arg, mainThreadStack+STACKSIZE/sizeof(u64), 10); osStartThread(&mainThread); osSetThreadPri(0,0); /* Start Idle Loop */ while (1); }
void boot(void) { /* * notice that you can't call osSyncPrintf() until you set * up an idle thread. */ osInitialize(); #ifdef SN64 init_debug(); #endif handler = osCartRomInit(); osCreateThread(&idleThread, 1, idle, NULL, idleThreadStack + STACKSIZE / sizeof(u64), 10); osStartThread(&idleThread); /* * never reached */ }