コード例 #1
0
ファイル: Lab2.c プロジェクト: airlink/EE-345M
//*******************final user main DEMONTRATE THIS TO TA**********
int main(void){ 

  // Set the clocking to run from PLL at 50 MHz 
  SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);

  OS_Init();           // initialize, disable interrupts

  DataLost = 0;        // lost data between producer and consumer
  NumSamples = 0;
  MaxJitter = 0;       // OS_Time in 20ns units
  MinJitter = 10000000;

//********initialize communication channels
  OS_MailBox_Init();
  OS_Fifo_Init(32);    // ***note*** 4 is not big enough*****

//*******attach background tasks***********
  OS_AddButtonTask(&ButtonPush,2);
  
  OS_AddPeriodicThread(&DAS,PERIOD,0); // 2 kHz real time sampling

  NumCreated = 0 ;
// create initial foreground threads
  NumCreated += OS_AddThread(&Interpreter,128,2); 
  NumCreated += OS_AddThread(&Consumer,128,1); 
  NumCreated += OS_AddThread(&PID,128,3);
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #2
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
//*******************final user main DEMONTRATE THIS TO TA**********
int main(void){        // lab 3 real main
  OS_Init();           // initialize, disable interrupts

  DataLost = 0;        // lost data between producer and consumer
  NumSamples = 0;

//********initialize communication channels
  OS_MailBox_Init();
  OS_Fifo_Init(32);    // ***note*** 4 is not big enough*****

//*******attach background tasks***********
  OS_AddButtonTask(&ButtonPush,2);
  OS_AddDownTask(&DownPush,3);
  OS_AddPeriodicThread(&DAS,1,PERIOD,0); // 2 kHz real time sampling

  NumCreated = 0 ;
// create initial foreground threads
  NumCreated += OS_AddThread(&Interpreter,128,2); 
  NumCreated += OS_AddThread(&Consumer,128,1); 
  NumCreated += OS_AddThread(&PID,128,3);

 
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #3
0
//*******************final user main DEMONTRATE THIS TO TA**********
int main(void){ 
  OS_Init();           // initialize, disable interrupts
  PortE_Init();
  DataLost = 0;        // lost data between producer and consumer
  NumSamples = 0;
  MaxJitter = 0;       // in 1us units

//********initialize communication channels
  OS_MailBox_Init();
  OS_Fifo_Init(128);    // ***note*** 4 is not big enough*****
	ST7735_InitR(INITR_REDTAB);				   // initialize LCD
	UART_Init();              					 // initialize UART
//*******attach background tasks***********
  OS_AddSW1Task(&SW1Push,2);
//  OS_AddSW2Task(&SW2Push,2);  // add this line in Lab 3
  ADC_Init(4);  // sequencer 3, channel 4, PD3, sampling in DAS()
  OS_AddPeriodicThread(&DAS,PERIOD,1); // 2 kHz real time sampling of PD3

  NumCreated = 0 ;
// create initial foreground threads
  NumCreated += OS_AddThread(&Interpreter,128,2); 
  NumCreated += OS_AddThread(&Consumer,128,1); 
  NumCreated += OS_AddThread(&PID,128,3);  // Lab 3, make this lowest priority
 
  OS_Launch(TIME_2MS); // doesn't return, interrupts enabled in here
  return 0;            // this never executes
}
コード例 #4
0
ファイル: Lab5.c プロジェクト: airlink/EE-345M
//************ButtonPush*************
// Called when Select Button pushed
// background threads execute once and return
void ButtonPush(void){
  if(Running==0){
    Running = 1;  // prevents you from starting two robot threads
    NumCreated += OS_AddThread(&Robot,128,1);  // start a 20 second run
	NumCreated += OS_AddThread(&IdleTask,128,1);  // start a 20 second run
  }
}
コード例 #5
0
ファイル: Lab2.c プロジェクト: airlink/EE-345M
int testmain1(void){ 
  OS_Init();           // initialize, disable interrupts
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread1,128,1); 
  NumCreated += OS_AddThread(&Thread2,128,2); 
  NumCreated += OS_AddThread(&Thread3,128,3); 
 
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #6
0
ファイル: Lab5.c プロジェクト: tach4455/EE345M
//******************* test main2 **********
// SYSTICK interrupts, period established by OS_Launch
// Timer interrupts, period established by first call to OS_AddPeriodicThread
int testmain2(void){ 
  OS_Init();           // initialize, disable interrupts
  
  NumCreated = 0 ;
// create initial foreground threads
  NumCreated += OS_AddThread(&TestFile,128,1);  
  NumCreated += OS_AddThread(&IdleTask,128,3); 
 
  OS_Launch(10*TIME_1MS); // doesn't return, interrupts enabled in here
  return 0;               // this never executes
}
コード例 #7
0
ファイル: Interpreter.c プロジェクト: tllado/RTOS_Bus
//------------cmdPing-----------------
// Control the ping sensors.
void cmdPing(void){
	if(FirstRun){                                            // only allowed to add ping threads once
		FirstRun = 0;			                           
		OS_AddThread(&Ping1, 128, 1);                          // sends a pulse to the ping sensor #1, 10 times a second
		OS_AddThread(&PingDisplay, 128, 6);                    // display ping results
		printf("Ping sensors added. Displaying data to ST7735.\n\r");
	}
	else{
		printf("Error, Ping sensors already added.\n\r");
	}	
}
コード例 #8
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
int testmain1(void){       // testmain1
  OS_Init();          // initialize, disable interrupts
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread1,128,1); 
  NumCreated += OS_AddThread(&Thread2,128,2); 
  NumCreated += OS_AddThread(&Thread3,128,3); 
  // Count1 runs, Count2 and Count3 are 0 because of starvation
  // change priority to equal to see round robin
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #9
0
ファイル: Lab3.c プロジェクト: airlink/EE-345M
int testmain5(void){       // Testmain5
  volatile unsigned long delay;
  OS_Init();           // initialize, disable interrupts
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread6,128,2); 
  NumCreated += OS_AddThread(&Thread7,128,1); 
  OS_AddPeriodicThread(&TaskA,(TIME_1MS*111)/100,0);           // 1 ms, higher priority
  OS_AddPeriodicThread(&TaskB,TIME_1MS,1);         // 2 ms, lower priority
  OS_Launch(TIMESLICE); // 2ms, doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #10
0
ファイル: Lab2Main.c プロジェクト: oujoshua/445M
int main2(void)
{
  #if PROFILING == 1
    volatile unsigned long delay;
  #endif
	/* Initialize 8MHz clock */
	SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_8MHZ | SYSCTL_OSC_MAIN);
  OLED_Init(15);
  ADC_Init(1000);
  ADC_Open(0);
  ADC_Open(1);
  SH_Init();
  OS_Init();
  OS_MailBox_Init();
  SH_Init();
  
  //********initialize communication channels
  OS_MailBox_Init();
  OS_Fifo_Init(32);
  
  NumCreated = 0;
  NumSamples = 0;
  MaxJitter = 0;       // OS_Time in 20ns units
  MinJitter = 10000000;
  
  #if PROFILING
    // intialize port b pins as specified by PINS mask
    // for digital output for use in profiling threads
    SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOB;
    delay = SYSCTL_RCGC2_R;
    GPIO_PORTB_DIR_R |= PINS;
    GPIO_PORTB_DEN_R |= PINS;
    GPIO_PORTB_DATA_R &= ~PINS;
  #endif
  
  // testing/debugging stuff
  OS_Add_Periodic_Thread(&DAS,2,1);
//  OS_AddButtonTask(&dummyButtonTask, 1);
  OS_AddButtonTask(&ButtonPush, 1);
  OS_AddDownTask(&ButtonPush, 1);
  
//   NumCreated += OS_AddThread(&jerkTask, 0, 6);
//   NumCreated += OS_AddThread(&dummyTask3, 0, 7);
//   NumCreated += OS_AddThread(&dummyTask1, 0, 2);
  NumCreated += OS_AddThread(&PID, 128, 5);
//   NumCreated += OS_AddThread(&dummyTask2, 0, 2);
  NumCreated += OS_AddThread(&Consumer, 128, 0);
  NumCreated += OS_AddThread(&SH_Shell, 128, 6);
  OS_Launch(TIMESLICE);
	
	/* Loop indefinitely */
  while(1);
}
コード例 #11
0
ファイル: OS.c プロジェクト: c0lin91/EE445M
// --------------------------- OS_Launch -----------------------------
void OS_Launch(unsigned long timeSlice){
	SysTick_InitInt(timeSlice);                     //For preemptive context switching
	OS_AddPeriodicThread(&RunTimeUpdate, 2, 128);  
	OS_AddPeriodicThread(&DecrementSleep, 2, 1);
  OS_AddThread(&NoCrash,128,7); //to guarantee there is always a thread in the actives list	
  OS_AddThread(&OS_Display,128,1);          
	OS_AddThread(&OS_ProcessInterpreter,128,3);
	
	RunPt = Actives;
	StartOS(); 
  EnableInterrupts();
}
コード例 #12
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
int testmain3(void){   // Testmain3
  Count4 = 0;          
  OS_Init();           // initialize, disable interrupts
// Count2 + Count5 should equal Count1 (Count5 may be zero)
  NumCreated = 0 ;
  OS_AddButtonTask(&BackgroundThread5c,2);
  NumCreated += OS_AddThread(&Thread2c,128,3); 
  NumCreated += OS_AddThread(&Thread3c,128,3); 
  NumCreated += OS_AddThread(&Thread4c,128,3); 
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;  // this never executes
}
コード例 #13
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
int testmain4(void){   // Testmain4
  Count4 = 0;          
  OS_Init();           // initialize, disable interrupts
  NumCreated = 0 ;
  OS_AddPeriodicThread(&BackgroundThread1d,1,PERIOD,0); 
  OS_AddButtonTask(&BackgroundThread5d,2);
  NumCreated += OS_AddThread(&Thread2d,128,2); 
  NumCreated += OS_AddThread(&Thread3d,128,3); 
  NumCreated += OS_AddThread(&Thread4d,128,3); 
  OS_Launch(TIMESLICE/16); // doesn't return, interrupts enabled in here
  return 0;  // this never executes
}
コード例 #14
0
ファイル: Lab2.c プロジェクト: airlink/EE-345M
int testmain2(void){  // testmain2
  OS_Init();           // initialize, disable interrupts
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread1b,128,1); 
  NumCreated += OS_AddThread(&Thread2b,128,1); 
  NumCreated += OS_AddThread(&Thread3b,128,3);
  OS_AddPeriodicThread(&Dummy1, PERIOD, 1);
  OS_AddPeriodicThread(&Dummy2, PERIOD, 2); 
 
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #15
0
ファイル: OS.c プロジェクト: tach4455/EE345M
// *********** OS_AddThreads **************
// add three foreground threads to the scheduler
// Inputs: three pointers to a void/void foreground tasks
// Outputs: 1 if successful, 0 if this thread can not be added
int OS_AddThreads(void(*task0)(void), void(*task1)(void), void(*task2)(void)) {

  int result = 0;
  result += OS_AddThread(task0, STACKSIZE, 0);
  result += OS_AddThread(task1, STACKSIZE, 0);
  result += OS_AddThread(task2, STACKSIZE, 0);

  if(result == 3) {
    return 1;
  } else {
    return 0;
  }
}
コード例 #16
0
ファイル: Lab5.c プロジェクト: AustinBlackstone/EE345M-S2012
//******************* test main2 **********
// SYSTICK interrupts, period established by OS_Launch
// Timer interrupts, period established by first call to OS_AddPeriodicThread
int testmain2(void){ 
  OS_Init();           // initialize, disable interrupts

//*******attach background tasks***********
  OS_AddPeriodicThread(&disk_timerproc,10*TIME_1MS,0);   // time out routines for disk
  
  NumCreated = 0 ;
// create initial foreground threads
  NumCreated += OS_AddThread(&TestFile,128,1);  
  NumCreated += OS_AddThread(&IdleTask,128,3); 
 
  OS_Launch(10*TIME_1MS); // doesn't return, interrupts enabled in here
  return 0;               // this never executes
}
コード例 #17
0
ファイル: Lab3.c プロジェクト: jrife/rtos
int Testmain5(void){       // Testmain5
  volatile unsigned long delay;
  SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOB; // activate port B
  delay = SYSCTL_RCGC2_R;     // allow time to finish activating
  GPIO_PORTB_DIR_R |= 0x07;   // make PB2, PB1, PB0 out
  GPIO_PORTB_DEN_R |= 0x07;   // enable digital I/O on PB2, PB1, PB0
  OS_Init();           // initialize, disable interrupts
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread6,128,2); 
  NumCreated += OS_AddThread(&Thread7,128,1); 
  OS_AddPeriodicThread(&TaskA,TIME_1MS,0);           // 1 ms, higher priority
  OS_AddPeriodicThread(&TaskB,2*TIME_1MS,1);         // 2 ms, lower priority
 
  OS_Launch(TIMESLICE); // 2ms, doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #18
