SlideShare a Scribd company logo
TIMER DEVICE DRIVER 
(SYSTEM TIMER, RTC, WATCHDOG) 
1
系統宣告(arch/arm/mach-ixp4xx) 
MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") 
/* Maintainer: MontaVista Software, Inc. */ 
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 
0xfffc, 
.map_io = ixp4xx_map_io, 
.init_irq = ixp4xx_init_irq, 
.timer = &ixp4xx_timer, 
.boot_params = 0x0100, 
.init_machine = ixdp425_init, 
MACHINE_END 
2
struct sys_timer armcpu_timer __initdata = 
{ 
.init = armcpu_timer_init, 
.offset = armcpu_gettimeoffset, 
.resume = armcpu_timer_setup, 
}; 
3 
Timer 資料結構宣告
static void armcpu_timer_setup(void) 
{ 
armcpu_timer_set_reload(USED_TIMER, APB_CLK/HZ); 
armcpu_timer_set_counter(USED_TIMER, APB_CLK/HZ); 
……………… 
} 
void __init armcpu_timer_init(void) 
{ 
armcpu_timer_setup(); 
setup_irq(IRQ_TIMER1, &armcpu_timer_irq); 
} 
4 
Timer Initiailzation
static irqreturn_t 
armcpu_timer_interrupt(int irq, void *dev_id) 
{ 
write_seqlock(&xtime_lock); 
timer_tick(); 
write_sequnlock(&xtime_lock); 
return IRQ_HANDLED; 
} 
5 
Timer interrupt
unsigned long armcpu_gettimeoffset (void) 
{ 
unsigned long volatile offsetticks; 
offsetticks = SET_COUNTER-armcpu_timer_get_counter(USED_TIMER); 
if ( *(volatile unsigned int *)(CPE_TIMER1_VA_BASE+TIMER_INTR_STATE) ) { 
offsetticks = SET_COUNTER-armcpu_timer_get_counter(USED_TIMER); 
offsetticks += SET_COUNTER; 
} 
offsetticks = offsetticks / (APB_CLK / 1000000); // tansfer ticks to usec 
return offsetticks; 
} 
6 
gettimeoffset callback 
#include <sys/time.h> 
int gettimeofday(struct timeval *tv, struct timezone *tz); 
struct timeval { 
time_t tv_sec; /* seconds */ 
suseconds_t tv_usec; /* microseconds */ 
};
RTC DRIVER 
7
簡單來看它就是一個時鐘,通常它只能計 
時至秒。 
大都規格是在一年內誤差為10幾秒。 
它需要電池供電,上電一輩子需要有一次 
啓動的動作,斷電後則時間停止。 
以PC為例系統時間(用date指令,或者任何 
API取得的時間)在開機時會讀入RTC時間並 
設定時間,關機時會將系統時間設回RTC。 
其應用層設定的程式為hwclock,使用的 
device node 為/dev/rtc (10, 135)。 
8 
RTC (Real Time Clock)
Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|-- 
localtime] [-u|--utc] [-f FILE] 
Query and set hardware clock (RTC) 
Options: 
-r Show hardware clock time 
-s Set system time from hardware clock 
-w Set hardware clock to system time 
-u Hardware clock is in UTC 
-l Hardware clock is in local time 
-f FILE Use specified device (e.g. /dev/rtc2) 
9 
hwclock usage
RTC Device Driver Example 
可架構在misc之下 
主要是支援兩個ioctl command 
1) RTC_RD_TIME 讀取時間 
2) RTC_SET_TIME 設定時間 
struct rtc_time { 
int tm_sec; 
int tm_min; 
int tm_hour; 
int tm_mday; 
int tm_mon; 
int tm_year; 
int tm_wday; 
int tm_yday; 
int tm_isdst; 
}; 
10
Module Initialize Example 
static struct file_operations rtc_fops = { 
owner:THIS_MODULE, 
ioctl:rtc_ioctl, 
open:rtc_open, 
release:rtc_release, 
}; 
static struct miscdevice rtc_dev = { 
RTC_MINOR, 
"rtc", 
&rtc_fops 
}; 
static int __init rtc_init(void) 
{ 
misc_register(&rtc_dev); 
return 0; 
}
Ioctl Example 
static int 
rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 
{ 
struct rtc_time rtc_tm; 
switch (cmd) { 
case RTC_RD_TIME: /* Read the time/date from RTC */ 
get_rtc_time(&rtc_tm); 
return copy_to_user((void *) arg, &rtc_tm, sizeof(rtc_tm)) ? -EFAULT : 0; 
case RTC_SET_TIME: /* Set the RTC */ 
if (copy_from_user(&rtc_tm, (struct rtc_time *) arg, sizeof(struct rtc_time))) 
return -EFAULT; 
// set to hardware RTC with the time 
return 0; 
default: 
return -EINVAL; 
} 
}
新RTC Driver 
Device node is put on /dev/misc directory. 
Up to 16 RTC node, from rtc0 
The major number is 254. 
The minor number is from 0. 
These are the same IOCTL command with the 
old type RTC driver. 
More features.
RTC Class Structure 
struct rtc_class_ops { 
int (*open)(struct device *); 
void (*release)(struct device *); 
int (*ioctl)(struct device *, unsigned int, unsigned long); 
int (*read_time)(struct device *, struct rtc_time *); 
int (*set_time)(struct device *, struct rtc_time *); 
int (*read_alarm)(struct device *, struct rtc_wkalrm *); 
int (*set_alarm)(struct device *, struct rtc_wkalrm *); 
int (*proc)(struct device *, struct seq_file *); 
int (*set_mmss)(struct device *, unsigned long secs); 
int (*irq_set_state)(struct device *, int enabled); 
int (*irq_set_freq)(struct device *, int freq); 
int (*read_callback)(struct device *, int data); 
int (*alarm_irq_enable)(struct device *, unsigned int enabled); 
int (*update_irq_enable)(struct device *, unsigned int enabled); 
};
RTC Time structure 
struct rtc_time { 
int tm_sec; 
int tm_min; 
int tm_hour; 
int tm_mday; 
int tm_mon; 
int tm_year; 
int tm_wday; 
int tm_yday; 
int tm_isdst; 
};
New RTC Driver Example 
static int rtc_read_time(struct device *dev, struct rtc_time *tm) 
{ 
……………. 
} 
static int rtc_set_time(struct device *dev, struct rtc_time *tm) 
{ 
………….. 
} 
static struct rtc_class_ops rtc_ops = { 
.read_time = rtc_read_time, 
.set_time = rtc_set_time, 
}; 
static struct rtc_device *rtc; 
static int rtc_module_init(void) 
{ 
………….. 
rtc = rtc_device_register(“name”, NULL, &rtc_ops, THIS_MODULE); 
if ( IS_ERR(rtc) { 
…….. 
} 
return 0; 
} 
static void rtc_module_exit(void) 
{ 
rtc_device_unregister(rtc); 
….. 
}
WATCHDOG DRIVER 
17
什麼是Watchdog 
1) 它是一種可以reset CPU的機制, 在一定的時間 
內需要觸發, 若沒有將會引起CPU reset 
它有什麼注意事項 
1) 小心檔案系統crashed, 因為它是直接CPU reset, 
並沒有做很好的shutdown動作 
2) 可能因為Flash在write state,使得reset之後無 
法boot from flash 
3) 硬體需配合reset CPU週邊元件, 否則系統還是 
無法reset 
View source code newwdt 
18 
Watchdog面面觀

