OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_LM3S811_KEIL/] [LuminaryCode/] [src/] [i2c.h] - Blame information for rev 581

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 581 jeremybenn
//*****************************************************************************
2
//
3
// i2c.h - Prototypes for the I2C Driver.
4
//
5
// Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
6
//
7
// Software License Agreement
8
//
9
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
10
// exclusively on LMI's Stellaris Family of microcontroller products.
11
//
12
// The software is owned by LMI and/or its suppliers, and is protected under
13
// applicable copyright laws.  All rights are reserved.  Any use in violation
14
// of the foregoing restrictions may subject the user to criminal sanctions
15
// under applicable laws, as well as to civil liability for the breach of the
16
// terms and conditions of this license.
17
//
18
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
22
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23
//
24
// This is part of revision 816 of the Stellaris Driver Library.
25
//
26
//*****************************************************************************
27
 
28
#ifndef __I2C_H__
29
#define __I2C_H__
30
 
31
#ifdef __cplusplus
32
extern "C"
33
{
34
#endif
35
 
36
//*****************************************************************************
37
//
38
// Defines for the API.
39
//
40
//*****************************************************************************
41
//*****************************************************************************
42
//
43
// Interrupt defines.
44
//
45
//*****************************************************************************
46
#define I2C_INT_MASTER          0x00000001
47
#define I2C_INT_SLAVE           0x00000002
48
 
49
//*****************************************************************************
50
//
51
// I2C Master commands.
52
//
53
//*****************************************************************************
54
#define I2C_MASTER_CMD_SINGLE_SEND                                            \
55
            (I2C_MASTER_CS_STOP | I2C_MASTER_CS_START | I2C_MASTER_CS_RUN)
56
#define I2C_MASTER_CMD_SINGLE_RECEIVE                                         \
57
            (I2C_MASTER_CS_STOP | I2C_MASTER_CS_START | I2C_MASTER_CS_RUN)
58
#define I2C_MASTER_CMD_BURST_SEND_START                                       \
59
            (I2C_MASTER_CS_START | I2C_MASTER_CS_RUN)
60
#define I2C_MASTER_CMD_BURST_SEND_CONT                                        \
61
            (I2C_MASTER_CS_RUN)
62
#define I2C_MASTER_CMD_BURST_SEND_FINISH                                      \
63
            (I2C_MASTER_CS_STOP | I2C_MASTER_CS_RUN)
64
#define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP                                  \
65
            (I2C_MASTER_CS_STOP)
66
#define I2C_MASTER_CMD_BURST_RECEIVE_START                                    \
67
            (I2C_MASTER_CS_ACK | I2C_MASTER_CS_START | I2C_MASTER_CS_RUN)
68
#define I2C_MASTER_CMD_BURST_RECEIVE_CONT                                     \
69
            (I2C_MASTER_CS_ACK | I2C_MASTER_CS_RUN)
70
#define I2C_MASTER_CMD_BURST_RECEIVE_FINISH                                   \
71
            (I2C_MASTER_CS_STOP | I2C_MASTER_CS_RUN)
72
#define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP                               \
73
            (I2C_MASTER_CS_STOP | I2C_MASTER_CS_RUN)
74
 
75
//*****************************************************************************
76
//
77
// I2C Master error status.
78
//
79
//*****************************************************************************
80
#define I2C_MASTER_ERR_NONE     0
81
#define I2C_MASTER_ERR_ADDR_ACK 0x00000004
82
#define I2C_MASTER_ERR_DATA_ACK 0x00000008
83
#define I2C_MASTER_ERR_ARB_LOST 0x00000010
84
 
85
//*****************************************************************************
86
//
87
// I2C Slave action requests
88
//
89
//*****************************************************************************
90
#define I2C_SLAVE_ACT_NONE      0
91
#define I2C_SLAVE_ACT_RREQ      0x00000001  // Master has sent data
92
#define I2C_SLAVE_ACT_TREQ      0x00000002  // Master has requested data
93
 
94
//*****************************************************************************
95
// Miscellaneous I2C driver definitions.
96
//*****************************************************************************
97
#define I2C_MASTER_MAX_RETRIES 1000        // Number of retries
98
 
99
//*****************************************************************************
100
//
101
// Prototypes for the APIs.
102
//
103
//*****************************************************************************
104
extern void I2CIntRegister(unsigned long ulBase, void(fnHandler)(void));
105
extern void I2CIntUnregister(unsigned long ulBase);
106
extern tBoolean I2CMasterBusBusy(unsigned long ulBase);
107
extern tBoolean I2CMasterBusy(unsigned long ulBase);
108
extern void I2CMasterControl(unsigned long ulBase, unsigned long ulCmd);
109
extern unsigned long I2CMasterDataGet(unsigned long ulBase);
110
extern void I2CMasterDataPut(unsigned long ulBase, unsigned char ucData);
111
extern void I2CMasterDisable(unsigned long ulBase);
112
extern void I2CMasterEnable(unsigned long ulBase);
113
extern unsigned long I2CMasterErr(unsigned long ulBase);
114
extern void I2CMasterInit(unsigned long ulBase, tBoolean bFast);
115
extern void I2CMasterIntClear(unsigned long ulBase);
116
extern void I2CMasterIntDisable(unsigned long ulBase);
117
extern void I2CMasterIntEnable(unsigned long ulBase);
118
extern tBoolean I2CMasterIntStatus(unsigned long ulBase, tBoolean bMasked);
119
extern void I2CMasterSlaveAddrSet(unsigned long ulBase,
120
                                  unsigned char ucSlaveAddr,
121
                                  tBoolean bReceive);
122
extern unsigned long I2CSlaveDataGet(unsigned long ulBase);
123
extern void I2CSlaveDataPut(unsigned long ulBase, unsigned char ucData);
124
extern void I2CSlaveDisable(unsigned long ulBase);
125
extern void I2CSlaveEnable(unsigned long ulBase);
126
extern void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr);
127
extern void I2CSlaveIntClear(unsigned long ulBase);
128
extern void I2CSlaveIntDisable(unsigned long ulBase);
129
extern void I2CSlaveIntEnable(unsigned long ulBase);
130
extern tBoolean I2CSlaveIntStatus(unsigned long ulBase, tBoolean bMasked);
131
extern unsigned long I2CSlaveStatus(unsigned long ulBase);
132
 
133
#ifdef __cplusplus
134
}
135
#endif
136
 
137
#endif // __I2C_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.