RTEMS 6.1-rc1
cadence-spi-regs.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (C) 2021 Jan Sommer, German Aerospace Center (DLR)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef LIBBSP_ARM_XILINX_ZYNQ_CADENCE_SPI_REGS_H
29#define LIBBSP_ARM_XILINX_ZYNQ_CADENCE_SPI_REGS_H
30
31#include <bsp/utility.h>
32
33typedef struct {
34 uint32_t config;
35#define CADENCE_SPI_CONFIG_MODEFAIL_EN BSP_BIT32(17)
36#define CADENCE_SPI_CONFIG_MANSTRT BSP_BIT32(16)
37#define CADENCE_SPI_CONFIG_MANSTRT_EN BSP_BIT32(15)
38#define CADENCE_SPI_CONFIG_MANUAL_CS BSP_BIT32(14)
39#define CADENCE_SPI_CONFIG_CS(val) BSP_FLD32(val, 10, 13)
40#define CADENCE_SPI_CONFIG_CS_GET(reg) BSP_FLD32GET(reg, 10, 13)
41#define CADENCE_SPI_CONFIG_CS_SET(reg, val) BSP_FLD32SET(reg, val, 10, 13)
42#define CADENCE_SPI_CONFIG_PERI_SEL BSP_BIT32(9)
43#define CADENCE_SPI_CONFIG_REF_CLK BSP_BIT32(8)
44#define CADENCE_SPI_CONFIG_BAUD_DIV(val) BSP_FLD32(val, 3, 5)
45#define CADENCE_SPI_CONFIG_BAUD_DIV_GET(reg) BSP_FLD32GET(reg, 3, 5)
46#define CADENCE_SPI_CONFIG_BAUD_DIV_SET(reg, val) BSP_FLD32SET(reg, val, 3, 5)
47#define CADENCE_SPI_CONFIG_CLK_PH BSP_BIT32(2)
48#define CADENCE_SPI_CONFIG_CLK_POL BSP_BIT32(1)
49#define CADENCE_SPI_CONFIG_MSTREN BSP_BIT32(0)
50 uint32_t irqstatus;
51 uint32_t irqenable;
52 uint32_t irqdisable;
53 uint32_t irqmask;
54#define CADENCE_SPI_IXR_TXUF BSP_BIT32(6)
55#define CADENCE_SPI_IXR_RXFULL BSP_BIT32(5)
56#define CADENCE_SPI_IXR_RXNEMPTY BSP_BIT32(4)
57#define CADENCE_SPI_IXR_TXFULL BSP_BIT32(3)
58#define CADENCE_SPI_IXR_TXOW BSP_BIT32(2)
59#define CADENCE_SPI_IXR_MODF BSP_BIT32(1)
60#define CADENCE_SPI_IXR_RXOVR BSP_BIT32(0)
61 uint32_t spienable;
62#define CADENCE_SPI_EN BSP_BIT32(0)
63 uint32_t delay;
64#define CADENCE_SPI_DELAY_DNSS(val) BSP_FLD32(val, 24, 31)
65#define CADENCE_SPI_DELAY_DNSS_GET(reg) BSP_FLD32GET(reg, 24, 31)
66#define CADENCE_SPI_DELAY_DNSS_SET(reg, val) BSP_FLD32SET(reg, val, 24, 31)
67#define CADENCE_SPI_DELAY_DBTWN(val) BSP_FLD32(val, 16, 23)
68#define CADENCE_SPI_DELAY_DBTWN_GET(reg) BSP_FLD32GET(reg, 16, 23)
69#define CADENCE_SPI_DELAY_DBTWN_SET(reg, val) BSP_FLD32SET(reg, val, 16, 23)
70#define CADENCE_SPI_DELAY_DAFTER(val) BSP_FLD32(val, 8, 15)
71#define CADENCE_SPI_DELAY_DAFTER_GET(reg) BSP_FLD32GET(reg, 8, 15)
72#define CADENCE_SPI_DELAY_DAFTER_SET(reg, val) BSP_FLD32SET(reg, val, 8, 15)
73#define CADENCE_SPI_DELAY_DINT(val) BSP_FLD32(val, 0, 7)
74#define CADENCE_SPI_DELAY_DINT_GET(reg) BSP_FLD32GET(reg, 0, 7)
75#define CADENCE_SPI_DELAY_DINT_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
76 uint32_t txdata;
77 uint32_t rxdata;
78 uint32_t slave_idle_count;
79 uint32_t txthreshold;
80 uint32_t rxthreshold;
81 uint32_t unused[51];
82 uint32_t moduleid;
84
85#endif /* LIBBSP_ARM_XILINX_ZYNQ_CADENCE_SPI_REGS_H */
This header file provides utility macros for BSPs.
Definition: cadence-spi-regs.h:33
Definition: deflate.c:114