More Related Content

PPTX
Linux PCI device driver
PPTX
建構嵌入式Linux系統於SD Card
PPTX
Linux Serial Driver
PPTX
用Raspberry Pi 學Linux I2C Driver
PDF
Specializing the Data Path - Hooking into the Linux Network Stack
PPTX
Linux Device Tree
PDF
Advanced cfg bypass on adobe flash player 18 defcon russia 23
PPTX
使用XMPP進行遠端設備控制
Linux PCI device driver
建構嵌入式Linux系統於SD Card
Linux Serial Driver
用Raspberry Pi 學Linux I2C Driver
Specializing the Data Path - Hooking into the Linux Network Stack
Linux Device Tree
Advanced cfg bypass on adobe flash player 18 defcon russia 23
使用XMPP進行遠端設備控制

What's hot (20)

ODP
Sysprog 16
PDF
Character drivers
PDF
Staging driver sins
PPTX
grsecurity and PaX
PDF
Semtex.c [CVE-2013-2094] - A Linux Privelege Escalation
PDF
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
PPTX
U-boot and Android Verified Boot 2.0
PDF
Building Network Functions with eBPF & BCC
PDF
Zn task - defcon russia 20
PDF
I2c drivers
PPTX
“Automation Testing for Embedded Systems”
PDF
Kernel crashdump
PDF
Debugging linux kernel tools and techniques
PPTX
Linux Kernel MMC Storage driver Overview
PPTX
“Linux Kernel CPU Hotplug in the Multicore System”
ODP
Debugging linux
PDF
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
ODP
Linux kernel debugging(ODP format)
PDF
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
DOC
Linux interrupts
Sysprog 16
Character drivers
Staging driver sins
grsecurity and PaX
Semtex.c [CVE-2013-2094] - A Linux Privelege Escalation
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
U-boot and Android Verified Boot 2.0
Building Network Functions with eBPF & BCC
Zn task - defcon russia 20
I2c drivers
“Automation Testing for Embedded Systems”
Kernel crashdump
Debugging linux kernel tools and techniques
Linux Kernel MMC Storage driver Overview
“Linux Kernel CPU Hotplug in the Multicore System”
Debugging linux
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
Linux kernel debugging(ODP format)
Spectre(v1%2 fv2%2fv4) v.s. meltdown(v3)
Linux interrupts
Ad

