lib/bsp/standalone/examples/xil_nested_interrupts_example.c
int SetupTimer(u16 DeviceID,XTtcPs *TtcPsInst,TmrCntrSetup SettingsTable)
{
	int Status;
	XTtcPs_Config *Config;
	XTtcPs *Timer;
	TmrCntrSetup *TimerSetup;

	TimerSetup = &SettingsTable;

	Timer = TtcPsInst;

	/*
	 * Look up the configuration based on the device identifier
	 */
	Config = XTtcPs_LookupConfig(DeviceID);
	if (NULL == Config) {
		return XST_FAILURE;
	}
	/*
	 * Initialize the device
	 */
	Status = XTtcPs_CfgInitialize(Timer, Config, Config->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Set the options
	 */
	XTtcPs_SetOptions(Timer, TimerSetup->Options);

	/*
	 * Timer frequency is preset in the TimerSetup structure,
	 * however, the value is not reflected in its other fields, such as
	 * IntervalValue and PrescalerValue. The following call will map the
	 * frequency to the interval and prescaler values.
	 */
	XTtcPs_CalcIntervalFromFreq(Timer, TimerSetup->OutputHz,
		&(TimerSetup->Interval), &(TimerSetup->Prescaler));

	/*
	 * Set the interval and prescale
	 */
	XTtcPs_SetInterval(Timer, TimerSetup->Interval);
	XTtcPs_SetPrescaler(Timer, TimerSetup->Prescaler);

	return XST_SUCCESS;
}
/****************************************************************************/
/**
*
* This function sets up a timer counter device, using the information in its
* setup structure.
*  . initialize device
*  . set options
*  . set interval and prescaler value for given output frequency.
*
* @param	DeviceID is the unique ID for the device.
* @param	TtcPsInst is a pointer to the ttc instance.
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
*****************************************************************************/
This function sets up a timer counter device, using the information in its
setup structure.
. initialize device
. set options
. set interval and prescaler value for given output frequency.
This function sets up a timer counter device using the information in its setup structure . . initialize device . set options . set interval and prescaler value for given output frequency .
int SetupTimer(u16 DeviceID,XTtcPs *TtcPsInst,TmrCntrSetup SettingsTable)
{
	int Status;
	XTtcPs_Config *Config;
	XTtcPs *Timer;
	TmrCntrSetup *TimerSetup;
	TimerSetup = &SettingsTable;
	Timer = TtcPsInst;
	Config = XTtcPs_LookupConfig(DeviceID);
	if (NULL == Config) {
		return XST_FAILURE;
	}
	Status = XTtcPs_CfgInitialize(Timer, Config, Config->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XTtcPs_SetOptions(Timer, TimerSetup->Options);
	XTtcPs_CalcIntervalFromFreq(Timer, TimerSetup->OutputHz,
		&(TimerSetup->Interval), &(TimerSetup->Prescaler));
	XTtcPs_SetInterval(Timer, TimerSetup->Interval);
	XTtcPs_SetPrescaler(Timer, TimerSetup->Prescaler);
	return XST_SUCCESS;
}
int SetupTimer ( u16 DeviceID , XTtcPs * TtcPsInst , TmrCntrSetup SettingsTable ) { int Status ; XTtcPs_Config * Config ; XTtcPs * Timer ; TmrCntrSetup * TimerSetup ; TimerSetup = & SettingsTable ; Timer = TtcPsInst ; Config = XTtcPs_LookupConfig ( DeviceID ) ; if ( NULL == Config ) { return XST_FAILURE ; } Status = XTtcPs_CfgInitialize ( Timer , Config , Config -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XTtcPs_SetOptions ( Timer , TimerSetup -> Options ) ; XTtcPs_CalcIntervalFromFreq ( Timer , TimerSetup -> OutputHz , & ( TimerSetup -> Interval ) , & ( TimerSetup -> Prescaler ) ) ; XTtcPs_SetInterval ( Timer , TimerSetup -> Interval ) ; XTtcPs_SetPrescaler ( Timer , TimerSetup -> Prescaler ) ; return XST_SUCCESS ; }
This function sets up a timer counter device, using the information in its
setup structure.
This function sets up a timer counter device using the information in its setup structure .
/*
	 * Look up the configuration based on the device identifier
	 */ /*
	 * Initialize the device
	 */ /*
	 * Set the options
	 */ /*
	 * Timer frequency is preset in the TimerSetup structure,
	 * however, the value is not reflected in its other fields, such as
	 * IntervalValue and PrescalerValue. The following call will map the
	 * frequency to the interval and prescaler values.
	 */ /*
	 * Set the interval and prescale
	 */