XilinxProcessorIPLib/drivers/qspipsu/examples/xqspipsu_generic_nand_flash_interrupt_example.c
int FlashStatusRead(XQspiPsu *QspiPsuPtr, u8 RegAddr, u8 *ReadBfrPtr)
{
	u8 WriteBfr[2];
	int Status = XST_FAILURE;


	WriteBfr[COMMAND_OFFSET] = READ_STATUS_CMD;
	WriteBfr[ADDRESS_1_OFFSET] = RegAddr;

	FlashMsg[0].TxBfrPtr = WriteBfr;
	FlashMsg[0].RxBfrPtr = NULL;
	FlashMsg[0].ByteCount = 2;
	FlashMsg[0].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
	FlashMsg[0].Flags = XQSPIPSU_MSG_FLAG_TX;

	FlashMsg[1].TxBfrPtr = NULL;
	FlashMsg[1].RxBfrPtr = ReadBfrPtr;
	FlashMsg[1].ByteCount = 1;
	FlashMsg[1].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
	FlashMsg[1].Flags = XQSPIPSU_MSG_FLAG_RX;

	TransferInProgress = TRUE;
	Status = XQspiPsu_InterruptTransfer(QspiPsuPtr, FlashMsg, 2);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	while (TransferInProgress);

	return Status;
}
/*****************************************************************************/
/**
 *
 * This API can be used to write to a flash register.
 *
 * @param	QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
 * @param	RegAddr is the flash register address
 * @param	ReadBfrPtr is the pointer to value to be read.
 *
 * @return	XST_SUCCESS if successful, else XST_FAILURE.
 *
 * @note	This API can only be used for one flash at a time.
 *
 ******************************************************************************/
This API can be used to write to a flash register.
@param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
@param       RegAddr is the flash register address
@param       ReadBfrPtr is the pointer to value to be read.



@note        This API can only be used for one flash at a time.
This API can be used to write to a flash register . @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use . @param RegAddr is the flash register address @param ReadBfrPtr is the pointer to value to be read . @note This API can only be used for one flash at a time .
int FlashStatusRead(XQspiPsu *QspiPsuPtr, u8 RegAddr, u8 *ReadBfrPtr)
{
	u8 WriteBfr[2];
	int Status = XST_FAILURE;
	WriteBfr[COMMAND_OFFSET] = READ_STATUS_CMD;
	WriteBfr[ADDRESS_1_OFFSET] = RegAddr;
	FlashMsg[0].TxBfrPtr = WriteBfr;
	FlashMsg[0].RxBfrPtr = NULL;
	FlashMsg[0].ByteCount = 2;
	FlashMsg[0].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
	FlashMsg[0].Flags = XQSPIPSU_MSG_FLAG_TX;
	FlashMsg[1].TxBfrPtr = NULL;
	FlashMsg[1].RxBfrPtr = ReadBfrPtr;
	FlashMsg[1].ByteCount = 1;
	FlashMsg[1].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
	FlashMsg[1].Flags = XQSPIPSU_MSG_FLAG_RX;
	TransferInProgress = TRUE;
	Status = XQspiPsu_InterruptTransfer(QspiPsuPtr, FlashMsg, 2);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	while (TransferInProgress);
	return Status;
}
int FlashStatusRead ( XQspiPsu * QspiPsuPtr , u8 RegAddr , u8 * ReadBfrPtr ) { u8 WriteBfr [ 2 ] ; int Status = XST_FAILURE ; WriteBfr [ COMMAND_OFFSET ] = READ_STATUS_CMD ; WriteBfr [ ADDRESS_1_OFFSET ] = RegAddr ; FlashMsg [ 0 ] . TxBfrPtr = WriteBfr ; FlashMsg [ 0 ] . RxBfrPtr = NULL ; FlashMsg [ 0 ] . ByteCount = 2 ; FlashMsg [ 0 ] . BusWidth = XQSPIPSU_SELECT_MODE_SPI ; FlashMsg [ 0 ] . Flags = XQSPIPSU_MSG_FLAG_TX ; FlashMsg [ 1 ] . TxBfrPtr = NULL ; FlashMsg [ 1 ] . RxBfrPtr = ReadBfrPtr ; FlashMsg [ 1 ] . ByteCount = 1 ; FlashMsg [ 1 ] . BusWidth = XQSPIPSU_SELECT_MODE_SPI ; FlashMsg [ 1 ] . Flags = XQSPIPSU_MSG_FLAG_RX ; TransferInProgress = TRUE ; Status = XQspiPsu_InterruptTransfer ( QspiPsuPtr , FlashMsg , 2 ) ; if ( Status != XST_SUCCESS ) { return Status ; } while ( TransferInProgress ) ; return Status ; }
This API can be used to write to a flash register.
This API can be used to write to a flash register .