ADI21489定时器设计思路:
1、配置Power management control register.
2、定义时钟中断调用函数接口及实现。。
3、指定时钟中断间隔。
4、启用时钟timer。
demo代码实现2~4,如下代码
#include <services/int/adi_int.h>
#include <stdio.h>
#include <def21489.h>
#include <21489.h>
int timer_count_H = 1;
int timer_count_L = 1;
//Timer interrupt service routine
void timer_isr_H (int sig)
{
// printf(“TimerH interrupt number %d\n”,timer_count_H);
timer_count_H++;
}
void timer_isr_L (int sig)
{
// printf(“TimerL interrupt number %d\n”,timer_count_L);
timer_count_L++;
}
void timer_init()
{
//adi_int_InstallHandler(ADI_CID_TMZHI,timer_isr_H,0,1);
adi_int_InstallHandler(ADI_CID_TMZLI,timer_isr_L,0,1);
timer_set(1000, 1000); // set tperiod and tcount of the timer
timer_on(); // start timer
}
注:中断调试打印时,在timer_isr_x打断点偶尔会如下异常,暂可忽略,原因待查,如果有朋友指导,还请不吝赐教,多谢多谢。
demo默认安装路径:D:\Analog Devices\ADSP-21479_EZKIT-Rel1.0.0\21479_EZ-Board\Examples\Core_Timer
demo安装包下载链接:http://download.analog.com/tools/EZBoards/21479/Releases/Release_1.0.0/ADI_ADSP-21479_EZKIT-Rel1.0.0.exe