EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 175
Low Performance Peripherals (LPP)
while (pageCount != 0)
{
if (isRead) /* Read */
{
/* Update the preamble information. */
preamble.length = 4;
preamble.buffer[0] = devAddr;
preamble.buffer[1] = (uint8_t )(byteAddress >> 8);
preamble.buffer[2] = (uint8_t)(byteAddress & 0xFF);
preamble.buffer[3] = (devAddr | 0x01);
preamble.ctrlMask = 0x0004;
buf_p.size = glI2cPageSize;
buf_p.count = glI2cPageSize;
status = CyU3PI2cSendCommand (&preamble, glI2cPageSize, isRead);
status = CyU3PDmaChannelSetupRecvBuffer (&glI2cRxHandle, &buf_p);
status = CyU3PDmaChannelWaitForCompletion(&glI2cRxHandle, 0x7FFF);
}
else /* Write */
{
/* Update the preamble information. */
preamble.length = 3;
preamble.buffer[0] = devAddr;
preamble.buffer[1] = (uint8_t)(byteAddress >> 8);
preamble.buffer[2] = (uint8_t)(byteAddress & 0xFF);
preamble.ctrlMask = 0x0000;
buf_p.size = glI2cPageSize;
buf_p.count = glI2cPageSize;
status = CyU3PDmaChannelSetupSendBuffer (&glI2cTxHandle, &buf_p);
status = CyU3PI2cSendCommand (&preamble, glI2cPageSize, isRead);
status = CyU3PDmaChannelWaitForCompletion(&glI2cTxHandle, 0x7FFF);
}
/* Update the parameters */
byteAddress += glI2cPageSize;
buf_p.buffer += glI2cPageSize;
pageCount --;
/* Need a delay between write operations. */
CyU3PThreadSleep (10);
}
}
8.3 Serial Peripheral Interface
8.3.1 SPI Block Features
â– Supports master mode only
â– Supports all four SPI transfer modes (programmable SPI clock polarity and phase)
â– Complies with the Motorola SPI specification in chapter 8 of the MC68HC11 reference manual
â– Supports register-based and DMA-based transfers
â– Supports programmable data unit length of 4 bit, 8 bit,16 bit, and 32 bit, MSB or LSB first