/* * sample_gic_utimer * Пример работы с контроллером прерываний GIC. * В программе обрабатывается прерывание от 2-го универсального * таймера. Как только прерывание сработало, таймер отключается. */ #include "mcom_runtime/gic.h" #include "mcom_runtime/mcom02.h" #include "mcom_runtime/utimers.h" int Flag_Corr = 0; int Int_Counter = 0; void timer2_interrupt_handler(int id) { disableUTimer(2); Int_Counter = 1; } int main(void) { //Map 0x2000_0000 to 0x0 BOOT_REMAP = 1; Flag_Corr = 0; risc_initialize_gic(); risc_enable_interrupt(TIMER_INTR2, GIC_PL390_TARGET_CPU0, 0xF1); risc_register_interrupt(&timer2_interrupt_handler, TIMER_INTR2, 0); initUTimer(2, 0xFFFFFFF, 1); while (Int_Counter != 1) ; if (Int_Counter == 1) Flag_Corr = 0; else Flag_Corr=1; asm volatile("bkpt"); return 0; }