给 9260 uboot 加硬件狗!

  1、Makefile 添加一句 COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o

 2、编写watchdog.c

  /*
 * watchdog.c - driver for Blackfin on-chip watchdog
 *
 * Copyright (c) 2007-2008 Analog Devices Inc.
 *
 * Licensed under the GPL-2 or later.
 */

#include <common.h>
#include <asm/arch/at91sam9260.h>
#include <asm/arch/at91_pmc.h>
#include <asm/arch/gpio.h>
#include <asm/arch/io.h>
#include <watchdog.h>


#ifdef CONFIG_HW_WATCHDOG
void hw_watchdog_reset(void)
{
       int i;

       at91_set_gpio_value(AT91_PIN_PB31, 1);
       for(i=0;i<100;i++);
       at91_set_gpio_value(AT91_PIN_PB31, 0);
}

void hw_watchdog_init(void)/
{
 /* Enable clock */
 at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOA);
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOB);
 at91_set_gpio_output(AT91_PIN_PA4, 1);
 at91_set_gpio_output(AT91_PIN_PB31, 1);
        at91_set_gpio_value(AT91_PIN_PA4, 0);
        hw_watchdog_reset();
}
#endif

3、u-boot-1.3.4/include/configs/t91sam9260ek.h 对应的配置文件加上 #define CONFIG_HW_WATCHDOG

4、static void create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd, int chip) 可能要加喂狗函数

    nand_read_raw (mtd, buf, from, readlen, ooblen);
                #ifdef CONFIG_HW_WATCHDOG
                        #include <watchdog.h>
   WATCHDOG_RESET ();
        #endif

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值