XilinxProcessorIPLib/drivers/qspips/examples/xqspips_g128_flash_example.c
int SendBankSelect(XQspiPs *QspiPtr, u8 *WriteBfrPtr, u32 BankSel)
{
	u8 WriteEnableCmd = { WRITE_ENABLE_CMD };

	/*
	 * Bank select commands for Micron and Spansion are different
	 */
	if(FlashMake == MICRON_ID_BYTE0) {
		/*
		 * For Micron command WREN should be sent first
		 * except for some specific feature set
		 */
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
					sizeof(WriteEnableCmd));

		WriteBfrPtr[COMMAND_OFFSET]   = EXTADD_REG_WR;
		WriteBfrPtr[ADDRESS_1_OFFSET] = BankSel;

		/*
		 * Send the Extended address register write command
		 * written, no receive buffer required
		 */
		XQspiPs_PolledTransfer(QspiPtr, WriteBfrPtr, NULL,
				BANK_SEL_SIZE);

	}
	if(FlashMake == SPANSION_ID_BYTE0) {
		WriteBfrPtr[COMMAND_OFFSET]   = BANK_REG_WR;
		WriteBfrPtr[ADDRESS_1_OFFSET] = BankSel;

		/*
		 * Send the Extended address register write command
		 * written, no receive buffer required
		 */
		XQspiPs_PolledTransfer(QspiPtr, WriteBfrPtr, NULL,
				BANK_SEL_SIZE);
	}

	/* Winbond can be added here */

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This functions selects the current bank
*
* @param	QspiPtr is a pointer to the QSPI driver component to use.
* @param	WriteBfrPtr to the write buffer which contains data to be
*			transmitted.
* @param	BankSel is the bank to be selected in the flash device(s).
*
* @return	XST_SUCCESS if bank selected, otherwise XST_FAILURE.
*
* @note		None.
*
******************************************************************************/
This functions selects the current bank
This functions selects the current bank
int SendBankSelect(XQspiPs *QspiPtr, u8 *WriteBfrPtr, u32 BankSel)
{
	u8 WriteEnableCmd = { WRITE_ENABLE_CMD };
	if(FlashMake == MICRON_ID_BYTE0) {
		XQspiPs_PolledTransfer(QspiPtr, &WriteEnableCmd, NULL,
					sizeof(WriteEnableCmd));
		WriteBfrPtr[COMMAND_OFFSET]   = EXTADD_REG_WR;
		WriteBfrPtr[ADDRESS_1_OFFSET] = BankSel;
		XQspiPs_PolledTransfer(QspiPtr, WriteBfrPtr, NULL,
				BANK_SEL_SIZE);
	}
	if(FlashMake == SPANSION_ID_BYTE0) {
		WriteBfrPtr[COMMAND_OFFSET]   = BANK_REG_WR;
		WriteBfrPtr[ADDRESS_1_OFFSET] = BankSel;
		XQspiPs_PolledTransfer(QspiPtr, WriteBfrPtr, NULL,
				BANK_SEL_SIZE);
	}
	return XST_SUCCESS;
}
int SendBankSelect ( XQspiPs * QspiPtr , u8 * WriteBfrPtr , u32 BankSel ) { u8 WriteEnableCmd = { WRITE_ENABLE_CMD } ; if ( FlashMake == MICRON_ID_BYTE0 ) { XQspiPs_PolledTransfer ( QspiPtr , & WriteEnableCmd , NULL , sizeof ( WriteEnableCmd ) ) ; WriteBfrPtr [ COMMAND_OFFSET ] = EXTADD_REG_WR ; WriteBfrPtr [ ADDRESS_1_OFFSET ] = BankSel ; XQspiPs_PolledTransfer ( QspiPtr , WriteBfrPtr , NULL , BANK_SEL_SIZE ) ; } if ( FlashMake == SPANSION_ID_BYTE0 ) { WriteBfrPtr [ COMMAND_OFFSET ] = BANK_REG_WR ; WriteBfrPtr [ ADDRESS_1_OFFSET ] = BankSel ; XQspiPs_PolledTransfer ( QspiPtr , WriteBfrPtr , NULL , BANK_SEL_SIZE ) ; } return XST_SUCCESS ; }
This functions selects the current bank
This functions selects the current bank
/*
	 * Bank select commands for Micron and Spansion are different
	 */ /*
		 * For Micron command WREN should be sent first
		 * except for some specific feature set
		 */ /*
		 * Send the Extended address register write command
		 * written, no receive buffer required
		 */ /*
		 * Send the Extended address register write command
		 * written, no receive buffer required
		 */ /* Winbond can be added here */