What is the difference between an event and an interrupt?

If you have a simple question and just want an answer.
User avatar
xmark
Member++
Posts: 19
Joined: Mon Apr 26, 2010 2:35 pm

What is the difference between an event and an interrupt?

Post by xmark »



User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Post by sethu_jangala »

Interrupts would force your program to halt in order to let some low-level code to execute. Events usually are sent to you from lower-level code and trigger execution of your code. Events in XMOS has an advantage that we dont need to save the context to serve these events. The events blocks a Core(Logical Core) until it happens and continues once it happens.

jimb
Junior Member
Posts: 5
Joined: Wed Dec 25, 2013 8:58 am

Post by jimb »

So then, could it be said, an event is a software managed flow control mechanism while an interrupt is a hardware generated and managed interruption and redirection of program flow.

Software sets a value/flag/semaphore and other software reacts to this value change. 

A hardware interrupt is generated by a pin change, a counter event(overflow/value), uart buffer full/empty or some other hardware event and forces the program counter of the processor to some new value/program address, temporarily redirecting the program flow perhaps to an interrupt service routine.

A return from the interrupt command RTI? reloads the processor context (PC, Stack pointer, Status register, Accumulators) to the pre-interrupt state and allows the processor to continue running the original code.

srinie
XCore Addict
Posts: 158
Joined: Thu Mar 20, 2014 8:04 am

Post by srinie »

Hi Jimb,

Event may not be categorized only as a software managed mechanism - It is similar to handling interrupts when it comes to servicing I/Os. In xCORE, an event provides an additional functionality of servicing resources (which can be I/O changes, channel communication, timer resource triggers etc); in xC abstraction, the select inside a task waits for such events and services them as they occur per the async order; as there is no context switching involved, programming is simplified.