summaryrefslogtreecommitdiff
path: root/driverlib/epi.h
blob: 387472cbbed833236bce9e11ffc1057487734ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
//*****************************************************************************
//
// epi.h - Prototypes and macros for the EPI module.
//
// Copyright (c) 2008-2012 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
//   Redistribution and use in source and binary forms, with or without
//   modification, are permitted provided that the following conditions
//   are met:
// 
//   Redistributions of source code must retain the above copyright
//   notice, this list of conditions and the following disclaimer.
// 
//   Redistributions in binary form must reproduce the above copyright
//   notice, this list of conditions and the following disclaimer in the
//   documentation and/or other materials provided with the  
//   distribution.
// 
//   Neither the name of Texas Instruments Incorporated nor the names of
//   its contributors may be used to endorse or promote products derived
//   from this software without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 
// This is part of revision 9453 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

#ifndef __EPI_H__
#define __EPI_H__

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

//*****************************************************************************
//
// Values that can be passed to EPIModeSet()
//
//*****************************************************************************
#define EPI_MODE_GENERAL                0x00000010
#define EPI_MODE_SDRAM                  0x00000011
#define EPI_MODE_HB8                    0x00000012
#define EPI_MODE_HB16                   0x00000013
#define EPI_MODE_DISABLE                0x00000000

//*****************************************************************************
//
// Values that can be passed to EPIConfigSDRAMSet()
//
//*****************************************************************************
#define EPI_SDRAM_CORE_FREQ_0_15        0x00000000
#define EPI_SDRAM_CORE_FREQ_15_30       0x40000000
#define EPI_SDRAM_CORE_FREQ_30_50       0x80000000
#define EPI_SDRAM_CORE_FREQ_50_100      0xC0000000
#define EPI_SDRAM_LOW_POWER             0x00000200
#define EPI_SDRAM_FULL_POWER            0x00000000
#define EPI_SDRAM_SIZE_64MBIT           0x00000000
#define EPI_SDRAM_SIZE_128MBIT          0x00000001
#define EPI_SDRAM_SIZE_256MBIT          0x00000002
#define EPI_SDRAM_SIZE_512MBIT          0x00000003

//*****************************************************************************
//
// Values that can be passed to EPIConfigGPModeSet()
//
//*****************************************************************************
#define EPI_GPMODE_CLKPIN               0x80000000
#define EPI_GPMODE_CLKGATE              0x40000000
#define EPI_GPMODE_RDYEN                0x10000000
#define EPI_GPMODE_FRAMEPIN             0x08000000
#define EPI_GPMODE_FRAME50              0x04000000
#define EPI_GPMODE_READWRITE            0x00200000
#define EPI_GPMODE_WRITE2CYCLE          0x00080000
#define EPI_GPMODE_READ2CYCLE           0x00040000
#define EPI_GPMODE_ASIZE_NONE           0x00000000
#define EPI_GPMODE_ASIZE_4              0x00000010
#define EPI_GPMODE_ASIZE_12             0x00000020
#define EPI_GPMODE_ASIZE_20             0x00000030
#define EPI_GPMODE_DSIZE_8              0x00000000
#define EPI_GPMODE_DSIZE_16             0x00000001
#define EPI_GPMODE_DSIZE_24             0x00000002
#define EPI_GPMODE_DSIZE_32             0x00000003
#define EPI_GPMODE_WORD_ACCESS          0x00000100

//*****************************************************************************
//
// Values that can be passed to EPIConfigHB8ModeSet()
//
//*****************************************************************************
#define EPI_HB8_USE_TXEMPTY             0x00800000
#define EPI_HB8_USE_RXFULL              0x00400000
#define EPI_HB8_WRHIGH                  0x00200000
#define EPI_HB8_RDHIGH                  0x00100000
#define EPI_HB8_WRWAIT_0                0x00000000
#define EPI_HB8_WRWAIT_1                0x00000040
#define EPI_HB8_WRWAIT_2                0x00000080
#define EPI_HB8_WRWAIT_3                0x000000C0
#define EPI_HB8_RDWAIT_0                0x00000000
#define EPI_HB8_RDWAIT_1                0x00000010
#define EPI_HB8_RDWAIT_2                0x00000020
#define EPI_HB8_RDWAIT_3                0x00000030
#define EPI_HB8_MODE_ADMUX              0x00000000
#define EPI_HB8_MODE_ADDEMUX            0x00000001
#define EPI_HB8_MODE_SRAM               0x00000002
#define EPI_HB8_MODE_FIFO               0x00000003
#define EPI_HB8_WORD_ACCESS             0x00000100
#define EPI_HB8_CSCFG_ALE               0x00000000
#define EPI_HB8_CSCFG_CS                0x00000200
#define EPI_HB8_CSCFG_DUAL_CS           0x00000400
#define EPI_HB8_CSCFG_ALE_DUAL_CS       0x00000600
#define EPI_HB8_CSBAUD_DUAL             0x00000800

