XilinxProcessorIPLib/drivers/qspipsu/examples/xqspipsu_generic_nand_flash_polled_example.c
int FlashStatusWrite(XQspiPsu *QspiPsuPtr, u8 RegAddr, u8 Data)
{
	u8 WriteBfr[5];
	int Status = XST_FAILURE;

	WriteBfr[COMMAND_OFFSET] = WRITE_STATUS_CMD;
	WriteBfr[ADDRESS_1_OFFSET] = RegAddr;
	WriteBfr[2] = Data;

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

	Status = XQspiPsu_PolledTransfer(QspiPsuPtr, FlashMsg, 1);
	if (Status != XST_SUCCESS) {
		return Status;
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
 *
 * 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	Data to be written to register.
 *
 * @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       Data to be written to register.



@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 Data to be written to register . @note This API can only be used for one flash at a time .
int FlashStatusWrite(XQspiPsu *QspiPsuPtr, u8 RegAddr, u8 Data)
{
	u8 WriteBfr[5];
	int Status = XST_FAILURE;
	WriteBfr[COMMAND_OFFSET] = WRITE_STATUS_CMD;
	WriteBfr[ADDRESS_1_OFFSET] = RegAddr;
	WriteBfr[2] = Data;
	FlashMsg[0].TxBfrPtr = WriteBfr;
	FlashMsg[0].RxBfrPtr = NULL;
	FlashMsg[0].ByteCount = 3;
	FlashMsg[0].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
	FlashMsg[0].Flags = XQSPIPSU_MSG_FLAG_TX;
	Status = XQspiPsu_PolledTransfer(QspiPsuPtr, FlashMsg, 1);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	return XST_SUCCESS;
}
int FlashStatusWrite ( XQspiPsu * QspiPsuPtr , u8 RegAddr , u8 Data ) { u8 WriteBfr [ 5 ] ; int Status = XST_FAILURE ; WriteBfr [ COMMAND_OFFSET ] = WRITE_STATUS_CMD ; WriteBfr [ ADDRESS_1_OFFSET ] = RegAddr ; WriteBfr [ 2 ] = Data ; FlashMsg [ 0 ] . TxBfrPtr = WriteBfr ; FlashMsg [ 0 ] . RxBfrPtr = NULL ; FlashMsg [ 0 ] . ByteCount = 3 ; FlashMsg [ 0 ] . BusWidth = XQSPIPSU_SELECT_MODE_SPI ; FlashMsg [ 0 ] . Flags = XQSPIPSU_MSG_FLAG_TX ; Status = XQspiPsu_PolledTransfer ( QspiPsuPtr , FlashMsg , 1 ) ; if ( Status != XST_SUCCESS ) { return Status ; } return XST_SUCCESS ; }
This API can be used to write to a flash register.
This API can be used to write to a flash register .