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

📄 fir.h

📁 This experiment uses the Blackfi n BF533/BF537 EZ-KIT to run a simple FIR fi lter on stereo channe
💻 H
字号:
///////////////////////////////////////////////////////////////////////////////
//
// 	
//  Experiment 6.11_BF533 implements FIR filtering using BF533 EZ-KIT
//  FILE name: fir.h
//
//  Description: Perform real-time FIR filtering on stero input signals.
//		 Header file to perform necessary variable declaration
//  
//  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 BF533 EZ-KIT)
//
///////////////////////////////////////////////////////////////////////////////


#ifndef  __fir_DEFINED
	#define __fir_DEFINED

//--------------------------------------------------------------------------//
// Header files																//
//--------------------------------------------------------------------------//
#include <sys\exception.h>
#include <cdefBF533.h>
#include <ccblkfn.h>
#include <sysreg.h>
#include <filter.h>
#include <fract.h>
#include "btc.h"

//--------------------------------------------------------------------------//
// Symbolic constants														//
//--------------------------------------------------------------------------//
// addresses for Port B in Flash A
#define pFlashA_PortA_Dir	(volatile unsigned char *)0x20270006
#define pFlashA_PortA_Data	(volatile unsigned char *)0x20270004

#define pFlashA_PortB_Dir	(volatile unsigned char *)0x20270007
#define pFlashA_PortB_Data	(volatile unsigned char *)0x20270005

// names for codec registers, used for sCodec1836TxRegs[]
#define DAC_CONTROL_1		0x0000
#define DAC_CONTROL_2		0x1000
#define DAC_VOLUME_0		0x2000
#define DAC_VOLUME_1		0x3000
#define DAC_VOLUME_2		0x4000
#define DAC_VOLUME_3		0x5000
#define DAC_VOLUME_4		0x6000
#define DAC_VOLUME_5		0x7000
#define ADC_0_PEAK_LEVEL	0x8000
#define ADC_1_PEAK_LEVEL	0x9000
#define ADC_2_PEAK_LEVEL	0xA000
#define ADC_3_PEAK_LEVEL	0xB000
#define ADC_CONTROL_1		0xC000
#define ADC_CONTROL_2		0xD000
#define ADC_CONTROL_3		0xE000

// names for slots in ad1836 audio frame
#define INTERNAL_ADC_L0			0
#define INTERNAL_ADC_R0			2
#define INTERNAL_ADC_L1			1
#define INTERNAL_ADC_R1			3

#define INTERNAL_DAC_L0			0
#define INTERNAL_DAC_R0			2
#define INTERNAL_DAC_L1			1
#define INTERNAL_DAC_R1			3

// number of input frames of samples
#define FRAME_SIZE				2

// number of input samples per channel 
#define IP_SIZE					32

// number of filter taps declaration
#define	TAPS					32

// size of array sCodec1836TxRegs
#define CODEC_1836_REGS_LENGTH	11

// SPI transfer mode
#define TIMOD_DMA_TX 			0x0003

// SPORT0 word length
#define SLEN_24					0x0017
#define SLEN_16					0x000F

// DMA flow mode
#define FLOW_1					0x1000


//--------------------------------------------------------------------------//
// Global variables															//
//--------------------------------------------------------------------------//
extern short iCh0LeftIn[];
extern short iCh0RightIn[];
extern short iCh1LeftIn[];
extern short iCh1RightIn[];

extern short iCh0LeftOut[];
extern short iCh0RightOut[];
extern short iCh1LeftOut[];
extern short iCh1RightOut[];

extern int pushbt_flag;
extern int cycleCount;

extern volatile short sCodec1836TxRegs[];
extern volatile short iRxBuffer1[];
extern volatile short iTxBuffer1[];

extern fir_state_fr16	state1;
extern fir_state_fr16	state2;
extern fract16 lpf[];
extern fract16 ldelay[];
extern fract16 rdelay[];


//--------------------------------------------------------------------------//
// Prototypes																//
//--------------------------------------------------------------------------//
// in file Initialize.c
void Init_EBIU(void);
void Init_Flash(void);
void Init_LED(void);
void Init_GPIO(void);
void Init1836(void);
void Init_Sport0(void);
void Init_DMA(void);
void Init_Interrupts(void);
void Enable_DMA_Sport(void);
void Init_Filter(void);

// in file Process_data.c
void Process_Data();
void firc(const fract16 in[], fract16 out[],fir_state_fr16 state);

// in file fir.asm
void _fir(const fract16 in[], fract16 out[], int ni, fir_state_fr16 *s);

// in file ISRs.c
EX_INTERRUPT_HANDLER(Sport0_RX_ISR);
EX_INTERRUPT_HANDLER(Switch_ISR);

#endif //__fir_DEFINED

⌨️ 快捷键说明

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