⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 This experiment uses the Blackfi n BF533/BF537 EZ-KIT to run a simple FIR fi lter on stereo channe
💻 C
字号:
///////////////////////////////////////////////////////////////////////////////
//
// 	
//  Experiment 6.11_BF537 Implement FIR filter using BF537 EZ-KIT
//  FILE name: main.c
//
//  Description: Perform real-time FIR filtering on stereo signals.
//		 The incoming audio data on left and right channel is fed
//		 into a set of FIR filters that filter the individual  	
//		 channels. The coefficients are pre-determined in MATLAB.
//
//  Mode of operation
//  	  SW10	: to switch to talkthrough mode
// 	  	  SW11	: to switch to FIR filtering mode
//	Note: reduce input volume to prevent clipping of signal.
//  
//  For the book "Embedded Signal Processing with the Micro Signal Architecture"
//		  By Woon-Seng Gan and Sen M. Kuo
//		  Publisher: John Wiley and Sons, Inc.
//
//  Tools used: VisualDSP++ v4.0 (running on BF537 EZ-KIT)
//
///////////////////////////////////////////////////////////////////////////////



#include "fir.h"

// SPORT0 DMA transmit buffer
section("L1_data_a") int iTxBuffer1[2*IP_SIZE*FRAME_SIZE];
// SPORT0 DMA receive buffer
section("L1_data_a") int iRxBuffer1[2*IP_SIZE*FRAME_SIZE];

// left and right input data from ad1836
section("L1_data_a") short sCh0LeftIn[IP_SIZE];
section("L1_data_a") short sCh0RightIn[IP_SIZE];
// left and right output data to ad1836
section("L1_data_a") short sCh0LeftOut[IP_SIZE];
section("L1_data_a") short sCh0RightOut[IP_SIZE];

int pushbt_flag;
int cycleCount;
unsigned char ucLED;

fir_state_fr16	state1;	// declare filter state
fir_state_fr16	state2;

fract16 lpf[TAPS] = {
	#include "coef32.dat"
};

fract16 ldelay[TAPS]={0};
fract16 rdelay[TAPS]={0};

//--------------------------------------------------------------------------//
// Function:	main														//
//																			//
// Description:	After calling a few initalization routines, main() just 	//
//				waits in a loop forever.  The code to process the incoming  //
//				data can be placed in the function Process_Data() in the 	//
//				file "Process_Data.c".										//
//--------------------------------------------------------------------------//
void main(void)
{
	pushbt_flag = 0;
	ucLED = 0x01;
	
	Init_Flags();
	Audio_Reset();
	Init_Sport0();
	Init_DMA();
	Init_PF();
	Init_Timer();
	Init_Interrupts();
	Init_Filter();
	Enable_DMA_Sport0();

	while(1);
}

⌨️ 快捷键说明

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