XilinxProcessorIPLib/drivers/wdtps/src/xwdtps.c
void XWdtPs_SetControlValue(XWdtPs *InstancePtr, u8 Control, u32 Value)
{
	u32 Register;
	u32 LocalValue = Value;

	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertVoid((Control == XWDTPS_CLK_PRESCALE) ||
			(Control == XWDTPS_COUNTER_RESET));

	/*
	 * Read the contents of the CCR register.
	 */
	Register = XWdtPs_ReadReg(InstancePtr->Config.BaseAddress,
				 XWDTPS_CCR_OFFSET);

	if (Control == XWDTPS_CLK_PRESCALE) {
		/*
		 * Zero the field in the register.
		 */
		Register &= ~((u32)XWDTPS_CCR_CLKSEL_MASK);

	} else {
		/*
		 * Zero the field in the register.
		 */
		Register &= ~((u32)XWDTPS_CCR_CRV_MASK);

		/*
		 * Shift Value over to the proper positions.
		 */
		LocalValue = LocalValue << XWDTPS_CCR_CRV_SHIFT;
	}

	Register |= LocalValue;

	/*
	 * Set the access key so the write takes.
	 */
	Register |= XWDTPS_CCR_CKEY_VAL;

	/*
	 * Update the CCR with the new value.
	 */
	XWdtPs_WriteReg(InstancePtr->Config.BaseAddress, XWDTPS_CCR_OFFSET,
			  Register);
}
/****************************************************************************/
/**
*
* Updates the current control setting for the indicated signal/output with
* the provided value.
*
* Performs a read/modify/write cycle to update the value correctly.
* The register referenced is the Counter Control Register (XWDTPS_CCR_OFFSET)
*
* @param	InstancePtr is a pointer to the XWdtPs instance.
* @param	Control is the desired signal/output.
*		Valid Control Values are XWDTPS_CLK_PRESCALE and
*		XWDTPS_COUNTER_RESET. Only one of them can be specified at a
*		time.
* @param	Value is the desired control value.
*		If the Control is XWDTPS_CLK_PRESCALE then use the
*		definitions XWDTEPB_CCR_PSCALE_XXXX.
*		If the Control is XWDTPS_COUNTER_RESET then the valid values
*		are 0x0 to 0xFFF, this sets the counter restart value of the CCR
*		register.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
Updates the current control setting for the indicated signal/output with
the provided value.

Performs a read/modify/write cycle to update the value correctly.
The register referenced is the Counter Control Register (XWDTPS_CCR_OFFSET)
Updates the current control setting for the indicated signal / output with the provided value . Performs a read / modify / write cycle to update the value correctly . The register referenced is the Counter Control Register ( XWDTPS_CCR_OFFSET )
void XWdtPs_SetControlValue(XWdtPs *InstancePtr, u8 Control, u32 Value)
{
	u32 Register;
	u32 LocalValue = Value;
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertVoid((Control == XWDTPS_CLK_PRESCALE) ||
			(Control == XWDTPS_COUNTER_RESET));
	Register = XWdtPs_ReadReg(InstancePtr->Config.BaseAddress,
				 XWDTPS_CCR_OFFSET);
	if (Control == XWDTPS_CLK_PRESCALE) {
		Register &= ~((u32)XWDTPS_CCR_CLKSEL_MASK);
	} else {
		Register &= ~((u32)XWDTPS_CCR_CRV_MASK);
		LocalValue = LocalValue << XWDTPS_CCR_CRV_SHIFT;
	}
	Register |= LocalValue;
	Register |= XWDTPS_CCR_CKEY_VAL;
	XWdtPs_WriteReg(InstancePtr->Config.BaseAddress, XWDTPS_CCR_OFFSET,
			  Register);
}
void XWdtPs_SetControlValue ( XWdtPs * InstancePtr , u8 Control , u32 Value ) { u32 Register ; u32 LocalValue = Value ; Xil_AssertVoid ( InstancePtr != NULL ) ; Xil_AssertVoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Xil_AssertVoid ( ( Control == XWDTPS_CLK_PRESCALE ) || ( Control == XWDTPS_COUNTER_RESET ) ) ; Register = XWdtPs_ReadReg ( InstancePtr -> Config . BaseAddress , XWDTPS_CCR_OFFSET ) ; if ( Control == XWDTPS_CLK_PRESCALE ) { Register &= ~ ( ( u32 ) XWDTPS_CCR_CLKSEL_MASK ) ; } else { Register &= ~ ( ( u32 ) XWDTPS_CCR_CRV_MASK ) ; LocalValue = LocalValue << XWDTPS_CCR_CRV_SHIFT ; } Register |= LocalValue ; Register |= XWDTPS_CCR_CKEY_VAL ; XWdtPs_WriteReg ( InstancePtr -> Config . BaseAddress , XWDTPS_CCR_OFFSET , Register ) ; }
Updates the current control setting for the indicated signal/output with
the provided value.
Updates the current control setting for the indicated signal / output with the provided value .
/*
	 * Read the contents of the CCR register.
	 */ /*
		 * Zero the field in the register.
		 */ /*
		 * Zero the field in the register.
		 */ /*
		 * Shift Value over to the proper positions.
		 */ /*
	 * Set the access key so the write takes.
	 */ /*
	 * Update the CCR with the new value.
	 */