void startup(void) { #if defined(CONFIG_BAREMETAL_ENABLE_DCACHE) init_tlb(main_tlb); assign_tlb(main_tlb); enable_cache(); #elif defined(CONFIG_BAREMETAL_ENABLE_ICACHE) enable_cache(); #endif #if defined(CONFIG_BAREMETAL_DDR_INIT) ddr_init(); #endif #if defined(CONFIG_BAREMETAL_PLL0_INIT) pll0_init(); #endif #if defined(CONFIG_BAREMETAL_UART_BASIC) uart_basic_init(); #endif main(); halt(); }
/* * Main */ int main(void) { init_tlb(); enable_tlb(); printf("Hello from Nios II!\n"); mutex = altera_avalon_mutex_open(MUTEX_0_NAME); // Initialize the hardware mutex mbox = OSSemCreate(0); // Initialize the message box CriticalFunctionPointers* cp = (CriticalFunctionPointers*)SHARED_MEMORY_BASE; // Wait for monitor to be done initialization of shared variables before retrieving their values while(cp->init_complete == 0); init_cpu1_isr(); // Initialize the ISR // Set the task(only one in this example) int arg_5 = CRITICAL_TASK_PRIORITY; OSTaskCreateExt(preemption_task, &arg_5, &critical_task_stk[TASK_STACKSIZE - 1], CRITICAL_TASK_PRIORITY, CRITICAL_TASK_PRIORITY, critical_task_stk, TASK_STACKSIZE, NULL,0); // Signal that the core has finished initializing altera_avalon_mutex_lock(mutex, 1); // Acquire the hardware mutex { cp->core_ready[1] = 1; } altera_avalon_mutex_unlock(mutex); // Memory // Start OS OSStart(); return 0; }
hwaddr_t page_translate(lnaddr_t addr) { if(this_cr3 != cpu.cr3.val) { init_tlb(); this_cr3 = cpu.cr3.val; } return tlb_read(addr); }
hwaddr_t page_translate(lnaddr_t addr, uint32_t len) { if(cr3 != cpu.cr._[3]) { init_tlb(); cr3 = cpu.cr._[3]; // printf("^_^%x\n", cr3); } return tlb_read(addr, len); }
static void init_caches() { init_cache(); init_cache2(); init_tlb(); }