//--------------------------------------------------------------------------- int main(void) { Kernel_Init(); Thread_Init( &stMainThread, aucMainStack, MAIN_STACK_SIZE, 1, (ThreadEntry_t)AppMain, NULL ); Thread_Init( &stIdleThread, aucIdleStack, MAIN_STACK_SIZE, 0, (ThreadEntry_t)IdleMain, NULL ); Thread_Start( &stMainThread ); Thread_Start( &stIdleThread ); Driver_SetName( (Driver_t*) &stUART, "/dev/tty"); ATMegaUART_Init( &stUART ); DriverList_Add( (Driver_t*)&stUART ); Kernel_Start(); }
//--------------------------------------------------------------------------- int main(void) { // See the annotations in lab1. Kernel_Init(); // In this exercise, we create two threads at the same priority level. // As a result, the CPU will automatically swap between these threads // at runtime to ensure that each get a chance to execute. Thread_Init( &stApp1Thread, awApp1Stack, APP1_STACK_SIZE, 1, App1Main, 0); Thread_Init( &stApp2Thread, awApp2Stack, APP2_STACK_SIZE, 1, App2Main, 0); // Set the threads up so that Thread 1 can get 4ms of CPU time uninterrupted, // but Thread 2 can get 8ms of CPU time uninterrupted. This means that // in an ideal situation, Thread 2 will get to do twice as much work as // Thread 1 - even though they share the same scheduling priority. // Note that if SetQuantum() isn't called on a thread, a default value // is set such that each thread gets equal timeslicing in the same // priority group by default. You can play around with these values and // observe how it affects the execution of both threads. Thread_SetQuantum( &stApp1Thread, 4 ); Thread_SetQuantum( &stApp2Thread, 8 ); Thread_Start( &stApp1Thread ); Thread_Start( &stApp2Thread ); Kernel_Start(); return 0; }
LVAL Native_Init() { LVAL pXReturn; int iPort; TVeosErr iErr; xlsave1(pXReturn); if (!moreargs()) iPort = TALK_BOGUS_FD; else iPort = getfixnum(xlgafixnum()); xllastarg(); /** invoke veos kernel inialization **/ iErr = Kernel_Init(iPort, Native_MessageToLSpace); if (iErr == VEOS_SUCCESS) { /** create a lisp based inspace for messages **/ s_InSpace = xlenter("VEOS_INSPACE"); setvalue(s_InSpace, NIL); NATIVE_INSPACE = &getvalue(s_InSpace); /** create keyword symbols for nancy prims **/ k_TestTime = xlenter(":TEST-TIME"); /* use with copy only */ k_Freq = xlenter(":FREQ"); /* use with copy, put or get */ /** setup invariant matcher settings in global param blocks **/ Native_InitMatcherPBs(); /** make a uid return value to signify success **/ Uid2XVect(&IDENT_ADDR, &pXReturn); } xlpop(); return(pXReturn); } /* Native_Init */
//--------------------------------------------------------------------------- int main(void) { // See the annotations in previous labs for details on init. Kernel_Init(); Thread_Init( &stApp1Thread, awApp1Stack, APP1_STACK_SIZE, 1, App1Main, 0); Thread_Init( &stApp2Thread, awApp2Stack, APP2_STACK_SIZE, 1, App2Main, 0); Thread_Start( &stApp1Thread ); Thread_Start( &stApp2Thread ); EventFlag_Init( &stFlags ); Kernel_Start(); return 0; }
//--------------------------------------------------------------------------- int main(void) { // See the annotations in previous labs for details on init. Kernel_Init(); Thread_Init( &stApp1Thread, awApp1Stack, APP1_STACK_SIZE, 1, App1Main, 0); Thread_Init( &stApp2Thread, awApp2Stack, APP2_STACK_SIZE, 1, App2Main, 0); Thread_Start( &stApp1Thread ); Thread_Start( &stApp2Thread ); // Initialize the mutex used in this example. Mutex_Init( &stMyMutex ); Kernel_Start(); return 0; }