RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
i2cmst.h
Go to the documentation of this file.
1
6/*
7 * COPYRIGHT (c) 2007 Cobham Gaisler AB
8 * with parts from the RTEMS MPC83xx I2C driver (c) 2007 Embedded Brains GmbH.
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef _I2CMST_H
16#define _I2CMST_H
17
28#include <rtems/libi2c.h>
29#include "ambapp.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/* I2C-master operational registers */
36
37typedef struct gr_i2cmst_regs {
38 volatile unsigned int prescl; /* Prescale register */
39 volatile unsigned int ctrl; /* Control register */
40 volatile unsigned int tdrd; /* Transmit and Receive registers */
41 volatile unsigned int cmdsts; /* Command and Status registers */
43
44/* Control (CTRL) register */
45#define GRI2C_CTRL_EN 0x00000080 /* Enable core */
46#define GRI2C_CTRL_IEN 0x00000040 /* Interrupt enable */
47
48/* Command (CMD) register */
49#define GRI2C_CMD_STA 0x00000080 /* Generate START condition */
50#define GRI2C_CMD_STO 0x00000040 /* Generate STOP condition */
51#define GRI2C_CMD_RD 0x00000020 /* Read from slave */
52#define GRI2C_CMD_WR 0x00000010 /* Write to slave */
53#define GRI2C_CMD_ACK 0x00000008 /* Acknowledge */
54#define GRI2C_CMD_IACK 0x00000001 /* Interrupt acknowledge */
55
56/* Status (STS) register */
57#define GRI2C_STS_RXACK 0x00000080 /* Receive acknowledge */
58#define GRI2C_STS_BUSY 0x00000040 /* I2C-bus busy */
59#define GRI2C_STS_AL 0x00000020 /* Arbitration lost */
60#define GRI2C_STS_TIP 0x00000002 /* Transfer in progress */
61#define GRI2C_STS_IF 0x00000001 /* Interrupt flag */
62
63#define GRI2C_STATUS_IDLE 0x00000000
64
65/* Register I2CMST driver to Driver Manager */
66void i2cmst_register_drv (void);
67
68#ifdef __cplusplus
69}
70#endif
71
74#endif /* _I2CMST_H */
Legacy I2C Library.
Definition: i2cmst.h:37