0
ファイル: Lab2Main.c プロジェクト: oujoshua/445M
//************ButtonPush*************
// Called when Select Button pushed
// Adds another foreground task
// background threads execute once and return
void ButtonPush(void){
  if(OS_AddThread(&ButtonWork,100,1)){
    NumCreated++; 
  }
  OS_Kill();
  OS_Delay(OS_ARBITRARY_DELAY);
}
コード例 #19
0
//************SW2Push*************
// Called when SW2 Button pushed, Lab 3 only
// Adds another foreground task
// background threads execute once and return
void SW2Push(void){
  if(OS_MsTime() > 20){ // debounce
    if(OS_AddThread(&ButtonWork,100,4)){
      NumCreated++; 
    }
    OS_ClearMsTime();  // at least 20ms between touches
  }
}
コード例 #20
0
ファイル: Main.c プロジェクト: tllado/RTOS_Bus
int main(void){
    OS_Init();
    LEDsInit();
    switchesInit(&leftSwitch, &rightSwitch, SWITCH_PRIO);
    SBInit(SYS_CLK_FREQ/SBUS_FREQ, SBUS_ID, SBUS_PRIO);
    OS_AddThread(&IdleTask, 128, 7);
    OS_Launch(SYS_CLK_FREQ/OS_FREQ);
    return 0;
}
コード例 #21
0
ファイル: Lab5.c プロジェクト: oujoshua/445M
void read_test(void) {
  int i;
  unsigned int then, now;
  eFile_Init();
  eFile_Format();
  OS_AddThread(&write_test, 128, 0);
  OS_Sleep(2000);
  then = OS_MsTime();
  // read 10 blocks
  for(i = 0; i < 10; i++) {
    eDisk_ReadBlock(buffer, i);
  }
  now = OS_MsTime();
  OS_AddThread(&SH_Shell, 128, 0);
	OS_Sleep(1000);
	OS_Suspend();
  printf("Read test took %d ms", now - then);
  eFile_Format();
  OS_Kill();
}
コード例 #22
0
ファイル: Lab5.c プロジェクト: oujoshua/445M
// main program to measure the bandwidth of the SD card
// measure the maximum rate at which you can continuously write to the SD card
// output to unused GPIO pins
int bandwidth_write_testmain(void) {
  OS_Init();           // initialize, disable interrupts
  
  //*******attach background tasks***********
  OS_AddPeriodicThread(&disk_timerproc,10*TIME_1MS,0);   // time out routines for disk
  
  // add threads for testing
  OS_AddThread(&write_test, 128, 0);  // this thread adds SH_Shell when it's done
  
  OS_Launch(TIMESLICE);
  return 0;
}
コード例 #23
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
//******************* Measurement of context switch time**********
// Run this to measure the time it takes to perform a task switch
// UART0 not needed 
// SYSTICK interrupts, period established by OS_Launch
// first timer not needed
// second timer not needed
// select not needed, 
// down not needed
// logic analyzer on PF0 for systick interrupt
//                on PB0 to measure context switch time
int testmain7(void){   // testmain7
  volatile unsigned long delay;
  OS_Init();           // initialize, disable interrupts
  SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOB; // activate port B
  delay = SYSCTL_RCGC2_R;     // allow time to finish activating
  GPIO_PORTB_DIR_R |= 0x07;   // make PB2, PB1, PB0 out
  GPIO_PORTB_DEN_R |= 0x07;   // enable digital I/O on PB2, PB1, PB0
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread6,128,1); // look at Port B0 on scope 
  OS_Launch(TIME_1MS/10);  // 0.1ms, doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #24
