?? t_fir_interp_gen.c
字號:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs ( Micro Signal Architecture 1.0 specification).
By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software.
********************************************************************************
File Name : tfir_interp.c
Description : This modules tests the fir_interp_gen function.
*******************************************************************************/
#include"mds_def.h"
#include "tfir.h"
void (*f1)();
int cycle_count[10];
int error_flag = 0;
extern void _fir_interp_gen(fract16 *i, fract16 *o, int, fract16 *h, int ,int,
int,fract16 *d);
void main()
{
fract32 accout;
int nsamples;
int i;
fract16 outputmag;
f1 = _fir_interp_gen;
nsamples=256;
//Test : Low pass Test, polyphase filter length L%4=0
//Description : Coefficients for a low pass filter will be applied against
// inputs. Inputs will be a sine wave of 1000 elements and have
// unity magnitude.
outputmag = 0;
for (i = 0; i < 8; i++)
{
d[i] = zero_in;
}
for (i = 0; i < nsamples; i++)
{
in[i] = FIRINPUT1[i]>> 2;
}
// For testing purposes testa and testb are used
// Testa finds interpolated filter output for Ni/2 samples and dslay line gts
// updated.
// Testb finds interpolated filter output for the next Ni/2 samples with the
// delay line previously updated by testa.
cycle_count[0] = Compute_Cycle_Count(in, out,nsamples/2, h, 16, 2, 8, d);
//This function inturn calls fir_interp_gen()
// Testa
cycle_count[1] = Compute_Cycle_Count(&in[nsamples/2], &out[nsamples],
nsamples/2, h, 16, 2, 8, d);
//This function inturn calls fir_interp_gen()
// Testb
accout = 0;
for (i = 0; i < 512; i++)
{
accout += out[i] * out[i];
}
outputmag = accout>> NBITS1;
outputmag -= thresh;
if(outputmag<0) outputmag = -outputmag;
if(outputmag > MAX_PERMISSIBLE_ERROR)
{
error_flag = error_flag | 1;
}
#ifdef PRINTF_SUPPORT
if(error_flag & 1)
printf("Test Case failed\n");
else
printf("Test Case passed\n");
#endif
printf("cycle_count[0]=%d,cycle_count[1]=%d\n",cycle_count[0],cycle_count[1]);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -