Specifications

Reviewing the Source Code
Debugging Program Behavior
5-3
5.2 Reviewing the Source Code
This example modifies the example from Chapter 4 to introduce real-time
behavior. Rather than having the main function loop forever, the data I/O in
the real application is likely to happen as a result of a periodic external
interrupt. A simple way to simulate a periodic external interrupt in the example
is to use the timer interrupt from the on-chip timer.
1) Double-click on the volume.c file in the Project View to see the source
code in the right half of the Code Composer Studio window.
2) Notice the following aspects of the example:
The data types for declarations have changed. DSP/BIOS provides
data types that are portable to other processors. Most types used by
DSP/BIOS are capitalized versions of the corresponding C types.
The code uses #include to reference three DSP/BIOS header files:
std.h, log.h, and swi.h. The std.h file must be included before other
DSP/BIOS header files.
The objects created in the configuration file are declared as external.
You examine the configuration file in the next section.
The main function no longer calls the dataIO and processing
functions. Instead, the main function simply returns after calling
LOG_printf to display a message. This drops the program into the
DSP/BIOS idle loop. At this point, the DSP/BIOS scheduler manages
thread execution.
The processing function is now called by a software interrupt called
processing_SWI, which yields to all hardware interrupts.
Alternatively, a hardware ISR could perform the signal processing
directly. However, signal processing may require a large number of
cycles, possibly more than the time until the next interrupt. Such
processing would prevent the interrupt from being handled.