RTEMS 6.1-rc4
Loading...
Searching...
No Matches
i2cmst.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
8/*
9 * COPYRIGHT (c) 2007 Cobham Gaisler AB
10 * with parts from the RTEMS MPC83xx I2C driver (c) 2007 Embedded Brains GmbH.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _I2CMST_H
35#define _I2CMST_H
36
47#include <rtems/libi2c.h>
48#include "ambapp.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/* I2C-master operational registers */
55
56typedef struct gr_i2cmst_regs {
57 volatile unsigned int prescl; /* Prescale register */
58 volatile unsigned int ctrl; /* Control register */
59 volatile unsigned int tdrd; /* Transmit and Receive registers */
60 volatile unsigned int cmdsts; /* Command and Status registers */
62
63/* Control (CTRL) register */
64#define GRI2C_CTRL_EN 0x00000080 /* Enable core */
65#define GRI2C_CTRL_IEN 0x00000040 /* Interrupt enable */
66
67/* Command (CMD) register */
68#define GRI2C_CMD_STA 0x00000080 /* Generate START condition */
69#define GRI2C_CMD_STO 0x00000040 /* Generate STOP condition */
70#define GRI2C_CMD_RD 0x00000020 /* Read from slave */
71#define GRI2C_CMD_WR 0x00000010 /* Write to slave */
72#define GRI2C_CMD_ACK 0x00000008 /* Acknowledge */
73#define GRI2C_CMD_IACK 0x00000001 /* Interrupt acknowledge */
74
75/* Status (STS) register */
76#define GRI2C_STS_RXACK 0x00000080 /* Receive acknowledge */
77#define GRI2C_STS_BUSY 0x00000040 /* I2C-bus busy */
78#define GRI2C_STS_AL 0x00000020 /* Arbitration lost */
79#define GRI2C_STS_TIP 0x00000002 /* Transfer in progress */
80#define GRI2C_STS_IF 0x00000001 /* Interrupt flag */
81
82#define GRI2C_STATUS_IDLE 0x00000000
83
84/* Register I2CMST driver to Driver Manager */
85void i2cmst_register_drv (void);
86
87#ifdef __cplusplus
88}
89#endif
90
93#endif /* _I2CMST_H */
Legacy I2C Library.
Definition: i2cmst.h:56