1360 views|0 replies

3836

Posts

19

Resources
The OP
 

The role of the microcontroller watchdog [Copy link]

The function of the watchdog is to feed the watchdog regularly and reset the timer when the system CPU is working normally. If there is a problem with the system and the watchdog is not fed, the watchdog will reset the CPU due to timeout. After initialization, the system registers the watchdog interrupt request_irq(WDT0_ACCSCSSNBARK_INT, wdog_bark_handler, 0, "apps_wdog_bark", NULL); and initializes the watchdog timeout bark time, __raw_writel(timeout, msm_tmr0_base + WDT0_BARK_TIME); __raw_writel(timeout + 3*WDT_HZ, msm_tmr0_base + WDT0_BITE_TIME); __raw_writel(timeout + 3*WDT_HZ, msm_tmr0_base + WDT0_BITE_TIME); Reset the watchdog, enable the watchdog and interrupt polarity. __raw_writel(1, msm_tmr0_base + WDT0_EN); __raw_writel(1, msm_tmr0_base + WDT0_RST); enable_percpu_irq(WDT0_ACCSC SSNBARK_INT, IRQ_TYPE_EDGE_RISING); And initialize and start a timer, such as once every 10 seconds, schedule_delayed_work_on(0, &dogwork_struct, delay_time); static DECLARE_DELAYED_WORK(dogwork_struct, pet_watchdog_work); static DECLARE_WORK(init_dogwork_struct, init_watchdog_work); static struct msm_watchdog_pdata msm_watchdog_pdata = { =4].pet_time = 10000, .bark_time = 11000, .has_secure = true, .needs_expired_enable = true, }; delay_time = msecs_to_jiffies(pdata->pet_time); schedule_work_on(0, &init_dogwork_struct); When the timer is up, reset the pet dog timer and restart the timer. static void pet_watchdog_work(struct work_struct *work){pet_watchdog();if (enable)schedule_delayed_work_on(0, &dogwork_struct, delay_time);}}if (enable)schedule_delayed_work_on(0, &dogwork_struct, delay_time);} Execute panic. panic("Apps watchdog bark received!");

This post is from Microcontroller MCU
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list