omap_wdt_hardware.c
来自「Linux Kernel 2.6.9 for OMAP1710」· C语言 代码 · 共 93 行
C
93 行
/* * drivers/char/watchdog/omap_wdt_hardware.c * * Hardware specific functions called by Watchdog Core driver OMAP platforms. * * Copyright (C) 2004 Texas Instruments, Inc. * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */#include <asm/io.h>#include <linux/delay.h>#include <asm/hardware/clock.h>#include "omap_wdt_core.h"#include "omap_wdt_hardware.h"static unsigned int wdt_trgr_pattern = 0x1234;unsigned int omap_wdt_boot_status(void){ return WDT_GET_BOOTSTATUS();}voidomap_wdt_ping(void){ /* wait for posted write to complete */ while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x08) ; wdt_trgr_pattern = ~wdt_trgr_pattern; omap_writel(wdt_trgr_pattern, (OMAP_WATCHDOG_TGR)); /* wait for posted write to complete */ while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x08) ; return;}voidomap_wdt_enable(void){ /* Sequence to enable the watchdog */ omap_writel(0xBBBB, OMAP_WATCHDOG_SPR); while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x10) ; omap_writel(0x4444, OMAP_WATCHDOG_SPR); while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x10) ; return;}voidomap_wdt_disable(void){ /* sequence required to disable watchdog */ omap_writel(0xAAAA, OMAP_WATCHDOG_SPR); /* TIMER_MODE */ while (omap_readl(OMAP_WATCHDOG_WPS) & 0x10) ; omap_writel(0x5555, OMAP_WATCHDOG_SPR); /* TIMER_MODE */ while (omap_readl(OMAP_WATCHDOG_WPS) & 0x10) ; return;}void omap_wldr_write(unsigned long data){ data=GET_WLDR_VAL(data); omap_writel(data, (OMAP_WATCHDOG_LDR)); while ((omap_readl(OMAP_WATCHDOG_WPS)) & 0x04) ;}void omap_wdt_get_time_margin (int * min, int * max){ *min = 1;#ifdef CONFIG_ARCH_OMAP *max = 32;#endif *max = 10000;} /* Hardware specific initializations */int omap_wdt_start(int timer_margin){#ifdef CONFIG_ARCH_OMAP struct clk *clk_info = clk_get(0,"armwdt_ck"); WDT_CK_ENABLE(); /* Enable the clock */ omap_wdt_disable(); if (timer_margin < 1 || timer_margin > 32){ timer_margin = 32; }#elif CONFIG_ARCH_OMAP24XX WDT_CK_ENABLE();#endif return timer_margin;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?