Viewers also liked (20)

PDF
S emb t7-arch_bus
PPT
Embedded systems
PDF
Selection and Integration of Embedded Display Devices
PDF
RFID embedded - MAGIC-PCB containing MAGICSTRAP
PPTX
Serial Communication & Embedded System Interface
PDF
Embedded c
PPTX
Embedded systems
PPTX
Linux watchdog timer
PPTX
Serial peripheral Interface - Embedded System Protocol
PPTX
FSK , FM DEMODULATOR & VOLTAGE REGULATOR ICS
PPT
Programmable Logic Devices Plds
PPT
Embedded system
PPT
Risc and cisc eugene clewlow
PPTX
Prerna sharma
PDF
SysTick, Timer & Watchdog
PPT
Chapter 19 - Real Time Systems
PPTX
Microprocessor and Microcontroller lec1
PDF
Embedded System
PPT
Embedded c program and programming structure for beginners
PPTX
Introduction to embedded systems
S emb t7-arch_bus
Embedded systems
Selection and Integration of Embedded Display Devices
RFID embedded - MAGIC-PCB containing MAGICSTRAP
Serial Communication & Embedded System Interface
Embedded c
Embedded systems
Linux watchdog timer
Serial peripheral Interface - Embedded System Protocol
FSK , FM DEMODULATOR & VOLTAGE REGULATOR ICS
Programmable Logic Devices Plds
Embedded system
Risc and cisc eugene clewlow
Prerna sharma
SysTick, Timer & Watchdog
Chapter 19 - Real Time Systems
Microprocessor and Microcontroller lec1
Embedded System
Embedded c program and programming structure for beginners
Introduction to embedded systems
Ad

Similar to Linux Timer device driver (20)

PDF
Hilman-Runtime-Power management linux .pdf
PDF
Manual completo ARM
PDF
2c esp8266 non-os_sdk_api_reference_en
PPT
39245203 intro-es-iv
PPTX
Intel Edison: Beyond the Breadboard
PDF
Implementing Lightweight Networking
PDF
Implementing Lightweight Networking
PDF
Reconfigurable Model for RISC Processors
PDF
PDF
embedded system introduction to microcontrollers
PDF
A novel implementation of
DOCX
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
PDF
System on Chip Based RTC in Power Electronics
PDF
2 colin walls - how to measure rtos performance
PPT
Arm7 architecture
PDF
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
PDF
Iaetsd rtos based electronics industrial
PDF
Develop Your Own Operating Systems using Cheap ARM Boards
PDF
Timers in Unix/Linux
PDF
RTOS on ARM cortex-M platform -draft
Hilman-Runtime-Power management linux .pdf
Manual completo ARM
2c esp8266 non-os_sdk_api_reference_en
39245203 intro-es-iv
Intel Edison: Beyond the Breadboard
Implementing Lightweight Networking
Implementing Lightweight Networking
Reconfigurable Model for RISC Processors
embedded system introduction to microcontrollers
A novel implementation of
# peripheral registers .equ PWR_BASE0x40007000 .equ PWR_CR0x00 .docx
System on Chip Based RTC in Power Electronics
2 colin walls - how to measure rtos performance
Arm7 architecture
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
Iaetsd rtos based electronics industrial
Develop Your Own Operating Systems using Cheap ARM Boards
Timers in Unix/Linux
RTOS on ARM cortex-M platform -draft