#define EPI_HB8_CSCFG_MASK              0x00000600

//*****************************************************************************
//
// Values that can be passed to EPIConfigHB16ModeSet()
//
//*****************************************************************************
#define EPI_HB16_USE_TXEMPTY            0x00800000
#define EPI_HB16_USE_RXFULL             0x00400000
#define EPI_HB16_WRHIGH                 0x00200000
#define EPI_HB16_RDHIGH                 0x00100000
#define EPI_HB16_WRWAIT_0               0x00000000
#define EPI_HB16_WRWAIT_1               0x00000040
#define EPI_HB16_WRWAIT_2               0x00000080
#define EPI_HB16_WRWAIT_3               0x000000C0
#define EPI_HB16_RDWAIT_0               0x00000000
#define EPI_HB16_RDWAIT_1               0x00000010
#define EPI_HB16_RDWAIT_2               0x00000020
#define EPI_HB16_RDWAIT_3               0x00000030
#define EPI_HB16_MODE_ADMUX             0x00000000
#define EPI_HB16_MODE_ADDEMUX           0x00000001
#define EPI_HB16_MODE_SRAM              0x00000002
#define EPI_HB16_MODE_FIFO              0x00000003
#define EPI_HB16_BSEL                   0x00000004
#define EPI_HB16_WORD_ACCESS            0x00000100
#define EPI_HB16_CSCFG_ALE              0x00000000
#define EPI_HB16_CSCFG_CS               0x00000200
#define EPI_HB16_CSCFG_DUAL_CS          0x00000400
#define EPI_HB16_CSCFG_ALE_DUAL_CS      0x00000600
#define EPI_HB16_CSBAUD_DUAL            0x00000800

#define EPI_HB16_CSCFG_MASK             0x00000600

//*****************************************************************************
//
// Values that can be passed to EPIConfigSDRAMSet()
//
//*****************************************************************************
#define EPI_ADDR_PER_SIZE_256B          0x00000000
#define EPI_ADDR_PER_SIZE_64KB          0x00000040
#define EPI_ADDR_PER_SIZE_16MB          0x00000080
#define EPI_ADDR_PER_SIZE_256MB         0x000000C0
#define EPI_ADDR_PER_BASE_NONE          0x00000000
#define EPI_ADDR_PER_BASE_A             0x00000010
#define EPI_ADDR_PER_BASE_C             0x00000020
#define EPI_ADDR_RAM_SIZE_256B          0x00000000
#define EPI_ADDR_RAM_SIZE_64KB          0x00000004
#define EPI_ADDR_RAM_SIZE_16MB          0x00000008
#define EPI_ADDR_RAM_SIZE_256MB         0x0000000C
#define EPI_ADDR_RAM_BASE_NONE          0x00000000
#define EPI_ADDR_RAM_BASE_6             0x00000001
#define EPI_ADDR_RAM_BASE_8             0x00000002

//*****************************************************************************
//
// Values that can be passed to EPINonBlockingReadConfigure()
//
//*****************************************************************************
#define EPI_NBCONFIG_SIZE_8             1
#define EPI_NBCONFIG_SIZE_16            2
#define EPI_NBCONFIG_SIZE_32            3

//*****************************************************************************
//
// Values that can be passed to EPIFIFOConfig()
//
//*****************************************************************************
#define EPI_FIFO_CONFIG_WTFULLERR       0x00020000
#define EPI_FIFO_CONFIG_RSTALLERR       0x00010000
#define EPI_FIFO_CONFIG_TX_EMPTY        0x00000000
#define EPI_FIFO_CONFIG_TX_1_4          0x00000020
#define EPI_FIFO_CONFIG_TX_1_2          0x00000030
#define EPI_FIFO_CONFIG_TX_3_4          0x00000040
#define EPI_FIFO_CONFIG_RX_1_8          0x00000001
#define EPI_FIFO_CONFIG_RX_1_4          0x00000002
#define EPI_FIFO_CONFIG_RX_1_2          0x00000003
#define EPI_FIFO_CONFIG_RX_3_4          0x00000004
#define EPI_FIFO_CONFIG_RX_7_8          0x00000005
#define EPI_FIFO_CONFIG_RX_FULL         0x00000006

//*****************************************************************************
//
// Values that can be passed to EPIIntEnable(), EPIIntDisable(), or returned
// as flags from EPIIntStatus()
//
//*****************************************************************************
#define EPI_INT_TXREQ                   0x00000004
#define EPI_INT_RXREQ                   0x00000002
#define EPI_INT_ERR                     0x00000001

//*****************************************************************************
//
// Values that can be passed to EPIIntErrorClear(), or returned as flags from
// EPIIntErrorStatus()
//
//*****************************************************************************
#define EPI_INT_ERR_WTFULL              0x00000004
#define EPI_INT_ERR_RSTALL              0x00000002
#define EPI_INT_ERR_TIMEOUT             0x00000001

