beautypg.com

2 interrupts, Interrupts -3 – Motorola DSP56301 User Manual

Page 113

background image

Data Transfer Methods

Programming the Peripherals

5

-3

DSP56300 core does not execute any other code. Polling is the easiest transfer method since it
does not require register initializations, but it is also the least efficient use of the DSP core.

Each peripheral has its own set of flags that can be polled to determine when data is ready to
be transferred. For example, the ESSI control registers provide bits that tell the core when
data is ready to be transferred to or from the peripheral. The core polls these bits to determine
when to interact with the peripheral. Similar flags exist for each peripheral.

5.3.2

Interrupts

Interrupts are more efficient than polling but require additional register initializations. Polling
requires the core to remain busy checking a flag in a specified control register and therefore
does not allow the core to execute other code at the same time. With interrupts, the
programmer can initialize the interrupt so it is triggered off one of the same flags that can be
polled so the core does not have to continuously check a flag. Once the interrupt is initialized
and the flag is set, the core is notified to execute a data transfer. Until the flag is set, the core
can remain busy executing other sections of code.

When an interrupt occurs, the core execution flow jumps to the interrupt start address defined
in Table B-3 in Appendix B, Programming Reference. It executes code starting at the
interrupt address. If it is a short interrupt (that is, the service routine is two opcodes long), the
code automatically returns to the original program flow after executing two opcodes with no
impact to the pipeline. Otherwise, if a longer service routine is required the programmer can
place a jump-to-subroutine (JSR) instruction at the interrupt service address. In this case, the
program executes that service routine and continues until a return-from-interrupt (RTI)
instruction executes. The execution flow then resumes at the position of the program counter
before the interrupt was triggered. Configuring interrupts requires two steps:

1.

Setting up the interrupt routine:

— The interrupt handler is located at the interrupt starting address.

— The interrupt routines can be short (only two opcodes long) or long (more than two

opcodes and requiring a JSR instruction).

2.

Enabling the interrupts:

b.

Set the corresponding bits in the applicable peripheral control register.

c.

Enable peripheral interrupts in the Interrupt Priority Register (IPRP).

d.

Enable global interrupts in the Mode Register (MR) portion of the Status Register
(SR).

Events that change bits in the peripheral control registers can then trigger the interrupt.
Depending on the peripheral, two to six peripheral interrupt sources are available to the
programmer.