More from 艾鍗科技 (20)

PPTX
AI 技術浪潮, 什麼是機器學習? 什麼是深度學習, 什麼是生成式AI, AI 能力認證
PDF
TinyML - 4 speech recognition
PPTX
Appendix 1 Goolge colab
PPTX
Project-IOT於餐館系統的應用
PPTX
02 IoT implementation
PPTX
Tiny ML for spark Fun Edge
PDF
Openvino ncs2
PDF
Step motor
PDF
2. 機器學習簡介
PDF
5.MLP(Multi-Layer Perceptron)
PDF
3. data features
PPTX
心率血氧檢測與運動促進
PPTX
利用音樂&情境燈幫助放鬆
PPTX
IoT感測器驅動程式 在樹莓派上實作
PPTX
無線聲控遙控車
PPT
最佳光源的研究和實作
PPTX
無線監控網路攝影機與控制自走車
PPTX
Reinforcement Learning
PPTX
人臉辨識考勤系統
PPTX
智慧家庭Smart Home
AI 技術浪潮, 什麼是機器學習? 什麼是深度學習, 什麼是生成式AI, AI 能力認證
TinyML - 4 speech recognition
Appendix 1 Goolge colab
Project-IOT於餐館系統的應用
02 IoT implementation
Tiny ML for spark Fun Edge
Openvino ncs2
Step motor
2. 機器學習簡介
5.MLP(Multi-Layer Perceptron)
3. data features
心率血氧檢測與運動促進
利用音樂&情境燈幫助放鬆
IoT感測器驅動程式 在樹莓派上實作
無線聲控遙控車
最佳光源的研究和實作
無線監控網路攝影機與控制自走車
Reinforcement Learning
人臉辨識考勤系統
智慧家庭Smart Home

Recently uploaded (20)

PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
System and Network Administration Chapter 2
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
top salesforce developer skills in 2025.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Introduction to Artificial Intelligence
Design an Analysis of Algorithms II-SECS-1021-03
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Operating system designcfffgfgggggggvggggggggg
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo Companies in India – Driving Business Transformation.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
System and Network Administration Chapter 2
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
top salesforce developer skills in 2025.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
How to Choose the Right IT Partner for Your Business in Malaysia
wealthsignaloriginal-com-DS-text-... (1).pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Introduction to Artificial Intelligence

