8
Analog Interface
8 – 15
setup:
I0 = ^buff1;
{I0 points to first data buffer}
L0 = %buff1;
I1 = ^buff2;
{I1 points to second data buffer}
L1 = %buff2;
M0 = 0x1;
SI = 0x0;
{initialize flag register}
DM(flag_bit) = SI;
{use I1 and M0 for tranmsit}
{use I0 and M0 for receive}
AY0 = 0x0203;
{enable rcv and tx autobuffer}
DM(codec_auto_ctrl) = AY0;
AX1 = 0x0060;
DM(codec_ctrl_reg) = AX1;
{power up analog interface}
IMASK = 0x8;
{enable analog rx interrupt}
wait:
IDLE;
{wait for autobuffer interrupt}
JUMP wait;
switch:
AX0 = DM(flag_bit);
AR = pass AX0;
{check buffer status}
IF NE JUMP fill_buff2;
fill_buff1:
SI = 0x1;
{fill buff2 next time}
AY0 = 0x0013;
JUMP done;
fill_buff2:
SI = 0x0;
{fill buff1 next time}
AY0 = 0x0203;
JUMP done;
done:
DM(codec_auto_ctrl) = AY0;
DM(flag_bit) = SI;
RTI;
.ENDMOD;
Listing 8.2 ADSP-21msp58/59 Analog Autobuffer Program
Receive and transmit autobuffering may be independently enabled
and the two interrupts can occur (and be serviced) independently. This
allows the use of different data buffer lengths when autobuffering both
receive and transmit data. It also allows autobuffering to be used on
only one side, receive or transmit, while the other is serviced at the
8 kHz interrupt rate.