]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_LM3S102_Rowley/hw_include/hw_i2c.h
Ethernet working in the Kinetis K60 demo.
[freertos] / Demo / CORTEX_LM3S102_Rowley / hw_include / hw_i2c.h
1 //*****************************************************************************\r
2 //\r
3 // hw_i2c.h - Macros used when accessing the I2C master and slave hardware.\r
4 //\r
5 // Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.\r
6 //\r
7 // Software License Agreement\r
8 //\r
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and\r
10 // exclusively on LMI's Stellaris Family of microcontroller products.\r
11 //\r
12 // The software is owned by LMI and/or its suppliers, and is protected under\r
13 // applicable copyright laws.  All rights are reserved.  Any use in violation\r
14 // of the foregoing restrictions may subject the user to criminal sanctions\r
15 // under applicable laws, as well as to civil liability for the breach of the\r
16 // terms and conditions of this license.\r
17 //\r
18 // THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
23 //\r
24 // This is part of revision 523 of the Stellaris Driver Library.\r
25 //\r
26 //*****************************************************************************\r
27 \r
28 #ifndef __HW_I2C_H__\r
29 #define __HW_I2C_H__\r
30 \r
31 //*****************************************************************************\r
32 //\r
33 // The following define the offsets of the I2C master registers.\r
34 //\r
35 //*****************************************************************************\r
36 #define I2C_MASTER_O_SA         0x00000000  // Slave address register\r
37 #define I2C_MASTER_O_CS         0x00000004  // Control and Status register\r
38 #define I2C_MASTER_O_DR         0x00000008  // Data register\r
39 #define I2C_MASTER_O_TPR        0x0000000C  // Timer period register\r
40 #define I2C_MASTER_O_IMR        0x00000010  // Interrupt mask register\r
41 #define I2C_MASTER_O_RIS        0x00000014  // Raw interrupt status register\r
42 #define I2C_MASTER_O_MIS        0x00000018  // Masked interrupt status reg\r
43 #define I2C_MASTER_O_ICR        0x0000001c  // Interrupt clear register\r
44 #define I2C_MASTER_O_CR         0x00000020  // Configuration register\r
45 \r
46 //*****************************************************************************\r
47 //\r
48 // The following define the offsets of the I2C slave registers.\r
49 //\r
50 //*****************************************************************************\r
51 #define I2C_SLAVE_O_OAR         0x00000000  // Own address register\r
52 #define I2C_SLAVE_O_CSR         0x00000004  // Control/Status register\r
53 #define I2C_SLAVE_O_DR          0x00000008  // Data register\r
54 #define I2C_SLAVE_O_IM          0x0000000C  // Interrupt mask register\r
55 #define I2C_SLAVE_O_RIS         0x00000010  // Raw interrupt status register\r
56 #define I2C_SLAVE_O_MIS         0x00000014  // Masked interrupt status reg\r
57 #define I2C_SLAVE_O_ICR         0x00000018  // Interrupt clear register\r
58 \r
59 //*****************************************************************************\r
60 //\r
61 // The following define the bit fields in the I2C Master Control and Status\r
62 // register.\r
63 //\r
64 //*****************************************************************************\r
65 #define I2C_MASTER_CS_ACK       0x00000008  // Acknowlegde\r
66 #define I2C_MASTER_CS_STOP      0x00000004  // Stop\r
67 #define I2C_MASTER_CS_START     0x00000002  // Start\r
68 #define I2C_MASTER_CS_RUN       0x00000001  // Run\r
69 #define I2C_MASTER_CS_BUS_BUSY  0x00000040  // Bus busy\r
70 #define I2C_MASTER_CS_IDLE      0x00000020  // Idle\r
71 #define I2C_MASTER_CS_ARB_LOST  0x00000010  // Lost arbitration\r
72 #define I2C_MASTER_CS_DATA_ACK  0x00000008  // Data byte not acknowledged\r
73 #define I2C_MASTER_CS_ADDR_ACK  0x00000004  // Address byte not acknowledged\r
74 #define I2C_MASTER_CS_ERROR     0x00000002  // Error occurred\r
75 #define I2C_MASTER_CS_BUSY      0x00000001  // Controller is TX/RX data\r
76 #define I2C_MASTER_CS_ERR_MASK  0x0000001C\r
77 \r
78 //*****************************************************************************\r
79 //\r
80 // The following define values used in determining the contents of the I2C\r
81 // Master Timer Period register.\r
82 //\r
83 //*****************************************************************************\r
84 #define I2C_MASTER_TPR_SCL_HP   0x00000004  // SCL high period\r
85 #define I2C_MASTER_TPR_SCL_LP   0x00000006  // SCL low period\r
86 #define I2C_SCL_STANDARD        100000      // SCL standard frequency\r
87 #define I2C_SCL_FAST            400000      // SCL fast frequency\r
88 \r
89 //*****************************************************************************\r
90 //\r
91 // The following define the bit fields in the I2C Master Interrupt Mask\r
92 // register.\r
93 //\r
94 //*****************************************************************************\r
95 #define I2C_MASTER_IMR_IM       0x00000001  // Master interrupt mask\r
96 \r
97 //*****************************************************************************\r
98 //\r
99 // The following define the bit fields in the I2C Master Raw Interrupt Status\r
100 // register.\r
101 //\r
102 //*****************************************************************************\r
103 #define I2C_MASTER_RIS_RIS      0x00000001  // Master raw interrupt status\r
104 \r
105 //*****************************************************************************\r
106 //\r
107 // The following define the bit fields in the I2C Master Masked Interrupt\r
108 // Status register.\r
109 //\r
110 //*****************************************************************************\r
111 #define I2C_MASTER_MIS_MIS      0x00000001  // Master masked interrupt status\r
112 \r
113 //*****************************************************************************\r
114 //\r
115 // The following define the bit fields in the I2C Master Configuration\r
116 // register.\r
117 //\r
118 //*****************************************************************************\r
119 #define I2C_MASTER_CR_SFE       0x00000020  // Slave function enable\r
120 #define I2C_MASTER_CR_MFE       0x00000010  // Master function enable\r
121 #define I2C_MASTER_CR_LPBK      0x00000001  // Loopback enable\r
122 \r
123 //*****************************************************************************\r
124 //\r
125 // The following define the bit fields in the I2C Slave Control/Status\r
126 // register.\r
127 //\r
128 //*****************************************************************************\r
129 #define I2C_SLAVE_CSR_DA        0x00000001  // Enable the device\r
130 #define I2C_SLAVE_CSR_TREQ      0x00000002  // Transmit request received\r
131 #define I2C_SLAVE_CSR_RREQ      0x00000001  // Receive data from I2C master\r
132 \r
133 //*****************************************************************************\r
134 //\r
135 // The following define the bit fields in the I2C Slave Interrupt Mask\r
136 // register.\r
137 //\r
138 //*****************************************************************************\r
139 #define I2C_SLAVE_IMR_IM       0x00000001  // Slave interrupt mask\r
140 \r
141 //*****************************************************************************\r
142 //\r
143 // The following define the bit fields in the I2C Slave Raw Interrupt Status\r
144 // register.\r
145 //\r
146 //*****************************************************************************\r
147 #define I2C_SLAVE_RIS_RIS      0x00000001  // Slave raw interrupt status\r
148 \r
149 //*****************************************************************************\r
150 //\r
151 // The following define the bit fields in the I2C Slave Masked Interrupt\r
152 // Status register.\r
153 //\r
154 //*****************************************************************************\r
155 #define I2C_SLAVE_MIS_MIS      0x00000001  // Master masked interrupt status\r
156 \r
157 #endif // __HW_I2C_H__\r