libpynq
(release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
|
Go to the documentation of this file.
71 #define _DEFAULT_SOURCE
89 static unsigned RecvData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
91 static unsigned SendData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
117 unsigned XIic_Recv(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr,
118 unsigned ByteCount, u8 Option) {
120 unsigned RemainingByteCount;
121 volatile u32 StatusReg;
153 if (ByteCount == 1) {
177 if (ByteCount == 1) {
190 RemainingByteCount = RecvData(BaseAddress, BufferPtr, ByteCount, Option);
207 return ByteCount - RemainingByteCount;
236 static unsigned RecvData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
244 while (ByteCount > 0) {
250 if (ByteCount == 1) {
271 if (IntrStatus & IntrStatusMask) {
283 if (ByteCount == 1) {
301 if (ByteCount == 2) {
373 unsigned XIic_Send(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr,
374 unsigned ByteCount, u8 Option) {
375 unsigned RemainingByteCount;
377 volatile u32 StatusReg;
418 time_t s = time(NULL);
422 time_t n = time(NULL);
424 printf(
"IIC timeout bus not busy.\n");
443 RemainingByteCount = SendData(BaseAddress, BufferPtr, ByteCount, Option);
470 return ByteCount - RemainingByteCount;
494 static unsigned SendData(UINTPTR BaseAddress, u8 *BufferPtr,
unsigned ByteCount,
502 while (ByteCount > 0) {
642 if (BusyCount++ > 10000) {
#define XIIC_DTR_REG_OFFSET
#define XIIC_RFD_REG_OFFSET
#define XIIC_CR_DIR_IS_TX_MASK
#define XIic_ClearIisr(BaseAddress, InterruptMask)
#define XIIC_INTR_ARB_LOST_MASK
#define XIIC_DRR_REG_OFFSET
#define XIIC_WRITE_OPERATION
unsigned XIic_Recv(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount, u8 Option)
#define XIic_ReadReg(BaseAddress, RegOffset)
#define XIIC_SR_BUS_BUSY_MASK
#define XIIC_SR_REG_OFFSET
#define XIIC_INTR_TX_ERROR_MASK
unsigned XIic_Send(UINTPTR BaseAddress, u8 Address, u8 *BufferPtr, unsigned ByteCount, u8 Option)
#define XIIC_INTR_RX_FULL_MASK
#define XIIC_READ_OPERATION
#define XIIC_CR_REG_OFFSET
#define XIic_Send7BitAddress(BaseAddress, SlaveAddress, Operation)
#define XIIC_INTR_BNB_MASK
#define XIic_ReadIisr(BaseAddress)
#define XIIC_CR_NO_ACK_MASK
#define XIIC_CR_REPEATED_START_MASK
#define XIIC_CR_ENABLE_DEVICE_MASK
#define XIIC_CR_MSMS_MASK
#define XIic_WriteReg(BaseAddress, RegOffset, RegisterValue)
#define XIIC_REPEATED_START
u32 XIic_CheckIsBusBusy(UINTPTR BaseAddress)
u32 XIic_WaitBusFree(UINTPTR BaseAddress)
#define XIIC_SR_ADDR_AS_SLAVE_MASK
#define XIIC_INTR_TX_EMPTY_MASK