main11a.c

来自「DSP,FIR设计」· C语言 代码 · 共 63 行

C
63
字号
//
//
// Main routine fir LAB11A - C54x
//
// Scott F. Bland  9/22/2000
#include <stdio.h>
#include "mmdrv.h"
#include "cpu_reg.h"    


// Define Sample and Tap sizes for function

#define RESULTS  185
#define TAPS 16

// Initialize Coefficient Table

#pragma DATA_SECTION (a,"coeffs");
int a[TAPS] = {0x7FC, 0x7FD, 0x7FE, 0x7FF,
      	       0x800, 0x801, 0x802, 0x803,
      	       0x803, 0x802, 0x801, 0x800,
               0x7FF, 0x7FE, 0x7FD, 0x7FC};

// Specify specific address for the result: y

#pragma DATA_SECTION (y,"yloc");
int y[RESULTS];

// include initialized x array

#include "in11.h"

extern void fir(int taps,int results,int *y);

main()
{
  int i;
 	SWWSR = 0x7fff;
    SWCR = 0x0001;
    BSCR = 0x8006;	  
    CLKMD = PLL_DIV_INIT;
    waitloop( 0x0400 );
    CLKMD = PLL_LOCK_INIT_X(5);	
    waitloop( 0x0400 );        
	PMST = 0x0168;

  // set wait states to zero using in-line assembly
//  asm("\t STM		#0,SWWSR");
//  asm("\t STM		#7FE8h,PMST");
  for(i= 0 ;i<RESULTS;i++)
  {
  	y[i]=0;
  }
   
  // call assembly FIR routine	
  fir(TAPS,RESULTS,y);
  while(1)
  {
    asm("\t nop\t");
  }
}	

⌨️ 快捷键说明

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