匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“Watchdog overview”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
Watchdog overview
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
This article provides information on the Linux<sup>®</sup> WDT (Watchdog Timer) framework.<br/> It explains how to activate the WDT interface and, based on examples, how to use it.<br /> <br /> == Framework purpose == A Watchdog Timer is a hardware circuit that can reset the computer system in case of a software fault (for example, when the software is blocked in an infinity loop and cannot reload the timer before an elapsed time). ==System overview== [[File:watchdog_overview.png|center|link=]] ===Component description=== From client application to hardware, the components are the following: *'''Application''' (User Space): an application that configures and regularly pings the char device<ref name="char device">[https://bootlin.com/doc/training/linux-kernel/linux-kernel-slides.pdf character device interface], ''Linux Kernel and Driver Development'' training document, see '''Character drivers''' and '''Kernel frameworks for device drivers''' chapter</ref>. *'''User Space interface''': composed of a standard char device<ref name="char device" />. *'''Watchdog framework''' (Kernel Space): this component provides a watchdog common interface <ref name="wdt user api">{{CodeSource | Linux kernel | Documentation/watchdog/watchdog-api.txt | kernel.org watchdog user api}}</ref>(through a char device) to configure and control a watchdog hardware block. *'''User driver''' (Kernel Space): Linux kernel drivers that handle internal peripherals or external devices under watchdog core<ref name="wdt kernel api">{{CodeSource | Linux kernel | Documentation/watchdog/watchdog-kernl-api.txt | kernel.org watchdog user api}}</ref>. *'''STM32 peripherals''' (Hardware): Hardware block for watchdog handling ([[IWDG internal peripheral|IWDT]]). ===API description=== A userspace daemon notifies the kernel watchdog driver that the userspace is still alive at regular intervals. This is done via the char device<ref name="char device" /> special device file ((/dev/watchdog). When such a notification occurs, the driver tells the hardware watchdog that everything is in order, and that the watchdog must wait a little more to reset the system. If the userspace fails (because of a RAM error or a kernel bug), the notifications stop and the hardware watchdog resets the system after the timeout occurs, thus causing a reboot. ==Configuration == ===Kernel configuration=== By default, the Watchdog Timer (WDT<ref name="wdt user api"/>) framework is activated in STMicroelectronics deliveries. If a specific configuration is needed, this section indicates how the WDT framework can be activated/inactivated in the kernel. The WDT framework can be activated in the kernel configuration via Linux<sup>®</sup> Menuconfig tool. Follow the steps below to configure the kernel via Menuconfig: <pre> [*] Watchdog Timer Support ---> [*] Disable watchdog shutdown on close [*] Update boot-enabled watchdog until userspace takes over <*> STM32 Independent WatchDoG (IWDG) support </pre> ===Device tree configuration=== DT configuration can be done thanks to STM32CubeMX. Please refer to the [[IWDG_device_tree_configuration| IWDG device tree configuration]]. ==How to use the Watchdog framework== The Watchdog framework can be used by the userspace application: * The kernel provides a simple code example<ref>{{CodeSource | Linux kernel | samples/watchdog/watchdog-simple.c | user example}}</ref> * Busybox provides a watchdog daemon<ref>[https://busybox.net/downloads/BusyBox.html busybox commands]</ref> * Systemd provides a watchdog support<ref>[http://0pointer.de/blog/projects/watchdog.html systemd watchdog configuration]</ref> ==How to trace and debug the framework== ===How to trace=== For details on dynamic trace usage, refer to How to use the kernel dynamic debug. {{Board$}} echo "file drivers/watchdog/* +p" > /sys/kernel/debug/dynamic_debug/control ==Source code location== *{{CodeSource | Linux kernel | drivers/watchdog/watchdog_core.c | WatchdogAPI core}} *{{CodeSource | Linux kernel | include/uapi/linux/watchdog.h | WatchdogAPI interface}} *{{CodeSource | Linux kernel | drivers/watchdog/stm32_iwdg.c | stm32 iwdg drivers}} ==References== <references /> <noinclude> [[Category:Watchdog|0]] {{PublicationRequestId | 10344 | 2019-01-17 | AnneJ}} {{ArticleBasedOnModel | Framework overview article model}} </noinclude>
该页面使用的模板:
模板:ArticleBasedOnModel
(
查看源代码
)
模板:Board$
(
查看源代码
)
模板:CodeSource
(
查看源代码
)
模板:PublicationRequestId
(
查看源代码
)
返回至
Watchdog overview
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志