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

📄 t_fir_decima_gen.c

📁 blackfin 533 DSP上优化的多速率数字滤波程序源码。
💻 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_decim.c
Description    : This modules tests the fir_decima_gen function.
*******************************************************************************/
#include "mds_def.h"
#include"tfir.h"

extern void _fir_decima_gen(const fract16 *in, fract16 *out, int n, fract16 *h, 
                            int L, int M, int LBYM, fract16 *d);

int error_flag = 0;
void (*f1)();
int cycle_count[10];

main()           
{
    fract16 outputmag;
    fract32 accout;

    int i,j,nsamples,error;
       
    f1 = _fir_decima_gen;
/*
Test: Low pass Test, filter length燣 % 4 = 0
Description: Input data consists of sinusoidal signal whose normalised frequency
= 0.1,the signal amplitude = 1/4, Stored number of samples = 260, 
Filter cutoff = 0.3 (normalised) Number of samples  = 260; 
*/
    
    for(i = 0; i < 16; i++)
        d[i] = 0;
    
    nsamples = BUFFER_SIZE;    // No: of inputs
     
/* input is scaled down by 1 bit right to allow filter output power not to 
overflow beyond 32 bits */

    for(i=0;i<nsamples;i++)
    {
       in[i] = FIRINPUT1[i]>> 1;  
    }
     
    nsamples=BUFFER_SIZE/2; // No: of outputs

// Testa finds decimated filter output for Ni/2 samples and dslay line gts 
// updated.
// Testb finds decimated 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_decima_gen()
                            // Testa 
    cycle_count[1] = Compute_Cycle_Count(&in[nsamples], &out[nsamples/2],
                                         nsamples/2, h, 16, 2, 8, d);
                            //This function inturn calls _fir_decima_gen()
                            // Testb

    accout = 0;
     for (i = 0; i < nsamples; i++)
     {
       accout += out[i] * out[i];
     }

    outputmag = (fract16)(accout>> NBITS1); 

    error = outputmag - thresh;

    if(error<0)
        error = -error;    
    if(error > 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 + -