⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xwdtps.h

📁 自学ZedBoard:使用IP通过ARM PS访问FPGA(源代码)
💻 H
字号:
/* $Id: xwdtps.h,v 1.1.2.1 2011/01/20 04:17:15 sadanan Exp $ *//******************************************************************************** (c) Copyright 2010 Xilinx, Inc. All rights reserved.** This file contains confidential and proprietary information of Xilinx, Inc.* and is protected under U.S. and international copyright and other* intellectual property laws.** DISCLAIMER* This disclaimer is not a license and does not grant any rights to the* materials distributed herewith. Except as otherwise provided in a valid* license issued to you by Xilinx, and to the maximum extent permitted by* applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL* FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,* IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF* MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;* and (2) Xilinx shall not be liable (whether in contract or tort, including* negligence, or under any other theory of liability) for any loss or damage* of any kind or nature related to, arising under or in connection with these* materials, including for any direct, or any indirect, special, incidental,* or consequential loss or damage (including loss of data, profits, goodwill,* or any type of loss or damage suffered as a result of any action brought by* a third party) even if such damage or loss was reasonably foreseeable or* Xilinx had been advised of the possibility of the same.** CRITICAL APPLICATIONS* Xilinx products are not designed or intended to be fail-safe, or for use in* any application requiring fail-safe performance, such as life-support or* safety devices or systems, Class III medical devices, nuclear facilities,* applications related to the deployment of airbags, or any other applications* that could lead to death, personal injury, or severe property or* environmental damage (individually and collectively, "Critical* Applications"). Customer assumes the sole risk and liability of any use of* Xilinx products in Critical Applications, subject only to applicable laws* and regulations governing limitations on product liability.** THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE* AT ALL TIMES.*******************************************************************************//****************************************************************************//**** @file xwdtps.h** The Xilinx watchdog timer driver supports the Xilinx watchdog timer hardware.** The Xilinx watchdog timer (WDT) driver supports the following features:*   - Both Interrupt driven and Polled mode*   - enabling and disabling the watchdog timer*   - restarting the watchdog.*   - configuring the width of the output pulse*   - initializing the most significant digit of the counter restart value.*   - multiple individually enabling/disabling outputs** It is the responsibility of the application to provide an interrupt handler* for the watchdog timer and connect it to the interrupt system if interrupt* driven mode is desired.** If interrupt is enabled, the watchdog timer device generates an interrupt* when the counter reaches zero.** If the hardware interrupt signal is not connected/enabled, polled mode is the* only option (using IsWdtExpired) for the watchdog.** The three outputs from the WDT are individually enabled/disabled using* _EnableOutput()/_DisableOutput(). The duration of the pulse width generated* by the External output is configurable using _SetExternalSignalLength(). The* clock divisor ratio and initial MSNibble of the count is configurable using* _SetControlValues().** The reset condition of the hardware has the maximum initial count in the* Counter Reset Value (CRV) and the WDT is enabled with the reset output* enabled and the pulse length set to 16 clocks. i.e.* <pre>*     register ZMR = 0x1C3*     register CCR = 0x03C* </pre>** This driver is intended to be RTOS and processor independent. It works with* physical addresses only.  Any needs for dynamic memory management, threads* or thread mutual exclusion, virtual memory, or cache control must be* satisfied by the layer above this driver.** <pre>* MODIFICATION HISTORY:** Ver   Who    Date     Changes* ----- ------ -------- -----------------------------------------------* 1.00a ecm/jz 01/15/10 First release* </pre>*******************************************************************************/#ifndef XWDTPS_H		/* prevent circular inclusions */#define XWDTPS_H		/* by using protection macros *//***************************** Include Files *********************************/#include "xil_types.h"#include "xil_assert.h"#include "xstatus.h"#include "xwdtps_hw.h"#ifdef __cplusplusextern "C" {#endif/************************** Constant Definitions *****************************//* * Choices for output selections for the device, used in * XWdtPs_EnableOutput()/XWdtPs_DisableOutput() functions */#define XWDTPS_RESET_SIGNAL	1   /**< Reset signal request */#define XWDTPS_IRQ_SIGNAL	2   /**< IRQ signal request */#define XWDTPS_EXTERNAL_SIGNAL	3   /**< External signal request *//* * Control value setting flags, used in * XWdtPs_SetControlValues()/XWdtPs_GetControlValues() functions */#define XWDTPS_CLK_PRESCALE	1   /**< Clock Prescale request */#define XWDTPS_COUNTER_RESET	2   /**< Counter Reset request *//**************************** Type Definitions *******************************//** * This typedef contains configuration information for the device. */typedef struct {	u16 DeviceId;		/**< Unique ID of device */	u32 BaseAddress;	/**< Base address of the device */} XWdtPs_Config;/** * The XWdtPs driver instance data. The user is required to allocate a * variable of this type for every watchdog/timer device in the system. * A pointer to a variable of this type is then passed to the driver API * functions. */typedef struct {	XWdtPs_Config Config;   /**< Hardware Configuration */	u32 IsReady;		/**< Device is initialized and ready */	u32 IsStarted;		/**< Device watchdog timer is running */} XWdtPs;/***************** Macros (Inline Functions) Definitions *********************//****************************************************************************//**** Check if the watchdog timer has expired. This function is used for polled* mode and it is also used to check if the last reset was caused by the* watchdog timer.** @param	InstancePtr is a pointer to the XWdtPs instance.** @return*		- TRUE if the watchdog has expired.*		- FALSE if the watchdog has not expired.** @note		C-style signature:*		int XWdtPs_IsWdtExpired(XWdtPs *InstancePtr)*******************************************************************************/#define XWdtPs_IsWdtExpired(InstancePtr)				  \((XWdtPs_ReadReg((InstancePtr)->Config.BaseAddress, XWDTPS_SR_OFFSET) & \   XWDTPS_SR_WDZ_MASK) == XWDTPS_SR_WDZ_MASK)/****************************************************************************//**** Restart the watchdog timer. An application needs to call this function* periodically to keep the timer from asserting the enabled output.** @param	InstancePtr is a pointer to the XWdtPs instance.** @return	None.** @note		C-style signature:*		void XWdtPs_RestartWdt(XWdtPs *InstancePtr)*******************************************************************************/#define XWdtPs_RestartWdt(InstancePtr)					\	XWdtPs_WriteReg((InstancePtr)->Config.BaseAddress,		\		XWDTPS_RESTART_OFFSET, XWDTPS_RESTART_KEY_VAL)/************************** Function Prototypes ******************************//* * Lookup configuration in xwdtps_sinit.c. */XWdtPs_Config *XWdtPs_LookupConfig(u16 DeviceId);/* * Interface functions in xwdtps.c */int XWdtPs_CfgInitialize(XWdtPs *InstancePtr,			XWdtPs_Config *ConfigPtr, u32 EffectiveAddress);void XWdtPs_Start(XWdtPs *InstancePtr);void XWdtPs_Stop(XWdtPs *InstancePtr);void XWdtPs_EnableOutput(XWdtPs *InstancePtr, u8 Signal);void XWdtPs_DisableOutput(XWdtPs *InstancePtr, u8 Signal);u32 XWdtPs_GetExternalSignalLength(XWdtPs *InstancePtr);void XWdtPs_SetExternalSignalLength(XWdtPs *InstancePtr, u32 Length);u32 XWdtPs_GetControlValue(XWdtPs *InstancePtr, u8 Control);void XWdtPs_SetControlValue(XWdtPs *InstancePtr, u8 Control, u32 Value);/* * Self-test function in xwdttb_selftest.c. */int XWdtPs_SelfTest(XWdtPs *InstancePtr);#ifdef __cplusplus}#endif#endif /* end of protection macro */

⌨️ 快捷键说明

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