Linux?豸?????watchdog?豸????
???????????? ???????[ 2016/5/13 11:36:11 ] ?????????????? Linux
???????????watchdog ?????????????????????????????????????????????? ??·???????????????·???λ???????????????Χ??????????? ????? “ι??”???????????????????????????????λ????????????????????????????λ??? ?????????????????????????????????????·????????????????????? ??????檔
????1 ????????????????
????1.1 watchdog???
????S3C2410?????????watchdog????3 ?????????watchdog ???в???????3 ???????????WTCON ??watchdog ????????????WTDAT ??watchdog ????????????WTCNT(watchdog ?????????) S3c2440????????????????£?
??????????????????????????????PCLK?????????????????255+1?????????MUX??????????????????????????????????????0????????????????ж????RESET??λ???? ???????????????????????£?
????t_watchdog = 1/[PCLK/(Prescaler value + 1)/Division_factor]
????1.2 ????S3C2410 ??????
????void enable watchdog ()
????{
????rWTCON = WTCON DIV64 | WTCON RSTEN;//64??????????λ???
????rWTDAT = 0x8000;//???????
????rWTCON |= WTCON ENABLE;//????????
????}
????1.3 S3C2410 ?????? “ι??”
????void feed dog ()
????{
????rWTCNT=0x8000;
????}
????1.4 ??????????????
????void main ()
????{
????init system ();
????...
????enable watchdog ();//????????
????...
????while (1)
????{
????...
????feed dog (); //ι??
????}
????}
????2 watchdog?е??????
??????????豸????? “???豸”????? SoC ???м????????????赥????????????豸????
????2.1 platform_device ????
????struct platform device
????{
????const char * name;//?豸??
????u32 id;
????struct device dev;
????u32 num resources;//?豸???????????????
????struct resource * resource;//???
????};
????2.2 S3C2410 ?е????豸
struct platform device *s3c24xx uart devs[];
struct platform device s3c device usb; //USB ??????
struct platform device s3c device lcd; //LCD ??????
struct platform device s3c device wdt; //?????
2
struct platform device s3c device i2c; //I C ??????
struct platform device s3c device iis; //IIS
struct platform device s3c device rtc; //????
...
/*SMDK2410?????????????豸*/
static struct platform device *smdk2410 devices[] initdata =
{
&s3c device usb?? //USB
&s3c device lcd?? //LCD
&s3c device wdt?? //?????
&s3c device i2c?? //I C
&s3c device iis?? //IIS
};
????2.3 S3C2410 ???????platform_device ????
????struct platform device s3c device wdt =
????{
????.name = "s3c2410-wdt"?? //?豸??
????.id = - 1?? .
????num resources = ARRAY SIZE (s3c wdt resource)?? //???????
????.resource = s3c wdt resource?? //?????????????
????};
????2.4 int platform_add_devices()????
int platform add devices(struct platform device **devs?? int num)
{
int i?? ret = 0;
for (i = 0; i < num; i++)
{
ret = platform device register(devs[i]);/*??????豸*/
if (ret) /*??????*/
{
while (--i >= 0)
platform device unregister(devs[i]);/*?????????????豸 */
break;
}
}
return ret;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11