0
ファイル: Lab5.c プロジェクト: oujoshua/445M
// main program to measure the bandwidth of the SD card
// measure the maximum rate at which you can continuously read from the SD card
// output to unused GPIO pins
int read_main(void) {
  OS_Init();           // initialize, disable interrupts
  
  //*******attach background tasks***********
  OS_AddPeriodicThread(&disk_timerproc,10,0);   // time out routines for disk
  
  // add threads for testing
  OS_AddThread(&read_test, 128, 0);
  
  OS_Launch(TIMESLICE);
  return 0;
}
コード例 #25
0
ファイル: Lab5.c プロジェクト: oujoshua/445M
// simple test main
int simple_test_main(void) {
  OS_Init();           // initialize, disable interrupts
	UART_Init();
  //*******attach background tasks***********
  OS_AddPeriodicThread(&disk_timerproc,10,0);   // time out routines for disk
  
  OS_AddThread(&TestFile, 128, 1);
  
  OS_Launch(TIMESLICE);
	
	return 0;
}
コード例 #26
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
void Thread2c(void){
  OS_InitSemaphore(&Readyc,0);
  Count1 = 0;    // number of times signal is called      
  Count2 = 0;    
  Count5 = 0;    // Count2 + Count5 should equal Count1 
  NumCreated += OS_AddThread(&Thread5c,128,3);  
  OS_AddPeriodicThread(&BackgroundThread1c,1,TIME_1MS,1); 
  for(;;){
    OS_Wait(&Readyc);
    Count2++;   // Count2 + Count5 should equal Count1, Count5 may be 0
  }
}
コード例 #27
0
ファイル: RTCommsProject.c プロジェクト: tllado/RTOS_Bus
int main(void){
    OS_Init();
    PortF_Init();
		Timer5_Init();
//    SW1_Init(&SW1Press,3);
//    SW2_Init(&SW2Press,3);
    PC6_Init(&PC6High,3);
    PC7_Init(&PC7High,3);
    OS_AddThread(&IdleTask, 128, 7);
    OS_Launch(TIMESLICE);
    return 0;
}
コード例 #28
0
ファイル: Lab3.c プロジェクト: tach4455/EE345M
int testmain6(void){      // Testmain6
  volatile unsigned long delay;
  OS_Init();           // initialize, disable interrupts
  delay = add(3,4);
  SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOB; // activate port B
  delay = SYSCTL_RCGC2_R;     // allow time to finish activating
  GPIO_PORTB_DIR_R |= 0x07;   // make PB2, PB1, PB0 out
  GPIO_PORTB_DEN_R |= 0x07;   // enable digital I/O on PB2, PB1, PB0
  SignalCount1 = 0;   // number of times s is signaled
  SignalCount2 = 0;   // number of times s is signaled
  SignalCount3 = 0;   // number of times s is signaled
  WaitCount1 = 0;     // number of times s is successfully waited on
  WaitCount2 = 0;     // number of times s is successfully waited on
  WaitCount3 = 0;	  // number of times s is successfully waited on
  OS_InitSemaphore(&s,0);	 // this is the test semaphore
  OS_AddPeriodicThread(&Signal1,1,(799*TIME_1MS)/1000,0);   // 0.799 ms, higher priority
  OS_AddPeriodicThread(&Signal2,2,(1111*TIME_1MS)/1000,1);  // 1.111 ms, lower priority
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread6,128,6);    	// idle thread to keep from crashing
  NumCreated += OS_AddThread(&OutputThread,128,2); 	// results output thread
  NumCreated += OS_AddThread(&Signal3,128,2); 	// signalling thread
  NumCreated += OS_AddThread(&Wait1,128,2); 	// waiting thread
  NumCreated += OS_AddThread(&Wait2,128,2); 	// waiting thread
  NumCreated += OS_AddThread(&Wait3,128,2); 	// waiting thread
 
  OS_Launch(TIME_1MS);  // 1ms, doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #29
