void test_ISR_should_signal_every_500ms(void) { ticks = 0; toggle = (0); isr(); UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((ticks)), (((void *)0)), (_U_UINT)57, UNITY_DISPLAY_STYLE_INT); if (!(toggle)) {} else {UnityFail( (" Expected FALSE Was TRUE"), (_U_UINT)(_U_UINT)58);;}; ticks = 499; isr(); UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((ticks)), (((void *)0)), (_U_UINT)64, UNITY_DISPLAY_STYLE_INT); if ((toggle)) {} else {UnityFail( (" Expected TRUE Was FALSE"), (_U_UINT)(_U_UINT)65);;}; }
void exceptionprefetch(void) { printf("prefetch error...abort\n"); unsigned long ex_type; unsigned long addr; __asm__ __volatile__("mrc p15,0,r0,c5,c0,1\n" "mov %0,r0\n":"=r"(ex_type) ::"memory"); __asm__ __volatile__("mrc p15,0,r0,c6,c0,2\n" "mov %0,r0\n":"=r"(addr) ::"memory"); // printf("111"); unsigned long select=ex_type&(0xF)+((ex_type&(0x400))?16:0); printf("pre addr : %X\n",addr); printf("pre select: %X\n",select); int domain=17; void (*isr)(char *,int,unsigned long) = NULL; char *name=NULL; int i=0; while(i<15) { i++; if(instrcabort[i].select!=select)continue; isr=instrcabort[i].fn; name=instrcabort[i].name; break; } isr(name,domain,addr); }
void exceptiondataabort(void) { printf("data error ....abort\n"); // while(1); volatile unsigned long ex_type; volatile unsigned long addr=0; __asm__("mrc p15,0,r0,c5,c0,0\n" "mov %0,r0\n":"=r"(ex_type) ::"memory"); __asm__("mrc p15,0,r0,c6,c0,0\n" "mov %0,r0\n":"=r"(addr) ::"memory"); printf("type: %X \n",ex_type); printf("addr: %X \n",addr); // printf("1239999"); // while(1); unsigned long select=ex_type&(0xF)+((ex_type&(0x400))?16:0); int domain=ex_type&(0xF0)>>4; void (*isr)(char *,int,unsigned long) = NULL; char *name=NULL; int i=0; while(i<18) { i++; if(dataabort[i].select!=select)continue; isr=dataabort[i].fn; name=dataabort[i].name; break; } isr(name,domain,addr); }
void exception_handler(unsigned long vect, unsigned long *sp) { if ((vect & 0xf00) == EXTERNAL_IRQ) { isr(); } else { /* Unhandled exception */ for(;;); } }
// Nested part, uses local variables, so compiler generated prologue and epilogue are needed. void _vinterrupt_wrapper(void) { void (*isr)(void); vm_state[current_vm].int_enabled = (bgrt_bool_t)0; // Virtual interrupt nesting is not allowed by default. isr = (void (*)(void))vm_buf; // After vm-buf read we can reenable real interrupts! sei(); isr(); }
void IPCServiceMain::runInstallScript(const char* file, const char* installpath, const char* function) { try { InstallScriptRunTime isr(file, installpath); isr.run(function); } catch (gcException &e) { Warning(gcString("Failed to execute script {0}: {1}\n", file, e)); } }
void hal_deliver_interrupt( cyg_uint32 vector ) { register cyg_uint32 isr_result; register cyg_isr *isr; cyg_bool pendsvc = false; #if defined(CYGPKG_KERNEL_INSTRUMENT) && \ defined(CYGDBG_KERNEL_INSTRUMENT_INTR) CYG_INSTRUMENT_INTR(RAISE, vector, 0); #endif isr = (cyg_isr *)hal_interrupt_handlers[vector]; // Call the ISR isr_result = isr( vector, hal_interrupt_data[vector] ); #if !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) // If the ISR has returned the CALL_DSR bit, post the DSR and set // the pendable SVC exception pending. if( isr_result & CYG_ISR_CALL_DSR ) { cyg_interrupt_post_dsr( hal_interrupt_objects[vector] ); // Post the pendable SVC to call interrupt_end(). But only if // the scheduler lock is currently zero. If it is non zero // then interrupt_end will do nothing useful, so avoid calling // it. if( cyg_scheduler_sched_lock == 0 ) pendsvc = true; } #else // When chaining we don't know here whether the nested interrupt // has posted a DSR, so we have to run interrupt_end() regardless. // However, the same considerations as above regarding the // scheduler lock still apply. if( cyg_scheduler_sched_lock == 0 ) pendsvc = true; #endif // Post the pendable SVC if required. if( pendsvc ) { cyg_uint32 icsr; HAL_READ_UINT32( CYGARC_REG_NVIC_BASE+CYGARC_REG_NVIC_ICSR, icsr ); icsr |= CYGARC_REG_NVIC_ICSR_PENDSVSET; HAL_WRITE_UINT32( CYGARC_REG_NVIC_BASE+CYGARC_REG_NVIC_ICSR, icsr ); } }
int sensor() { uint16_t sensors[] = {1,2,3,4,5}; unsigned int sensorsSize = 5; unsigned int i = 0; uint16_t value; for(;;) { sleep(1); value = (i+2)%sensorsSize; i++; i = i%sensorsSize; memcpy(reg,&(sensors[i]),2); memcpy(reg+2,&value,2); isr(); //fake interrupt } }
void irq_controller_isr(uint32_t addr) { uint32_t irq; irq = get_register(INTC_BASE + INTC_SIR_IRQ); irq_isr isr = irq_vectors[irq]; if(!isr) { uart_print(0, "No ISR for received IRQ\n"); for(;;); return; } isr(addr); set_register_bit_value(INTC_BASE + INTC_CONTROL, 0, 1); synchronize(); }
void IRQ_HDLR(void) { // vectNum = RESERVED[31:13] | CPUID[12:10] | INTERRUPT_ID[9:0] // send ack and get ID source uint32_t vectNum = gic_read_irq_ack(); // Check that INT_ID isn't 1023 or 1022 (spurious interrupt) if (vectNum & 0x0200) { gic_write_end_of_irq(vectNum); // send end of irq } else { // copy the local value to the global image of CPUID unsigned cpu = (vectNum >> 10) & 0x7; unsigned irq = vectNum & 0x1FF; // Store the current interrupt number. g_vectNum[cpu] = irq; // Call the service routine stored in the handlers array. If there isn't // one for this IRQ, then call the default handler. irq_hdlr_t isr = g_interrupt_handlers[irq]; if (isr) { isr(); } else { default_interrupt_routine(); } // Clear current interrupt number. g_vectNum[cpu] = 0; // Signal the end of the irq. gic_write_end_of_irq(vectNum); } }
void filein_in2(t_filein *x, long n) /* long access */ { t_atom info; unsigned long data[4]; long count; OSErr err; if (x->f_open) { if (isr()) { atom_setlong(&info,n); defer(x,(method)filein_access,ps_in2,1,&info); } else { err = sysfile_setpos(x->f_fh,SYSFILE_FROMSTART,n); if (err) object_error((t_object *)x, "seek err %d",err); else { count = 4; err = sysfile_read(x->f_fh,&count,data); if (err) object_error((t_object *)x, "read err %d",err); else { count = data[0]; outlet_int(x->f_out,count); } } } } else if (x->f_data) { if (n < 0) object_error((t_object *)x, "access out of range"); else if (n >= x->f_size) outlet_bang(x->f_eof); else { sysmem_copyptr(*(x->f_data)+n,data,4L); outlet_int(x->f_out,data[0]); } } }
void filein_int(t_filein *x, long n) /* byte access */ { t_atom info; Byte data[16]; long count; OSErr err; if (x->f_open) { if (isr()) { atom_setlong(&info,n); defer(x,(method)filein_access,ps_int,1,&info); } else { err = sysfile_setpos(x->f_fh,SYSFILE_FROMSTART,n); if (err) object_error((t_object *)x, "seek err %d",err); else { count = 1; err = sysfile_read(x->f_fh,&count,data); if (err) object_error((t_object *)x, "read err %d",err); else { count = data[0]; outlet_int(x->f_out,count); } } } } else if (x->f_data) { if (n < 0) object_error((t_object *)x, "access out of range"); else if (n >= x->f_size) outlet_bang(x->f_eof); else { count = *((*(x->f_data))+n); outlet_int(x->f_out,count); } } }
void isr_13() {isr(13);}
void isr_14() {isr(14);}
void isr_29() {isr(29);}
void isr_28() {isr(28);}
void isr_27() {isr(27);}
void isr_26() {isr(26);}
void isr_18() {isr(18);}
void isr_24() {isr(24);}
void isr_23() {isr(23);}
void isr_22() {isr(22);}
void isr_15() {isr(15);}
void isr_16() {isr(16);}
void isr_19() {isr(19);}
void isr_25() {isr(25);}
void isr_20() {isr(20);}
void isr_17() {isr(17);}
/******************************************************************************* * for LLWU wakeup ISR to call actual digital ISR code *******************************************************************************/ void SnoozeDigital::clearIsrFlags( void ) { isr( ); }
void isr_21() {isr(21);}