main.c

来自「设置先初始化21161 EZ-KIT开发板」· C语言 代码 · 共 58 行

C
58
字号
#include "ADDS_21161_EzKit.h"
#include <def21161.h>

#include <signal.h>

float * DelayLine;
int Index  = 0;

void	Process_Samples( int sig_int)
{
	Receive_Samples();

	/* Perform AD1836/AD1852/SPDIF Audio Processing Here */
	Left_Channel_Out0 = Left_Channel_In1;	// left channel 1/8th inch jack to headphone out left channel
	Right_Channel_Out0 = Right_Channel_In1;	// left channel 1/8th inch jack to headphone out left channel

	/* 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;			// loopback left channel, no processing
	DelayLine[Index++] = Left_Channel_In1;			// store left channel into delay-line
	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();
}


void	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(	SIG_SP0I,	Process_Samples);

	*(int *) SP02MCTL |= MCE;

	DelayLine = (float *) 0x00200000;

	for (;;)
		asm("idle;");
y

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?