/* Send data as a master on the IIC bus. This function sends the data using polled I/O and blocks until the data has been sent. It only supports 7 bit addressing and non-repeated start modes of operation. The user is responsible for ensuring the bus is not busy if multiple masters are present on the bus. */
unsigned XIic_Send(u32 BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount)
/* Send data as a master on the IIC bus. This function sends the data using polled I/O and blocks until the data has been sent. It only supports 7 bit addressing and non-repeated start modes of operation. The user is responsible for ensuring the bus is not busy if multiple masters are present on the bus. */
unsigned XIic_Send(u32 BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount)
{
	unsigned RemainingByteCount;
	XIic_mSend7BitAddress (BaseAddress, Address, XIIC_WRITE_OPERATION);
	XIic_mClearIisr (BaseAddress, XIIC_INTR_TX_EMPTY_MASK |
			 XIIC_INTR_TX_ERROR_MASK | XIIC_INTR_ARB_LOST_MASK);
	XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET,
		  XIIC_CR_MSMS_MASK | XIIC_CR_DIR_IS_TX_MASK |
		  XIIC_CR_ENABLE_DEVICE_MASK);
	XIic_mClearIisr (BaseAddress, XIIC_INTR_BNB_MASK);
	RemainingByteCount = SendData (BaseAddress, BufferPtr, ByteCount);
	XIo_Out8 (BaseAddress + XIIC_CR_REG_OFFSET, 0);
	return ByteCount - RemainingByteCount;
}