PRELIMINARY
VS1063a Prog. Guide
6
WRITING USER APPLICATIONS THAT TAKE FULL CONTROL OVER VS1063A
6.2.1
Taking Control of Interrupts
To take control of interrupts, the user first needs to write interrupt handlers. This cannot be
directly done in the C language: stack store and restore operations as well as interrupt reacti-
vation will need to be done in Assembly language.
After an interrupt routine has been written, the corresponding interrupt vector needs to be
rerouted to the user’s own routine. Interrupt vectors are stored in instruction RAM memory
starting from address 0x20, as shown in the following table:
Interrupt vectors
Name
Address
Used
Default
Description
VEC_DAC
0x20
Yes
jmpi dac_int,(i6)+1
DAC
VEC_SCI
0x21
Yes
jmpi sci_int,(i6)+1
SCI
VEC_SDI
0x22
Yes
jmpi _sdi_int,(i6)+1
SDI
VEC_ADC
0x23
Y/N
1
jmpi modu_int,(i6)+1
ADC
VEC_TX
0x24
No
jmpi _empty_int,(i6)+1
UART TX
VEC_RX
0x25
Yes
jmpi rx_int,(i6)+1
UART RX
VEC_TIM0
0x26
No
jmpi _empty_int,(i6)+1
Timer 0
VEC_TIM1
0x27
No
jmpi _empty_int,(i6)+1
Timer 1
VEC_SRC
0x28
Y/N
2
jmpi src_int,(i6)+1
SampleRate Converter
VEC_SDM
0x29
Y/N
3
jmpi sdm_int,(i6)+1
Sigma Delta Modulator
1
Active in codec and encoding mode.
2
Active in encoding mode.
3
Active if PCM Mixer or AD Mixer is used.
To replace an interrupt vector, calculate
i
= 0
x
2
A
00000
E
+
a
×
0
x
40
, where
a
is the address of
your own interrupt handler and
i
is the resulting instruction codeword.
Note: “JMPI” is the only instruction on VS_DSP that doesn’t have delay slot code execution.
Because of this it is also the only VS_DSP instruction that takes two clock cycles to execute
instead of one.
Example: How to take control over the DAC interrupt. First disable the DAC interrupt by clearing
bit 0 of register INT_ENABLE. Do your other initializations. Then calculate your interrupt vector.
E.g. if your own interrupt is at instruction address 0x50, then
i
=
0x2A00000E
+
0x50
×
0x40
=
0x2A00140E. Write this value to instruction address 0x20. Then reactivate the interrupt by
setting bit 0 of INT_ENABLE. (Note that disabling and re-enabling the interrupt isn’t necessarily
needed if you don’t care that the old interrupt may occur during your initializations.)
6.3
VSIDE and Applications
VSIDE will get a VS1063a full control application example in Q3/2011.
Version: 0.40, 2011-09-02
18