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

📄 my_led.h

📁 基于Xilinx-XUPV2P开发平台的嵌入式系统实验例程:实验4编写基本的应用程序
💻 H
字号:
//////////////////////////////////////////////////////////////////////////////
// Filename:          C:\XUP\Markets\Embedded\Workshops\courses\v81Embedded\xupv2pro\solutions\lab3/drivers/my_led_v1_00_a/src/my_led.h
// Version:           1.00.a
// Description:       my_led Driver Header File
// Date:              Wed Feb 08 15:59:38 2006 (by Create and Import Peripheral Wizard)
//////////////////////////////////////////////////////////////////////////////

#ifndef MY_LED_H
#define MY_LED_H

/***************************** Include Files *******************************/

#include "xbasic_types.h"
#include "xstatus.h"
#include "xio.h"

/************************** Constant Definitions ***************************/


/**
 * User Logic Slave Space Offsets
 * -- SLAVE_REG0 : user logic slave module register 0
 */
#define MY_LED_USER_SLAVE_SPACE_OFFSET (0x00000000)
#define MY_LED_SLAVE_REG0_OFFSET (MY_LED_USER_SLAVE_SPACE_OFFSET + 0x00000000)

/**
 * IPIF Reset/Mir Space Register Offsets
 * -- RST : software reset register
 * -- MIR : module identification register
 */
#define MY_LED_IPIF_RST_SPACE_OFFSET (0x00000100)
#define MY_LED_RST_OFFSET (MY_LED_IPIF_RST_SPACE_OFFSET + 0x00000000)
#define MY_LED_MIR_OFFSET (MY_LED_IPIF_RST_SPACE_OFFSET + 0x00000000)

/**
 * IPIF Reset/Mir Masks
 * -- IPIF_MAVN_MASK   : module major version number
 * -- IPIF_MIVN_MASK   : module minor version number
 * -- IPIF_MIVL_MASK   : module minor version letter
 * -- IPIF_BID_MASK    : module block id
 * -- IPIF_BTP_MASK    : module block type
 * -- IPIF_RESET       : software reset
 */
#define IPIF_MAVN_MASK (0xF0000000UL)
#define IPIF_MIVN_MASK (0x0FE00000UL)
#define IPIF_MIVL_MASK (0x001F0000UL)
#define IPIF_BID_MASK (0x0000FF00UL)
#define IPIF_BTP_MASK (0x000000FFUL)
#define IPIF_RESET (0x0000000A)

/***************** Macros (Inline Functions) Definitions *******************/

/**
 *
 * Write a value to a MY_LED register. A 32 bit write is performed.
 * If the component is implemented in a smaller width, only the least
 * significant data is written.
 *
 * @param   BaseAddress is the base address of the MY_LED device.
 * @param   RegOffset is the register offset from the base to write to.
 * @param   Data is the data written to the register.
 *
 * @return  None.
 *
 * @note    None.
 *
 * C-style signature:
 * 	void MY_LED_mWriteReg(Xuint32 BaseAddress, unsigned RegOffset, Xuint32 Data)
 *
 */
#define MY_LED_mWriteReg(BaseAddress, RegOffset, Data) \
 	XIo_Out32((BaseAddress) + (RegOffset), (Xuint32)(Data))

/**
 *
 * Read a value from a MY_LED register. A 32 bit read is performed.
 * If the component is implemented in a smaller width, only the least
 * significant data is read from the register. The most significant data
 * will be read as 0.
 *
 * @param   BaseAddress is the base address of the MY_LED device.
 * @param   RegOffset is the register offset from the base to write to.
 *
 * @return  Data is the data from the register.
 *
 * @note    None.
 *
 * C-style signature:
 * 	Xuint32 MY_LED_mReadReg(Xuint32 BaseAddress, unsigned RegOffset)
 *
 */
#define MY_LED_mReadReg(BaseAddress, RegOffset) \
 	XIo_In32((BaseAddress) + (RegOffset))


/**
 *
 * Write/Read value to/from MY_LED user logic slave registers.
 *
 * @param   BaseAddress is the base address of the MY_LED device.
 * @param   Value is the data written to the register.
 *
 * @return  Data is the data from the user logic slave register.
 *
 * @note    None.
 *
 * C-style signature:
 * 	Xuint32 MY_LED_mReadSlaveRegn(Xuint32 BaseAddress)
 *
 */
#define MY_LED_mWriteSlaveReg0(BaseAddress, Value) \
 	XIo_Out32((BaseAddress) + (MY_LED_SLAVE_REG0_OFFSET), (Xuint32)(Value))

#define MY_LED_mReadSlaveReg0(BaseAddress) \
 	XIo_In32((BaseAddress) + (MY_LED_SLAVE_REG0_OFFSET))

/**
 *
 * Reset MY_LED via software.
 *
 * @param   BaseAddress is the base address of the MY_LED device.
 *
 * @return  None.
 *
 * @note    None.
 *
 * C-style signature:
 * 	void MY_LED_mReset(Xuint32 BaseAddress)
 *
 */
#define MY_LED_mReset(BaseAddress) \
 	XIo_Out32((BaseAddress)+(MY_LED_RST_OFFSET), IPIF_RESET)

/**
 *
 * Read module identification information from MY_LED device.
 *
 * @param   BaseAddress is the base address of the MY_LED device.
 *
 * @return  None.
 *
 * @note    None.
 *
 * C-style signature:
 * 	Xuint32 MY_LED_mReadMIR(Xuint32 BaseAddress)
 *
 */
#define MY_LED_mReadMIR(BaseAddress) \
 	XIo_In32((BaseAddress)+(MY_LED_MIR_OFFSET))

/************************** Function Prototypes ****************************/


/**
 *
 * Run a self-test on the driver/device. Note this may be a destructive test if
 * resets of the device are performed.
 *
 * If the hardware system is not built correctly, this function may never
 * return to the caller.
 *
 * @param   baseaddr_p is the base address of the MY_LED instance to be worked on.
 *
 * @return
 *
 *    - XST_SUCCESS   if all self-test code passed
 *    - XST_FAILURE   if any self-test code failed
 *
 * @note    Caching must be turned off for this function to work.
 * @note    Self test may fail if data memory and device are not on the same bus.
 *
 */
XStatus MY_LED_SelfTest(void * baseaddr_p);

#endif // MY_LED_H

⌨️ 快捷键说明

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