scutimer_v2_1: Added new version for scutimer driver.
This patch adds new minor version for scutimer by changing mdd files. Signed-off-by: P L Sai Krishna <lakshmis@xilinx.com>
This commit is contained in:
parent
0ab23c8519
commit
7eea5a82f0
14 changed files with 2154 additions and 0 deletions
42
XilinxProcessorIPLib/drivers/scutimer/data/scutimer.mdd
Normal file
42
XilinxProcessorIPLib/drivers/scutimer/data/scutimer.mdd
Normal file
|
@ -0,0 +1,42 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
OPTION psf_version = 2.1;
|
||||
|
||||
BEGIN driver scutimer
|
||||
|
||||
OPTION supported_peripherals = (ps7_scutimer);
|
||||
OPTION driver_state = ACTIVE;
|
||||
OPTION copyfiles = all;
|
||||
OPTION VERSION = 2.1;
|
||||
OPTION NAME = scutimer;
|
||||
|
||||
END driver
|
51
XilinxProcessorIPLib/drivers/scutimer/data/scutimer.tcl
Executable file
51
XilinxProcessorIPLib/drivers/scutimer/data/scutimer.tcl
Executable file
|
@ -0,0 +1,51 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
###############################################################################
|
||||
##############################################################################
|
||||
#
|
||||
# Modification History
|
||||
#
|
||||
# Ver Who Date Changes
|
||||
# ----- ---- -------- -----------------------------------------------
|
||||
# 1.00a sdm 11/22/11 Created
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
#uses "xillib.tcl"
|
||||
|
||||
proc generate {drv_handle} {
|
||||
xdefine_zynq_include_file $drv_handle "xparameters.h" "XScuTimer" "NUM_INSTANCES" "DEVICE_ID" "C_S_AXI_BASEADDR" "C_S_AXI_HIGHADDR"
|
||||
|
||||
xdefine_zynq_config_file $drv_handle "xscutimer_g.c" "XScuTimer" "DEVICE_ID" "C_S_AXI_BASEADDR"
|
||||
|
||||
xdefine_zynq_canonical_xpars $drv_handle "xparameters.h" "XScuTimer" "DEVICE_ID" "C_S_AXI_BASEADDR" "C_S_AXI_HIGHADDR"
|
||||
|
||||
}
|
44
XilinxProcessorIPLib/drivers/scutimer/data/scutimer_header.h
Normal file
44
XilinxProcessorIPLib/drivers/scutimer/data/scutimer_header.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* $Id: tmrctr_header.h,v 1.1.2.1 2010/12/01 07:53:56 svemula Exp $ */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef SCUTIMER_HEADER_H /* prevent circular inclusions */
|
||||
#define SCUTIMER_HEADER_H /* by using protection macros */
|
||||
|
||||
#include "xil_types.h"
|
||||
#include "xil_assert.h"
|
||||
#include "xstatus.h"
|
||||
|
||||
int ScuTimerPolledExample(u16 DeviceId);
|
||||
int ScuTimerIntrExample(XScuGic *IntcInstancePtr, XScuTimer *TimerInstancePtr,
|
||||
u16 TimerDeviceId, u16 TimerIntrId);
|
||||
|
||||
#endif
|
186
XilinxProcessorIPLib/drivers/scutimer/data/scutimer_tapp.tcl
Executable file
186
XilinxProcessorIPLib/drivers/scutimer/data/scutimer_tapp.tcl
Executable file
|
@ -0,0 +1,186 @@
|
|||
###############################################################################
|
||||
#
|
||||
# Copyright (C) 2011 - 2014 Xilinx, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# Use of the Software is limited solely to applications:
|
||||
# (a) running on a Xilinx device, or
|
||||
# (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
# in advertising or otherwise to promote the sale, use or other dealings in
|
||||
# this Software without prior written authorization from Xilinx.
|
||||
#
|
||||
#
|
||||
# MODIFICATION HISTORY:
|
||||
# Ver Who Date Changes
|
||||
# -------- ------ -------- ------------------------------------
|
||||
# 2.0 adk 12/10/13 Updated as per the New Tcl API's
|
||||
##############################################################################
|
||||
|
||||
# Uses $XILINX_EDK/bin/lib/xillib_sw.tcl
|
||||
# -----------------------------------------------------------------
|
||||
# Software Project Types (swproj):
|
||||
# 0 : MemoryTest - Calls basic memorytest routines from common driver dir
|
||||
# 1 : PeripheralTest - Calls any existing polled_example and/or selftest
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TCL Procedures:
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
proc gen_include_files {swproj mhsinst} {
|
||||
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
set inc_file_lines {xscutimer.h scutimer_header.h}
|
||||
}
|
||||
return $inc_file_lines
|
||||
}
|
||||
|
||||
|
||||
proc gen_src_files {swproj mhsinst} {
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
|
||||
set inc_file_lines {examples/xscutimer_polled_example.c examples/xscutimer_intr_example.c data/scutimer_header.h}
|
||||
|
||||
return $inc_file_lines
|
||||
}
|
||||
}
|
||||
|
||||
proc gen_testfunc_def {swproj mhsinst} {
|
||||
return ""
|
||||
}
|
||||
|
||||
proc gen_init_code {swproj mhsinst} {
|
||||
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
|
||||
set ipname [get_property NAME $mhsinst]
|
||||
set decl " static XScuTimer ${ipname};"
|
||||
set inc_file_lines $decl
|
||||
return $inc_file_lines
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
proc gen_testfunc_call {swproj mhsinst} {
|
||||
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
|
||||
set ipname [get_property NAME $mhsinst]
|
||||
set deviceid [::hsi::utils::get_ip_param_name $mhsinst "DEVICE_ID"]
|
||||
set stdout [get_property CONFIG.STDOUT [get_os]]
|
||||
if { $stdout == "" || $stdout == "none" } {
|
||||
set hasStdout 0
|
||||
} else {
|
||||
set hasStdout 1
|
||||
}
|
||||
|
||||
set isintr [::hsi::utils::is_ip_interrupting_current_proc $mhsinst]
|
||||
set intcvar intc
|
||||
|
||||
|
||||
set testfunc_call ""
|
||||
|
||||
if {${hasStdout} == 0} {
|
||||
|
||||
append testfunc_call "
|
||||
|
||||
{
|
||||
int Status;
|
||||
|
||||
Status = ScuTimerPolledExample(${deviceid});
|
||||
|
||||
}"
|
||||
|
||||
if {$isintr == 1} {
|
||||
set intr_id "XPAR_${ipname}_INTR"
|
||||
set intr_id [string toupper $intr_id]
|
||||
|
||||
append testfunc_call "
|
||||
|
||||
{
|
||||
int Status;
|
||||
Status = ScuTimerIntrExample(&${intcvar}, &${ipname}, \\
|
||||
${deviceid}, \\
|
||||
${intr_id});
|
||||
}"
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
append testfunc_call "
|
||||
|
||||
{
|
||||
int Status;
|
||||
|
||||
print(\"\\r\\n Running ScuTimerPolledExample() for ${ipname}...\\r\\n\");
|
||||
|
||||
Status = ScuTimerPolledExample(${deviceid});
|
||||
|
||||
if (Status == 0) {
|
||||
print(\"ScuTimerPolledExample PASSED\\r\\n\");
|
||||
}
|
||||
else {
|
||||
print(\"ScuTimerPolledExample FAILED\\r\\n\");
|
||||
}
|
||||
}"
|
||||
|
||||
if {$isintr ==1 } {
|
||||
set intr_id "XPAR_${ipname}_INTR"
|
||||
set intr_id [string toupper $intr_id]
|
||||
|
||||
append testfunc_call "
|
||||
{
|
||||
int Status;
|
||||
|
||||
print(\"\\r\\n Running Interrupt Test for ${ipname}...\\r\\n\");
|
||||
|
||||
Status = ScuTimerIntrExample(&${intcvar}, &${ipname}, \\
|
||||
${deviceid}, \\
|
||||
${intr_id});
|
||||
|
||||
if (Status == 0) {
|
||||
print(\"ScuTimerIntrExample PASSED\\r\\n\");
|
||||
}
|
||||
else {
|
||||
print(\"ScuTimerIntrExample FAILED\\r\\n\");
|
||||
}
|
||||
|
||||
}"
|
||||
}
|
||||
}
|
||||
|
||||
return $testfunc_call
|
||||
}
|
18
XilinxProcessorIPLib/drivers/scutimer/examples/index.html
Executable file
18
XilinxProcessorIPLib/drivers/scutimer/examples/index.html
Executable file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Driver example applications</title>
|
||||
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<h1> Example Applications for the driver scutimer_v2_0 </h1>
|
||||
<HR>
|
||||
<ul>
|
||||
<li>xscutimer_polled_example.c <a href="xscutimer_polled_example.c">(source)</a> </li>
|
||||
<li>xscutimer_intr_example.c <a href="xscutimer_intr_example.c">(source)</a> </li>
|
||||
</ul>
|
||||
<p><font face="Times New Roman" color="#800000">Copyright <20> 1995-2014 Xilinx, Inc. All rights reserved.</font></p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,377 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer_intr_example.c
|
||||
*
|
||||
* This file contains a design example using the Cortex A9 Scu Private
|
||||
* Timer and the driver (XScuTimer) using interrupts.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xscutimer.h"
|
||||
#include "xscugic.h"
|
||||
#include "xil_exception.h"
|
||||
#include "xil_printf.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are only defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#ifndef TESTAPP_GEN
|
||||
#define TIMER_DEVICE_ID XPAR_XSCUTIMER_0_DEVICE_ID
|
||||
#define INTC_DEVICE_ID XPAR_SCUGIC_SINGLE_DEVICE_ID
|
||||
#define TIMER_IRPT_INTR XPAR_SCUTIMER_INTR
|
||||
#endif
|
||||
|
||||
#define TIMER_LOAD_VALUE 0xFFFF
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int ScuTimerIntrExample(XScuGic *IntcInstancePtr, XScuTimer *TimerInstancePtr,
|
||||
u16 TimerDeviceId, u16 TimerIntrId);
|
||||
|
||||
static void TimerIntrHandler(void *CallBackRef);
|
||||
|
||||
static int TimerSetupIntrSystem(XScuGic *IntcInstancePtr,
|
||||
XScuTimer *TimerInstancePtr, u16 TimerIntrId);
|
||||
|
||||
static void TimerDisableIntrSystem(XScuGic *IntcInstancePtr, u16 TimerIntrId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
XScuTimer TimerInstance; /* Cortex A9 Scu Private Timer Instance */
|
||||
XScuGic IntcInstance; /* Interrupt Controller Instance */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following variables are shared between non-interrupt processing and
|
||||
* interrupt processing such that they must be global.
|
||||
*/
|
||||
volatile int TimerExpired;
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Main function to call the Cortex A9 Scu Private Timer interrupt example.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
|
||||
xil_printf("SCU Timer Interrupt Example Test \r\n");
|
||||
|
||||
/*
|
||||
* Call the interrupt example, specify the parameters generated in
|
||||
* xparameters.h
|
||||
*/
|
||||
Status = ScuTimerIntrExample(&IntcInstance, &TimerInstance,
|
||||
TIMER_DEVICE_ID, TIMER_IRPT_INTR);
|
||||
if (Status != XST_SUCCESS) {
|
||||
xil_printf("SCU Timer Interrupt Example Test Failed\r\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
xil_printf("Successfully ran SCU Timer Interrupt Example Test\r\n");
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function tests the functioning of the Cortex A9 Scu Private Timer driver
|
||||
* and hardware using interrupts.
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the instance of XScuGic driver.
|
||||
* @param TimerInstancePtr is a pointer to the instance of XScuTimer
|
||||
* driver.
|
||||
* @param TimerDeviceId is the Device ID of the XScuTimer device.
|
||||
* @param TimerIntrId is the Interrupt Id of the XScuTimer device.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int ScuTimerIntrExample(XScuGic *IntcInstancePtr, XScuTimer * TimerInstancePtr,
|
||||
u16 TimerDeviceId, u16 TimerIntrId)
|
||||
{
|
||||
int Status;
|
||||
int LastTimerExpired = 0;
|
||||
XScuTimer_Config *ConfigPtr;
|
||||
|
||||
/*
|
||||
* Initialize the Scu Private Timer driver.
|
||||
*/
|
||||
ConfigPtr = XScuTimer_LookupConfig(TimerDeviceId);
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform a self-test to ensure that the hardware was built correctly.
|
||||
*/
|
||||
Status = XScuTimer_SelfTest(TimerInstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Connect the device to interrupt subsystem so that interrupts
|
||||
* can occur.
|
||||
*/
|
||||
Status = TimerSetupIntrSystem(IntcInstancePtr,
|
||||
TimerInstancePtr, TimerIntrId);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable Auto reload mode.
|
||||
*/
|
||||
XScuTimer_EnableAutoReload(TimerInstancePtr);
|
||||
|
||||
/*
|
||||
* Load the timer counter register.
|
||||
*/
|
||||
XScuTimer_LoadTimer(TimerInstancePtr, TIMER_LOAD_VALUE);
|
||||
|
||||
/*
|
||||
* Start the timer counter and then wait for it
|
||||
* to timeout a number of times.
|
||||
*/
|
||||
XScuTimer_Start(TimerInstancePtr);
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* Wait for the first timer counter to expire as indicated by
|
||||
* the shared variable which the handler will increment.
|
||||
*/
|
||||
while (TimerExpired == LastTimerExpired) {
|
||||
}
|
||||
|
||||
LastTimerExpired = TimerExpired;
|
||||
/*
|
||||
* If it has expired a number of times, then stop the timer
|
||||
* counter and stop this example.
|
||||
*/
|
||||
if (TimerExpired == 3) {
|
||||
XScuTimer_Stop(TimerInstancePtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Disable and disconnect the interrupt system.
|
||||
*/
|
||||
TimerDisableIntrSystem(IntcInstancePtr, TimerIntrId);
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function sets up the interrupt system such that interrupts can occur
|
||||
* for the device.
|
||||
*
|
||||
* @param IntcInstancePtr is a pointer to the instance of XScuGic driver.
|
||||
* @param TimerInstancePtr is a pointer to the instance of XScuTimer
|
||||
* driver.
|
||||
* @param TimerIntrId is the Interrupt Id of the XScuTimer device.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static int TimerSetupIntrSystem(XScuGic *IntcInstancePtr,
|
||||
XScuTimer *TimerInstancePtr, u16 TimerIntrId)
|
||||
{
|
||||
int Status;
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
XScuGic_Config *IntcConfig;
|
||||
|
||||
/*
|
||||
* Initialize the interrupt controller driver so that it is ready to
|
||||
* use.
|
||||
*/
|
||||
IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
|
||||
if (NULL == IntcConfig) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
|
||||
IntcConfig->CpuBaseAddress);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
Xil_ExceptionInit();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Connect the interrupt controller interrupt handler to the hardware
|
||||
* interrupt handling logic in the processor.
|
||||
*/
|
||||
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT,
|
||||
(Xil_ExceptionHandler)XScuGic_InterruptHandler,
|
||||
IntcInstancePtr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Connect the device driver handler that will be called when an
|
||||
* interrupt for the device occurs, the handler defined above performs
|
||||
* the specific interrupt processing for the device.
|
||||
*/
|
||||
Status = XScuGic_Connect(IntcInstancePtr, TimerIntrId,
|
||||
(Xil_ExceptionHandler)TimerIntrHandler,
|
||||
(void *)TimerInstancePtr);
|
||||
if (Status != XST_SUCCESS) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the interrupt for the device.
|
||||
*/
|
||||
XScuGic_Enable(IntcInstancePtr, TimerIntrId);
|
||||
|
||||
/*
|
||||
* Enable the timer interrupts for timer mode.
|
||||
*/
|
||||
XScuTimer_EnableInterrupt(TimerInstancePtr);
|
||||
|
||||
#ifndef TESTAPP_GEN
|
||||
/*
|
||||
* Enable interrupts in the Processor.
|
||||
*/
|
||||
Xil_ExceptionEnable();
|
||||
#endif
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function is the Interrupt handler for the Timer interrupt of the
|
||||
* Timer device. It is called on the expiration of the timer counter in
|
||||
* interrupt context.
|
||||
*
|
||||
* @param CallBackRef is a pointer to the callback function.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static void TimerIntrHandler(void *CallBackRef)
|
||||
{
|
||||
XScuTimer *TimerInstancePtr = (XScuTimer *) CallBackRef;
|
||||
|
||||
/*
|
||||
* Check if the timer counter has expired, checking is not necessary
|
||||
* since that's the reason this function is executed, this just shows
|
||||
* how the callback reference can be used as a pointer to the instance
|
||||
* of the timer counter that expired, increment a shared variable so
|
||||
* the main thread of execution can see the timer expired.
|
||||
*/
|
||||
if (XScuTimer_IsExpired(TimerInstancePtr)) {
|
||||
XScuTimer_ClearInterruptStatus(TimerInstancePtr);
|
||||
TimerExpired++;
|
||||
if (TimerExpired == 3) {
|
||||
XScuTimer_DisableAutoReload(TimerInstancePtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function disables the interrupts that occur for the device.
|
||||
*
|
||||
* @param IntcInstancePtr is the pointer to the instance of XScuGic
|
||||
* driver.
|
||||
* @param TimerIntrId is the Interrupt Id for the device.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
static void TimerDisableIntrSystem(XScuGic *IntcInstancePtr, u16 TimerIntrId)
|
||||
{
|
||||
/*
|
||||
* Disconnect and disable the interrupt for the Timer.
|
||||
*/
|
||||
XScuGic_Disconnect(IntcInstancePtr, TimerIntrId);
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @file xscutimer_polled_example.c
|
||||
*
|
||||
* This file contains a design example using the Scu Private Timer driver
|
||||
* (XScuTimer) and hardware timer device. This test assumes Auto Reload mode is
|
||||
* not enabled.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
*<pre>
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
*</pre>
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xscutimer.h"
|
||||
#include "xil_printf.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/*
|
||||
* The following constants map to the XPAR parameters created in the
|
||||
* xparameters.h file. They are only defined here such that a user can easily
|
||||
* change all the needed parameters in one place.
|
||||
*/
|
||||
#define TIMER_DEVICE_ID XPAR_XSCUTIMER_0_DEVICE_ID
|
||||
#define TIMER_LOAD_VALUE 0xFF
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
int ScuTimerPolledExample(u16 DeviceId);
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
XScuTimer Timer; /* Cortex A9 SCU Private Timer Instance */
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Main function to call the Scu Private Timer polled mode example.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return XST_SUCCESS if successful, XST_FAILURE if unsuccessful.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef TESTAPP_GEN
|
||||
int main(void)
|
||||
{
|
||||
int Status;
|
||||
|
||||
xil_printf("SCU Timer Polled Mode Example Test \r\n");
|
||||
|
||||
/*
|
||||
* Call the polled example, specify the device ID that is generated in
|
||||
* xparameters.h.
|
||||
*/
|
||||
Status = ScuTimerPolledExample(TIMER_DEVICE_ID);
|
||||
if (Status != XST_SUCCESS) {
|
||||
xil_printf("SCU Timer Polled Mode Example Test Failed\r\n");
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
xil_printf("Successfully ran SCU Timer Polled Mode Example Test\r\n");
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
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;
|
||||
}
|
40
XilinxProcessorIPLib/drivers/scutimer/src/Makefile
Normal file
40
XilinxProcessorIPLib/drivers/scutimer/src/Makefile
Normal file
|
@ -0,0 +1,40 @@
|
|||
COMPILER=
|
||||
ARCHIVER=
|
||||
CP=cp
|
||||
COMPILER_FLAGS=
|
||||
EXTRA_COMPILER_FLAGS=
|
||||
LIB=libxil.a
|
||||
|
||||
CC_FLAGS = $(COMPILER_FLAGS)
|
||||
ECC_FLAGS = $(EXTRA_COMPILER_FLAGS)
|
||||
|
||||
RELEASEDIR=../../../lib
|
||||
INCLUDEDIR=../../../include
|
||||
INCLUDES=-I./. -I${INCLUDEDIR}
|
||||
|
||||
OUTS = *.o
|
||||
|
||||
LIBSOURCES:=*.c
|
||||
INCLUDEFILES:=*.h
|
||||
|
||||
OBJECTS = $(addsuffix .o, $(basename $(wildcard *.c)))
|
||||
|
||||
libs: banner scutimer_libs clean
|
||||
|
||||
%.o: %.c
|
||||
${COMPILER} $(CC_FLAGS) $(ECC_FLAGS) $(INCLUDES) -o $@ $<
|
||||
|
||||
banner:
|
||||
echo "Compiling scutimer"
|
||||
|
||||
scutimer_libs: ${OBJECTS}
|
||||
$(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OBJECTS}
|
||||
|
||||
.PHONY: include
|
||||
include: scutimer_includes
|
||||
|
||||
scutimer_includes:
|
||||
${CP} ${INCLUDEFILES} ${INCLUDEDIR}
|
||||
|
||||
clean:
|
||||
rm -rf ${OBJECTS}
|
279
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer.c
Normal file
279
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer.c
Normal file
|
@ -0,0 +1,279 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer.c
|
||||
*
|
||||
* Contains the implementation of interface functions of the SCU Timer driver.
|
||||
* See xscutimer.h for a description of the driver.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xscutimer.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Initialize a specific timer instance/driver. This function must be called
|
||||
* before other functions of the driver are called.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
* @param ConfigPtr points to the XScuTimer configuration structure.
|
||||
* @param 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.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if initialization was successful.
|
||||
* - XST_DEVICE_IS_STARTED if the device has already been started.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int XScuTimer_CfgInitialize(XScuTimer *InstancePtr,
|
||||
XScuTimer_Config *ConfigPtr, u32 EffectiveAddress)
|
||||
{
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(ConfigPtr != NULL);
|
||||
|
||||
/*
|
||||
* If the device is started, disallow the initialize and return a
|
||||
* status indicating it is started. This allows the user to stop the
|
||||
* device and reinitialize, but prevents a user from inadvertently
|
||||
* initializing.
|
||||
*/
|
||||
if (InstancePtr->IsStarted == XIL_COMPONENT_IS_STARTED) {
|
||||
return XST_DEVICE_IS_STARTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy configuration into the instance structure.
|
||||
*/
|
||||
InstancePtr->Config.DeviceId = ConfigPtr->DeviceId;
|
||||
|
||||
/*
|
||||
* Save the base address pointer such that the registers of the block
|
||||
* can be accessed and indicate it has not been started yet.
|
||||
*/
|
||||
InstancePtr->Config.BaseAddr = EffectiveAddress;
|
||||
|
||||
InstancePtr->IsStarted = 0;
|
||||
|
||||
/*
|
||||
* Indicate the instance is ready to use, successfully initialized.
|
||||
*/
|
||||
InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Start the timer.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void XScuTimer_Start(XScuTimer *InstancePtr)
|
||||
{
|
||||
u32 Register;
|
||||
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
/*
|
||||
* Read the contents of the Control register.
|
||||
*/
|
||||
Register = XScuTimer_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET);
|
||||
|
||||
/*
|
||||
* Set the 'timer enable' bit in the register.
|
||||
*/
|
||||
Register |= XSCUTIMER_CONTROL_ENABLE_MASK;
|
||||
|
||||
/*
|
||||
* Update the Control register with the new value.
|
||||
*/
|
||||
XScuTimer_WriteReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET, Register);
|
||||
|
||||
/*
|
||||
* Indicate that the device is started.
|
||||
*/
|
||||
InstancePtr->IsStarted = XIL_COMPONENT_IS_STARTED;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Stop the timer.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
void XScuTimer_Stop(XScuTimer *InstancePtr)
|
||||
{
|
||||
u32 Register;
|
||||
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
/*
|
||||
* Read the contents of the Control register.
|
||||
*/
|
||||
Register = XScuTimer_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET);
|
||||
|
||||
/*
|
||||
* Clear the 'timer enable' bit in the register.
|
||||
*/
|
||||
Register &= ~XSCUTIMER_CONTROL_ENABLE_MASK;
|
||||
|
||||
/*
|
||||
* Update the Control register with the new value.
|
||||
*/
|
||||
XScuTimer_WriteReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET, Register);
|
||||
|
||||
/*
|
||||
* Indicate that the device is stopped.
|
||||
*/
|
||||
InstancePtr->IsStarted = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function sets the prescaler bits in the timer control register.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
* @param PrescalerValue is a 8 bit value that sets the prescaler to use.
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*
|
||||
****************************************************************************/
|
||||
void XScuTimer_SetPrescaler(XScuTimer *InstancePtr, u8 PrescalerValue)
|
||||
{
|
||||
u32 ControlReg;
|
||||
|
||||
/*
|
||||
* Assert to validate input arguments.
|
||||
*/
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
/*
|
||||
* Read the Timer control register.
|
||||
*/
|
||||
ControlReg = XScuTimer_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET);
|
||||
|
||||
/*
|
||||
* Clear all of the prescaler control bits in the register.
|
||||
*/
|
||||
ControlReg &= ~XSCUTIMER_CONTROL_PRESCALER_MASK;
|
||||
|
||||
/*
|
||||
* Set the prescaler value.
|
||||
*/
|
||||
ControlReg |= (PrescalerValue << XSCUTIMER_CONTROL_PRESCALER_SHIFT);
|
||||
|
||||
/*
|
||||
* Write the register with the new values.
|
||||
*/
|
||||
XScuTimer_WriteReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET, ControlReg);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function returns the current prescaler value.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return The prescaler value.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
****************************************************************************/
|
||||
u8 XScuTimer_GetPrescaler(XScuTimer *InstancePtr)
|
||||
{
|
||||
u32 ControlReg;
|
||||
|
||||
/*
|
||||
* Assert to validate input arguments.
|
||||
*/
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
/*
|
||||
* Read the Timer control register.
|
||||
*/
|
||||
ControlReg = XScuTimer_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET);
|
||||
ControlReg &= XSCUTIMER_CONTROL_PRESCALER_MASK;
|
||||
|
||||
return (ControlReg >> XSCUTIMER_CONTROL_PRESCALER_SHIFT);
|
||||
}
|
361
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer.h
Normal file
361
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer.h
Normal file
|
@ -0,0 +1,361 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer.h
|
||||
*
|
||||
* The timer driver supports the Cortex A9 private timer.
|
||||
*
|
||||
* The timer driver supports the following features:
|
||||
* - Normal mode and Auto reload mode
|
||||
* - Interrupts (Interrupt handler is not provided in this driver. Application
|
||||
* has to register it's own handler)
|
||||
*
|
||||
* <b> Initialization and Configuration </b>
|
||||
*
|
||||
* The device driver enables higher layer software (e.g., an application) to
|
||||
* communicate with the Timer.
|
||||
*
|
||||
* XScuTimer_CfgInitialize() API is used to initialize the Timer. The
|
||||
* user needs to first call the XScuTimer_LookupConfig() API which returns
|
||||
* the Configuration structure pointer which is passed as a parameter to
|
||||
* the XScuTimer_CfgInitialize() API.
|
||||
*
|
||||
* <b> Interrupts </b>
|
||||
*
|
||||
* The Timer hardware supports interrupts.
|
||||
*
|
||||
* This driver does not provide a Interrupt Service Routine (ISR) for the device.
|
||||
* It is the responsibility of the application to provide one if needed. Refer to
|
||||
* the interrupt example provided with this driver for details on using the
|
||||
* Timer in interrupt mode.
|
||||
*
|
||||
* <b> Virtual Memory </b>
|
||||
*
|
||||
* This driver supports Virtual Memory. The RTOS is responsible for calculating
|
||||
* the correct device base address in Virtual Memory space.
|
||||
*
|
||||
* <b> Threads </b>
|
||||
*
|
||||
* This driver is not thread safe. Any needs for threads or thread mutual
|
||||
* exclusion must be satisfied by the layer above this driver.
|
||||
*
|
||||
* <b> Asserts </b>
|
||||
*
|
||||
* Asserts are used within all Xilinx drivers to enforce constraints on argument
|
||||
* values. Asserts can be turned off on a system-wide basis by defining, at
|
||||
* compile time, the NDEBUG identifier. By default, asserts are turned on and it
|
||||
* is recommended that users leave asserts on during development.
|
||||
*
|
||||
* <b> Building the driver </b>
|
||||
*
|
||||
* The XScuTimer driver is composed of several source files. This allows the user
|
||||
* to build and link only those parts of the driver that are necessary.
|
||||
*
|
||||
* <br><br>
|
||||
*
|
||||
* NOTE:
|
||||
* The timer is not a part of the snoop control unit as indicated by the
|
||||
* prefix "scu" in the name of the driver.
|
||||
* It is an independent module in APU.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* 1.02a sg 07/17/12 Included xil_assert.h for CR 667947. This is an issue
|
||||
* when the xstatus.h in the common driver overwrites
|
||||
* the xstatus.h of the standalone BSP during the
|
||||
* libgen.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef XSCUTIMER_H /* prevent circular inclusions */
|
||||
#define XSCUTIMER_H /* by using protection macros */
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xstatus.h"
|
||||
#include "xscutimer_hw.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/**
|
||||
* This typedef contains configuration information for the device.
|
||||
*/
|
||||
typedef struct {
|
||||
u16 DeviceId; /**< Unique ID of device */
|
||||
u32 BaseAddr; /**< Base address of the device */
|
||||
} XScuTimer_Config;
|
||||
|
||||
/**
|
||||
* The XScuTimer driver instance data. The user is required to allocate a
|
||||
* variable of this type for every timer device in the system.
|
||||
* A pointer to a variable of this type is then passed to the driver API
|
||||
* functions.
|
||||
*/
|
||||
typedef struct {
|
||||
XScuTimer_Config Config; /**< Hardware Configuration */
|
||||
u32 IsReady; /**< Device is initialized and ready */
|
||||
u32 IsStarted; /**< Device timer is running */
|
||||
} XScuTimer;
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check if the timer has expired.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return
|
||||
* - TRUE if the timer has expired.
|
||||
* - FALSE if the timer has not expired.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* int XScuTimer_IsExpired(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_IsExpired(InstancePtr) \
|
||||
((XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_ISR_OFFSET) & \
|
||||
XSCUTIMER_ISR_EVENT_FLAG_MASK) == \
|
||||
XSCUTIMER_ISR_EVENT_FLAG_MASK)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_RestartTimer(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_RestartTimer(InstancePtr) \
|
||||
XScuTimer_LoadTimer(InstancePtr, \
|
||||
XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_LOAD_OFFSET))
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
* @param Value is the count to be loaded in to the load register.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_LoadTimer(XScuTimer *InstancePtr, u32 Value)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_LoadTimer(InstancePtr, Value) \
|
||||
XScuTimer_WriteReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_LOAD_OFFSET, Value)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Returns the current timer counter register value. It can be called at any
|
||||
* time.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return Contents of the timer counter register.
|
||||
*
|
||||
* @note C-style signature:
|
||||
u32 XScuTimer_GetCounterValue(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_GetCounterValue(InstancePtr) \
|
||||
XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_COUNTER_OFFSET)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Enable auto-reload mode.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_EnableAutoReload(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_EnableAutoReload(InstancePtr) \
|
||||
XScuTimer_WriteReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET, \
|
||||
(XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET) | \
|
||||
XSCUTIMER_CONTROL_AUTO_RELOAD_MASK))
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Disable auto-reload mode.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_DisableAutoReload(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_DisableAutoReload(InstancePtr) \
|
||||
XScuTimer_WriteReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET, \
|
||||
(XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET) & \
|
||||
~(XSCUTIMER_CONTROL_AUTO_RELOAD_MASK)))
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Enable the Timer interrupt.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_EnableInterrupt(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_EnableInterrupt(InstancePtr) \
|
||||
XScuTimer_WriteReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET, \
|
||||
(XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET) | \
|
||||
XSCUTIMER_CONTROL_IRQ_ENABLE_MASK))
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Disable the Timer interrupt.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_DisableInterrupt(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_DisableInterrupt(InstancePtr) \
|
||||
XScuTimer_WriteReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET, \
|
||||
(XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_CONTROL_OFFSET) & \
|
||||
~(XSCUTIMER_CONTROL_IRQ_ENABLE_MASK)))
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function reads the interrupt status.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_GetInterruptStatus(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_GetInterruptStatus(InstancePtr) \
|
||||
XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_ISR_OFFSET)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function clears the interrupt status.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_ClearInterruptStatus(XScuTimer *InstancePtr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_ClearInterruptStatus(InstancePtr) \
|
||||
XScuTimer_WriteReg((InstancePtr)->Config.BaseAddr, \
|
||||
XSCUTIMER_ISR_OFFSET, XSCUTIMER_ISR_EVENT_FLAG_MASK)
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/*
|
||||
* Lookup configuration in xscutimer_sinit.c
|
||||
*/
|
||||
XScuTimer_Config *XScuTimer_LookupConfig(u16 DeviceId);
|
||||
|
||||
/*
|
||||
* Selftest function in xscutimer_selftest.c
|
||||
*/
|
||||
int XScuTimer_SelfTest(XScuTimer *InstancePtr);
|
||||
|
||||
/*
|
||||
* Interface functions in xscutimer.c
|
||||
*/
|
||||
int XScuTimer_CfgInitialize(XScuTimer *InstancePtr,
|
||||
XScuTimer_Config *ConfigPtr, u32 EffectiveAddress);
|
||||
void XScuTimer_Start(XScuTimer *InstancePtr);
|
||||
void XScuTimer_Stop(XScuTimer *InstancePtr);
|
||||
void XScuTimer_SetPrescaler(XScuTimer *InstancePtr, u8 PrescalerValue);
|
||||
u8 XScuTimer_GetPrescaler(XScuTimer *InstancePtr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of protection macro */
|
74
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_g.c
Normal file
74
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_g.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer_g.c
|
||||
*
|
||||
* This file contains a table that specifies the configuration of the SCU
|
||||
* Timer in the system.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xscutimer.h"
|
||||
#include "xparameters.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/************************** Variable Prototypes ******************************/
|
||||
|
||||
/**
|
||||
* This table contains configuration information for each timer
|
||||
* device in the system.
|
||||
*/
|
||||
XScuTimer_Config XScuTimer_ConfigTable[XPAR_XSCUTIMER_NUM_INSTANCES] = {
|
||||
{
|
||||
XPAR_XSCUTIMER_0_DEVICE_ID,
|
||||
XPAR_XSCUTIMER_0_BASEADDR
|
||||
}
|
||||
};
|
283
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_hw.h
Normal file
283
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_hw.h
Normal file
|
@ -0,0 +1,283 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer_hw.h
|
||||
*
|
||||
* This file contains the hardware interface to the Timer.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* 1.01a sdm 02/02/12 Added low level macros to read/write load, counter, control
|
||||
* and interrupt registers
|
||||
* 1.02a sg 07/17/12 Included xil_assert.h for CR 667947. This is an issue
|
||||
* when the xstatus.h in the common driver overwrites
|
||||
* the xstatus.h of the standalone BSP during the
|
||||
* libgen.
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef XSCUTIMER_HW_H /* prevent circular inclusions */
|
||||
#define XSCUTIMER_HW_H /* by using protection macros */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
#include "xil_types.h"
|
||||
#include "xil_io.h"
|
||||
#include "xil_assert.h"
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/** @name Register Map
|
||||
* Offsets of registers from the start of the device
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XSCUTIMER_LOAD_OFFSET 0x00 /**< Timer Load Register */
|
||||
#define XSCUTIMER_COUNTER_OFFSET 0x04 /**< Timer Counter Register */
|
||||
#define XSCUTIMER_CONTROL_OFFSET 0x08 /**< Timer Control Register */
|
||||
#define XSCUTIMER_ISR_OFFSET 0x0C /**< Timer Interrupt
|
||||
Status Register */
|
||||
/* @} */
|
||||
|
||||
/** @name Timer Control register
|
||||
* This register bits control the prescaler, Intr enable,
|
||||
* auto-reload and timer enable.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XSCUTIMER_CONTROL_PRESCALER_MASK 0x0000FF00 /**< Prescaler */
|
||||
#define XSCUTIMER_CONTROL_PRESCALER_SHIFT 8
|
||||
#define XSCUTIMER_CONTROL_IRQ_ENABLE_MASK 0x00000004 /**< Intr enable */
|
||||
#define XSCUTIMER_CONTROL_AUTO_RELOAD_MASK 0x00000002 /**< Auto-reload */
|
||||
#define XSCUTIMER_CONTROL_ENABLE_MASK 0x00000001 /**< Timer enable */
|
||||
/* @} */
|
||||
|
||||
/** @name Interrupt Status register
|
||||
* This register indicates the Timer counter register has reached zero.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define XSCUTIMER_ISR_EVENT_FLAG_MASK 0x00000001 /**< Event flag */
|
||||
/*@}*/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
* @param Value is the count to be loaded in to the load register.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_SetLoadReg(u32 BaseAddr, u32 Value)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_SetLoadReg(BaseAddr, Value) \
|
||||
XScuTimer_WriteReg(BaseAddr, XSCUTIMER_LOAD_OFFSET, Value)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Returns the current timer load register value.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
*
|
||||
* @return Contents of the timer load register.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* u32 XScuTimer_GetLoadReg(u32 BaseAddr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_GetLoadReg(BaseAddr) \
|
||||
XScuTimer_ReadReg(BaseAddr, XSCUTIMER_LOAD_OFFSET)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Write to the timer counter register.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
* @param Value is the count to be loaded in to the counter register.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_SetCounterReg(u32 BaseAddr, u32 Value)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_SetCounterReg(BaseAddr, Value) \
|
||||
XScuTimer_WriteReg(BaseAddr, XSCUTIMER_COUNTER_OFFSET, Value)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Returns the current timer counter register value.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
*
|
||||
* @return Contents of the timer counter register.
|
||||
*
|
||||
* @note C-style signature:
|
||||
u32 XScuTimer_GetCounterReg(u32 BaseAddr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_GetCounterReg(BaseAddr) \
|
||||
XScuTimer_ReadReg(BaseAddr, XSCUTIMER_COUNTER_OFFSET)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
* @param Value is the count to be loaded in to the load register.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_SetControlReg(u32 BaseAddr, u32 Value)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_SetControlReg(BaseAddr, Value) \
|
||||
XScuTimer_WriteReg(BaseAddr, XSCUTIMER_CONTROL_OFFSET, Value)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Returns the current timer load register value.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
*
|
||||
* @return Contents of the timer load register.
|
||||
*
|
||||
* @note C-style signature:
|
||||
u32 XScuTimer_GetControlReg(u32 BaseAddr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_GetControlReg(BaseAddr) \
|
||||
XScuTimer_ReadReg(BaseAddr, XSCUTIMER_CONTROL_OFFSET)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Write to the timer counter register.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
* @param Value is the count to be loaded in to the counter register.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_SetIntrReg(u32 BaseAddr, u32 Value)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_SetIntrReg(BaseAddr, Value) \
|
||||
XScuTimer_WriteReg(BaseAddr, XSCUTIMER_ISR_OFFSET, Value)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Returns the current timer counter register value.
|
||||
*
|
||||
* @param BaseAddr is the base address of the scu timer.
|
||||
*
|
||||
* @return Contents of the timer counter register.
|
||||
*
|
||||
* @note C-style signature:
|
||||
u32 XScuTimer_GetIntrReg(u32 BaseAddr)
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XScuTimer_GetIntrReg(BaseAddr) \
|
||||
XScuTimer_ReadReg(BaseAddr, XSCUTIMER_ISR_OFFSET)
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Read from the given Timer register.
|
||||
*
|
||||
* @param BaseAddr is the base address of the device
|
||||
* @param RegOffset is the register offset to be read
|
||||
*
|
||||
* @return The 32-bit value of the register
|
||||
*
|
||||
* @note C-style signature:
|
||||
* u32 XScuTimer_ReadReg(u32 BaseAddr, u32 RegOffset)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XScuTimer_ReadReg(BaseAddr, RegOffset) \
|
||||
Xil_In32((BaseAddr) + (RegOffset))
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Write to the given Timer register.
|
||||
*
|
||||
* @param BaseAddr is the base address of the device
|
||||
* @param RegOffset is the register offset to be written
|
||||
* @param Data is the 32-bit value to write to the register
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note C-style signature:
|
||||
* void XScuTimer_WriteReg(u32 BaseAddr, u32 RegOffset, u32 Data)
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XScuTimer_WriteReg(BaseAddr, RegOffset, Data) \
|
||||
Xil_Out32((BaseAddr) + (RegOffset), (Data))
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of protection macro */
|
131
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_selftest.c
Normal file
131
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_selftest.c
Normal file
|
@ -0,0 +1,131 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer_selftest.c
|
||||
*
|
||||
* Contains diagnostic self-test functions for the XScuTimer driver.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xscutimer.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
#define XSCUTIMER_SELFTEST_VALUE 0xA55AF00F
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XScuTimer instance.
|
||||
*
|
||||
* @return
|
||||
* - XST_SUCCESS if self-test was successful.
|
||||
* - XST_FAILURE if self test was not successful.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
int XScuTimer_SelfTest(XScuTimer *InstancePtr)
|
||||
{
|
||||
u32 Register;
|
||||
u32 CtrlOrig;
|
||||
u32 LoadOrig;
|
||||
|
||||
/*
|
||||
* Assert to ensure the inputs are valid and the instance has been
|
||||
* initialized.
|
||||
*/
|
||||
Xil_AssertNonvoid(InstancePtr != NULL);
|
||||
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
||||
|
||||
/*
|
||||
* Save the contents of the Control Register and stop the timer.
|
||||
*/
|
||||
CtrlOrig = XScuTimer_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET);
|
||||
Register = CtrlOrig & ~XSCUTIMER_CONTROL_ENABLE_MASK;
|
||||
XScuTimer_WriteReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET, Register);
|
||||
|
||||
/*
|
||||
* Save the contents of the Load Register.
|
||||
* Load a new test value in the Load Register, read it back and
|
||||
* compare it with the written value.
|
||||
*/
|
||||
LoadOrig = XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr,
|
||||
XSCUTIMER_LOAD_OFFSET);
|
||||
XScuTimer_LoadTimer(InstancePtr, XSCUTIMER_SELFTEST_VALUE);
|
||||
Register = XScuTimer_ReadReg((InstancePtr)->Config.BaseAddr,
|
||||
XSCUTIMER_LOAD_OFFSET);
|
||||
|
||||
/*
|
||||
* Restore the contents of the Load Register and Control Register.
|
||||
*/
|
||||
XScuTimer_LoadTimer(InstancePtr, LoadOrig);
|
||||
XScuTimer_WriteReg(InstancePtr->Config.BaseAddr,
|
||||
XSCUTIMER_CONTROL_OFFSET, CtrlOrig);
|
||||
|
||||
/*
|
||||
* Return a Failure if the contents of the Load Register do not
|
||||
* match with the value written to it.
|
||||
*/
|
||||
if (Register != XSCUTIMER_SELFTEST_VALUE) {
|
||||
return XST_FAILURE;
|
||||
}
|
||||
|
||||
return XST_SUCCESS;
|
||||
}
|
90
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_sinit.c
Normal file
90
XilinxProcessorIPLib/drivers/scutimer/src/xscutimer_sinit.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* Use of the Software is limited solely to applications:
|
||||
* (a) running on a Xilinx device, or
|
||||
* (b) that interact with a Xilinx device through a bus or interconnect.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the Xilinx shall not be used
|
||||
* in advertising or otherwise to promote the sale, use or other dealings in
|
||||
* this Software without prior written authorization from Xilinx.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xscutimer_sinit.c
|
||||
*
|
||||
* This file contains method for static initialization (compile-time) of the
|
||||
* driver.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- --- -------- ---------------------------------------------
|
||||
* 1.00a nm 03/10/10 First release
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
#include "xscutimer.h"
|
||||
#include "xparameters.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Lookup the device configuration based on the unique device ID. The table
|
||||
* contains the configuration info for each device in the system.
|
||||
*
|
||||
* @param DeviceId is the unique device ID of the device being looked up.
|
||||
*
|
||||
* @return A pointer to the configuration table entry corresponding to the
|
||||
* given device ID, or NULL if no match is found.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
******************************************************************************/
|
||||
XScuTimer_Config *XScuTimer_LookupConfig(u16 DeviceId)
|
||||
{
|
||||
extern XScuTimer_Config XScuTimer_ConfigTable[];
|
||||
XScuTimer_Config *CfgPtr = NULL;
|
||||
int Index;
|
||||
|
||||
for (Index = 0; Index < XPAR_XSCUTIMER_NUM_INSTANCES; Index++) {
|
||||
if (XScuTimer_ConfigTable[Index].DeviceId == DeviceId) {
|
||||
CfgPtr = &XScuTimer_ConfigTable[Index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (CfgPtr);
|
||||
}
|
Loading…
Add table
Reference in a new issue