📄 wdogav.h
字号:
/************************************************************************** * * Copyright (c) 2005 Curtiss-Wright Controls, Inc. All rights * reserved. This Source Code is the Property of Curtiss-Wright * Controls, Inc. and can only be used in accordance with Source * Code License Agreement(s) of Curtiss-Wright Controls, Inc. or any * of its subsidiaries. * **************************************************************************//****************************************************************************** Filename : wDogAv.h * Author : Melanie Babin* Created : May 27, 2004** Description: Avionics Watchdog driver header for vxWorks.* Hardware: CWCEC SVME/DMV-182/183 and CCA-145/146/149** Copyright 2005 CWCEC. All Rights Reserved.** History : ** 01a,27may04,mb created PT: 1444* 01b,nov04,jb updated for CCA-145* 01c,17dec04,jb fixed the IOFPGA_WD offsets* 01d,11jan05,rcd ported to VME-183.* 01e,06may05,tis updated for CCA-145* 01f,26jul05,aak correct watchdog timer resolution description (CR#11394)* 01g,29sep05,asu updated for CCA-146* 01h,09nov05,tis merged v8 with v6.1.1.*****************************************************************************/#ifndef __WDOGAV_#define __WDOGAV_#ifdef __cplusplusextern "C" {#endif#include "stdio.h"#include "logLib.h"#include "taskLib.h"#include "intLib.h"#ifdef VME_182#include "fpga182_dy4.h"#include "intCtrl182_dy4.h"#include "dy4182.h"#endif#ifdef CCA_145#include "fpga145.h"#include "intCtrl145.h"#include "cca145.h"#endif#ifdef CCA_146#include "fpga146.h"#include "intCtrl146.h"#include "cca146.h"#endif#ifdef CCA_149#include "fpga149.h"#include "intCtrl149.h"#include "cca149.h"#endif#ifdef VME_183#include "fpga183.h"#include "intCtrl183.h"#include "cwv183.h"#endif#if defined(CCA_145) || defined(CCA_146) || defined(CCA_149)|| defined(VME_183)#define WDOG_MODE_OFFSET 0x01 #define WDOG_LOCK_OFFSET 0x10#else#define WDOG_MODE_OFFSET 0x02 #define WDOG_LOCK_OFFSET 0x01#define WDOG_JMPR_OFFSET 0x04#endif#define WDOG_MAX_BOUNDARY 0xFFFFFF#define WDOG_MIN_BOUNDARY 0x000000#define WDOG_MODE_INTERRUPT 0#define WDOG_MODE_RESET 1#if defined(CCA_145)||defined(VME_183)#define IOFPGA_WDA_BASE_OFFSET FPGA_WDOG0_MAX_OFFSET #define IOFPGA_WDB_BASE_OFFSET FPGA_WDOG1_MAX_OFFSET#else#define IOFPGA_WDA_BASE_OFFSET 0x08#define IOFPGA_WDB_BASE_OFFSET 0x10#endif#if defined(CCA_145) || defined(CCA_146) || defined(CCA_149)|| defined(VME_183)#define IOFPGA_WD_CONTROL 0x8#define IOFPGA_WD_KICK 0x9#define IOFPGA_WD_MIN_TIMEOUT_7_0 0x7#define IOFPGA_WD_MIN_TIMEOUT_15_8 0x6#define IOFPGA_WD_MIN_TIMEOUT_23_16 0x5#define IOFPGA_WD_MIN_TIMEOUT_31_24 0x4#define IOFPGA_WD_MAX_TIMEOUT_7_0 0x3#define IOFPGA_WD_MAX_TIMEOUT_15_8 0x2#define IOFPGA_WD_MAX_TIMEOUT_23_16 0x1#define IOFPGA_WD_MAX_TIMEOUT_31_24 0x0#else#define IOFPGA_WD_CONTROL 0x0#define IOFPGA_WD_KICK 0x1#define IOFPGA_WD_MIN_TIMEOUT_7_0 0x2#define IOFPGA_WD_MIN_TIMEOUT_15_8 0x3#define IOFPGA_WD_MIN_TIMEOUT_23_16 0x4#define IOFPGA_WD_MAX_TIMEOUT_7_0 0x5#define IOFPGA_WD_MAX_TIMEOUT_15_8 0x6#define IOFPGA_WD_MAX_TIMEOUT_23_16 0x7#endif#ifndef VME_182 #define IOFPGA_WDA_ADRS_WDOG_AV (volatile UINT8 *)(CPU_FPGA_BASE_ADRS + IOFPGA_WDA_BASE_OFFSET)#define IOFPGA_WDB_ADRS_WDOG_AV (volatile UINT8 *)(CPU_FPGA_BASE_ADRS + IOFPGA_WDB_BASE_OFFSET)#endif /* * Sets the register pointer, initializes all variables * performs a jumper check, and installs an interrupt * service routine. * Parameters: * routine - routine to be called with the interrupt * arg - parameter passed to the routine * mode - user defined value (interrupt/reset) */STATUS wDogAvInit (VOIDFUNCPTR routine,int arg,int mode);/* * Sets the minimum and maximum timeout values for * the watchdog * Parameters: * minVal - user defined value in microseconds * maxVal - user defined value in microseconds * (eg: 5000000 = 0x4C4B40 = 5 seconds) */STATUS wDogAvMinMaxSet(int minVal,int maxVal);/* * Get the minimum timeout value */int wDogAvMinGet(void);/* * Get the maximum timeout value */int wDogAvMaxGet(void);/* * Checks the mode and enables interrupts or sets * the reset bit in watchdog registers to effectively * "start" handling of watchdog events. */STATUS wDogAvStart (void);/* * Locks the watchdog registers. When locked, * the registers cannot be modified until a cold reboot. */STATUS wDogAvLock(void);/* * Resets the watchdog by writing to the specific * kick location */STATUS wDogAvKick(void); /* * Display contents of minimum and maximum timeout * registers */void wDogAvShow(void); #if defined(CCA_145) || defined(CCA_146) || defined(CCA_149) || defined(VME_183)/* * Clears the interrupt status register */STATUS wDogIntClear(void);/* * Enables/Disables the watchdog */STATUS wDogEnable(void);STATUS wDogDisable(void);/* * Enables/Disables reset on watchdog interrupt */STATUS wDogResetEnable(void);STATUS wDogResetDisable(void);/* * Masks/Unmasks the Watchdog interrupt */STATUS wDogIntMask(int cpuId);STATUS wDogIntUnmask(int cpuId);#endif#ifdef __cplusplus}#endif#endif /* __WDOGAV_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -