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

📄 test_timer.c

📁 TI DSP TMS320DM642 用定时器测试函数执行时间
💻 C
字号:

#include <std.h>
#include <csl.h>
#include <csl_dat.h>
#include <csl_timer.h>

TIMER_Handle hTimer;
    ///////////////////////////////////
void SetTimer(void) 
{
    TIMER_Config MyConfig = {   0x00000200, /* ctl */
   								0xffffffff, /* prd */
      							0x00000000  /* cnt */ };
    
//    IRQ_enable(IRQ_EVT_TINT0);

    hTimer = TIMER_open(TIMER_DEV1,TIMER_OPEN_RESET);
    TIMER_config(hTimer,&MyConfig);
    TIMER_setCount(hTimer,0x00000000);
	TIMER_setPeriod(hTimer,0xffffffff); //unit 1ms ->75000
		
}
/////////////////////////////////////////

Uint32 timer_start(void)
{
	TIMER_setCount(hTimer,0x00000000);
	TIMER_start(hTimer);
	return TIMER_getCount(hTimer);
}

Uint32 timer_stop(void)
{
	TIMER_pause(hTimer);
	return TIMER_getCount(hTimer);
}

⌨️ 快捷键说明

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