XilinxProcessorIPLib/drivers/scutimer/examples/xscutimer_polled_example.c
int ScuTimerPolledExample(u16 DeviceId)
{
	int Status;
	volatile u32 CntValue1 = 0;
	volatile u32 CntValue2 = 0;
	XScuTimer_Config *ConfigPtr;
	XScuTimer *TimerInstancePtr = &Timer;

	/*
	 * Initialize the Scu Private Timer so that it is ready to use.
	 */
	ConfigPtr = XScuTimer_LookupConfig(DeviceId);

	/*
	 * This is where the virtual address would be used, this example
	 * uses physical address.
	 */
	Status = XScuTimer_CfgInitialize(TimerInstancePtr, ConfigPtr,
				 ConfigPtr->BaseAddr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Load the timer counter register.
	 */
	XScuTimer_LoadTimer(TimerInstancePtr, TIMER_LOAD_VALUE);

	/*
	 * Get a snapshot of the timer counter value before it's started
	 * to compare against later.
	 */
	CntValue1 = XScuTimer_GetCounterValue(TimerInstancePtr);

	/*
	 * Start the Scu Private Timer device.
	 */
	XScuTimer_Start(TimerInstancePtr);

	/*
	 * Read the value of the timer counter and wait for it to change,
	 * since it's decrementing it should change, if the hardware is not
	 * working for some reason, this loop could be infinite such that the
	 * function does not return.
	 */
	while (1) {
		CntValue2 = XScuTimer_GetCounterValue(TimerInstancePtr);
		if (CntValue1 != CntValue2) {
			break;
		}
	}
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function does a minimal test on the SCU Private timer device and driver.
* The purpose of this function is to illustrate how to use the XScuTimer driver.
*
* @param	DeviceId is the unique device id of the device.
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note		None.
*
****************************************************************************/
This function does a minimal test on the SCU Private timer device and driver.
The purpose of this function is to illustrate how to use the XScuTimer driver.
This function does a minimal test on the SCU Private timer device and driver . The purpose of this function is to illustrate how to use the XScuTimer driver .
int ScuTimerPolledExample(u16 DeviceId)
{
	int Status;
	volatile u32 CntValue1 = 0;
	volatile u32 CntValue2 = 0;
	XScuTimer_Config *ConfigPtr;
	XScuTimer *TimerInstancePtr = &Timer;
	ConfigPtr = XScuTimer_LookupConfig(DeviceId);
	Status = XScuTimer_CfgInitialize(TimerInstancePtr, ConfigPtr,
				 ConfigPtr->BaseAddr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuTimer_LoadTimer(TimerInstancePtr, TIMER_LOAD_VALUE);
	CntValue1 = XScuTimer_GetCounterValue(TimerInstancePtr);
	XScuTimer_Start(TimerInstancePtr);
	while (1) {
		CntValue2 = XScuTimer_GetCounterValue(TimerInstancePtr);
		if (CntValue1 != CntValue2) {
			break;
		}
	}
	return XST_SUCCESS;
}
int ScuTimerPolledExample ( u16 DeviceId ) { int Status ; volatile u32 CntValue1 = 0 ; volatile u32 CntValue2 = 0 ; XScuTimer_Config * ConfigPtr ; XScuTimer * TimerInstancePtr = & Timer ; ConfigPtr = XScuTimer_LookupConfig ( DeviceId ) ; Status = XScuTimer_CfgInitialize ( TimerInstancePtr , ConfigPtr , ConfigPtr -> BaseAddr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XScuTimer_LoadTimer ( TimerInstancePtr , TIMER_LOAD_VALUE ) ; CntValue1 = XScuTimer_GetCounterValue ( TimerInstancePtr ) ; XScuTimer_Start ( TimerInstancePtr ) ; while ( 1 ) { CntValue2 = XScuTimer_GetCounterValue ( TimerInstancePtr ) ; if ( CntValue1 != CntValue2 ) { break ; } } return XST_SUCCESS ; }
This function does a minimal test on the SCU Private timer device and driver.
This function does a minimal test on the SCU Private timer device and driver .
/*
	 * Initialize the Scu Private Timer so that it is ready to use.
	 */ /*
	 * This is where the virtual address would be used, this example
	 * uses physical address.
	 */ /*
	 * Load the timer counter register.
	 */ /*
	 * Get a snapshot of the timer counter value before it's started
	 * to compare against later.
	 */ /*
	 * Start the Scu Private Timer device.
	 */ /*
	 * Read the value of the timer counter and wait for it to change,
	 * since it's decrementing it should change, if the hardware is not
	 * working for some reason, this loop could be infinite such that the
	 * function does not return.
	 */