0
ファイル: Lab3.c プロジェクト: airlink/EE-345M
int testmain6(void){      // Testmain6
  volatile unsigned long delay;
  OS_Init();           // initialize, disable interrupts
  delay = add(3,4);

  SignalCount1 = 0;   // number of times s is signaled
  SignalCount2 = 0;   // number of times s is signaled
  SignalCount3 = 0;   // number of times s is signaled
  WaitCount1 = 0;     // number of times s is successfully waited on
  WaitCount2 = 0;     // number of times s is successfully waited on
  WaitCount3 = 0;	  // number of times s is successfully waited on
  OS_InitSemaphore(&s,0);	 // this is the test semaphore
  OS_AddPeriodicThread(&Signal1,(799*TIME_1MS)/1000,0);   // 0.799 ms, higher priority
  OS_AddPeriodicThread(&Signal2,(1111*TIME_1MS)/1000,1);  // 1.111 ms, lower priority
  NumCreated = 0 ;
  NumCreated += OS_AddThread(&Thread6,128,6);    	// idle thread to keep from crashing
  NumCreated += OS_AddThread(&OutputThread,128,2); 	// results output thread
  NumCreated += OS_AddThread(&Signal3,128,2); 	// signalling thread
  NumCreated += OS_AddThread(&Wait1,128,2); 	// waiting thread
  NumCreated += OS_AddThread(&Wait2,128,2); 	// waiting thread
  NumCreated += OS_AddThread(&Wait3,128,2); 	// waiting thread
 
  OS_Launch(TIMESLICE);  // 1ms, doesn't return, interrupts enabled in here
  return 0;             // this never executes
}
コード例 #30
0
ファイル: Lab5.c プロジェクト: AustinBlackstone/EE345M-S2012
//*******************lab 5 main **********
int realmain(void){        // lab 5 real main
  OS_Init();           // initialize, disable interrupts
  Running = 0;         // robot not running
  DataLost = 0;        // lost data between producer and consumer
  NumSamples = 0;

//********initialize communication channels
  OS_Fifo_Init(512);    // ***note*** 4 is not big enough*****
  ADC_Collect(0, 1000, &Producer); // start ADC sampling, channel 0, 1000 Hz

//*******attach background tasks***********
  OS_AddButtonTask(&ButtonPush,2);
  OS_AddDownTask(&DownPush,3);
  OS_AddPeriodicThread(disk_timerproc,10*TIME_1MS,5);

  NumCreated = 0 ;
// create initial foreground threads
  NumCreated += OS_AddThread(&Interpreter,128,2); 
  NumCreated += OS_AddThread(&IdleTask,128,7);  // runs when nothing useful to do
 
  OS_Launch(TIMESLICE); // doesn't return, interrupts enabled in here
  return 0;             // this never executes
}