What is the difference of a SWI and a Hardwareinterrupt?
For example if code toggles a port which is connected to a IRQ.
This question is the essence of my formerly thread. Hope there will be some posetive echo. :-)
Hi Georg,
SWI are implemented in more complex microprocessor systems to deal with the problems introduced by different priviledge levels of the processor. The SWI has normally the highest priority of all external trigerred exceptions (i.e. IRQ, FIQ for ARM) but lower than processor related exceptions. Calling software routines from different priviledge levels requires these functions to be reentrant. But this is not enough. Certain parts of functions need to be atomic to produce correct results. Imagine that you have a driver function and the access to this function is protected by a busy flag. Reading the flag and setting it to the state busy requires to be a atomic (non interruptable). There is no single processor command to do this, therefore you put the required code into a SWI function. When you enter the SWI function, no one can interrupt you - therefore the code inside the SWI function is atomic. By the way, did you notice that SWI interrupt functions allow you to send parameters and receive a return value. This is possibel since you are in control when and where the SWI is called. Hope this helps.
Frank
Hi Frank, thanks for your advice. befor your explanation i completely missunderstood SWI functionality. My reference was the ADuC7026 datasheet. Can you guide me to some better literature?
you can start with the Keil help system: - go in Search - type SWI - press search
The Keil help system is pretty good and gives you a lot of additional information. Start using it.
View all questions in Keil forum