|
5#

楼主 |
发表于 2016-6-8 13:48:50
|
只看该作者
STK中例程STK_Timer里面有有WatchDog测试函数
- /*set local timer (==DNUM of a core) as watch dog timer,
- service the watch-dog for sometime,
- after stop servicing watch-dog, let it trigger NMI*/
- void watchdog_timer_test()
- {
- int i;
- Uint32 timerCnt;
- Timer64_Config tmrCfg;
- //select output on TIMO0 from local timer.
- gpBootCfgRegs->TOUTSEL = (DNUM*2)<<CSL_BOOTCFG_TOUTSEL_TOUTSEL0_SHIFT;
- gpBootCfgRegs->RSTMUX[DNUM] =
- (4<<CSL_BOOTCFG_RSTMUX0_RSTMUX_DELAY0_SHIFT)
- /*WD timer event trigger NMI*/
- |(WD_RESET_DEVICE<<CSL_BOOTCFG_RSTMUX0_RSTMUX_OMODE0_SHIFT);
- puts("start watch-dog timer...");
- //configure the timer for watch-dog
- tmrCfg.timer_num= DNUM;
- tmrCfg.timerMode= TIMER_WATCH_DOG;
- tmrCfg.period= (unsigned long long)WATCH_DOG_PERIOD_MS*gDSP_Core_Speed_Hz/6000;
- tmrCfg.pulseWidth= 3;
- Timer64_Init(&tmrCfg);
- //service the watch-dog for sometime,
- for(i=1; i<=30; i++)
- {
- timerCnt= gpTimerRegs[DNUM]->CNTLO;
- Service_Watchdog(DNUM);
- printf("service watch-dog %d times, at time counter = %u\n",
- i, timerCnt);
- }
- puts("stop servicing watch-dog, it will timeout and trigger NMI...\n");
- }
复制代码
我应该怎样修改让WatchDog超时后直接系统重启,而不是只打印一句话 |
|