???????????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;
}