void SystemInit() { init_system_clock(); /* SystemCoreClock will be set here */ /* SysTick is defined in core_cm0.h */ SysTick->LOAD = (SystemCoreClock/1000UL*(unsigned long)SYS_TICK_PERIOD_IN_MS) - 1; SysTick->VAL = 0; SysTick->CTRL = 7; /* enable, generate interrupt (SysTick_Handler), do not divide by 2 */ }
void osmain( void ) { int i; int j=0; char nb[10]; char tmbuf[30]; /* ini screen first,so that we can output info as early as possible */ init_tty(); /* initialize the screen*/ kprintf( "TTY initialized\n" ); /* init both physical and virtual memory */ init_mm(); kprintf( "Memory manager initialized\n" ); init_irq(); /*initialize irq,with all interrupte disabled.*/ kprintf( "IRQ initialized\n" ); kprintf("\nHello\n"); install_syscall(); init_all_tasks(); init_kb(); /* set keyboard IRQ,and enable it */ kprintf( "\nKeyboard initialized\n" ); init_timer(); /* initialize time, enable timer irq */ /* init_system_clock(&real_tm); */ kprintf( "\nTimer initialized\n"); init_system_clock(&start_tm); kprintf("\nSystem start time is \n"); kprintf(timetostr(&start_tm, tmbuf)); kprintf("\nStarting first process....\n"); start_first_process(); kprintf( "\nNow I am doing a loop ,waiting for interrupt :)\n" ); while(1); halt(); }
void system_init(void) { SCB_EnableICache(); SCB_EnableDCache(); DBG_INIT(); init_system_clock(); HAL_Init(); BSP_SDRAM_Init(); BSP_LED_Init(LED1); BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); MX_FATFS_Init(); FRESULT res = f_mount(&ctx.fs, SD_Path, 0); ASSERT_WARN(res == FR_OK); gui_init(); }
void enable_timer() { init_system_clock(&real_tm); enable_irq(TIMER_IRQ); timefly = last_timefly = 0; }