wdt.c

来自「TI OMAP 1510上mcbsp的驱动程序」· C语言 代码 · 共 91 行

C
91
字号
/* * dspapps/dsp/task_testB/wdt.c * * DSP Watchdog timer module * * Copyright (C) 2003 Nokia Corporation * * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: wdt.c * $Revision: 2.0 * $Date: 2003/11/11 * */#include <std.h>#include "omap1510.h"#include "mailbox.h"#include "tokliBIOSlib.h"#define __wdt_start() \	do {\		outw(inw(_CNTL_TIMER) | _CNTL_TIMER_BIT_ST,\		     _CNTL_TIMER);\	} while(0)#define __wdt_stop() \	do {\		outw(inw(_CNTL_TIMER) & ~_CNTL_TIMER_BIT_ST,\		     _CNTL_TIMER);\	} while(0)/* * WDT configuration (timer mode) */Void init_wdt(Void){	// Enable WDT clock	outw(inw(_DSP_IDLECT2) | _DSP_IDLECT2_BIT_EN_WDTCK, _DSP_IDLECT2);		// Start WDT with autoreload mode, expires in 19.57s.	outw(0xFFFF, _LOAD_TIM);	outw((inw(_CNTL_TIMER) & ~_CNTL_TIMER_BIT_PTV_MASK) |	     _CNTL_TIMER_BIT_AR |	     _CNTL_TIMER_BIT_PTV(7) |	     _CNTL_TIMER_BIT_ST,	     _CNTL_TIMER);	// Enable Interrupt	*_IER0 |= _IER0_BIT_WDGTIMER;}Void wdt_reflesh(Void){	Uns	intm_saved;	intm_saved = HWI_disable();	__wdt_start();	__wdt_stop();	HWI_restore(intm_saved);}Void wdt_start(Void){	__wdt_start();}Void wdt_stop(Void){	__wdt_stop();}Void wdt_handle(Void){	mbsend(mbcmd(MBCMD_WDT,0),0x0a21); // "!\n"}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?