71#define _DEFAULT_SOURCE
85static unsigned RecvData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
87static unsigned SendData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
113unsigned XIic_Recv(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr,
114 unsigned ByteCount, u8 Option) {
116 unsigned RemainingByteCount;
117 volatile u32 StatusReg;
149 if (ByteCount == 1) {
172 CntlReg &= ~XIIC_CR_DIR_IS_TX_MASK;
173 if (ByteCount == 1) {
186 RemainingByteCount = RecvData(BaseAddress, BufferPtr, ByteCount, Option);
203 return ByteCount - RemainingByteCount;
232static unsigned RecvData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
240 while (ByteCount > 0) {
246 if (ByteCount == 1) {
267 if (IntrStatus & IntrStatusMask) {
279 if (ByteCount == 1) {
297 if (ByteCount == 2) {
369unsigned XIic_Send(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr,
370 unsigned ByteCount, u8 Option) {
371 unsigned RemainingByteCount;
373 volatile u32 StatusReg;
433 RemainingByteCount = SendData(BaseAddress, BufferPtr, ByteCount, Option);
460 return ByteCount - RemainingByteCount;
484static unsigned SendData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
492 while (ByteCount > 0) {
632 if (BusyCount++ > 10000) {
u32 XIic_CheckIsBusBusy(UINTPTR BaseAddress)
unsigned XIic_Recv(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount, u8 Option)
unsigned XIic_Send(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount, u8 Option)
u32 XIic_WaitBusFree(UINTPTR BaseAddress)
#define XIIC_CR_REG_OFFSET
#define XIIC_SR_BUS_BUSY_MASK
#define XIIC_INTR_BNB_MASK
#define XIIC_CR_REPEATED_START_MASK
#define XIIC_DTR_REG_OFFSET
#define XIIC_CR_NO_ACK_MASK
#define XIic_WriteReg(BaseAddress, RegOffset, RegisterValue)
#define XIic_Send7BitAddress(BaseAddress, SlaveAddress, Operation)
#define XIIC_DRR_REG_OFFSET
#define XIIC_WRITE_OPERATION
#define XIIC_SR_REG_OFFSET
#define XIIC_INTR_TX_ERROR_MASK
#define XIIC_CR_ENABLE_DEVICE_MASK
#define XIIC_SR_ADDR_AS_SLAVE_MASK
#define XIic_ReadReg(BaseAddress, RegOffset)
#define XIIC_READ_OPERATION
#define XIIC_INTR_ARB_LOST_MASK
#define XIIC_INTR_RX_FULL_MASK
#define XIIC_RFD_REG_OFFSET
#define XIIC_INTR_TX_EMPTY_MASK
#define XIIC_REPEATED_START
#define XIIC_CR_DIR_IS_TX_MASK
#define XIic_ReadIisr(BaseAddress)
#define XIic_ClearIisr(BaseAddress, InterruptMask)
#define XIIC_CR_MSMS_MASK