{"id":669,"date":"2019-10-07T14:17:13","date_gmt":"2019-10-07T06:17:13","guid":{"rendered":"http:\/\/iqotom.com\/?p=669"},"modified":"2024-12-19T15:46:10","modified_gmt":"2024-12-19T07:46:10","slug":"linux%e4%b8%8b%e7%ae%80%e5%8d%95%e5%ae%9e%e7%8e%b0%e4%b8%80%e4%b8%aa%e7%9c%8b%e9%97%a8%e7%8b%97watch-dog","status":"publish","type":"post","link":"http:\/\/iqotom.com\/?p=669","title":{"rendered":"Linux\u4e0b\u7b80\u5355\u5b9e\u73b0\u4e00\u4e2a\u770b\u95e8\u72d7(Watch Dog)"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u5b9a\u4e49<\/h2>\n\n\n\n<p> \u770b\u95e8\u72d7\uff0c\u53c8\u53ebwatchdog timer\uff0c\u662f\u4e00\u4e2a\u5b9a\u65f6\u5668\u7535\u8def\uff0c\u4e00\u822c\u6709\u4e00\u4e2a\u8f93\u5165\uff0c\u53eb\u5582\u72d7(kicking the dog\/service the dog\uff09\uff0c\u4e00\u4e2a\u8f93\u51fa\u5230MCU\u7684RST\u7aef\uff0cMCU\u6b63\u5e38\u5de5\u4f5c\u7684\u65f6\u5019\uff0c\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4\u8f93\u51fa\u4e00\u4e2a\u4fe1\u53f7\u5230\u5582\u72d7\u7aef\uff0c\u7ed9 WDT\u6e05\u96f6\uff0c\u5982\u679c\u8d85\u8fc7\u89c4\u5b9a\u7684\u65f6\u95f4\u4e0d\u5582\u72d7\uff08\u4e00\u822c\u5728\u7a0b\u5e8f\u8dd1\u98de\u65f6\uff09\uff0cWDT\u5b9a\u65f6\u8d85\u8fc7\uff0c\u5c31\u4f1a\u7ed9\u51fa\u4e00\u4e2a\u590d\u4f4d\u4fe1\u53f7\u5230MCU\uff0c\u4f7fMCU\u590d\u4f4d\u3002\u9632\u6b62MCU\u6b7b\u673a. \u770b\u95e8\u72d7\u7684\u4f5c\u7528\u5c31\u662f\u9632\u6b62\u7a0b\u5e8f\u53d1\u751f\u6b7b\u5faa\u73af\uff0c\u6216\u8005\u8bf4\u7a0b\u5e8f\u8dd1\u98de \u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u57fa\u672c\u539f\u7406<\/h2>\n\n\n\n<p> \u770b\u95e8\u72d7\u662f\u4e00\u79cd\u76d1\u63a7\u7cfb\u7edf\u7684\u8fd0\u884c\u72b6\u51b5\u7684\u624b\u6bb5\uff0c\u901a\u8fc7\u8f6f\u786c\u4ef6\u7ed3\u5408\u7684\u65b9\u5f0f\u5b9e\u73b0\u5bf9\u7cfb\u7edf\u8fd0\u884c\u72b6\u51b5\u7684\u76d1\u63a7\u3002\u7a33\u5b9a\u8fd0\u884c\u7684\u8f6f\u4ef6\u4f1a\u5728\u6267\u884c\u5b8c\u7279\u5b9a\u6307\u4ee4\u540e\u8fdb\u884c\u5582\u72d7\uff0c\u82e5\u5728\u4e00\u5b9a\u5468\u671f\u5185\u770b\u95e8\u72d7\u6ca1\u6709\u6536\u5230\u6765\u81ea\u8f6f\u4ef6\u7684\u5582\u72d7\u4fe1\u53f7\uff0c\u5219\u8ba4\u4e3a\u7cfb\u7edf\u6545\u969c\uff0c\u4f1a\u8fdb\u5165\u4e2d\u65ad\u5904\u7406\u7a0b\u5e8f\u6216\u5f3a\u5236\u7cfb\u7edf\u590d\u4f4d\u3002\u7cfb\u7edf\u4e0a\u7535\u540e\u6839\u636e\u4e0d\u540c\u7684\u5de5\u4f5c\u6a21\u5f0f\u53ef\u4ee5\u9009\u62e9\u4f7f\u80fd\u770b\u95e8\u72d7\u7684\u65f6\u673a\uff0c\u82e5\u770b\u95e8\u72d7\u88ab\u4f7f\u80fd\u5219\u8ba1\u6570\u5668\u5f00\u59cb\u8ba1\u6570\uff0c\u5982\u679c\u5728\u8bbe\u5b9a\u7684\u65f6\u95f4\u5185\u6ca1\u6709\u53ca\u65f6\u5582\u72d7\u5219\u4f1a\u53d1\u751f\u770b\u95e8\u72d7\u8d85\u65f6\u3002 <br> \u770b\u95e8\u72d7\u4e3b\u8981\u7531\u5bc4\u5b58\u5668\u3001\u8ba1\u6570\u5668\u548c\u72d7\u53eb\u6a21\u5757\u6784\u6210\uff0c\u901a\u8fc7\u5bc4\u5b58\u5668\u5bf9\u770b\u95e8\u72d7\u8fdb\u884c\u57fa\u672c\u8bbe\u7f6e\uff0c\u8ba1\u6570\u5668\u8ba1\u7b97\u72d7\u53eb\u65f6\u95f4\uff0c\u72d7\u53eb\u6a21\u5757\u51b3\u5b9a\u770b\u95e8\u72d7\u8d85\u65f6\u540e\u53d1\u51fa\u7684\u4e2d\u65ad\u6216\u590d\u4f4d\u65b9\u5f0f\u3002 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">QOTOM Watch Dog<\/h2>\n\n\n\n<p><a href=\"http:\/\/www.qotom.com\/\">QOTOM<\/a> <a href=\"http:\/\/www.qotom.com\/product\/57.html\">Q300P<\/a>\u81ea\u5e26\u786c\u4ef6\u770b\u95e8\u72d7\uff0c\u7531SuperIO\u82af\u7247\u63d0\u4f9b\uff0c<strong>SuperIO Chip: IT8786E-I<\/strong>\uff0c\u8fd9\u91cc\u7b80\u5355\u5b9e\u73b0\u4e00\u4e0b\u770b\u95e8\u72d7\u7684\u590d\u4f4d\u529f\u80fd\uff0c\u53ea\u9700\u8981\u5bf9\u770b\u95e8\u72d7\u7684\u914d\u7f6e\u5bc4\u5b58\u5668\u7ec4\u548c\u6570\u636e\u5bc4\u5b58\u5668\u7ec4\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p><strong>WDTCTRL:<\/strong>Watch Dog Timer Control Register (Index=71h, Default=00h)  \u63a7\u5236\u5bc4\u5b58\u5668\uff0c\u4e3b\u8981\u662f\u8bbe\u7f6e\u4e2d\u65ad\uff0c\u8fd9\u91cc\u4e0d\u6d89\u53ca <\/p>\n\n\n\n<p><strong>WDTCONF:<\/strong>Watch Dog Timer Configuration Register (Index=72h, Default=001s0000b)  \u914d\u7f6e\u5bc4\u5b58\u5668 <br><strong>Bit6 or Bit4<\/strong>\u8bbe\u7f6e\u4e3a<strong>1<\/strong>\u5373\u53ef\u5f00\u542f\u770b\u95e8\u72d7\u529f\u80fd\uff0c\u8fd9\u91cc\u4f7f\u7528<strong>Bit4 PWRGD<\/strong> <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"307\" src=\"http:\/\/iqotom.com\/wp-content\/uploads\/2019\/10\/watch_dog_01.png\" alt=\"\" class=\"wp-image-670\" srcset=\"http:\/\/iqotom.com\/wp-content\/uploads\/2019\/10\/watch_dog_01.png 674w, http:\/\/iqotom.com\/wp-content\/uploads\/2019\/10\/watch_dog_01-300x137.png 300w\" sizes=\"(max-width: 674px) 100vw, 674px\" \/><figcaption class=\"wp-element-caption\">Watch Dog<\/figcaption><\/figure><\/div>\n\n\n<p><strong>WDTVALLSB:<\/strong>Watch Dog Timer Time-out Value (LSB) Register (Index=73h, Default=38h) \u4f4e\u4f4d\u6570\u636e\u5bc4\u5b58\u5668 <\/p>\n\n\n\n<p><strong>WDTVALMSB:<\/strong>Watch Dog Timer Time-out Value (MSB) Register (Index=74h, Default=00h)  \u9ad8\u4f4d\u6570\u636e\u5bc4\u5b58\u5668 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e3b\u8981\u6d41\u7a0b<\/h2>\n\n\n\n<ol>\n<li> \u8fdb\u5165IO\u914d\u7f6e\u7a7a\u95f4<\/li>\n\n\n\n<li> \u9009\u62e9\u903b\u8f91\u8bbe\u5907 <\/li>\n\n\n\n<li> \u8bbe\u7f6e\u770b\u95e8\u72d7\u914d\u7f6e\u5bc4\u5b58\u5668 <\/li>\n\n\n\n<li> \u8bbe\u7f6e\u770b\u95e8\u72d7\u6570\u636e\u5bc4\u5b58\u5668 <\/li>\n\n\n\n<li>  \u5582\u72d7(\u5faa\u73af\u7b2c4\u6b65) <\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u6838\u5fc3\u4ee3\u7801<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">\/* IO Ports *\/\n#define REG             0x2e\n#define VAL             0x2f\n\/* Logical device Numbers LDN *\/\n#define LDNREG          0x07\n#define GPIOLND         0x07\n\n\/\/superio enter\noutb(0x87, REG);\noutb(0x01, REG);\noutb(0x55, REG);\noutb(0x55, REG);\n\n\/\/select logic device\noutb(LDNREG, REG);\noutb(GPIOLND, VAL);\n\n\/\/WDT Output through KRST (pulse) Enable\noutb(0x72, REG);\noutb(0x90, VAL);\/\/1001 0000\n\n\/\/WDT Timer-out Value (feed dog)\noutb(0x73, REG);\noutb(0x1e, VAL);\/\/1e:30s\noutb(0x74, REG);\noutb(0x00, VAL);\n\n\/\/Close WDT\n\/\/outb(0x72, REG);\n\/\/outb(0x80, VAL);\n\n\/\/exit superio\noutb(0x02, REG);\noutb(0x02, VAL);<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5728\u8d85\u65f6\u65f6\u95f4\u5185\u6ca1\u6709\u8fdb\u884c\u5582\u72d7\uff0cWDT\u5c06\u4f1a\u81ea\u52a8\u4ea7\u751f\u4e00\u4e2a\u590d\u4f4d\u4fe1\u53f7\uff0c\u91cd\u542f\u7535\u8111\u3002<br>\u6267\u884c\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u6b63\u5e38\u7684\u8bdd30s\u540e\u7cfb\u7edf\u5c06\u4f1a\u81ea\u52a8\u91cd\u542f<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-medium-font-size\"><strong>\u6ce8\u610f\uff1a\u8be5\u4ee3\u7801\u4ec5\u4f9b\u53c2\u8003\uff0c\u5b9e\u9645\u9700\u53c2\u8003WDT\u786c\u4ef6\u7535\u8def\u8bbe\u8ba1<\/strong><\/p>\n\n\n\n<p> \u4ee3\u7801\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/huchanghui123\/Watch-Dog-Linux\">https:\/\/github.com\/huchanghui123\/Watch-Dog-Linux<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9a\u4e49 \u770b\u95e8\u72d7\uff0c\u53c8\u53ebwatchdog timer\uff0c\u662f\u4e00\u4e2a\u5b9a\u65f6\u5668\u7535\u8def\uff0c\u4e00\u822c\u6709\u4e00\u4e2a\u8f93\u5165\uff0c\u53eb\u5582\u72d7(kicking th\u2026 <span class=\"read-more\"><a href=\"http:\/\/iqotom.com\/?p=669\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":671,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,49],"tags":[7,61],"_links":{"self":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/669"}],"collection":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=669"}],"version-history":[{"count":6,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/669\/revisions"}],"predecessor-version":[{"id":2090,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/669\/revisions\/2090"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/media\/671"}],"wp:attachment":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=669"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}