//----------------------------------------------------------------------------------------------------// // @func - xilkernel_init //! @desc //! Initialize the system - This function is called at the start of system. //! It initializes the system. //! - Initializes the process vector table. //! - Creates the Idle process (pid - 0). //! - Creates the static set of processes. //! @return //! - Nothing. //----------------------------------------------------------------------------------------------------// void xilkernel_init(void) { unsigned int i = 0 ; DBG_PRINT("XMK: Initializing Hardware.\r\n"); hw_init(); // Do hardware specific initialization DBG_PRINT("XMK: System initialization.\r\n"); for( ; i < MAX_PROCESS_CONTEXTS; i++ ) { ptable[i].is_allocated = 0 ; ptable[i].pcontext.isrflag = 0; } #ifdef MB_XILKERNEL kernel_sp = (void*)((unsigned int)&_stack + SSTACK_PTR_ADJUST); #elif defined(PPC_XILKERNEL) kernel_sp = (void*)((unsigned int)&__stack + SSTACK_PTR_ADJUST); #endif readyq_init(); #ifdef CONFIG_PTHREAD_SUPPORT pthread_init(); #endif #ifdef CONFIG_SEMA sem_heap_init(); #endif #ifdef CONFIG_MSGQ msgq_init(); #endif #ifdef CONFIG_SHM shm_init(); #endif #ifdef CONFIG_BUFMALLOC bufmalloc_init (); #endif init_idle_task (); #ifdef CONFIG_STATIC_ELF_PROCESS_SUPPORT se_process_init() ; // Create statically specified separate executable processes #endif #ifdef CONFIG_STATIC_PTHREAD_SUPPORT kb_pthread_init (); // Create statically specified kernel bundled threads #endif #ifdef CONFIG_TIME soft_tmr_init (); #endif }
/* * init system task queue * this function must be called before any other task_xxx() */ void task_init() { uint32_t f; SYS_FSAVE(f); /* init system ready task queue */ readyq_init(&sysready_queue); /* init system delay task queue */ ptimer_init_nomalloc(&sysdelay_queue, MAX_TASK_DELAY_NUMBER, sysdelay_slot); /* set current to NULL, then task_schedule() can be called, * even system ready queue is empty */ current = NULL; sys_schedule_flags = 0; sys_active_ints = 0; SYS_FRESTORE(f); }