lib/sw_services/xilisf/src/xilisf_write.c
static int WriteVCR(XIsf *InstancePtr, u8 Command, u32 Address,
			u8 *BufferPtr, u32 ByteCount)
{
	int Status = (int)(XST_FAILURE);
	int Mode;
	u8 *NULLPtr = NULL;

	if (BufferPtr[0] == 0xE7)
		Mode = XOSPIPSV_EDGE_MODE_DDR_PHY;
	else
		Mode = XOSPIPSV_EDGE_MODE_SDR_NON_PHY;

	Status = XIsf_WriteEnable(InstancePtr, XISF_WRITE_ENABLE);
	if (Status != (int)XST_SUCCESS)
		return (int)XST_FAILURE;

	if (InstancePtr->SpiInstPtr->OpMode == XOSPIPSV_DAC_EN_OPTION)
		XOspiPsv_ConfigureAutoPolling(InstancePtr->SpiInstPtr, Mode);

	FlashMsg.Opcode = Command;
	FlashMsg.Addrvalid = 1;
	FlashMsg.Addrsize = 3;
	if (InstancePtr->FourByteAddrMode == TRUE)
		FlashMsg.Addrsize = 4;
	FlashMsg.Addr = Address;
	FlashMsg.TxBfrPtr = BufferPtr;
	FlashMsg.RxBfrPtr = NULL;
	FlashMsg.ByteCount = ByteCount;
	FlashMsg.Flags = XOSPIPSV_MSG_FLAG_TX;
	FlashMsg.IsDDROpCode = 0;
	FlashMsg.Proto = 0;
	if (InstancePtr->SpiInstPtr->SdrDdrMode == XOSPIPSV_EDGE_MODE_DDR_PHY) {
		FlashMsg.Proto = XOSPIPSV_WRITE_8_8_8;
		FlashMsg.Addrsize = 4;
		FlashMsg.ByteCount = 2;
	}

	InstancePtr->SpiInstPtr->Msg = &FlashMsg;
	Status = XIsf_Transfer(InstancePtr, NULLPtr, NULLPtr, FlashMsg.ByteCount);
	if (Status != (int)XST_SUCCESS)
		return (int)XST_FAILURE;

	return Status;
}
/*****************************************************************************/
/**
 *
 * This function writes the volatile configuration register
 *
 * @param	InstancePtr is a pointer to the XIsf instance.
 * @param	Address is the address in the Serial Flash memory, where the
 *		data is to be written.
 * @param	BufferPtr is a pointer to the data to be written to Serial
 *		Flash.
 * @param	ByteCount is the number of bytes to be written.
 *
 * @return	XST_SUCCESS if successful else XST_FAILURE.
 *
 * @note
 *
 ******************************************************************************/
This function writes the volatile configuration register
@param       InstancePtr is a pointer to the XIsf instance.
@param       Address is the address in the Serial Flash memory, where the
data is to be written.
@param       BufferPtr is a pointer to the data to be written to Serial
Flash.
@param       ByteCount is the number of bytes to be written.



