XilinxProcessorIPLib/drivers/qspips/src/xqspips_options.c
s32 XQspiPs_SetClkPrescaler(XQspiPs *InstancePtr, u8 Prescaler)
{
	u32 ConfigReg;

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

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

	/*
	 * Read the configuration register, mask out the interesting bits, and set
	 * them with the shifted value passed into the function. Write the
	 * results back to the configuration register.
	 */
	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_CR_OFFSET);

	ConfigReg &= ~XQSPIPS_CR_PRESC_MASK;
	ConfigReg |= (u32) (Prescaler & XQSPIPS_CR_PRESC_MAXIMUM) <<
			    XQSPIPS_CR_PRESC_SHIFT;

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

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets the clock prescaler for an QSPI device. 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	Prescaler is the value that determine how much the clock should
*		be divided by. Use the XQSPIPS_CLK_PRESCALE_* constants defined
*		in xqspips.h for this setting.
*
* @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 clock prescaler for an QSPI device. The device
must be idle rather than busy transferring data before setting these device
options.
This function sets the clock prescaler for an QSPI device . The device must be idle rather than busy transferring data before setting these device options .
s32 XQspiPs_SetClkPrescaler(XQspiPs *InstancePtr, u8 Prescaler)
{
	u32 ConfigReg;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(Prescaler <= XQSPIPS_CR_PRESC_MAXIMUM);
	if (InstancePtr->IsBusy) {
		return XST_DEVICE_BUSY;
	}
	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_CR_OFFSET);
	ConfigReg &= ~XQSPIPS_CR_PRESC_MASK;
	ConfigReg |= (u32) (Prescaler & XQSPIPS_CR_PRESC_MAXIMUM) <<
			    XQSPIPS_CR_PRESC_SHIFT;
	XQspiPs_WriteReg(InstancePtr->Config.BaseAddress,
			  XQSPIPS_CR_OFFSET,
			  ConfigReg);
	return XST_SUCCESS;
}
s32 XQspiPs_SetClkPrescaler ( XQspiPs * InstancePtr , u8 Prescaler ) { u32 ConfigReg ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertNonvoid ( Prescaler <= XQSPIPS_CR_PRESC_MAXIMUM ) ; if ( InstancePtr -> IsBusy ) { return XST_DEVICE_BUSY ; } ConfigReg = XQspiPs_ReadReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_CR_OFFSET ) ; ConfigReg &= ~ XQSPIPS_CR_PRESC_MASK ; ConfigReg |= ( u32 ) ( Prescaler & XQSPIPS_CR_PRESC_MAXIMUM ) << XQSPIPS_CR_PRESC_SHIFT ; XQspiPs_WriteReg ( InstancePtr -> Config . BaseAddress , XQSPIPS_CR_OFFSET , ConfigReg ) ; return XST_SUCCESS ; }
This function sets the clock prescaler for an QSPI device.
This function sets the clock prescaler for an QSPI device .
/*
	 * Do not allow the slave select to change while a transfer is in
	 * progress. Not thread-safe.
	 */ /*
	 * Read the configuration register, mask out the interesting bits, and set
	 * them with the shifted value passed into the function. Write the
	 * results back to the configuration register.
	 */