void bsp_start (void) { /* initialize irq management */ BSP_rtems_irq_mngt_init (); /* setup console mode for lower screen */ irqEnable (IRQ_VBLANK); videoSetMode (0); videoSetModeSub (MODE_0_2D | DISPLAY_BG0_ACTIVE); vramSetBankC (VRAM_C_SUB_BG); SUB_BG0_CR = BG_MAP_BASE (31); BG_PALETTE_SUB[255] = RGB15 (31, 31, 31); consoleInitDefault ((u16 *) SCREEN_BASE_BLOCK_SUB (31), (u16 *) CHAR_BASE_BLOCK_SUB (0), 16); /* print status message */ printk ("[+] kernel console started\n"); /* set the cpu mode to system user */ arm_cpu_mode = 0x1f; /* configure clock period */ Configuration.microseconds_per_tick = 10000; /* us */ defaultExceptionHandler (); }
static void _bsp_start(void) { rtems_status_code sc = RTEMS_SUCCESSFUL; uintptr_t intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start); uintptr_t intrStackSize = rtems_configuration_get_interrupt_stack_size(); /* * Initialize default raw exception handlers. * * This BSP does not assume anything about firmware possibly loaded in the * FPGA, so the external interrupt should not be enabled in order to avoid * spurious interrupts. */ sc = ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT & ~MSR_EE, intrStackStart, intrStackSize); if (sc != RTEMS_SUCCESSFUL) BSP_panic("Cannot initialize exceptions"); /* Install our own set of exception vectors */ BSP_rtems_irq_mngt_init(0); }
/* * BSP start routine. Called by boot_card(). * * This routine does the bulk of the system initialization. */ void bsp_start(void) { uintptr_t intrStackStart; uintptr_t intrStackSize; ppc_cpu_id_t myCpu; ppc_cpu_revision_t myCpuRevision; /* Set the character output function; The application may override this */ BSP_output_char = __bsp_outchar_to_memory; printk("RTEMS %s\n", rtems_get_version_string()); /* * Get CPU identification dynamically. Note that the get_ppc_cpu_type() * function stores the result in global variables so that it can be used later... */ myCpu = get_ppc_cpu_type(); myCpuRevision = get_ppc_cpu_revision(); printk("CPU: 0x%04x, Revision: 0x%04x = %d, Name: %s\n", myCpu, myCpuRevision, myCpuRevision, get_ppc_cpu_type_name(myCpu)); /* * Initialize the device driver parameters */ /* Timebase register ticks/microsecond; The application may override these */ bsp_clicks_per_usec = 350; bsp_timer_internal_clock = true; bsp_timer_average_overhead = 2; bsp_timer_least_valid = 3; rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000); /* * Initialize the interrupt related settings. */ intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start); intrStackSize = rtems_configuration_get_interrupt_stack_size(); ppc_exc_initialize(intrStackStart, intrStackSize); /* Let the user know what parameters we were compiled with */ printk(" Base/Start End Size\n" "RAM: 0x%08x 0x%x\n" "RTEMS: 0x%08x\n" "Interrupt Stack: 0x%08x 0x%x\n" "Stack: 0x%08x 0x%08x 0x%x\n" "Workspace: 0x%08x 0x%08x\n" "MsgArea: 0x%08x 0x%x\n" "Physical RAM 0x%08x\n", (uint32_t)RamBase, (uint32_t)RamSize, (uint32_t)__rtems_end, intrStackStart, intrStackSize, (uint32_t)__stack_base, (uint32_t)_stack, (uint32_t)StackSize, (uint32_t)WorkAreaBase, (uint32_t)__bsp_ram_end, (uint32_t)MsgAreaBase, (uint32_t)MsgAreaSize, (uint32_t)__phy_ram_end); /* * Initialize RTEMS IRQ system */ BSP_rtems_irq_mngt_init(0); /* Continue with application-specific initialization */ app_bsp_start(); }