Пример #1
0
int main()
{
    timeout_queue = NULL; 
    pcb_init_t itable[3];

    itable[0].pid = TIMER_I_PROCESS_PID; 
    itable[0].name = "timer_i_process";
    itable[0].priority = 0;
    itable[0].start = timer_i_process;
    itable[0].stack_size = 4096;
    itable[0].is_i_process = 1;
    itable[0].is_sys_process = 0;

    itable[1].pid = CCI_PID;
    itable[1].name = "fake_cci";
    itable[1].priority = 0;
    itable[1].start = fake_cci;
    itable[1].stack_size = 4096;
    itable[1].is_i_process = 0;
    itable[1].is_sys_process = 1;

    itable[2].pid = NULL_PID;
    itable[2].name = "null";
    itable[2].priority = 3;
    itable[2].start = null_process;
    itable[2].stack_size = 4096;
    itable[2].is_i_process = 0;
    itable[2].is_sys_process = 1;
   
    trace(ALWAYS,"Starting initialization");
    
    k_init(itable, 3, FALSE, TRUE);
  
    return 0;
}
Пример #2
0
void test_jsw_level (int n, int level)
{
	struct jsw_tree tree = { 0 };
	u64 key;
	s64 count = 0;
	int i;
	int rc;
	u64 start, finish, total;

	k_seed(1);
	k_init();
	start = nsecs();
	for (i = 0; i < n; i++) {
		if (k_should_delete(count, level)) {
			key = k_delete_rand();
			rc = jsw_remove(&tree, key);
			if (!rc) fatal("jswremove key=%lld", key);
			--count;
		} else {
			key = k_rand_key();
			k_add(key);
			rc = jsw_insert(&tree, key);
			if (!rc) fatal("jswinsert key=%lld", key);
			++count;
		}
	}
	finish = nsecs();
	total = finish - start;
	printf("%lld nsecs  %g nsecs/op\n", total, (double)total/(double)n);
}
Пример #3
0
//------------------------------------------------------------------------------
// Function: main
//
// Description: Initializes Kernel then creates 4 threads where each blinks
//              a different LED at its own rate. The last thread created
//              (thread 0) replaces 'main'.
//
//   Threads use the following resources:
//
//   thread0 - PORTB bit 2  (Arduino pin 10)
//   thread1 - PORTB bit 3  (Arduino pin 11)
//   thread2 - PORTB bit 4  (Arduino pin 12)
//   thread3 - PORTB bit 5  (Arduino pin 13)
// 
//------------------------------------------------------------------------------
int main(void)
{
	k_init();
	
	setupStuff();
	
	//k_new(T3_ID, thread3, 1);
	//k_new(T2_ID, thread2, 1);
	//k_new(T1_ID, thread1, 1);
	//k_new(T0_ID, thread0, 1);  // This replaces 'main' 
	
	while(1);  // should not get here at all

}
Пример #4
0
void startupc(void)
{
  clr_bss();			/* clear BSS area (uninitialized data) */
  init_devio();			/* latch onto Tutor-supplied info, code */
  k_init();			/* start kernel */
}
Пример #5
0
int main(int argc, char * argv[])
{
    utest_start();
    enable_debug = 1;

    append_i = 0;
    trace_uint(ALWAYS,"append i ", append_i);
    trace_ptr(ALWAYS,"expected ", expected);
    trace(ALWAYS,expected);

    pcb_init_t itable[6];

    itable[0].pid = 0;
    itable[0].name = "a";
    itable[0].priority = 0;
    itable[0].start = start_a;
    itable[0].stack_size = 4096;
    itable[0].is_i_process = 0;
    itable[0].is_sys_process = 0;

    itable[1].pid = 1;
    itable[1].name = "b";
    itable[1].priority = 0;
    itable[1].start = start_b;
    itable[1].stack_size = 4096;
    itable[1].is_i_process = 0;
    itable[1].is_sys_process = 0;

    itable[2].pid = 2;
    itable[2].name = "c";
    itable[2].priority = 1;
    itable[2].start = start_c;
    itable[2].stack_size = 4096;
    itable[2].is_i_process = 0;
    itable[2].is_sys_process = 0;

    itable[3].pid = 3;
    itable[3].name = "d";
    itable[3].priority = 1;
    itable[3].start = start_d;
    itable[3].stack_size = 4096;
    itable[3].is_i_process = 0;
    itable[3].is_sys_process = 0;

    itable[4].pid = 4;
    itable[4].name = "e";
    itable[4].priority = 1;
    itable[4].start = start_e;
    itable[4].stack_size = 4096;
    itable[4].is_i_process = 0;
    itable[4].is_sys_process = 0;

    itable[5].pid = 5;
    itable[5].name = "f";
    itable[5].priority = 2;
    itable[5].start = start_f;
    itable[5].stack_size = 4096;
    itable[5].is_i_process = 0;
    itable[5].is_sys_process = 0;

    k_init(itable, 6, FALSE, FALSE);

    return 0;
}