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

📄 timertest.c

📁 CHP 2 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen
💻 C
字号:
// 
//  Project: Experiment 2.10.3 DSP Timer - Chapter 2 
//  File name: timerTest.c   
//  Function(s): main()        
//               application()
//
//  Description: This is the test funciton to show how to setup and use the DSP timer
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//


#include <stdio.h>
#include "timer.h"

#pragma CODE_SECTION(main,         ".text:example:timer0");
#pragma CODE_SECTION(application,  ".text:example:timer0");

static unsigned long application(unsigned long cnt, short lp);

void main()
{                  
  short k,loop;
  unsigned long  sampleCnt;

  asm(" MOV #0x01,mmap(IVPD)");// Set up DSP interrupt vector table pointer
  asm(" MOV #0x01,mmap(IVPH)");// Set up HOST interrupt vector table pointer
     
  initCLKMD();                 // Initialize CLKMD register                    
  initTimer();                 // Initialize Timer
    
  loop = 100;    
  for (k=0; k<9; k++)
  {              
    time.us = 0;               // Reset time variables
    time.ms = 0;
    time.s = 0;  
        
    startTimer();              // Start timer
	    
    sampleCnt = application(0, loop);
	    
    stopTimer();               // Stop timer
	    
    loop -= 10;      
                                                          
    printf("samples processed = %10ld\ttime used = %d(s)%d(ms)%d(us)\n", 
            sampleCnt,time.s,time.ms,time.us);		         
  }                                            
}

// Example DSP application
static unsigned long application(unsigned long cnt, short lp)
{       
  short i,j,k,n;
    
  for (i=0; i<lp; i++)
  {
    for (j=0; j<lp; j++)
    {
      for (k=0; k<lp; k++)
      {
        for (n=0; n<lp; n++)
        {
          cnt++;
        }
      }  
    }
  }  
  return (cnt);
} 

⌨️ 快捷键说明

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