@note
This function writes the volatile configuration register @param InstancePtr is a pointer to the XIsf instance . @param Address is the address in the Serial Flash memory where the data is to be written . @param BufferPtr is a pointer to the data to be written to Serial Flash . @param ByteCount is the number of bytes to be written . @note
static int WriteVCR(XIsf *InstancePtr, u8 Command, u32 Address,
			u8 *BufferPtr, u32 ByteCount)
{
	int Status = (int)(XST_FAILURE);
	int Mode;
	u8 *NULLPtr = NULL;
	if (BufferPtr[0] == 0xE7)
		Mode = XOSPIPSV_EDGE_MODE_DDR_PHY;
	else
		Mode = XOSPIPSV_EDGE_MODE_SDR_NON_PHY;
	Status = XIsf_WriteEnable(InstancePtr, XISF_WRITE_ENABLE);
	if (Status != (int)XST_SUCCESS)
		return (int)XST_FAILURE;
	if (InstancePtr->SpiInstPtr->OpMode == XOSPIPSV_DAC_EN_OPTION)
		XOspiPsv_ConfigureAutoPolling(InstancePtr->SpiInstPtr, Mode);
	FlashMsg.Opcode = Command;
	FlashMsg.Addrvalid = 1;
	FlashMsg.Addrsize = 3;
	if (InstancePtr->FourByteAddrMode == TRUE)
		FlashMsg.Addrsize = 4;
	FlashMsg.Addr = Address;
	FlashMsg.TxBfrPtr = BufferPtr;
	FlashMsg.RxBfrPtr = NULL;
	FlashMsg.ByteCount = ByteCount;
	FlashMsg.Flags = XOSPIPSV_MSG_FLAG_TX;
	FlashMsg.IsDDROpCode = 0;
	FlashMsg.Proto = 0;
	if (InstancePtr->SpiInstPtr->SdrDdrMode == XOSPIPSV_EDGE_MODE_DDR_PHY) {
		FlashMsg.Proto = XOSPIPSV_WRITE_8_8_8;
		FlashMsg.Addrsize = 4;
		FlashMsg.ByteCount = 2;
	}
	InstancePtr->SpiInstPtr->Msg = &FlashMsg;
	Status = XIsf_Transfer(InstancePtr, NULLPtr, NULLPtr, FlashMsg.ByteCount);
	if (Status != (int)XST_SUCCESS)
		return (int)XST_FAILURE;
	return Status;
}
static int WriteVCR ( XIsf * InstancePtr , u8 Command , u32 Address , u8 * BufferPtr , u32 ByteCount ) { int Status = ( int ) ( XST_FAILURE ) ; int Mode ; u8 * NULLPtr = NULL ; if ( BufferPtr [ 0 ] == 0xE7 ) Mode = XOSPIPSV_EDGE_MODE_DDR_PHY ; else Mode = XOSPIPSV_EDGE_MODE_SDR_NON_PHY ; Status = XIsf_WriteEnable ( InstancePtr , XISF_WRITE_ENABLE ) ; if ( Status != ( int ) XST_SUCCESS ) return ( int ) XST_FAILURE ; if ( InstancePtr -> SpiInstPtr -> OpMode == XOSPIPSV_DAC_EN_OPTION ) XOspiPsv_ConfigureAutoPolling ( InstancePtr -> SpiInstPtr , Mode ) ; FlashMsg . Opcode = Command ; FlashMsg . Addrvalid = 1 ; FlashMsg . Addrsize = 3 ; if ( InstancePtr -> FourByteAddrMode == TRUE ) FlashMsg . Addrsize = 4 ; FlashMsg . Addr = Address ; FlashMsg . TxBfrPtr = BufferPtr ; FlashMsg . RxBfrPtr = NULL ; FlashMsg . ByteCount = ByteCount ; FlashMsg . Flags = XOSPIPSV_MSG_FLAG_TX ; FlashMsg . IsDDROpCode = 0 ; FlashMsg . Proto = 0 ; if ( InstancePtr -> SpiInstPtr -> SdrDdrMode == XOSPIPSV_EDGE_MODE_DDR_PHY ) { FlashMsg . Proto = XOSPIPSV_WRITE_8_8_8 ; FlashMsg . Addrsize = 4 ; FlashMsg . ByteCount = 2 ; } InstancePtr -> SpiInstPtr -> Msg = & FlashMsg ; Status = XIsf_Transfer ( InstancePtr , NULLPtr , NULLPtr , FlashMsg . ByteCount ) ; if ( Status != ( int ) XST_SUCCESS ) return ( int ) XST_FAILURE ; return Status ; }
This function writes the volatile configuration register
 @param       InstancePtr is a pointer to the XIsf instance.
This function writes the volatile configuration register @param InstancePtr is a pointer to the XIsf instance .