firtest1.c

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

C
73
字号
/*

 *  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)

 */

/*

 *  ======== firtest1.c ========

 *  This example shows how vendor specific extensions can 

 *  be used directly by an application.

 */

#include <std.h>

#include <log.h>

#include <fir_ti.h>



#ifdef _28_

#define far  

#endif



extern LOG_Obj trace;



#define NUMFRAMES   2



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

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



#define FRAMELEN    ((sizeof (inout) / sizeof (Int)) / NUMFRAMES)

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



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



/*

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

 */

Int main(Int argc, String argv[])

{

    FIR_TI_Params firParams;

    FIR_TI_Handle fir;

    

    FIR_TI_init();

    

    firParams = FIR_TI_PARAMS;

    firParams.filterLen = FILTERLEN;

    firParams.frameLen = FRAMELEN;

    firParams.coeffPtr = coeff;



    if ((fir = FIR_TI_create(&firParams)) != NULL) {

        FIR_TI_nApply(fir, inout, NUMFRAMES);   /* filter data in-place */

        display(inout, NUMFRAMES * FRAMELEN);   /* display the result */

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

    }



    FIR_TI_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 + -
显示快捷键?