]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/standalone_v6_6/src/xil_sleeptimer.h
Update Zynq, MPSoc Cortex-A53 and MPSoc Cortex-R5 demo projects to build with the...
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / standalone_v6_6 / src / xil_sleeptimer.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2017 Xilinx, Inc.  All rights reserved.
4 *
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:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
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.
18 *
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
25 * SOFTWARE.
26 *
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.
30 *
31 ******************************************************************************/
32 /*****************************************************************************/
33 /**
34 *
35 * @file xil_sleeptimer.h
36 *
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.
40 *
41 *
42 * <pre>
43 * MODIFICATION HISTORY :
44 *
45 * Ver   Who  Date        Changes
46 * ----- ---- -------- -------------------------------------------------------
47 * 6.6   srm  10/18/17 First Release.
48 *
49 * </pre>
50 *****************************************************************************/
51
52 #ifndef XIL_SLEEPTIMER_H                /* prevent circular inclusions */
53 #define XIL_SLEEPTIMER_H                /* by using protection macros */
54 /****************************  Include Files  ********************************/
55
56 #include "xil_io.h"
57 #include "xparameters.h"
58 #include "bspconfig.h"
59
60 /************************** Constant Definitions *****************************/
61
62 #if defined (ARMR5) || (__aarch64__) || (ARMA53_32)
63 #define XSLEEP_TIMER_REG_SHIFT  32U
64 #define XSleep_ReadCounterVal   Xil_In32
65 #define XCntrVal                            u32
66 #else
67 #define XSLEEP_TIMER_REG_SHIFT  16U
68 #define XSleep_ReadCounterVal   Xil_In16
69 #define XCntrVal                            u16
70 #endif
71
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
75 #endif
76
77 #if defined (SLEEP_TIMER_BASEADDR)
78 /** @name Register Map
79 *
80 * Register offsets from the base address of the TTC device
81 *
82 * @{
83 */
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 */
90 /* @} */
91 /** @name Clock Control Register
92 * Clock Control Register definitions of TTC
93 * @{
94 */
95  #define XSLEEP_TIMER_TTC_CLK_CNTRL_PS_EN_MASK          0x00000001U
96                                                    /**< Prescale enable */
97 /* @} */
98 /** @name Counter Control Register
99 * Counter Control Register definitions of TTC
100 * @{
101 */
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 */
106 /* @} */
107
108 /**************************** Type Definitions *******************************/
109
110 /************************** Function Prototypes ******************************/
111
112 void Xil_SleepTTCCommon(u32 delay, u64 frequency);
113 void XTime_StartTTCTimer();
114
115 #endif
116 #endif /* XIL_SLEEPTIMER_H */