RTEMS 6.1-rc5
Loading...
Searching...
No Matches
zynq-slcr-regs.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
9/*
10 * Copyright (c) 2017
11 * NSF Center for High-Performance Reconfigurable Computing (CHREC),
12 * University of Pittsburgh. All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 * The views and conclusions contained in the software and documentation
36 * are those of the authors and should not be interpreted as representing
37 * official policies, either expressed or implied, of CHREC.
38 *
39 * Author: Patrick Gauvin <gauvin@hcs.ufl.edu>
40 */
41
48#ifndef LIBBSP_ARM_XILINX_ZYNQ_SLCR_REGS_H
49#define LIBBSP_ARM_XILINX_ZYNQ_SLCR_REGS_H
50
51#include <bsp/utility.h>
52
53#ifdef __cplusplus
54extern "C" {
55#endif /* __cplusplus */
56
57#define ZYNQ_SLCR_BASE_ADDR ( 0xF8000000 )
58
59#define ZYNQ_SLCR_LOCK_OFF ( 0x4 )
60#define ZYNQ_SLCR_UNLOCK_OFF ( 0x8 )
61#define ZYNQ_SLCR_FPGA_RST_CTRL_OFF ( 0x240 )
62#define ZYNQ_SLCR_PSS_IDCODE_OFF ( 0x530 )
63#define ZYNQ_SLCR_LVL_SHFTR_EN_OFF ( 0x900 )
64
65#define ZYNQ_SLCR_LOCK_KEY ( 0x767b )
66#define ZYNQ_SLCR_UNLOCK_KEY ( 0xdf0d )
67
69#define ZYNQ_SLCR_FPGA_RST_CTRL_FPGA_OUT_RST_GET( reg ) \
70 BSP_FLD32GET( reg, 0, 3 )
71#define ZYNQ_SLCR_FPGA_RST_CTRL_FPGA_OUT_RST( val ) BSP_FLD32( val, 0, 3 )
72
73/* NOTE: QEMU gives a value of 0 for the pss_idcode. */
74#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_GET( reg ) BSP_FLD32GET( reg, 12, 16 )
75#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z007s ( 0x03 )
76#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z012s ( 0x1c )
77#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z014s ( 0x08 )
78#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z010 ( 0x02 )
79#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z015 ( 0x1b )
80#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z020 ( 0x07 )
81#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z030 ( 0x0c )
82#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z035 ( 0x12 )
83#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z045 ( 0x11 )
84#define ZYNQ_SLCR_PSS_IDCODE_DEVICE_7z100 ( 0x16 )
85
86#define ZYNQ_SLCR_LVL_SHFTR_EN_DISABLE ( 0 )
87#define ZYNQ_SLCR_LVL_SHFTR_EN_PS_TO_PL ( 0xA )
88#define ZYNQ_SLCR_LVL_SHFTR_EN_ALL ( 0xF )
89
90static inline void zynq_slcr_write32(
91 const uint32_t reg_off,
92 const uint32_t val
93)
94{
95 volatile uint32_t *slcr_reg;
96 slcr_reg = (volatile uint32_t *)( ZYNQ_SLCR_BASE_ADDR + reg_off );
97 *slcr_reg = val;
98}
99
100static inline uint32_t zynq_slcr_read32(
101 const uint32_t reg_off
102)
103{
104 volatile uint32_t *slcr_reg;
105 slcr_reg = (volatile uint32_t *)( ZYNQ_SLCR_BASE_ADDR + reg_off);
106 return *slcr_reg;
107}
108
109#ifdef __cplusplus
110}
111#endif /* __cplusplus */
112
113#endif /* LIBBSP_ARM_XILINX_ZYNQ_SLCR_REGS_H */
This header file provides utility macros for BSPs.