Linux Timer device driver

  • 1. TIMER DEVICE DRIVER (SYSTEM TIMER, RTC, WATCHDOG) 1
  • 2. 系統宣告(arch/arm/mach-ixp4xx) MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") /* Maintainer: MontaVista Software, Inc. */ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, .map_io = ixp4xx_map_io, .init_irq = ixp4xx_init_irq, .timer = &ixp4xx_timer, .boot_params = 0x0100, .init_machine = ixdp425_init, MACHINE_END 2
  • 3. struct sys_timer armcpu_timer __initdata = { .init = armcpu_timer_init, .offset = armcpu_gettimeoffset, .resume = armcpu_timer_setup, }; 3 Timer 資料結構宣告
  • 4. static void armcpu_timer_setup(void) { armcpu_timer_set_reload(USED_TIMER, APB_CLK/HZ); armcpu_timer_set_counter(USED_TIMER, APB_CLK/HZ); ……………… } void __init armcpu_timer_init(void) { armcpu_timer_setup(); setup_irq(IRQ_TIMER1, &armcpu_timer_irq); } 4 Timer Initiailzation
  • 5. static irqreturn_t armcpu_timer_interrupt(int irq, void *dev_id) { write_seqlock(&xtime_lock); timer_tick(); write_sequnlock(&xtime_lock); return IRQ_HANDLED; } 5 Timer interrupt
  • 6. unsigned long armcpu_gettimeoffset (void) { unsigned long volatile offsetticks; offsetticks = SET_COUNTER-armcpu_timer_get_counter(USED_TIMER); if ( *(volatile unsigned int *)(CPE_TIMER1_VA_BASE+TIMER_INTR_STATE) ) { offsetticks = SET_COUNTER-armcpu_timer_get_counter(USED_TIMER); offsetticks += SET_COUNTER; } offsetticks = offsetticks / (APB_CLK / 1000000); // tansfer ticks to usec return offsetticks; } 6 gettimeoffset callback #include <sys/time.h> int gettimeofday(struct timeval *tv, struct timezone *tz); struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ };
  • 8. 簡單來看它就是一個時鐘,通常它只能計 時至秒。 大都規格是在一年內誤差為10幾秒。 它需要電池供電,上電一輩子需要有一次 啓動的動作,斷電後則時間停止。 以PC為例系統時間(用date指令,或者任何 API取得的時間)在開機時會讀入RTC時間並 設定時間,關機時會將系統時間設回RTC。 其應用層設定的程式為hwclock,使用的 device node 為/dev/rtc (10, 135)。 8 RTC (Real Time Clock)
  • 9. Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|-- localtime] [-u|--utc] [-f FILE] Query and set hardware clock (RTC) Options: -r Show hardware clock time -s Set system time from hardware clock -w Set hardware clock to system time -u Hardware clock is in UTC -l Hardware clock is in local time -f FILE Use specified device (e.g. /dev/rtc2) 9 hwclock usage
  • 10. RTC Device Driver Example 可架構在misc之下 主要是支援兩個ioctl command 1) RTC_RD_TIME 讀取時間 2) RTC_SET_TIME 設定時間 struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; 10
  • 11. Module Initialize Example static struct file_operations rtc_fops = { owner:THIS_MODULE, ioctl:rtc_ioctl, open:rtc_open, release:rtc_release, }; static struct miscdevice rtc_dev = { RTC_MINOR, "rtc", &rtc_fops }; static int __init rtc_init(void) { misc_register(&rtc_dev); return 0; }
  • 12. Ioctl Example static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct rtc_time rtc_tm; switch (cmd) { case RTC_RD_TIME: /* Read the time/date from RTC */ get_rtc_time(&rtc_tm); return copy_to_user((void *) arg, &rtc_tm, sizeof(rtc_tm)) ? -EFAULT : 0; case RTC_SET_TIME: /* Set the RTC */ if (copy_from_user(&rtc_tm, (struct rtc_time *) arg, sizeof(struct rtc_time))) return -EFAULT; // set to hardware RTC with the time return 0; default: return -EINVAL; } }
  • 13. 新RTC Driver Device node is put on /dev/misc directory. Up to 16 RTC node, from rtc0 The major number is 254. The minor number is from 0. These are the same IOCTL command with the old type RTC driver. More features.
  • 14. RTC Class Structure struct rtc_class_ops { int (*open)(struct device *); void (*release)(struct device *); int (*ioctl)(struct device *, unsigned int, unsigned long); int (*read_time)(struct device *, struct rtc_time *); int (*set_time)(struct device *, struct rtc_time *); int (*read_alarm)(struct device *, struct rtc_wkalrm *); int (*set_alarm)(struct device *, struct rtc_wkalrm *); int (*proc)(struct device *, struct seq_file *); int (*set_mmss)(struct device *, unsigned long secs); int (*irq_set_state)(struct device *, int enabled); int (*irq_set_freq)(struct device *, int freq); int (*read_callback)(struct device *, int data); int (*alarm_irq_enable)(struct device *, unsigned int enabled); int (*update_irq_enable)(struct device *, unsigned int enabled); };
  • 15. RTC Time structure struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; };
  • 16. New RTC Driver Example static int rtc_read_time(struct device *dev, struct rtc_time *tm) { ……………. } static int rtc_set_time(struct device *dev, struct rtc_time *tm) { ………….. } static struct rtc_class_ops rtc_ops = { .read_time = rtc_read_time, .set_time = rtc_set_time, }; static struct rtc_device *rtc; static int rtc_module_init(void) { ………….. rtc = rtc_device_register(“name”, NULL, &rtc_ops, THIS_MODULE); if ( IS_ERR(rtc) { …….. } return 0; } static void rtc_module_exit(void) { rtc_device_unregister(rtc); ….. }
  • 18. 什麼是Watchdog 1) 它是一種可以reset CPU的機制, 在一定的時間 內需要觸發, 若沒有將會引起CPU reset 它有什麼注意事項 1) 小心檔案系統crashed, 因為它是直接CPU reset, 並沒有做很好的shutdown動作 2) 可能因為Flash在write state,使得reset之後無 法boot from flash 3) 硬體需配合reset CPU週邊元件, 否則系統還是 無法reset View source code newwdt 18 Watchdog面面觀