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

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
APPENDIX B:
C Program Source Code Listing for 21161 EZ-KIT Lite
Audio Driver (Visual DSP Project Files)
Main.C
#include "ADDS_21161_EzKit.h"
#include <def21161.h>
#include <signal.h>
float * DelayLine;
int Index
void
{
}
void
{
Process_Samples( int sig_int)
Receive_Samples();
/* Perform AD1836/AD1852/SPDIF Audio Processing Here */
// left channel 1/8th inch jack to headphone out left channel
Left_Channel_Out0 = Left_Channel_In1;
// left channel 1/8th inch jack to headphone out left channel
Right_Channel_Out0 = Right_Channel_In1;
/* create a simple stereo digital delay on internal AD1836 stereo DAC1 channel */
Right_Channel_Out1 = DelayLine[Index] + Right_Channel_In1; // delayed left + right channel
Left_Channel_Out1 = Left_Channel_In1;
DelayLine[Index++] = Left_Channel_In1;
if (Index == 12000) Index = 0;
/* loop back other audio data */
Left_Channel_Out2 = Left_Channel_In0;
Right_Channel_Out2 = Right_Channel_In0;
Left_Channel_AD1852 = Left_Channel_SPDIF_rx;
Right_Channel_AD1852 = Right_Channel_SPDIF_rx;
Transmit_Samples();
main()
/* Setup Interrupt edges and flag I/O directions */
Setup_ADSP21161N();
/* Setup SDRAM Controller */
Setup_SDRAM();
Setup_AD1836();
Init_AD1852_DACs();
Program_SPORT02_TDM_Registers();
Program_SPORT02_DMA_Channels();
interruptf(
*(int *) SP02MCTL |= MCE;
DelayLine = (float *) 0x00200000;
for (;;)
= 0;
asm("idle;");
SIG_SP0I,
Process_Samples);
// loopback left channel, no processing
// store left channel into delay-line

Related parts for AN1836-AN21161