XilinxProcessorIPLib/drivers/qspips/src/xqspips_options.c
s32 XQspiPs_SetOptions(XQspiPs *InstancePtr, u32 Options)
{
	u32 ConfigReg;
	unsigned int Index;
	u32 QspiOptions;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	/*
	 * Do not allow to modify the Control Register while a transfer is in
	 * progress. Not thread-safe.
	 */
	if (InstancePtr->IsBusy) {
		return XST_DEVICE_BUSY;
	}

	QspiOptions = Options & XQSPIPS_LQSPI_MODE_OPTION;
	Options &= ~XQSPIPS_LQSPI_MODE_OPTION;

	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_CR_OFFSET);

	/*
	 * Loop through the options table, turning the option on or off
	 * depending on whether the bit is set in the incoming options flag.
	 */
	for (Index = 0; Index < XQSPIPS_NUM_OPTIONS; Index++) {
		if (Options & OptionsTable[Index].Option) {
			/* Turn it on */
			ConfigReg |= OptionsTable[Index].Mask;
		} else {
			/* Turn it off */
			ConfigReg &= ~(OptionsTable[Index].Mask);
		}
	}

	/*
	 * Now write the control register. Leave it to the upper layers
	 * to restart the device.
	 */
	XQspiPs_WriteReg(InstancePtr->Config.BaseAddress, XQSPIPS_CR_OFFSET,
			 ConfigReg);

	/*
	 * Check for the LQSPI configuration options.
	 */
	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_LQSPI_CR_OFFSET);


	if (QspiOptions & XQSPIPS_LQSPI_MODE_OPTION) {
		XQspiPs_WriteReg(InstancePtr->Config.BaseAddress,
				  XQSPIPS_LQSPI_CR_OFFSET,
				  XQSPIPS_LQSPI_CR_RST_STATE);
		XQspiPs_SetSlaveSelect(InstancePtr);
	} else {
		ConfigReg &= ~XQSPIPS_LQSPI_CR_LINEAR_MASK;
		XQspiPs_WriteReg(InstancePtr->Config.BaseAddress,
				  XQSPIPS_LQSPI_CR_OFFSET, ConfigReg);
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets the options for the QSPI device driver. The options control
* how the device behaves relative to the QSPI bus. The device must be idle
* rather than busy transferring data before setting these device options.
*
* @param	InstancePtr is a pointer to the XQspiPs instance.
* @param	Options contains the specified options to be set. This is a bit
*		mask where a 1 means to turn the option on, and a 0 means to
*		turn the option off. One or more bit values may be contained in
*		the mask. See the bit definitions named XQSPIPS_*_OPTIONS in
*		the file xqspips.h.
*
* @return
*		- XST_SUCCESS if options are successfully set.
*		- XST_DEVICE_BUSY if the device is currently transferring data.
*		The transfer must complete or be aborted before setting options.
*
* @note
* This function is not thread-safe.
*
******************************************************************************/
This function sets the options for the QSPI device driver. The options control
how the device behaves relative to the QSPI bus. The device must be idle
rather than busy transferring data before setting these device options.
This function sets the options for the QSPI device driver . The options control how the device behaves relative to the QSPI bus . The device must be idle rather than busy transferring data before setting these device options .
s32 XQspiPs_SetOptions(XQspiPs *InstancePtr, u32 Options)
{
	u32 ConfigReg;
	unsigned int Index;
	u32 QspiOptions;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	if (InstancePtr->IsBusy) {
		return XST_DEVICE_BUSY;
	}
	QspiOptions = Options & XQSPIPS_LQSPI_MODE_OPTION;
	Options &= ~XQSPIPS_LQSPI_MODE_OPTION;
	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_CR_OFFSET);
	for (Index = 0; Index < XQSPIPS_NUM_OPTIONS; Index++) {
		if (Options & OptionsTable[Index].Option) {
			ConfigReg |= OptionsTable[Index].Mask;
		} else {
			ConfigReg &= ~(OptionsTable[Index].Mask);
		}
	}
	XQspiPs_WriteReg(InstancePtr->Config.BaseAddress, XQSPIPS_CR_OFFSET,
			 ConfigReg);
	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_LQSPI_CR_OFFSET);
	if (QspiOptions & XQSPIPS_LQSPI_MODE_OPTION) {
		XQspiPs_WriteReg(InstancePtr->Config.BaseAddress,
				  XQSPIPS_LQSPI_CR_OFFSET,
				  XQSPIPS_LQSPI_CR_RST_STATE);
		XQspiPs_SetSlaveSelect(InstancePtr);
	} else {
		ConfigReg &= ~XQSPIPS_LQSPI_CR_LINEAR_MASK;
		XQspiPs_WriteReg(InstancePtr->Config.BaseAddress,
				  XQSPIPS_LQSPI_CR_OFFSET, ConfigReg);
	}
	return XST_SUCCESS;
}
s32 XQspiPs_SetOptions ( XQspiPs * InstancePtr , u32 Options ) { u32 ConfigReg ; unsigned int Index ; u32 QspiOptions ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; if ( InstancePtr -> IsBusy ) { return XST_DEVICE_BUSY ; } QspiOptions = Options & XQSPIPS_LQSPI_MODE_OPTION ; Options &= ~ XQSPIPS_LQSPI_MODE_OPTION ; ConfigReg = XQspiPs_ReadReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_CR_OFFSET ) ; for ( Index = 0 ; Index < XQSPIPS_NUM_OPTIONS ; Index ++ ) { if ( Options & OptionsTable [ Index ] . Option ) { ConfigReg |= OptionsTable [ Index ] . Mask ; } else { ConfigReg &= ~ ( OptionsTable [ Index ] . Mask ) ; } } XQspiPs_WriteReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_CR_OFFSET , ConfigReg ) ; ConfigReg = XQspiPs_ReadReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_LQSPI_CR_OFFSET ) ; if ( QspiOptions & XQSPIPS_LQSPI_MODE_OPTION ) { XQspiPs_WriteReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_LQSPI_CR_OFFSET , XQSPIPS_LQSPI_CR_RST_STATE ) ; XQspiPs_SetSlaveSelect ( InstancePtr ) ; } else { ConfigReg &= ~ XQSPIPS_LQSPI_CR_LINEAR_MASK ; XQspiPs_WriteReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_LQSPI_CR_OFFSET , ConfigReg ) ; } return XST_SUCCESS ; }
This function sets the options for the QSPI device driver.
This function sets the options for the QSPI device driver .
/*
	 * Do not allow to modify the Control Register while a transfer is in
	 * progress. Not thread-safe.
	 */ /*
	 * Loop through the options table, turning the option on or off
	 * depending on whether the bit is set in the incoming options flag.
	 */ /* Turn it on */ /* Turn it off */ /*
	 * Now write the control register. Leave it to the upper layers
	 * to restart the device.
	 */ /*
	 * Check for the LQSPI configuration options.
	 */