/**
*
* Resets the IIC device. Reset must only be called after the driver has been
* initialized. The configuration of the device after reset is the same as its
* configuration after initialization.  Any data transfer that is in progress is
* aborted.
*
* The upper layer software is responsible for re-configuring (if necessary)
* and reenabling interrupts for the IIC device after the reset.
*
* @param	InstancePtr is a pointer to the XIicPs instance.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
void XIicPs_Reset(XIicPs *InstancePtr)
{

	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	/*
	 * Abort any transfer that is in progress.
	 */
	XIicPs_Abort(InstancePtr);

	/*
	 * Reset any values so the software state matches the hardware device.
	 */
	XIicPs_WriteReg(InstancePtr->Config.BaseAddress, XIICPS_CR_OFFSET,
			  XIICPS_CR_RESET_VALUE);
	XIicPs_WriteReg(InstancePtr->Config.BaseAddress,
			  XIICPS_TIME_OUT_OFFSET, XIICPS_TO_RESET_VALUE);
	XIicPs_WriteReg(InstancePtr->Config.BaseAddress, XIICPS_IDR_OFFSET,
			  XIICPS_IXR_ALL_INTR_MASK);

}
Exemple #2
0
/*
 * IIC Abort Transaction
 */
int iic_reset_init_abort(XIicPs *IicPs, u16 DeviceId, u32 ClkRate) {
	//Variables
//	int i = 0;

//	//Check if IIC is busy
//	while (XIicPs_BusIsBusy(IicPs)) {
//		i++;
//		if (i >= 1000) {
//#ifdef DEBUG
//			myprintf("Cannot abort IIC Transaction because IIC is busy.\r\n");
//#endif
//			return XST_FAILURE;
//		}
//	}

//Reset and Init
//	XIicPs_ResetHw(IIC_BASE_ADDR);
	iic_init(IicPs, IIC_DEVICE_ID, IIC_SCLK_RATE);
//	XIicPs_Reset(IicPs);

//Abort and return
	XIicPs_Abort(IicPs);
	return XST_SUCCESS;
}