QSPI_SRECBootloader/bootloader.c
int SpiFlashQuadEnable(XSpi *SpiPtr)
{
	int Status;

	/*
	 * Perform the Write Enable operation.
	 */
	Status = SpiFlashWriteEnable(SpiPtr);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Wait while the Flash is busy.
	 */
	Status = SpiFlashWaitForFlashReady();
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Prepare the WriteBuffer.
	 */
	WriteBuffer[BYTE1] = 0x01;
	WriteBuffer[BYTE2] = 0x00;
	WriteBuffer[BYTE3] = 0x02; /* QE = 1 */

	/*
	 * Initiate the Transfer.
	 */
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, NULL, 3);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}


	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}

	/*
	 * Wait while the Flash is busy.
	 */
	Status = SpiFlashWaitForFlashReady();
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Verify that QE bit is set by reading status register 2.
	 */

	/*
	 * Prepare the Write Buffer.
	 */
	WriteBuffer[BYTE1] = 0x35;

	/*
	 * Initiate the Transfer.
	 */
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, ReadBuffer,
						STATUS_READ_BYTES);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}


	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets the QuadEnable bit in Winbond flash.
*
* @param	None
*
* @return	XST_SUCCESS if successful else XST_FAILURE.
*
* @note		None.
*
******************************************************************************/
This function sets the QuadEnable bit in Winbond flash.
This function sets the QuadEnable bit in Winbond flash .
int SpiFlashQuadEnable(XSpi *SpiPtr)
{
	int Status;
	Status = SpiFlashWriteEnable(SpiPtr);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = SpiFlashWaitForFlashReady();
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	WriteBuffer[BYTE1] = 0x01;
	WriteBuffer[BYTE2] = 0x00;
	WriteBuffer[BYTE3] = 0x02; 
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, NULL, 3);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}
	Status = SpiFlashWaitForFlashReady();
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	WriteBuffer[BYTE1] = 0x35;
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, ReadBuffer,
						STATUS_READ_BYTES);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
int SpiFlashQuadEnable ( XSpi * SpiPtr ) { int Status ; Status = SpiFlashWriteEnable ( SpiPtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = SpiFlashWaitForFlashReady ( ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } WriteBuffer [ BYTE1 ] = 0x01 ; WriteBuffer [ BYTE2 ] = 0x00 ; WriteBuffer [ BYTE3 ] = 0x02 ; Status = XSpi_Transfer ( SpiPtr , WriteBuffer , NULL , 3 ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } if ( ErrorCount != 0 ) { ErrorCount = 0 ; return XST_FAILURE ; } Status = SpiFlashWaitForFlashReady ( ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } WriteBuffer [ BYTE1 ] = 0x35 ; Status = XSpi_Transfer ( SpiPtr , WriteBuffer , ReadBuffer , STATUS_READ_BYTES ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } if ( ErrorCount != 0 ) { ErrorCount = 0 ; return XST_FAILURE ; } return XST_SUCCESS ; }
This function sets the QuadEnable bit in Winbond flash.
This function sets the QuadEnable bit in Winbond flash .
/*
	 * Perform the Write Enable operation.
	 */ /*
	 * Wait while the Flash is busy.
	 */ /*
	 * Prepare the WriteBuffer.
	 */ /* QE = 1 */ /*
	 * Initiate the Transfer.
	 */ /*
	 * Wait while the Flash is busy.
	 */ /*
	 * Verify that QE bit is set by reading status register 2.
	 */ /*
	 * Prepare the Write Buffer.
	 */ /*
	 * Initiate the Transfer.
	 */