📄 xiic_i.h
字号:
/* $Id: xiic_i.h,v 1.1 2007/12/03 15:44:58 meinelte Exp $ *//******************************************************************************** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS* FOR A PARTICULAR PURPOSE.** (c) Copyright 2002-07 Xilinx Inc.* All rights reserved.*******************************************************************************//*****************************************************************************//**** @file xiic_i.h** This header file contains internal identifiers, which are those shared* between XIic components. The identifiers in this file are not intended for* use external to the driver.** <pre>* MODIFICATION HISTORY:** Ver Who Date Changes* ----- ---- -------- -----------------------------------------------* 1.01a rfp 10/19/01 release* 1.01c ecm 12/05/02 new rev* 1.13a wgr 03/22/07 Converted to new coding style.* </pre>*******************************************************************************/#ifndef XIIC_I_H /* prevent circular inclusions */#define XIIC_I_H /* by using protection macros */#ifdef __cplusplusextern "C" {#endif/***************************** Include Files *********************************/#include "xbasic_types.h"#include "xstatus.h"#include "xiic.h"/************************** Constant Definitions *****************************//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//******************************************************************************** This macro sends the first byte of the address for a 10 bit address during* both read and write operations. It takes care of the details to format the* address correctly.** address = 1111_0xxD xx = address MSBits* D = Tx direction = 0 = write** @param SlaveAddress contains the address of the slave to send to.* @param Operation indicates XIIC_READ_OPERATION or XIIC_WRITE_OPERATION** @return None.** @note Signature:* void XIic_mSend10BitAddrByte1(u16 SlaveAddress, u8 Operation);*******************************************************************************/#define XIic_mSend10BitAddrByte1(SlaveAddress, Operation) \{ \ u8 LocalAddr = (u8)((SlaveAddress) >> 7); \ LocalAddr = (LocalAddr & 0xF6) | 0xF0 | (Operation); \ XIo_Out8(InstancePtr->BaseAddress + XIIC_DTR_REG_OFFSET, LocalAddr); \}/******************************************************************************** This macro sends the second byte of the address for a 10 bit address during* both read and write operations. It takes care of the details to format the* address correctly.** @param SlaveAddress contains the address of the slave to send to.** @return None.** @note Signature: void XIic_mSend10BitAddrByte2(u16 SlaveAddress,* u8 Operation);*******************************************************************************/#define XIic_mSend10BitAddrByte2(SlaveAddress) \ XIo_Out8(InstancePtr->BaseAddress + XIIC_DTR_REG_OFFSET, \ (u8)(SlaveAddress));/******************************************************************************** This macro sends the address for a 7 bit address during both read and write* operations. It takes care of the details to format the address correctly.** @param SlaveAddress contains the address of the slave to send to.* @param Operation indicates XIIC_READ_OPERATION or XIIC_WRITE_OPERATION** @return None.** @note Signature:* void XIic_mSend7BitAddr(u16 SlaveAddress, u8 Operation);*******************************************************************************/#define XIic_mSend7BitAddr(SlaveAddress, Operation) \{ \ u8 LocalAddr = (u8)(SlaveAddress << 1); \ LocalAddr = (LocalAddr & 0xFE) | (Operation); \ XIo_Out8(InstancePtr->BaseAddress + XIIC_DTR_REG_OFFSET, LocalAddr); \}/******************************************************************************** This macro disables the specified interrupts in the Interrupt enable* register. It is non-destructive in that the register is read and only the* interrupts specified is changed.** @param BaseAddress is the base address of the IIC device.* @param InterruptMask contains the interrupts to be disabled** @return None.** @note Signature:* void XIic_mDisableIntr(u32 BaseAddress, u32 InterruptMask);*******************************************************************************/#define XIic_mDisableIntr(BaseAddress, InterruptMask) \ XIIC_WRITE_IIER((BaseAddress), \ XIIC_READ_IIER(BaseAddress) & ~(InterruptMask))/******************************************************************************** This macro enables the specified interrupts in the Interrupt enable* register. It is non-destructive in that the register is read and only the* interrupts specified is changed.** @param BaseAddress is the base address of the IIC device.* @param InterruptMask contains the interrupts to be disabled** @return None.** @note Signature:* void XIic_mEnableIntr(u32 BaseAddress, u32 InterruptMask);*******************************************************************************/#define XIic_mEnableIntr(BaseAddress, InterruptMask) \ XIIC_WRITE_IIER((BaseAddress), \ XIIC_READ_IIER(BaseAddress) | (InterruptMask))/******************************************************************************** This macro clears the specified interrupt in the Interrupt status* register. It is non-destructive in that the register is read and only the* interrupt specified is cleared. Clearing an interrupt acknowledges it.** @param BaseAddress is the base address of the IIC device.* @param InterruptMask contains the interrupts to be disabled** @return None.** @note Signature:* void XIic_mClearIntr(u32 BaseAddress, u32 InterruptMask);*******************************************************************************/#define XIic_mClearIntr(BaseAddress, InterruptMask) \ XIIC_WRITE_IISR((BaseAddress), \ XIIC_READ_IISR(BaseAddress) & (InterruptMask))/******************************************************************************** This macro clears and enables the specified interrupt in the Interrupt* status and enable registers. It is non-destructive in that the registers are* read and only the interrupt specified is modified.* Clearing an interrupt acknowledges it.** @param BaseAddress is the base address of the IIC device.* @param InterruptMask contains the interrupts to be cleared and enabled** @return None.** @note Signature:* void XIic_mClearEnableIntr(u32 BaseAddress, u32 InterruptMask);*******************************************************************************/#define XIic_mClearEnableIntr(BaseAddress, InterruptMask) \{ \ XIIC_WRITE_IISR(BaseAddress, \ (XIIC_READ_IISR(BaseAddress) & (InterruptMask))); \ \ XIIC_WRITE_IIER(BaseAddress, \ (XIIC_READ_IIER(BaseAddress) | (InterruptMask))); \}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -