SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
Software interrupt is not an interrupt in the regular sense of a software routine that is getting called by an external event. Software interrupt is initiated by the sequential execution of the software and by calling a specific function. The call to a software interrupt function looks identical to a call to any other standard function.
Declaration of a new function and its mapping to software interrupt is done through aliasing pragma.
#pragma SWI_ALIAS (erase_data_flash_segment, 0)
void erase_data_flash_segment(Uint8 segment);
The major functional difference between the two is that during a call to the software interrupt function the ARM7 will switch to a privileged mode.
In this privileged mode the software will be able to enable/disable interrupts, manipulate Program and Data flash content and more. None of these are accessible when ARM7 is in User mode.
Then the implementation of the function should be added in the relevant case inside the switch/case expression in the body of software interrupt.
#pragma INTERRUPT(software_interrupt,SWI)
void software_interrupt(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number)
{ switch (swi_number)
{
case 0:
{
// Erase one segment of Data Flash
return;
}
case 1:
{
}
return;
}
}