AN1836-AN21161 Analog Devices, AN1836-AN21161 Datasheet - Page 62

no-image

AN1836-AN21161

Manufacturer Part Number
AN1836-AN21161
Description
Interfacing the ADSP-21161 SIMD SHARC DSP to the AD1836 (24-bit/96 kHz) Multichannel Codec
Manufacturer
Analog Devices
Datasheet
void
{
}
#ifdef DEBUG
/* TDM audio frame/ISR counter, for debug purposes */
int
#endif
/* AD1852 Setup */
#define SPI_TX_BUF_LEN 5
int
void
{
~RDMAEN & ~SPRINT);
}
/* SDRAM Setup Routine */
void
{
}
/* DSP Setup */
void
{
Program_SPORT02_DMA_Channels()
xmit2a_tcb[4]
rcv0a_tcb[4]
Init_AD1852_DACs()
// initially clear SPI control register
*(int *) SPICTL = 0;
*(int *) IISTX
*(int *) IMSTX
*(int *) CSTX
asm("#include <def21161_may2001.h>");
asm("bit set LIRPTL SPITMSK;");
interruptf( SIG_LP0I, SPORT_RX_IRQ);
*(int *) SPICTL |= SPIEN|SPTINT|TDMAEN|MS|FLS1|CPHASE|DF|WL16|BAUDR4|PSSE|DCPH0|SGN|GM;
*(int *) SPICTL &= (~CP & ~FLS0 & ~FLS2 & ~FLS3 & ~SMLS & ~DMISO & ~OPD & ~PACKEN & ~SENDZ &
while( (*(int*) DMASTAT) & DMA9ST) idle();
interruptf( SIG_LP0I, SIG_IGN);
asm("bit clr LIRPTL SPITMSK;");
*(int *) SPICTL = 0;
Setup_SDRAM()
Setup_ADSP21161N()
/* *** Enable circular buffering in MODE1 Register for revision 0.x silicon.
asm("bit set MODE1 CBUFEN;");
/* Setup hardware interrupts, FLAG LEDs and pushbutton */
spi_tx_buf[SPI_TX_BUF_LEN] = {
Important when porting 2106x code!!! */
/*clear MSx waitstate and mode*/
*(int *)WAIT &=
/*refresh rate*/
*(int*) SDRDIV = 0x1000;
// SDCTL = 0x02014231;
// 1/2 CCLK, no SDRAM buffering option, 2 SDRAM banks
// SDRAM mapped to bank 0 only, no self-refresh, page size 256 words
// SDRAM powerup mode is prechrg, 8 CRB refs, and then mode reg set cmd
// tRCD = 2 cycles, tRP=2 cycles, tRAS=3 cycles, SDCL=1 cycle
// SDCLK0, SDCLK1, RAS, CAS and SDCLKE activated
*(int *) SDCTL |= SDTRCD2|SDCKR_DIV2|SDBN2|SDEM0|SDPSS|SDPGS256|SDTRP2|SDTRAS3|SDCL1;
*(int *) SDCTL &= ~SDBUF & ~SDEM3 & ~SDEM2 & ~SDEM1 & ~SDSRF & ~SDPM & ~DSDCK1 & ~DSDCTL;
= *(int *) CP2A = ((int) xmit2a_tcb + 7) & 0x3FFFF | (1<<18);
= *(int *) CP0A = ((int) rcv0a_tcb
audio_frame_timer = 0;
= SPI_TX_BUF_LEN;
= (int) spi_tx_buf;
= 1;
DEASSERT_RESET | CONTROL_REG, // remove reset command
WL_24_BIT_DATA | I2S_JUSTIFIED | NO_DEMPH_FILTER | CONTROL_REG,
0x00FC | VOLUME_LEFT,
0x00FC | VOLUME_RIGHT };
0xFFF00000;
RESET_AD1852 | CONTROL_REG,
+ 7) & 0x3FFFF | (1<<18);
// reset AD1852

Related parts for AN1836-AN21161