1 /******************************************************************************
3 * Copyright (C) 2017 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
35 * @file xil_sleeptimer.h
37 * This header file contains ARM Cortex A53,A9,R5 specific sleep related APIs.
38 * For sleep related functions that can be used across all Xilinx supported
39 * processors, please use xil_sleeptimer.h.
43 * MODIFICATION HISTORY :
45 * Ver Who Date Changes
46 * ----- ---- -------- -------------------------------------------------------
47 * 6.6 srm 10/18/17 First Release.
50 *****************************************************************************/
52 #ifndef XIL_SLEEPTIMER_H /* prevent circular inclusions */
53 #define XIL_SLEEPTIMER_H /* by using protection macros */
54 /**************************** Include Files ********************************/
57 #include "xparameters.h"
58 #include "bspconfig.h"
60 /************************** Constant Definitions *****************************/
62 #if defined (ARMR5) || (__aarch64__) || (ARMA53_32)
63 #define XSLEEP_TIMER_REG_SHIFT 32U
64 #define XSleep_ReadCounterVal Xil_In32
67 #define XSLEEP_TIMER_REG_SHIFT 16U
68 #define XSleep_ReadCounterVal Xil_In16
72 #if defined(ARMR5) || (defined (__aarch64__) && EL3==1) || defined (ARMA53_32)
73 #define RST_LPD_IOU2 0xFF5E0238U
74 #define RST_LPD_IOU2_TTC_BASE_RESET_MASK 0x00000800U
77 #if defined (SLEEP_TIMER_BASEADDR)
78 /** @name Register Map
80 * Register offsets from the base address of the TTC device
84 #define XSLEEP_TIMER_TTC_CLK_CNTRL_OFFSET 0x00000000U
85 /**< Clock Control Register */
86 #define XSLEEP_TIMER_TTC_CNT_CNTRL_OFFSET 0x0000000CU
87 /**< Counter Control Register*/
88 #define XSLEEP_TIMER_TTC_COUNT_VALUE_OFFSET 0x00000018U
89 /**< Current Counter Value */
91 /** @name Clock Control Register
92 * Clock Control Register definitions of TTC
95 #define XSLEEP_TIMER_TTC_CLK_CNTRL_PS_EN_MASK 0x00000001U
96 /**< Prescale enable */
98 /** @name Counter Control Register
99 * Counter Control Register definitions of TTC
102 #define XSLEEP_TIMER_TTC_CNT_CNTRL_DIS_MASK 0x00000001U
103 /**< Disable the counter */
104 #define XSLEEP_TIMER_TTC_CNT_CNTRL_RST_MASK 0x00000010U
105 /**< Reset counter */
108 /**************************** Type Definitions *******************************/
110 /************************** Function Prototypes ******************************/
112 void Xil_SleepTTCCommon(u32 delay, u64 frequency);
113 void XTime_StartTTCTimer();
116 #endif /* XIL_SLEEPTIMER_H */