XilinxProcessorIPLib/drivers/iicps/examples/xiicps_eeprom_intr_example.c
static int IicPsSlaveMonitor(u16 Address, u16 DeviceId, u32 Int_Id)
{
	u32 Index;
	int Status;
	XIicPs *IicPtr;

	SlaveResponse = FALSE;
	/*
	 * Initialize the IIC driver so that it is ready to use.
	 */
	Status = IicPsConfig(DeviceId,Int_Id);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	IicPtr = &IicInstance;
	XIicPs_DisableAllInterrupts(IicPtr->Config.BaseAddress);
	XIicPs_EnableSlaveMonitor(&IicInstance, Address);

	TotalErrorCount = 0;

	Index = 0;

	/*
	 * Wait for the Slave Monitor Interrupt, the interrupt processing
	 * works in the background, this function may get locked up in this
	 * loop if the interrupts are not working correctly or the slave
	 * never responds.
	 */
	while ((!SlaveResponse) && (Index < SLV_MON_LOOP_COUNT)) {
		Index++;

		/*
		 * Ignore any errors. The hardware generates NACK interrupts
		 * if the slave is not present.
		 */
		if (0 != TotalErrorCount) {
			xil_printf("Test error unexpected NACK\n");
			return XST_FAILURE;
		}
	}

	if (Index >= SLV_MON_LOOP_COUNT) {
		return XST_FAILURE;

	}

	XIicPs_DisableSlaveMonitor(&IicInstance);
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function checks the availability of a slave using slave monitor mode.
*
* @param	DeviceId is the Device ID of the IicPs Device and is the
*		XPAR_<IICPS_instance>_DEVICE_ID value from xparameters.h
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note 	None.
*
*******************************************************************************/
This function checks the availability of a slave using slave monitor mode.
This function checks the availability of a slave using slave monitor mode .
static int IicPsSlaveMonitor(u16 Address, u16 DeviceId, u32 Int_Id)
{
	u32 Index;
	int Status;
	XIicPs *IicPtr;
	SlaveResponse = FALSE;
	Status = IicPsConfig(DeviceId,Int_Id);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	IicPtr = &IicInstance;
	XIicPs_DisableAllInterrupts(IicPtr->Config.BaseAddress);
	XIicPs_EnableSlaveMonitor(&IicInstance, Address);
	TotalErrorCount = 0;
	Index = 0;
	while ((!SlaveResponse) && (Index < SLV_MON_LOOP_COUNT)) {
		Index++;
		if (0 != TotalErrorCount) {
			xil_printf("Test error unexpected NACK\n");
			return XST_FAILURE;
		}
	}
	if (Index >= SLV_MON_LOOP_COUNT) {
		return XST_FAILURE;
	}
	XIicPs_DisableSlaveMonitor(&IicInstance);
	return XST_SUCCESS;
}
static int IicPsSlaveMonitor ( u16 Address , u16 DeviceId , u32 Int_Id ) { u32 Index ; int Status ; XIicPs * IicPtr ; SlaveResponse = FALSE ; Status = IicPsConfig ( DeviceId , Int_Id ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } IicPtr = & IicInstance ; XIicPs_DisableAllInterrupts ( IicPtr -> Config . BaseAddress ) ; XIicPs_EnableSlaveMonitor ( & IicInstance , Address ) ; TotalErrorCount = 0 ; Index = 0 ; while ( ( ! SlaveResponse ) && ( Index < SLV_MON_LOOP_COUNT ) ) { Index ++ ; if ( 0 != TotalErrorCount ) { xil_printf ( " \n " ) ; return XST_FAILURE ; } } if ( Index >= SLV_MON_LOOP_COUNT ) { return XST_FAILURE ; } XIicPs_DisableSlaveMonitor ( & IicInstance ) ; return XST_SUCCESS ; }
This function checks the availability of a slave using slave monitor mode.
This function checks the availability of a slave using slave monitor mode .
/*
	 * Initialize the IIC driver so that it is ready to use.
	 */ /*
	 * Wait for the Slave Monitor Interrupt, the interrupt processing
	 * works in the background, this function may get locked up in this
	 * loop if the interrupts are not working correctly or the slave
	 * never responds.
	 */ /*
		 * Ignore any errors. The hardware generates NACK interrupts
		 * if the slave is not present.
		 */