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

📄 firfilt.h

📁 DSP的实验测试程序
💻 H
字号:
/* ==================================================================
File name:      FIRFILT.H                     
                    
Originator:     Digital Control Systems Group
                Texas Instruments
Description:  
Header file containing  object definitions, proto type declaration and 
default object initializers for FIR Filter.
===================================================================
 History:
-------------------------------------------------------------------
12-1-2000   Release Rev 1.0                                                  
-------------------------------------------------------------------*/

#ifndef __FIRFILT_H__
#define __FIRFILT_H__
#define NULL    0

#include <fircoeff.h>
#include <fir10init.h>
#include <fir20init.h>   
  
/*----------------------------------------------------------------
Define the structure of the FIRFILT_GEN Filter Module 
-----------------------------------------------------------------*/
typedef struct {   
    int *coeff_ptr;         /* Pointer to Filter coefficient */
    int *dbuffer_ptr;       /* Delay buffer ptr              */
    int order;              /* Order of the Filter           */
    int input;              /* Latest Input sample           */ 
    int output;             /* Filter Output                 */
    void (*init)(void *);   /* Ptr to Init funtion           */
    void (*calc)(void *);   /* Ptr to calc fn                */
    }FIRFILT_GEN;    

/*----------------------------------------------------------------
Define the structure of the FIRFILT_ORD10 Filter Module
-----------------------------------------------------------------*/
typedef struct {
    int *coeff_ptr;         /* Pointer to Filter coefficient */
    int *dbuffer_ptr;       /* Delay buffer ptr              */
    int order;              /* Order of the Filter           */
    int input;              /* Latest Input sample           */ 
    int output;             /* Filter Output                 */
    int dbuffer[10];        /* Delay buffer                  */
    int coeff[11];          /* Coefficient Buffer            */
    void (*init)(void *);   /* Ptr to the init fn            */
    void (*calc)(void *);   /* Ptr to the Calc fn            */
    }FIRFILT_ORD10;

/*---------------------------------------------------------------
Define the structure of the FIRFILT_ORD20 Filter Module
-----------------------------------------------------------------*/
typedef struct {
    int *coeff_ptr;         /* Pointer to Filter coefficient */
    int *dbuffer_ptr;       /* Delay buffer ptr              */
    int order;              /* Order of the Filter           */
    int input;              /* Latest Input sample           */
    int output;             /* Filter Output                 */
    int dbuffer[20];        /* Delay buffer                  */
    int coeff[21];          /* Coefficient Buffer            */ 
    void (*init)(void *);   /* Ptr to init fn                */
    void (*calc)(void *);   /* Ptr to calc fn                */ 
    }FIRFILT_ORD20;
               
/*----------------------------------------------------------------
Define the structure of the FIRFILT_GEN Filter Module 
-----------------------------------------------------------------*/
typedef struct {   
    int *coeff_ptr;         /* Pointer to Filter coefficient */
    int brindex;            /* Index for Bit Reverse addressing */
    int order;              /* Order of the Filter           */
    int *dbuffer_ptr;       /* Delay buffer ptr              */
    int input;              /* Latest Input sample           */
    int output;             /* Filter Output                 */
    void (*init)(void *);   /* Ptr to Init funtion           */
    void (*calc)(void *);   /* Ptr to calc fn                */
        }FIRFILT_CGEN; 
 
/* Structure Template for Fixed order Circular buffers are same as the
FIRFILT_CIRG template */
#define FIRFILT_CORD10  FIRFILT_CGEN
#define FIRFILT_CORD20  FIRFILT_CGEN      

           
/*---------------------------------------------------------------
Define a Handles for the Filter Modules
-----------------------------------------------------------------*/
typedef FIRFILT_GEN     *FIRFILT_GEN_handle;
typedef FIRFILT_ORD10   *FIRFILT_ORD10_handle;
typedef FIRFILT_ORD20   *FIRFILT_ORD20_handle;  
typedef FIRFILT_CGEN    *FIRFILT_CGEN_handle;  
typedef FIRFILT_CGEN    *FIRFILT_CORD10_handle; 
typedef FIRFILT_CGEN    *FIRFILT_COED20_handle; 

          
#define FIRFILT_GEN_DEFAULTS { (int *)NULL, \
             (int *)NULL,   \
             10,            \
             0,             \
             0,             \
             (void (*)(void *))FIRFILT_LIN_init,\
             (void (*)(void *))FIRFILT_GEN_calc }    

#define FIRFILT_ORD10_DEFAULTS  FIRFILT_ORD10_LPF
#define FIRFILT_ORD20_DEFAULTS  FIRFILT_ORD20_LPF
            
#define FIRFILT_CGEN_DEFAULTS { (int *)NULL,    \
             0,             \
             20,            \
             (int *)NULL,   \
             0,             \
             0,             \
             (void (*)(void *))FIRFILT_CIR_init,\
             (void (*)(void *))FIRFILT_CGEN_calc }

#define FIRFILT_CORD10_DEFAULTS { (int *)NULL,  \
             0,             \
             10,            \
             (int *)NULL,   \
             0,             \
             0,             \
             (void (*)(void *))FIRFILT_CIR_init,\
             (void (*)(void *))FIRFILT_CORD10_calc }                           

#define FIRFILT_CORD20_DEFAULTS { (int *)NULL,  \
             0,             \
             20,            \
             (int *)NULL,   \
             0,             \
             0,             \
             (void (*)(void *))FIRFILT_CIR_init,\
             (void (*)(void *))FIRFILT_CORD20_calc }   

                                                       
/*-------------------------------------------------------------
 Prototypes for the functions
---------------------------------------------------------------*/
void FIRFILT_GEN_calc(void *);
void FIRFILT_ORD10_calc(void *);
void FIRFILT_ORD20_calc(void *);
void FIRFILT_CGEN_calc(void *);
void FIRFILT_CORD10_calc(void *);
void FIRFILT_CORD20_calc(void *);

void FIRFILT_LIN_init();
void FIRFILT_CIR_init();


#endif 

⌨️ 快捷键说明

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