![]() |
scutimer
Vitis Drivers API Documentation
|
Data Structures | |
struct | XScuTimer_Config |
This typedef contains configuration information for the device. More... | |
struct | XScuTimer |
The XScuTimer driver instance data. More... | |
Macros | |
#define | XScuTimer_IsExpired(InstancePtr) |
Check if the timer has expired. More... | |
#define | XScuTimer_RestartTimer(InstancePtr) |
Re-start the timer. More... | |
#define | XScuTimer_LoadTimer(InstancePtr, Value) |
Write to the timer load register. More... | |
#define | XScuTimer_GetCounterValue(InstancePtr) |
Returns the current timer counter register value. More... | |
#define | XScuTimer_EnableAutoReload(InstancePtr) |
Enable auto-reload mode. More... | |
#define | XScuTimer_DisableAutoReload(InstancePtr) |
Disable auto-reload mode. More... | |
#define | XScuTimer_EnableInterrupt(InstancePtr) |
Enable the Timer interrupt. More... | |
#define | XScuTimer_DisableInterrupt(InstancePtr) |
Disable the Timer interrupt. More... | |
#define | XScuTimer_GetInterruptStatus(InstancePtr) |
This function reads the interrupt status. More... | |
#define | XScuTimer_ClearInterruptStatus(InstancePtr) |
This function clears the interrupt status. More... | |
#define | XScuTimer_SetLoadReg(BaseAddr, Value) XScuTimer_WriteReg(BaseAddr, XSCUTIMER_LOAD_OFFSET, (Value)) |
Write to the timer load register. More... | |
#define | XScuTimer_GetLoadReg(BaseAddr) XScuTimer_ReadReg(BaseAddr, XSCUTIMER_LOAD_OFFSET) |
Returns the current timer load register value. More... | |
#define | XScuTimer_SetCounterReg(BaseAddr, Value) XScuTimer_WriteReg(BaseAddr, XSCUTIMER_COUNTER_OFFSET, (Value)) |
Write to the timer counter register. More... | |
#define | XScuTimer_GetCounterReg(BaseAddr) XScuTimer_ReadReg(BaseAddr, XSCUTIMER_COUNTER_OFFSET) |
Returns the current timer counter register value. More... | |
#define | XScuTimer_SetControlReg(BaseAddr, Value) XScuTimer_WriteReg(BaseAddr, XSCUTIMER_CONTROL_OFFSET, (Value)) |
Write to the timer load register. More... | |
#define | XScuTimer_GetControlReg(BaseAddr) XScuTimer_ReadReg(BaseAddr, XSCUTIMER_CONTROL_OFFSET) |
Returns the current timer load register value. More... | |
#define | XScuTimer_SetIntrReg(BaseAddr, Value) XScuTimer_WriteReg(BaseAddr, XSCUTIMER_ISR_OFFSET, (Value)) |
Write to the timer counter register. More... | |
#define | XScuTimer_GetIntrReg(BaseAddr) XScuTimer_ReadReg(BaseAddr, XSCUTIMER_ISR_OFFSET) |
Returns the current timer counter register value. More... | |
#define | XScuTimer_ReadReg(BaseAddr, RegOffset) Xil_In32((BaseAddr) + (RegOffset)) |
Read from the given Timer register. More... | |
#define | XScuTimer_WriteReg(BaseAddr, RegOffset, Data) Xil_Out32((BaseAddr) + (RegOffset), (Data)) |
Write to the given Timer register. More... | |
Functions | |
s32 | XScuTimer_CfgInitialize (XScuTimer *InstancePtr, XScuTimer_Config *ConfigPtr, u32 EffectiveAddress) |
Initialize a specific timer instance/driver. More... | |
void | XScuTimer_Start (XScuTimer *InstancePtr) |
Start the timer. More... | |
void | XScuTimer_Stop (XScuTimer *InstancePtr) |
Stop the timer. More... | |
void | XScuTimer_SetPrescaler (XScuTimer *InstancePtr, u8 PrescalerValue) |
This function sets the prescaler bits in the timer control register. More... | |
u8 | XScuTimer_GetPrescaler (XScuTimer *InstancePtr) |
This function returns the current prescaler value. More... | |
XScuTimer_Config * | XScuTimer_LookupConfig (u16 DeviceId) |
Lookup the device configuration based on the unique device ID. More... | |
s32 | XScuTimer_SelfTest (XScuTimer *InstancePtr) |
Run a self-test on the timer. More... | |
Variables | |
XScuTimer_Config | XScuTimer_ConfigTable [XPAR_XSCUTIMER_NUM_INSTANCES] |
This table contains configuration information for each timer device in the system. More... | |
XScuTimer_Config | XScuTimer_ConfigTable [XPAR_XSCUTIMER_NUM_INSTANCES] |
This table contains configuration information for each timer device in the system. More... | |
Register Map | |
#define | XSCUTIMER_LOAD_OFFSET 0x00U |
Timer Load Register. More... | |
#define | XSCUTIMER_COUNTER_OFFSET 0x04U |
Timer Counter Register. More... | |
#define | XSCUTIMER_CONTROL_OFFSET 0x08U |
Timer Control Register. More... | |
#define | XSCUTIMER_ISR_OFFSET 0x0CU |
Timer Interrupt Status Register. More... | |
Timer Control register | |
This register bits control the prescaler, Intr enable, auto-reload and timer enable. | |
#define | XSCUTIMER_CONTROL_PRESCALER_MASK 0x0000FF00U |
Prescaler. More... | |
#define | XSCUTIMER_CONTROL_PRESCALER_SHIFT 8U |
#define | XSCUTIMER_CONTROL_IRQ_ENABLE_MASK 0x00000004U |
Intr enable. More... | |
#define | XSCUTIMER_CONTROL_AUTO_RELOAD_MASK 0x00000002U |
Auto-reload. More... | |
#define | XSCUTIMER_CONTROL_ENABLE_MASK 0x00000001U |
Timer enable. More... | |
Interrupt Status register | |
This register indicates the Timer counter register has reached zero. | |
#define | XSCUTIMER_ISR_EVENT_FLAG_MASK 0x00000001U |
Event flag. More... | |
#define XScuTimer_ClearInterruptStatus | ( | InstancePtr | ) |
This function clears the interrupt status.
InstancePtr | is a pointer to the XScuTimer instance. |
#define XSCUTIMER_CONTROL_AUTO_RELOAD_MASK 0x00000002U |
Auto-reload.
#define XSCUTIMER_CONTROL_ENABLE_MASK 0x00000001U |
Timer enable.
Referenced by XScuTimer_SelfTest(), XScuTimer_Start(), and XScuTimer_Stop().
#define XSCUTIMER_CONTROL_IRQ_ENABLE_MASK 0x00000004U |
Intr enable.
#define XSCUTIMER_CONTROL_OFFSET 0x08U |
Timer Control Register.
Referenced by XScuTimer_GetPrescaler(), XScuTimer_SelfTest(), XScuTimer_SetPrescaler(), XScuTimer_Start(), and XScuTimer_Stop().
#define XSCUTIMER_CONTROL_PRESCALER_MASK 0x0000FF00U |
Prescaler.
Referenced by XScuTimer_GetPrescaler(), and XScuTimer_SetPrescaler().
#define XSCUTIMER_COUNTER_OFFSET 0x04U |
Timer Counter Register.
#define XScuTimer_DisableAutoReload | ( | InstancePtr | ) |
Disable auto-reload mode.
InstancePtr | is a pointer to the XScuTimer instance. |
#define XScuTimer_DisableInterrupt | ( | InstancePtr | ) |
Disable the Timer interrupt.
InstancePtr | is a pointer to the XScuTimer instance. |
#define XScuTimer_EnableAutoReload | ( | InstancePtr | ) |
Enable auto-reload mode.
InstancePtr | is a pointer to the XScuTimer instance. |
Referenced by ScuTimerIntrExample().
#define XScuTimer_EnableInterrupt | ( | InstancePtr | ) |
Enable the Timer interrupt.
InstancePtr | is a pointer to the XScuTimer instance. |
Referenced by ScuTimerIntrExample().
#define XScuTimer_GetControlReg | ( | BaseAddr | ) | XScuTimer_ReadReg(BaseAddr, XSCUTIMER_CONTROL_OFFSET) |
Returns the current timer load register value.
BaseAddr | is the base address of the scu timer. |
#define XScuTimer_GetCounterReg | ( | BaseAddr | ) | XScuTimer_ReadReg(BaseAddr, XSCUTIMER_COUNTER_OFFSET) |
Returns the current timer counter register value.
BaseAddr | is the base address of the scu timer. |
#define XScuTimer_GetCounterValue | ( | InstancePtr | ) |
Returns the current timer counter register value.
It can be called at any time.
InstancePtr | is a pointer to the XScuTimer instance. |
Referenced by ScuTimerPolledExample().
#define XScuTimer_GetInterruptStatus | ( | InstancePtr | ) |
This function reads the interrupt status.
InstancePtr | is a pointer to the XScuTimer instance. |
#define XScuTimer_GetIntrReg | ( | BaseAddr | ) | XScuTimer_ReadReg(BaseAddr, XSCUTIMER_ISR_OFFSET) |
Returns the current timer counter register value.
BaseAddr | is the base address of the scu timer. |
#define XScuTimer_GetLoadReg | ( | BaseAddr | ) | XScuTimer_ReadReg(BaseAddr, XSCUTIMER_LOAD_OFFSET) |
Returns the current timer load register value.
BaseAddr | is the base address of the scu timer. |
#define XScuTimer_IsExpired | ( | InstancePtr | ) |
Check if the timer has expired.
InstancePtr | is a pointer to the XScuTimer instance. |
#define XSCUTIMER_ISR_EVENT_FLAG_MASK 0x00000001U |
Event flag.
#define XSCUTIMER_ISR_OFFSET 0x0CU |
Timer Interrupt Status Register.
#define XSCUTIMER_LOAD_OFFSET 0x00U |
Timer Load Register.
Referenced by XScuTimer_SelfTest().
#define XScuTimer_LoadTimer | ( | InstancePtr, | |
Value | |||
) |
Write to the timer load register.
This will also update the timer counter register with the new value. This macro can be used to change the time-out value.
InstancePtr | is a pointer to the XScuTimer instance. |
Value | is the count to be loaded in to the load register. |
Referenced by ScuTimerIntrExample(), ScuTimerPolledExample(), and XScuTimer_SelfTest().
#define XScuTimer_ReadReg | ( | BaseAddr, | |
RegOffset | |||
) | Xil_In32((BaseAddr) + (RegOffset)) |
Read from the given Timer register.
BaseAddr | is the base address of the device |
RegOffset | is the register offset to be read |
Referenced by XScuTimer_GetPrescaler(), XScuTimer_SelfTest(), XScuTimer_SetPrescaler(), XScuTimer_Start(), and XScuTimer_Stop().
#define XScuTimer_RestartTimer | ( | InstancePtr | ) |
Re-start the timer.
This macro will read the timer load register and writes the same value to load register to update the counter register.
InstancePtr | is a pointer to the XScuTimer instance. |
#define XScuTimer_SetControlReg | ( | BaseAddr, | |
Value | |||
) | XScuTimer_WriteReg(BaseAddr, XSCUTIMER_CONTROL_OFFSET, (Value)) |
Write to the timer load register.
This will also update the timer counter register with the new value. This macro can be used to change the time-out value.
BaseAddr | is the base address of the scu timer. |
Value | is the count to be loaded in to the load register. |
#define XScuTimer_SetCounterReg | ( | BaseAddr, | |
Value | |||
) | XScuTimer_WriteReg(BaseAddr, XSCUTIMER_COUNTER_OFFSET, (Value)) |
Write to the timer counter register.
BaseAddr | is the base address of the scu timer. |
Value | is the count to be loaded in to the counter register. |
#define XScuTimer_SetIntrReg | ( | BaseAddr, | |
Value | |||
) | XScuTimer_WriteReg(BaseAddr, XSCUTIMER_ISR_OFFSET, (Value)) |
Write to the timer counter register.
BaseAddr | is the base address of the scu timer. |
Value | is the count to be loaded in to the counter register. |
#define XScuTimer_SetLoadReg | ( | BaseAddr, | |
Value | |||
) | XScuTimer_WriteReg(BaseAddr, XSCUTIMER_LOAD_OFFSET, (Value)) |
Write to the timer load register.
This will also update the timer counter register with the new value. This macro can be used to change the time-out value.
BaseAddr | is the base address of the scu timer. |
Value | is the count to be loaded in to the load register. |
#define XScuTimer_WriteReg | ( | BaseAddr, | |
RegOffset, | |||
Data | |||
) | Xil_Out32((BaseAddr) + (RegOffset), (Data)) |
Write to the given Timer register.
BaseAddr | is the base address of the device |
RegOffset | is the register offset to be written |
Data | is the 32-bit value to write to the register |
Referenced by XScuTimer_SelfTest(), XScuTimer_SetPrescaler(), XScuTimer_Start(), and XScuTimer_Stop().
s32 XScuTimer_CfgInitialize | ( | XScuTimer * | InstancePtr, |
XScuTimer_Config * | ConfigPtr, | ||
u32 | EffectiveAddress | ||
) |
Initialize a specific timer instance/driver.
This function must be called before other functions of the driver are called.
InstancePtr | is a pointer to the XScuTimer instance. |
ConfigPtr | points to the XScuTimer configuration structure. |
EffectiveAddress | is the base address for the device. It could be a virtual address if address translation is supported in the system, otherwise it is the physical address. |
References XScuTimer_Config::BaseAddr, XScuTimer::Config, XScuTimer_Config::DeviceId, XScuTimer::IsReady, and XScuTimer::IsStarted.
Referenced by ScuTimerIntrExample(), and ScuTimerPolledExample().
u8 XScuTimer_GetPrescaler | ( | XScuTimer * | InstancePtr | ) |
This function returns the current prescaler value.
InstancePtr | is a pointer to the XScuTimer instance. |
References XScuTimer_Config::BaseAddr, XScuTimer::Config, XScuTimer::IsReady, XSCUTIMER_CONTROL_OFFSET, XSCUTIMER_CONTROL_PRESCALER_MASK, and XScuTimer_ReadReg.
XScuTimer_Config * XScuTimer_LookupConfig | ( | u16 | DeviceId | ) |
Lookup the device configuration based on the unique device ID.
The table contains the configuration info for each device in the system.
DeviceId | is the unique device ID of the device being looked up. |
Referenced by ScuTimerIntrExample(), and ScuTimerPolledExample().
s32 XScuTimer_SelfTest | ( | XScuTimer * | InstancePtr | ) |
Run a self-test on the timer.
This test clears the timer enable bit in the control register, writes to the timer load register and verifies the value read back matches the value written and restores the control register and the timer load register.
InstancePtr | is a pointer to the XScuTimer instance. |
References XScuTimer_Config::BaseAddr, XScuTimer::Config, XScuTimer::IsReady, XSCUTIMER_CONTROL_ENABLE_MASK, XSCUTIMER_CONTROL_OFFSET, XSCUTIMER_LOAD_OFFSET, XScuTimer_LoadTimer, XScuTimer_ReadReg, and XScuTimer_WriteReg.
Referenced by ScuTimerIntrExample().
void XScuTimer_SetPrescaler | ( | XScuTimer * | InstancePtr, |
u8 | PrescalerValue | ||
) |
This function sets the prescaler bits in the timer control register.
InstancePtr | is a pointer to the XScuTimer instance. |
PrescalerValue | is a 8 bit value that sets the prescaler to use. |
References XScuTimer_Config::BaseAddr, XScuTimer::Config, XScuTimer::IsReady, XSCUTIMER_CONTROL_OFFSET, XSCUTIMER_CONTROL_PRESCALER_MASK, XScuTimer_ReadReg, and XScuTimer_WriteReg.
void XScuTimer_Start | ( | XScuTimer * | InstancePtr | ) |
Start the timer.
InstancePtr | is a pointer to the XScuTimer instance. |
References XScuTimer_Config::BaseAddr, XScuTimer::Config, XScuTimer::IsReady, XScuTimer::IsStarted, XSCUTIMER_CONTROL_ENABLE_MASK, XSCUTIMER_CONTROL_OFFSET, XScuTimer_ReadReg, and XScuTimer_WriteReg.
Referenced by ScuTimerIntrExample(), and ScuTimerPolledExample().
void XScuTimer_Stop | ( | XScuTimer * | InstancePtr | ) |
Stop the timer.
InstancePtr | is a pointer to the XScuTimer instance. |
References XScuTimer_Config::BaseAddr, XScuTimer::Config, XScuTimer::IsReady, XScuTimer::IsStarted, XSCUTIMER_CONTROL_ENABLE_MASK, XSCUTIMER_CONTROL_OFFSET, XScuTimer_ReadReg, and XScuTimer_WriteReg.
Referenced by ScuTimerIntrExample(), and ScuTimerPolledExample().
XScuTimer_Config XScuTimer_ConfigTable[XPAR_XSCUTIMER_NUM_INSTANCES] |
This table contains configuration information for each timer device in the system.
XScuTimer_Config XScuTimer_ConfigTable[XPAR_XSCUTIMER_NUM_INSTANCES] |
This table contains configuration information for each timer device in the system.