Lab 9: DSP/BIOS
Post a SWI
8. In DefaultIsr_9_10.c add the following SWI_post to the ADCINT_ISR(), just
after the structure used to acknowledge the PIE group:
SWI_post(&ADC_swi); // post a SWI
This post a SWI that will execute the ADC_swi() code you populated a few steps back in
the lab. In other words, the ADC interrupt still executes the same code as before.
However, some of that code is now in a posted SWI that DSP/BIOS will execute
according to the specified scheduling priorities.
Add the SWI to the CDB File
9. In the configuration file Lab.cdb we need to add and setup the AdcSwi() SWI. Open
Lab.cdb and click on the plus sign (+) to the left of Scheduling and again on the
plus sign (+) to the left of SWI – Software Interrupt Manager.
10. Right click on SWI – Software Interrupt Manager and select Insert SWI.
SWI0 will be added. Right-click on it, and rename it to ADC_swi. This is just an
arbitrary name. We want to differentiate the AdcSwi() function itself (which is nothing
but an ordinary C function) from the DSP/BIOS SWI object which we are calling
ADC_swi.
11. Select the Properties for ADC_swi and type _AdcSwi (with a leading underscore)
in the function field. Click OK. This tells DSP/BIOS that it should run the function
AdcSwi() when it executes the ADC_swi SWI.
12. We need to have the PIE for the ADC interrupt use the dispatcher. The dispatcher will
automatically perform the context save and restore, and allow the DSP/BIOS scheduler to
have insight into the ISR. You may recall from an earlier lab that the ADC interrupt is
located at PIE_INT1_6.
Click on the plus sign (+) to the left of HWI – Hardware Interrupt Service
Routine Manager. Click the plus sign (+) to the left of PIE INTERRUPTS. Locate
the interrupt location for the ADC: PIE_INT1_6. Right click, select Properties, and
select the Dispatcher tab.
Now check the “Use Dispatcher” box and select OK. Close the configuration file
and click YES to save changes.
Build, Load, and Reset
13. Click the “Build” button to rebuild and load the project.
14. Reset the DSP.
C28x - Using DSP/BIOS 9 - 17