EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 182
Low Performance Peripherals (LPP)
CyU3PDebugPrint (2, "SPI READ command failed\r\n");
CyU3PSpiSetSsnLine (CyTrue);
}
CyU3PSpiSetBlockXfer (0, glSpiPageSize);
status = CyU3PDmaChannelSetupRecvBuffer (&glSpiRxHandle, &buf_p);
if (status != CY_U3P_SUCCESS)
{
CyU3PSpiSetSsnLine (CyTrue);
}
status = CyU3PDmaChannelWaitForCompletion (&glSpiRxHandle, 5000);
if (status != CY_U3P_SUCCESS)
{
CyU3PSpiSetSsnLine (CyTrue);
}
CyU3PSpiSetSsnLine (CyTrue);
CyU3PSpiDisableBlockXfer (CyFalse, CyTrue);
}
else /* Write */
{
location[0] = 0x02; /* Write command */
buf_p.size = glSpiPageSize;
buf_p.count = glSpiPageSize;
status = CyFxSpiWaitForStatus ();
CyU3PSpiSetSsnLine (CyFalse);
status = CyU3PSpiTransmitWords (location, 4);
if (status != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (2, "SPI WRITE command failed\r\n");
CyU3PSpiSetSsnLine (CyTrue);
}
CyU3PSpiSetBlockXfer (glSpiPageSize, 0);
status = CyU3PDmaChannelSetupSendBuffer (&glSpiTxHandle, &buf_p);
if (status != CY_U3P_SUCCESS)
{
CyU3PSpiSetSsnLine (CyTrue);
}
status = CyU3PDmaChannelWaitForCompletion(&glSpiTxHandle, 5000);
if (status != CY_U3P_SUCCESS)
{
CyU3PSpiSetSsnLine (CyTrue);
}
CyU3PSpiSetSsnLine (CyTrue);
CyU3PSpiDisableBlockXfer (CyTrue, CyFalse);
}
/* Update the parameters */
byteAddress += glSpiPageSize;
buf_p.buffer += glSpiPageSize;
pageCount --;