RTEMS 6.1-rc5
Loading...
Searching...
No Matches
cadence-i2c-regs.h
1/*
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (C) 2014 embedded brains GmbH & Co. KG
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_I2C_REGS_H
29#define LIBBSP_ARM_XILINX_ZYNQ_CADENCE_I2C_REGS_H
30
31#include <bsp/utility.h>
32
33typedef struct {
34 uint32_t control;
35#define CADENCE_I2C_CONTROL_DIV_A(val) BSP_FLD32(val, 14, 15)
36#define CADENCE_I2C_CONTROL_DIV_A_GET(reg) BSP_FLD32GET(reg, 14, 15)
37#define CADENCE_I2C_CONTROL_DIV_A_SET(reg, val) BSP_FLD32SET(reg, val, 14, 15)
38#define CADENCE_I2C_CONTROL_DIV_B(val) BSP_FLD32(val, 8, 13)
39#define CADENCE_I2C_CONTROL_DIV_B_GET(reg) BSP_FLD32GET(reg, 8, 13)
40#define CADENCE_I2C_CONTROL_DIV_B_SET(reg, val) BSP_FLD32SET(reg, val, 8, 13)
41#define CADENCE_I2C_CONTROL_CLR_FIFO BSP_BIT32(6)
42#define CADENCE_I2C_CONTROL_SLVMON BSP_BIT32(5)
43#define CADENCE_I2C_CONTROL_HOLD BSP_BIT32(4)
44#define CADENCE_I2C_CONTROL_ACKEN BSP_BIT32(3)
45#define CADENCE_I2C_CONTROL_NEA BSP_BIT32(2)
46#define CADENCE_I2C_CONTROL_MS BSP_BIT32(1)
47#define CADENCE_I2C_CONTROL_RW BSP_BIT32(0)
48 uint32_t status;
49#define CADENCE_I2C_STATUS_BA BSP_BIT32(8)
50#define CADENCE_I2C_STATUS_RXOVF BSP_BIT32(7)
51#define CADENCE_I2C_STATUS_TXDV BSP_BIT32(6)
52#define CADENCE_I2C_STATUS_RXDV BSP_BIT32(5)
53#define CADENCE_I2C_STATUS_RXRW BSP_BIT32(3)
54 uint32_t address;
55#define CADENCE_I2C_ADDRESS(val) BSP_FLD32(val, 0, 9)
56#define CADENCE_I2C_ADDRESS_GET(reg) BSP_FLD32GET(reg, 0, 9)
57#define CADENCE_I2C_ADDRESS_SET(reg, val) BSP_FLD32SET(reg, val, 0, 9)
58 uint32_t data;
59 uint32_t irqstatus;
60#define CADENCE_I2C_IXR_ARB_LOST BSP_BIT32(9)
61#define CADENCE_I2C_IXR_RX_UNF BSP_BIT32(7)
62#define CADENCE_I2C_IXR_TX_OVR BSP_BIT32(6)
63#define CADENCE_I2C_IXR_RX_OVR BSP_BIT32(5)
64#define CADENCE_I2C_IXR_SLV_RDY BSP_BIT32(4)
65#define CADENCE_I2C_IXR_TO BSP_BIT32(3)
66#define CADENCE_I2C_IXR_NACK BSP_BIT32(2)
67#define CADENCE_I2C_IXR_DATA BSP_BIT32(1)
68#define CADENCE_I2C_IXR_COMP BSP_BIT32(0)
69 uint32_t transfer_size;
70#define CADENCE_I2C_TRANSFER_SIZE(val) BSP_FLD32(val, 0, 7)
71#define CADENCE_I2C_TRANSFER_SIZE_GET(reg) BSP_FLD32GET(reg, 0, 7)
72#define CADENCE_I2C_TRANSFER_SIZE_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
73 uint32_t slave_mon_pause;
74#define CADENCE_I2C_SLAVE_MON_PAUSE(val) BSP_FLD32(val, 0, 3)
75#define CADENCE_I2C_SLAVE_MON_PAUSE_GET(reg) BSP_FLD32GET(reg, 0, 3)
76#define CADENCE_I2C_SLAVE_MON_PAUSE_SET(reg, val) BSP_FLD32SET(reg, val, 0, 3)
77 uint32_t timeout;
78#define CADENCE_I2C_TIMEOUT(val) BSP_FLD32(val, 0, 7)
79#define CADENCE_I2C_TIMEOUT_GET(reg) BSP_FLD32GET(reg, 0, 7)
80#define CADENCE_I2C_TIMEOUT_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
81 uint32_t irqmask;
82 uint32_t irqenable;
83 uint32_t irqdisable;
85
86#endif /* LIBBSP_ARM_XILINX_ZYNQ_CADENCE_I2C_REGS_H */
This header file provides utility macros for BSPs.
Definition: cadence-i2c-regs.h:33
Definition: intercom.c:87