//*****************************************************************************
//
// API Function prototypes
//
//*****************************************************************************
extern void EPIModeSet(unsigned long ulBase, unsigned long ulMode);
extern void EPIDividerSet(unsigned long ulBase, unsigned long ulDivider);
extern void EPIConfigSDRAMSet(unsigned long ulBase, unsigned long ulConfig,
                              unsigned long ulRefresh);
extern void EPIConfigGPModeSet(unsigned long ulBase, unsigned long ulConfig,
                               unsigned long ulFrameCount,
                               unsigned long ulMaxWait);
extern void EPIConfigHB8Set(unsigned long ulBase, unsigned long ulConfig,
                            unsigned long ulMaxWait);
extern void EPIConfigHB16Set(unsigned long ulBase, unsigned long ulConfig,
                             unsigned long ulMaxWait);
extern void EPIAddressMapSet(unsigned long ulBase, unsigned long ulMap);
extern void EPINonBlockingReadConfigure(unsigned long ulBase,
                                        unsigned long ulChannel,
                                        unsigned long ulDataSize,
                                        unsigned long ulAddress);
extern void EPINonBlockingReadStart(unsigned long ulBase,
                                    unsigned long ulChannel,
                                    unsigned long ulCount);
extern void EPINonBlockingReadStop(unsigned long ulBase,
                                   unsigned long ulChannel);
extern unsigned long EPINonBlockingReadCount(unsigned long ulBase,
                                             unsigned long ulChannel);
extern unsigned long EPINonBlockingReadAvail(unsigned long ulBase);
extern unsigned long EPINonBlockingReadGet32(unsigned long ulBase,
                                             unsigned long ulCount,
                                             unsigned long *pulBuf);
extern unsigned long EPINonBlockingReadGet16(unsigned long ulBase,
                                             unsigned long ulCount,
                                             unsigned short *pusBuf);
extern unsigned long EPINonBlockingReadGet8(unsigned long ulBase,
                                            unsigned long ulCount,
                                            unsigned char *pucBuf);
extern void EPIFIFOConfig(unsigned long ulBase, unsigned long ulConfig);
extern unsigned long EPIWriteFIFOCountGet(unsigned long ulBase);
extern void EPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
extern void EPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
extern unsigned long EPIIntStatus(unsigned long ulBase, tBoolean bMasked);
extern unsigned long EPIIntErrorStatus(unsigned long ulBase);
extern void EPIIntErrorClear(unsigned long ulBase, unsigned long ulErrFlags);
extern void EPIIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
extern void EPIIntUnregister(unsigned long ulBase);

//*****************************************************************************
//
// Several EPI APIs and labels have been renamed, with the original definition
// name being deprecated.  These defines provide backward compatibility.
//
//*****************************************************************************
#ifndef DEPRECATED
#define EPI_MODE_NONE           EPI_MODE_GENERAL
#define EPI_NONMODE_CLKPIN      EPI_GPMODE_CLKPIN
#define EPI_NONMODE_CLKSTOP     EPI_GPMODE_CLKGATE
#define EPI_NONMODE_CLKENA      EPI_GPMODE_RDYEN
#define EPI_NONMODE_FRAMEPIN    EPI_GPMODE_FRAMEPIN
#define EPI_NONMODE_FRAME50     EPI_GPMODE_FRAME50
#define EPI_NONMODE_READWRITE   EPI_GPMODE_READWRITE
#define EPI_NONMODE_WRITE2CYCLE EPI_GPMODE_WRITE2CYCLE
#define EPI_NONMODE_READ2CYCLE  EPI_GPMODE_READ2CYCLE
#define EPI_NONMODE_ASIZE_NONE  EPI_GPMODE_ASIZE_NONE
#define EPI_NONMODE_ASIZE_4     EPI_GPMODE_ASIZE_4
#define EPI_NONMODE_ASIZE_12    EPI_GPMODE_ASIZE_12
#define EPI_NONMODE_ASIZE_20    EPI_GPMODE_ASIZE_20
#define EPI_NONMODE_DSIZE_8     EPI_GPMODE_DSIZE_8
#define EPI_NONMODE_DSIZE_16    EPI_GPMODE_DSIZE_16
#define EPI_NONMODE_DSIZE_24    EPI_GPMODE_DSIZE_24
#define EPI_NONMODE_DSIZE_32    EPI_GPMODE_DSIZE_32
#define EPI_NONMODE_WORD_ACCESS EPI_GPMODE_WORD_ACCESS

#define EPINonBlockingWriteCount(a) EPIWriteFIFOCountGet(a)
#define EPIConfigNoModeSet(a, b, c, d) EPIConfigGPModeSet((a), (b), (c), (d))
#endif

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif //  __EPI_H__