firtest.c

来自「使用在TI DSP c54xx系列的 xdaix」· C语言 代码 · 共 76 行

C
76
字号
/*

 *  Copyright 2003 by Texas Instruments Incorporated.

 *  All rights reserved. Property of Texas Instruments Incorporated.

 *  Restricted rights to use, duplicate or disclose this code are

 *  granted through contract.

 *

 *  @(#) XDAS 2.51.00 11-29-2003 (xdas-2.50.00.9)

 */

/*

 *  ======== firtest.c ========

 *  This example shows how to use the type safe FIR "utility"

 *  library directly by an application.

 */

#include <std.h>

#include <fir.h>

#include <log.h>



#include <fir_ti.h>



#include <stdio.h>



#ifdef _28_

#define far  

#endif



extern LOG_Obj trace;



Int coeff[] = {1, 2, 3, 4, 4, 3, 2, 1};

Int input[] = {1, 0, 0, 0, 0, 0, 0};



#define FRAMELEN    (sizeof (input) / sizeof (Int))

#define FILTERLEN   (sizeof (coeff) / sizeof (Int))



Int output[FRAMELEN];



static Void display(Int a[], Int n);



/*

 *  ======== main ========

 */

Int main(Int argc, String argv[])

{

    FIR_Params firParams;

    FIR_Handle fir;

    

    FIR_init();

    

    firParams = FIR_PARAMS;

    firParams.filterLen = FILTERLEN;

    firParams.frameLen = FRAMELEN;

    firParams.coeffPtr = coeff;

    if ((fir = FIR_create(&FIR_TI_IFIR, &firParams)) != NULL) {

        FIR_apply(fir, input, output);      /* filter some data */

        display(output, FRAMELEN);          /* display the result */

        FIR_delete(fir);                    /* delete the filter */

    }



    FIR_exit();



    return (0);

}



/*

 *  ======== display ========

 */

static Void display(Int a[], Int n)

{

    Int i;

    

    for (i = 0; i < n; i++) {

        LOG_printf(&trace, "%d ", (Arg)a[i]);

    }



    LOG_printf(&trace, "\n");

}

⌨️ 快捷键说明

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