XilinxProcessorIPLib/drivers/qspips/examples/xqspips_dual_flash_stack_lqspi_example.c
void FlashErase(XQspiPs *QspiPtr, u32 Address, u32 ByteCount)
{
	u8 WriteEnableCmd = { WRITE_ENABLE_CMD };
	u8 ReadStatusCmd[] = { READ_STATUS_CMD, 0 };  /* Must send 2 bytes */
	u8 FlashStatus[2];
	u32 RealAddr;
	int Sector;
	u32 LqspiCr;
	u32 NumSect;

	/*
	 * If erase size is same as the total size of the two flash devices,
	 * use bulk erase command on both flash devices.
	 */
	if (ByteCount == (NUM_SECTORS * SECTOR_SIZE)) {


		/* Get the current LQSPI configuration register value*/
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		/* Set selection to L_PAGE*/
		XQspiPs_SetLqspiConfigReg(QspiPtr,
				LqspiCr & (~XQSPIPS_LQSPI_CR_U_PAGE_MASK));

		/* Assert the Flash chip select.*/
		XQspiPs_SetSlaveSelect(QspiPtr);

		/*
		 * Send the write enable command to the Flash so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the erase
		 */
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));

		/* Setup the bulk erase command*/
		WriteBuffer[COMMAND_OFFSET]   = BULK_ERASE_CMD;

		/*
		 * Send the bulk erase command; no receive buffer is specified
		 * since there is nothing to receive
		 */
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					BULK_ERASE_SIZE);

		/* Wait for the erase command to the Flash to be completed*/
		while (1) {
			/*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));

			/*
			 * If the status indicates the write is done, then stop
			 * waiting; if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}


		/* Get the current LQSPI configuration register value*/
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		/* Set selection to U_PAGE*/
		XQspiPs_SetLqspiConfigReg(QspiPtr,
				LqspiCr | XQSPIPS_LQSPI_CR_U_PAGE_MASK);

		/* Assert the Flash chip select.*/
		XQspiPs_SetSlaveSelect(QspiPtr);

		/*
		 * Send the write enable command to the Flash so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the erase
		 */
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));

		/* Setup the bulk erase command*/
		WriteBuffer[COMMAND_OFFSET]   = BULK_ERASE_CMD;

		/*
		 * Send the bulk erase command; no receive buffer is specified
		 * since there is nothing to receive
		 */
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					BULK_ERASE_SIZE);

		/* Wait for the erase command to the Flash to be completed*/
		while (1) {
			/*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));

			/*
			 * If the status indicates the write is done, then stop
			 * waiting; if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}

		return;
	}

	/*
	 * If entire first flash needs + some sectors in the second flash
	 * need to be erased, then bulk erase first flash here and
	 * second flash sectors will be erased in the following loop.
	 */
	if ((Address == FLASH1BASE) &&
			(ByteCount == (NUM_SECTORS * SECTOR_SIZE) / 2)) {


		/* Get the current LQSPI configuration register value*/
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		/* Set selection to L_PAGE*/
		XQspiPs_SetLqspiConfigReg(QspiPtr,
				LqspiCr & (~XQSPIPS_LQSPI_CR_U_PAGE_MASK));

		/* Assert the Flash chip select.*/
		XQspiPs_SetSlaveSelect(QspiPtr);

		/*
		 * Send the write enable command to the Flash so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the erase
		 */
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));

		/* Setup the bulk erase command*/
		WriteBuffer[COMMAND_OFFSET]   = BULK_ERASE_CMD;

		/*
		 * Send the bulk erase command; no receive buffer is specified
		 * since there is nothing to receive
		 */
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					BULK_ERASE_SIZE);

		/* Wait for the erase command to the Flash to be completed*/
		while (1) {
			/*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));

			/*
			 * If the status indicates the write is done, then stop
			 * waiting; if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}

		/* Increment address to second flash*/
		Address = FLASH2BASE;
	}

	/*
	 * If the erase size is less than the total size of the either flash,
	 * use sector erase command.
	 */

	/* Calculate no. of sectors to erase based on byte count*/
	NumSect = ByteCount/SECTOR_SIZE + 1;

	/*
	 * If ByteCount to k sectors,
	 * but the address range spans from N to N+k+1 sectors, then
	 * increment no. of sectors to be erased
	 */
	if (((Address + ByteCount) & SECTORMASK) ==
			((Address + (NumSect*SECTOR_SIZE)) & SECTORMASK)) {
		NumSect++;
	}

	/*
	 * Check condition - This is for the case when the byte count is
	 * less than a sector but the address range spreads over two sectors
	 */
	for (Sector = 0; Sector < NumSect; Sector++) {

		/* Get the current LQSPI configuration register value*/
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);

		/* Select lower or upper Flash based on sector address */
		if (Address & FLASH2BASE) {
			/* Set selection to U_PAGE*/
			XQspiPs_SetLqspiConfigReg(QspiPtr,
					LqspiCr | XQSPIPS_LQSPI_CR_U_PAGE_MASK);

			/* Subtract 16MB when accessing second flash*/
			RealAddr = Address & (~FLASH2BASE);
		} else {

			/* Set selection to L_PAGE*/
			XQspiPs_SetLqspiConfigReg(QspiPtr,
					LqspiCr & (~XQSPIPS_LQSPI_CR_U_PAGE_MASK));

			RealAddr = Address;
		}

		/* Assert the Flash chip select.*/
		XQspiPs_SetSlaveSelect(QspiPtr);
		/*
		 * Send the write enable command to the SEEPOM so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the write
		 */
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));

		/*
		 * Setup the write command with the specified address and data
		 * for the Flash
		 */
		WriteBuffer[COMMAND_OFFSET]   = SEC_ERASE_CMD;
		WriteBuffer[ADDRESS_1_OFFSET] = (u8)(RealAddr >> 16);
		WriteBuffer[ADDRESS_2_OFFSET] = (u8)(RealAddr >> 8);
		WriteBuffer[ADDRESS_3_OFFSET] = (u8)(RealAddr & 0xFF);

		/*
		 * Send the sector erase command and address; no receive buffer
		 * is specified since there is nothing to receive
		 */
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					SEC_ERASE_SIZE);

		/*
		 * Wait for the sector erase command to the
		 * Flash to be completed
		 */
		while (1) {
			/*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));

			/*
			 * If the status indicates the write is done, then stop
			 * waiting, if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}

		Address += SECTOR_SIZE;

	}
}
/*****************************************************************************/
/**
*
* This function erases the sectors in the  serial Flash connected to the
* QSPI interface.
*
* @param	QspiPtr is a pointer to the QSPI driver component to use.
* @param	Address contains the address of the first sector which needs to
*		be erased.
* @param	ByteCount contains the total size to be erased.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function erases the sectors in the  serial Flash connected to the
QSPI interface.
This function erases the sectors in the serial Flash connected to the QSPI interface .
void FlashErase(XQspiPs *QspiPtr, u32 Address, u32 ByteCount)
{
	u8 WriteEnableCmd = { WRITE_ENABLE_CMD };
	u8 ReadStatusCmd[] = { READ_STATUS_CMD, 0 };  
	u8 FlashStatus[2];
	u32 RealAddr;
	int Sector;
	u32 LqspiCr;
	u32 NumSect;
	if (ByteCount == (NUM_SECTORS * SECTOR_SIZE)) {
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		XQspiPs_SetLqspiConfigReg(QspiPtr,
				LqspiCr & (~XQSPIPS_LQSPI_CR_U_PAGE_MASK));
		XQspiPs_SetSlaveSelect(QspiPtr);
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));
		WriteBuffer[COMMAND_OFFSET]   = BULK_ERASE_CMD;
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					BULK_ERASE_SIZE);
		while (1) {
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		XQspiPs_SetLqspiConfigReg(QspiPtr,
				LqspiCr | XQSPIPS_LQSPI_CR_U_PAGE_MASK);
		XQspiPs_SetSlaveSelect(QspiPtr);
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));
		WriteBuffer[COMMAND_OFFSET]   = BULK_ERASE_CMD;
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					BULK_ERASE_SIZE);
		while (1) {
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}
		return;
	}
	if ((Address == FLASH1BASE) &&
			(ByteCount == (NUM_SECTORS * SECTOR_SIZE) / 2)) {
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		XQspiPs_SetLqspiConfigReg(QspiPtr,
				LqspiCr & (~XQSPIPS_LQSPI_CR_U_PAGE_MASK));
		XQspiPs_SetSlaveSelect(QspiPtr);
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));
		WriteBuffer[COMMAND_OFFSET]   = BULK_ERASE_CMD;
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					BULK_ERASE_SIZE);
		while (1) {
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}
		Address = FLASH2BASE;
	}
	NumSect = ByteCount/SECTOR_SIZE + 1;
	if (((Address + ByteCount) & SECTORMASK) ==
			((Address + (NumSect*SECTOR_SIZE)) & SECTORMASK)) {
		NumSect++;
	}
	for (Sector = 0; Sector < NumSect; Sector++) {
		LqspiCr = XQspiPs_GetLqspiConfigReg(QspiPtr);
		if (Address & FLASH2BASE) {
			XQspiPs_SetLqspiConfigReg(QspiPtr,
					LqspiCr | XQSPIPS_LQSPI_CR_U_PAGE_MASK);
			RealAddr = Address & (~FLASH2BASE);
		} else {
			XQspiPs_SetLqspiConfigReg(QspiPtr,
					LqspiCr & (~XQSPIPS_LQSPI_CR_U_PAGE_MASK));
			RealAddr = Address;
		}
		XQspiPs_SetSlaveSelect(QspiPtr);
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
				  sizeof(WriteEnableCmd));
		WriteBuffer[COMMAND_OFFSET]   = SEC_ERASE_CMD;
		WriteBuffer[ADDRESS_1_OFFSET] = (u8)(RealAddr >> 16);
		WriteBuffer[ADDRESS_2_OFFSET] = (u8)(RealAddr >> 8);
		WriteBuffer[ADDRESS_3_OFFSET] = (u8)(RealAddr & 0xFF);
		XQspiPs_PolledTransfer(QspiPtr, WriteBuffer, NULL,
					SEC_ERASE_SIZE);
		while (1) {
			XQspiPs_PolledTransfer(QspiPtr, ReadStatusCmd,
						FlashStatus,
						sizeof(ReadStatusCmd));
			if ((FlashStatus[1] & 0x01) == 0) {
				break;
			}
		}
		Address += SECTOR_SIZE;
	}
}
void FlashErase ( XQspiPs * QspiPtr , u32 Address , u32 ByteCount ) { u8 WriteEnableCmd = { WRITE_ENABLE_CMD } ; u8 ReadStatusCmd [ ] = { READ_STATUS_CMD , 0 } ; u8 FlashStatus [ 2 ] ; u32 RealAddr ; int Sector ; u32 LqspiCr ; u32 NumSect ; if ( ByteCount == ( NUM_SECTORS * SECTOR_SIZE ) ) { LqspiCr = XQspiPs_GetLqspiConfigReg ( QspiPtr ) ; XQspiPs_SetLqspiConfigReg ( QspiPtr , LqspiCr & ( ~ XQSPIPS_LQSPI_CR_U_PAGE_MASK ) ) ; XQspiPs_SetSlaveSelect ( QspiPtr ) ; XQspiPs_PolledTransfer ( QspiPtr , & WriteEnableCmd , NULL , sizeof ( WriteEnableCmd ) ) ; WriteBuffer [ COMMAND_OFFSET ] = BULK_ERASE_CMD ; XQspiPs_PolledTransfer ( QspiPtr , WriteBuffer , NULL , BULK_ERASE_SIZE ) ; while ( 1 ) { XQspiPs_PolledTransfer ( QspiPtr , ReadStatusCmd , FlashStatus , sizeof ( ReadStatusCmd ) ) ; if ( ( FlashStatus [ 1 ] & 0x01 ) == 0 ) { break ; } } LqspiCr = XQspiPs_GetLqspiConfigReg ( QspiPtr ) ; XQspiPs_SetLqspiConfigReg ( QspiPtr , LqspiCr | XQSPIPS_LQSPI_CR_U_PAGE_MASK ) ; XQspiPs_SetSlaveSelect ( QspiPtr ) ; XQspiPs_PolledTransfer ( QspiPtr , & WriteEnableCmd , NULL , sizeof ( WriteEnableCmd ) ) ; WriteBuffer [ COMMAND_OFFSET ] = BULK_ERASE_CMD ; XQspiPs_PolledTransfer ( QspiPtr , WriteBuffer , NULL , BULK_ERASE_SIZE ) ; while ( 1 ) { XQspiPs_PolledTransfer ( QspiPtr , ReadStatusCmd , FlashStatus , sizeof ( ReadStatusCmd ) ) ; if ( ( FlashStatus [ 1 ] & 0x01 ) == 0 ) { break ; } } return ; } if ( ( Address == FLASH1BASE ) && ( ByteCount == ( NUM_SECTORS * SECTOR_SIZE ) / 2 ) ) { LqspiCr = XQspiPs_GetLqspiConfigReg ( QspiPtr ) ; XQspiPs_SetLqspiConfigReg ( QspiPtr , LqspiCr & ( ~ XQSPIPS_LQSPI_CR_U_PAGE_MASK ) ) ; XQspiPs_SetSlaveSelect ( QspiPtr ) ; XQspiPs_PolledTransfer ( QspiPtr , & WriteEnableCmd , NULL , sizeof ( WriteEnableCmd ) ) ; WriteBuffer [ COMMAND_OFFSET ] = BULK_ERASE_CMD ; XQspiPs_PolledTransfer ( QspiPtr , WriteBuffer , NULL , BULK_ERASE_SIZE ) ; while ( 1 ) { XQspiPs_PolledTransfer ( QspiPtr , ReadStatusCmd , FlashStatus , sizeof ( ReadStatusCmd ) ) ; if ( ( FlashStatus [ 1 ] & 0x01 ) == 0 ) { break ; } } Address = FLASH2BASE ; } NumSect = ByteCount / SECTOR_SIZE + 1 ; if ( ( ( Address + ByteCount ) & SECTORMASK ) == ( ( Address + ( NumSect * SECTOR_SIZE ) ) & SECTORMASK ) ) { NumSect ++ ; } for ( Sector = 0 ; Sector < NumSect ; Sector ++ ) { LqspiCr = XQspiPs_GetLqspiConfigReg ( QspiPtr ) ; if ( Address & FLASH2BASE ) { XQspiPs_SetLqspiConfigReg ( QspiPtr , LqspiCr | XQSPIPS_LQSPI_CR_U_PAGE_MASK ) ; RealAddr = Address & ( ~ FLASH2BASE ) ; } else { XQspiPs_SetLqspiConfigReg ( QspiPtr , LqspiCr & ( ~ XQSPIPS_LQSPI_CR_U_PAGE_MASK ) ) ; RealAddr = Address ; } XQspiPs_SetSlaveSelect ( QspiPtr ) ; XQspiPs_PolledTransfer ( QspiPtr , & WriteEnableCmd , NULL , sizeof ( WriteEnableCmd ) ) ; WriteBuffer [ COMMAND_OFFSET ] = SEC_ERASE_CMD ; WriteBuffer [ ADDRESS_1_OFFSET ] = ( u8 ) ( RealAddr >> 16 ) ; WriteBuffer [ ADDRESS_2_OFFSET ] = ( u8 ) ( RealAddr >> 8 ) ; WriteBuffer [ ADDRESS_3_OFFSET ] = ( u8 ) ( RealAddr & 0xFF ) ; XQspiPs_PolledTransfer ( QspiPtr , WriteBuffer , NULL , SEC_ERASE_SIZE ) ; while ( 1 ) { XQspiPs_PolledTransfer ( QspiPtr , ReadStatusCmd , FlashStatus , sizeof ( ReadStatusCmd ) ) ; if ( ( FlashStatus [ 1 ] & 0x01 ) == 0 ) { break ; } } Address += SECTOR_SIZE ; } }
This function erases the sectors in the  serial Flash connected to the
QSPI interface.
This function erases the sectors in the serial Flash connected to the QSPI interface .
/* Must send 2 bytes */ /*
	 * If erase size is same as the total size of the two flash devices,
	 * use bulk erase command on both flash devices.
	 */ /* Get the current LQSPI configuration register value*/ /* Set selection to L_PAGE*/ /* Assert the Flash chip select.*/ /*
		 * Send the write enable command to the Flash so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the erase
		 */ /* Setup the bulk erase command*/ /*
		 * Send the bulk erase command; no receive buffer is specified
		 * since there is nothing to receive
		 */ /* Wait for the erase command to the Flash to be completed*/ /*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */ /*
			 * If the status indicates the write is done, then stop
			 * waiting; if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */ /* Get the current LQSPI configuration register value*/ /* Set selection to U_PAGE*/ /* Assert the Flash chip select.*/ /*
		 * Send the write enable command to the Flash so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the erase
		 */ /* Setup the bulk erase command*/ /*
		 * Send the bulk erase command; no receive buffer is specified
		 * since there is nothing to receive
		 */ /* Wait for the erase command to the Flash to be completed*/ /*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */ /*
			 * If the status indicates the write is done, then stop
			 * waiting; if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */ /*
	 * If entire first flash needs + some sectors in the second flash
	 * need to be erased, then bulk erase first flash here and
	 * second flash sectors will be erased in the following loop.
	 */ /* Get the current LQSPI configuration register value*/ /* Set selection to L_PAGE*/ /* Assert the Flash chip select.*/ /*
		 * Send the write enable command to the Flash so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the erase
		 */ /* Setup the bulk erase command*/ /*
		 * Send the bulk erase command; no receive buffer is specified
		 * since there is nothing to receive
		 */ /* Wait for the erase command to the Flash to be completed*/ /*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */ /*
			 * If the status indicates the write is done, then stop
			 * waiting; if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */ /* Increment address to second flash*/ /*
	 * If the erase size is less than the total size of the either flash,
	 * use sector erase command.
	 */ /* Calculate no. of sectors to erase based on byte count*/ /*
	 * If ByteCount to k sectors,
	 * but the address range spans from N to N+k+1 sectors, then
	 * increment no. of sectors to be erased
	 */ /*
	 * Check condition - This is for the case when the byte count is
	 * less than a sector but the address range spreads over two sectors
	 */ /* Get the current LQSPI configuration register value*/ /* Select lower or upper Flash based on sector address */ /* Set selection to U_PAGE*/ /* Subtract 16MB when accessing second flash*/ /* Set selection to L_PAGE*/ /* Assert the Flash chip select.*/ /*
		 * Send the write enable command to the SEEPOM so that it can be
		 * written to, this needs to be sent as a separate transfer
		 * before the write
		 */ /*
		 * Setup the write command with the specified address and data
		 * for the Flash
		 */ /*
		 * Send the sector erase command and address; no receive buffer
		 * is specified since there is nothing to receive
		 */ /*
		 * Wait for the sector erase command to the
		 * Flash to be completed
		 */ /*
			 * Poll the status register of the device to determine
			 * when it completes, by sending a read status command
			 * and receiving the status byte
			 */ /*
			 * If the status indicates the write is done, then stop
			 * waiting, if a value of 0xFF in the status byte is
			 * read from the device and this loop never exits, the
			 * device slave select is possibly incorrect such that
			 * the device status is not being read
			 */