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

📄 xiic.h

📁 FPGA 并行NOR FLash的操作相关
💻 H
📖 第 1 页 / 共 2 页
字号:
/* $Id: xiic.h,v 1.3 2007/12/17 19:15:38 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-2007 Xilinx Inc.*       All rights reserved.*******************************************************************************//*****************************************************************************//**** @file xiic.h** XIic is the driver for an IIC master or slave device.** In order to reduce the memory requirements of the driver the driver is* partitioned such that there are optional parts of the driver.* Slave, master, and multimaster features are optional such that all these files* are not required at the same time.* In order to use the slave and multimaster features of the driver, the user* must call functions (XIic_SlaveInclude and XIic_MultiMasterInclude)* to dynamically include the code. These functions may be called at any time.** Two sets of higher level API's are available in the XIic driver that can* be used for Transmission/Reception in Master mode :* - XIic_MasterSend()/ XIic_MasterRecv() which is used in normal mode.* - XIic_DynMasterSend()/XIic_DynMasterRecv() which is used in Dynamic mode.** Similarly two sets of lower level API's are available in XIic driver that* can be used for Transmission/Reception in Master mode:* - XIic_Send()/XIic_Recv() which is used in normal mode* - XIic_DynSend()/XIic_DynRecv() which is used in Dynamic mode.** The user should use a single set of APIs as per his requirement and* should not intermix them.** All the driver APIs can be used for read, write and  combined mode of* operations on the IIC bus.** In the normal mode IIC support both 7-bit and 10-bit addressing, and in* the dynamic mode support only 7-bit addressing.** <b>Initialization & Configuration</b>** The XIic_Config structure is used by the driver to configure itself. This* configuration structure is typically created by the tool-chain based on HW* build properties.** To support multiple runtime loading and initialization strategies employed* by various operating systems, the driver instance can be initialized in one* of the following ways:**   - XIic_Initialize(InstancePtr, DeviceId) - The driver looks up its own*     configuration structure created by the tool-chain based on an ID provided*     by the tool-chain.**   - XIic_CfgInitialize(InstancePtr, CfgPtr, EffectiveAddr) - Uses a*     configuration structure provided by the caller. If running in a system*     with address translation, the provided virtual memory base address*     replaces the physical address present in the configuration structure.** <b>General Purpose Output</b>* The IIC hardware provides a General Purpose Output Register that allows the* user to connect general purpose outputs to devices, such as a write protect,* for an EEPROM. This register is parameterizable in the hardware such that* there could be zero bits in this register and in this case it will cause* a bus error if read or written.** <b>Bus Throttling</b>** The IIC hardware provides bus throttling which allows either the device, as* either a master or a slave, to stop the clock on the IIC bus. This feature* allows the software to perform the appropriate processing for each interrupt* without an unreasonable response restriction.  With this design, it is* important for the user to understand the implications of bus throttling.** <b>Repeated Start</b>** An application can send multiple messages, as a master, to a slave device* and re-acquire the IIC bus each time a message is sent. The repeated start* option allows the application to send multiple messages without re-acquiring* the IIC bus for each message. The transactions involving repeated start* are also called combined transfers if there is Read and Write in the* same transaction.** The repeated start feature works with all the API's in XIic driver.** The Repeated Start feature also could cause the application to lock up, or* monopolize the IIC bus, should repeated start option be enabled and sequences* of messages never end(periodic data collection).* Also when repeated start is not disable before the last master message is* sent or received, will leave the bus captive to the master, but unused.** <b>Addressing</b>** The IIC hardware is parameterized such that it can be built for 7 or 10* bit addresses. The driver provides the ability to control which address* size is sent in messages as a master to a slave device.  The address size* which the hardware responds to as a slave is parameterized as 7 or 10 bits* but fixed by the hardware build.** Addresses are represented as hex values with no adjustment for the data* direction bit as the software manages address bit placement. This is* especially important as the bit placement is not handled the same depending* on which options are used such as repeated start and 7 vs 10 bit addessing.** <b>Data Rates</b>** The IIC hardware is parameterized such that it can be built to support* data rates from DC to 400KBit. The frequency of the interrupts which* occur is proportional to the data rate.** <b>Polled Mode Operation</b>** This driver does not provide a polled mode of operation primarily because* polled mode which is non-blocking is difficult with the amount of* interaction with the hardware that is necessary.** <b>Interrupts</b>** The device has many interrupts which allow IIC data transactions as well* as bus status processing to occur.** The interrupts are divided into two types, data and status. Data interrupts* indicate data has been received or transmitted while the status interrupts* indicate the status of the IIC bus. Some of the interrupts, such as Not* Addressed As Slave and Bus Not Busy, are only used when these specific* events must be recognized as opposed to being enabled at all times.** Many of the interrupts are not a single event in that they are continuously* present such that they must be disabled after recognition or when undesired.* Some of these interrupts, which are data related, may be acknowledged by the* software by reading or writing data to the appropriate register, or must* be disabled. The following interrupts can be continuous rather than single* events.*   - Data Transmit Register Empty/Transmit FIFO Empty*   - Data Receive Register Full/Receive FIFO*   - Transmit FIFO Half Empty*   - Bus Not Busy*   - Addressed As Slave*   - Not Addressed As Slave** The following interrupts are not passed directly to the application thru the* status callback.  These are only used internally for the driver processing* and may result in the receive and send handlers being called to indicate* completion of an operation.  The following interrupts are data related* rather than status.*   - Data Transmit Register Empty/Transmit FIFO Empty*   - Data Receive Register Full/Receive FIFO*   - Transmit FIFO Half Empty*   - Slave Transmit Complete** <b>Interrupt To Event Mapping</b>** The following table provides a mapping of the interrupts to the events which* are passed to the status handler and the intended role (master or slave) for* the event.  Some interrupts can cause multiple events which are combined* together into a single status event such as XII_MASTER_WRITE_EVENT and* XII_GENERAL_CALL_EVENT* <pre>* Interrupt                         Event(s)                     Role** Arbitration Lost Interrupt        XII_ARB_LOST_EVENT            Master* Transmit Error                    XII_SLAVE_NO_ACK_EVENT        Master* IIC Bus Not Busy                  XII_BUS_NOT_BUSY_EVENT        Master* Addressed As Slave                XII_MASTER_READ_EVENT,        Slave*                                   XII_MASTER_WRITE_EVENT,       Slave*                                   XII_GENERAL_CALL_EVENT        Slave* </pre>* <b>Not Addressed As Slave Interrupt</b>** The Not Addressed As Slave interrupt is not passed directly to the* application thru the status callback.  It is used to determine the end of* a message being received by a slave when there was no stop condition* (repeated start).  It will cause the receive handler to be called to* indicate completion of the operation.** <b>RTOS Independence</b>** 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.01a rfp  10/19/01 release* 1.01c ecm  12/05/02 new rev* 1.01d jhl  10/08/03 Added general purpose output feature* 1.01d sv   05/09/05 Changed the data being written to the Address/Control*                     Register and removed the code for testing the*                     Receive Data Register in XIic_SelfTest function of*                     xiic_selftest.c source file* 1.02a jvb  12/14/05 I separated dependency on the static config table and*                     xparameters.h from the driver initialization by moving*                     _Initialize and _LookupConfig to _sinit.c. I also added*                     the new _CfgInitialize routine.* 1.02a mta  03/09/06 Added a new function XIic_IsIicBusy() which returns*					  whether IIC Bus is Busy or Free.* 1.02a mta  03/09/06 Implemented Repeated Start in the Low Level Driver.* 1.03a mta  07/17/06 Added files to support Dynamic IIC controller in High*		      level driver. Added xiic_dyn_master.c. Added support* 		      for IIC Dynamic controller in Low level driver in xiic_l.c* 1.13a wgr  03/22/07 Converted to new coding style.* 1.13b ecm  11/29/07 added BB polling loops to the DynSend and DynRecv*					  routines to handle the race condition with BNB in IISR.* </pre>*******************************************************************************/#ifndef XIIC_H			/* prevent circular inclusions */#define XIIC_H			/* by using protection macros */#ifdef __cplusplusextern "C" {#endif/***************************** Include Files *********************************/#include "xbasic_types.h"#include "xstatus.h"#include "xiic_l.h"/************************** Constant Definitions *****************************//** @name Configuration options * * The following options may be specified or retrieved for the device and * enable/disable additional features of the IIC bus.  Each of the options * are bit fields such that more than one may be specified. * @{ *//** * <pre> * XII_GENERAL_CALL_OPTION      The general call option allows an IIC slave to *                              recognized the general call address. The status *                              handler is called as usual indicating the device *                              has been addressed as a slave with a general *                              call. It is the application's responsibility to *                              perform any special processing for the general *                              call. * * XII_REPEATED_START_OPTION    The repeated start option allows multiple *                              messages to be sent/received on the IIC bus

⌨️ 快捷键说明

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