1 //*****************************************************************************
2 //
3 // epi.c - Driver for the EPI module.
4 //
5 // Copyright (c) 2008-2012 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the
18 // distribution.
19 //
20 // Neither the name of Texas Instruments Incorporated nor the names of
21 // its contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 // This is part of revision 9453 of the Stellaris Peripheral Driver Library.
37 //
38 //*****************************************************************************
39
40 #include "inc/hw_epi.h"
41 #include "inc/hw_ints.h"
42 #include "inc/hw_memmap.h"
43 #include "inc/hw_types.h"
44 #include "driverlib/debug.h"
45 #include "driverlib/epi.h"
46 #include "driverlib/interrupt.h"
47
48 //*****************************************************************************
49 //
50 //! \addtogroup epi_api
51 //! @{
52 //
53 //*****************************************************************************
54
55 //*****************************************************************************
56 //
57 //! Sets the usage mode of the EPI module.
58 //!
59 //! \param ulBase is the EPI module base address.
60 //! \param ulMode is the usage mode of the EPI module.
61 //!
62 //! This functions sets the operating mode of the EPI module. The parameter
63 //! \e ulMode must be one of the following:
64 //!
65 //! - \b EPI_MODE_GENERAL - use for general-purpose mode operation
66 //! - \b EPI_MODE_SDRAM - use with SDRAM device
67 //! - \b EPI_MODE_HB8 - use with host-bus 8-bit interface
68 //! - \b EPI_MODE_HB16 - use with host-bus 16-bit interface
69 //! - \b EPI_MODE_DISABLE - disable the EPI module
70 //!
71 //! Selection of any of the above modes enables the EPI module, except
72 //! for \b EPI_MODE_DISABLE which should be used to disable the module.
73 //!
74 //! \return None.
75 //
76 //*****************************************************************************
77 void
EPIModeSet(unsigned long ulBase,unsigned long ulMode)78 EPIModeSet(unsigned long ulBase, unsigned long ulMode)
79 {
80 //
81 // Check the arguments.
82 //
83 ASSERT(ulBase == EPI0_BASE);
84 ASSERT((ulMode == EPI_MODE_GENERAL) ||
85 (ulMode == EPI_MODE_SDRAM) ||
86 (ulMode == EPI_MODE_HB8) ||
87 (ulMode == EPI_MODE_HB16) ||
88 (ulMode == EPI_MODE_DISABLE));
89
90 //
91 // Write the mode word to the register.
92 //
93 HWREG(ulBase + EPI_O_CFG) = ulMode;
94 }
95
96 //*****************************************************************************
97 //
98 //! Sets the clock divider for the EPI module.
99 //!
100 //! \param ulBase is the EPI module base address.
101 //! \param ulDivider is the value of the clock divider to be applied to
102 //! the external interface (0-65535).
103 //!
104 //! This function sets the clock divider(s) that is used to determine the
105 //! clock rate of the external interface. The \e ulDivider value is used to
106 //! derive the EPI clock rate from the system clock based on the following
107 //! formula.
108 //!
109 //! EPIClock = (Divider == 0) ? SysClk : (SysClk / (((Divider / 2) + 1) * 2))
110 //!
111 //! For example, a divider value of 1 results in an EPI clock rate of half
112 //! the system clock, value of 2 or 3 yields one quarter of the system clock and
113 //! a value of 4 results in one sixth of the system clock rate.
114 //!
115 //! In cases where a dual chip select mode is in use and different clock rates
116 //! are required for each chip select, the \e ulDivider parameter must contain
117 //! two dividers. The lower 16 bits define the divider to be used with CS0n
118 //! and the upper 16 bits define the divider for CS1n.
119 //!
120 //! \return None.
121 //
122 //*****************************************************************************
123 void
EPIDividerSet(unsigned long ulBase,unsigned long ulDivider)124 EPIDividerSet(unsigned long ulBase, unsigned long ulDivider)
125 {
126 //
127 // Check the arguments.
128 //
129 ASSERT(ulBase == EPI0_BASE);
130
131 //
132 // Write the divider value to the register.
133 //
134 HWREG(ulBase + EPI_O_BAUD) = ulDivider;
135 }
136
137 //*****************************************************************************
138 //
139 //! Configures the SDRAM mode of operation.
140 //!
141 //! \param ulBase is the EPI module base address.
142 //! \param ulConfig is the SDRAM interface configuration.
143 //! \param ulRefresh is the refresh count in core clocks (0-2047).
144 //!
145 //! This function is used to configure the SDRAM interface, when the SDRAM
146 //! mode is chosen with the function EPIModeSet(). The parameter \e ulConfig
147 //! is the logical OR of several sets of choices:
148 //!
149 //! The processor core frequency must be specified with one of the following:
150 //!
151 //! - \b EPI_SDRAM_CORE_FREQ_0_15 - core clock is 0 MHz < clk <= 15 MHz
152 //! - \b EPI_SDRAM_CORE_FREQ_15_30 - core clock is 15 MHz < clk <= 30 MHz
153 //! - \b EPI_SDRAM_CORE_FREQ_30_50 - core clock is 30 MHz < clk <= 50 MHz
154 //! - \b EPI_SDRAM_CORE_FREQ_50_100 - core clock is 50 MHz < clk <= 100 MHz
155 //!
156 //! The low power mode is specified with one of the following:
157 //!
158 //! - \b EPI_SDRAM_LOW_POWER - enter low power, self-refresh state
159 //! - \b EPI_SDRAM_FULL_POWER - normal operating state
160 //!
161 //! The SDRAM device size is specified with one of the following:
162 //!
163 //! - \b EPI_SDRAM_SIZE_64MBIT - 64 Mbit device (8 MB)
164 //! - \b EPI_SDRAM_SIZE_128MBIT - 128 Mbit device (16 MB)
165 //! - \b EPI_SDRAM_SIZE_256MBIT - 256 Mbit device (32 MB)
166 //! - \b EPI_SDRAM_SIZE_512MBIT - 512 Mbit device (64 MB)
167 //!
168 //! The parameter \e ulRefresh sets the refresh counter in units of core
169 //! clock ticks. It is an 11-bit value with a range of 0 - 2047 counts.
170 //!
171 //! \return None.
172 //
173 //*****************************************************************************
174 void
EPIConfigSDRAMSet(unsigned long ulBase,unsigned long ulConfig,unsigned long ulRefresh)175 EPIConfigSDRAMSet(unsigned long ulBase, unsigned long ulConfig,
176 unsigned long ulRefresh)
177 {
178 //
179 // Check the arguments.
180 //
181 ASSERT(ulBase == EPI0_BASE);
182 ASSERT(ulRefresh < 2048);
183
184 //
185 // Fill in the refresh count field of the configuration word.
186 //
187 ulConfig &= ~EPI_SDRAMCFG_RFSH_M;
188 ulConfig |= ulRefresh << EPI_SDRAMCFG_RFSH_S;
189
190 //
191 // Write the SDRAM configuration register.
192 //
193 HWREG(ulBase + EPI_O_SDRAMCFG) = ulConfig;
194 }
195
196 //*****************************************************************************
197 //
198 //! Configures the interface for Host-bus 8 operation.
199 //!
200 //! \param ulBase is the EPI module base address.
201 //! \param ulConfig is the interface configuration.
202 //! \param ulMaxWait is the maximum number of external clocks to wait
203 //! if a FIFO ready signal is holding off the transaction.
204 //!
205 //! This function is used to configure the interface when used in Host-bus 8
206 //! operation as chosen with the function EPIModeSet(). The parameter
207 //! \e ulConfig is the logical OR of any of the following:
208 //!
209 //! - one of \b EPI_HB8_MODE_ADMUX, \b EPI_HB8_MODE_ADDEMUX,
210 //! \b EPI_HB8_MODE_SRAM, or \b EPI_HB8_MODE_FIFO to select the HB8 mode
211 //! - \b EPI_HB8_USE_TXEMPTY - enable TXEMPTY signal with FIFO
212 //! - \b EPI_HB8_USE_RXFULL - enable RXFULL signal with FIFO
213 //! - \b EPI_HB8_WRHIGH - use active high write strobe, otherwise it is
214 //! active low
215 //! - \b EPI_HB8_RDHIGH - use active high read strobe, otherwise it is
216 //! active low
217 //! - one of \b EPI_HB8_WRWAIT_0, \b EPI_HB8_WRWAIT_1, \b EPI_HB8_WRWAIT_2,
218 //! or \b EPI_HB8_WRWAIT_3 to select the number of write wait states (default
219 //! is 0 wait states)
220 //! - one of \b EPI_HB8_RDWAIT_0, \b EPI_HB8_RDWAIT_1, \b EPI_HB8_RDWAIT_2,
221 //! or \b EPI_HB8_RDWAIT_3 to select the number of read wait states (default
222 //! is 0 wait states)
223 //! - \b EPI_HB8_WORD_ACCESS - use Word Access mode to route bytes to the
224 //! correct byte lanes allowing data to be stored in bits [31:8]. If absent,
225 //! all data transfers use bits [7:0].
226 //! - \b EPI_HB8_CSBAUD_DUAL - use different baud rates when accessing devices
227 //! on each CSn. CS0n uses the baud rate specified by the lower 16 bits of the
228 //! divider passed to EPIDividerSet() and CS1n uses the divider passed in the
229 //! upper 16 bits. If this option is absent, both chip selects use the baud
230 //! rate resulting from the divider in the lower 16 bits of the parameter passed
231 //! to EPIDividerSet().
232 //! - one of \b EPI_HB8_CSCFG_CS, \b EPI_HB8_CSCFG_ALE,
233 //! \b EPI_HB8_CSCFG_DUAL_CS or \b EPI_HB8_CSCFG_ALE_DUAL_CS.
234 //! \b EPI_HB8_CSCFG_CS sets EPI30 to operate as a Chip Select (CSn) signal.
235 //! \b EPI_HB8_CSCFG_ALE sets EPI30 to operate as an address latch (ALE).
236 //! \b EPI_HB8_CSCFG_DUAL_CS sets EPI30 to operate as CS0n and EPI27 as CS1n
237 //! with the asserted chip select determined from the most significant address
238 //! bit for the respective external address map. \b EPI_HB8_CSCFG_ALE_DUAL_CS
239 //! sets EPI30 as an address latch (ALE), EPI27 as CS0n and EPI26 as CS1n with
240 //! the asserted chip select determined from the most significant address bit
241 //! for the respective external address map.
242 //!
243 //! The parameter \e ulMaxWait is used if the FIFO mode is chosen. If a
244 //! FIFO is used along with RXFULL or TXEMPTY ready signals, then this
245 //! parameter determines the maximum number of clocks to wait when the
246 //! transaction is being held off by by the FIFO using one of these ready
247 //! signals. A value of 0 means to wait forever.
248 //!
249 //! \return None.
250 //
251 //*****************************************************************************
252 void
EPIConfigHB8Set(unsigned long ulBase,unsigned long ulConfig,unsigned long ulMaxWait)253 EPIConfigHB8Set(unsigned long ulBase, unsigned long ulConfig,
254 unsigned long ulMaxWait)
255 {
256 //
257 // Check the arguments.
258 //
259 ASSERT(ulBase == EPI0_BASE);
260 ASSERT(ulMaxWait < 256);
261
262 //
263 // Determine the CS and word access modes.
264 //
265 HWREG(ulBase + EPI_O_HB8CFG2) = (((ulConfig & EPI_HB8_WORD_ACCESS) ?
266 EPI_HB8CFG2_WORD : 0) |
267 ((ulConfig & EPI_HB8_CSBAUD_DUAL) ?
268 EPI_HB8CFG2_CSBAUD : 0) |
269 ((ulConfig & EPI_HB8_CSCFG_MASK) << 15));
270 //
271 // Fill in the max wait field of the configuration word.
272 //
273 ulConfig &= ~EPI_HB8CFG_MAXWAIT_M;
274 ulConfig |= ulMaxWait << EPI_HB8CFG_MAXWAIT_S;
275
276 //
277 // Write the main HostBus8 configuration register.
278 //
279 HWREG(ulBase + EPI_O_HB8CFG) = ulConfig;
280 }
281
282 //*****************************************************************************
283 //
284 //! Configures the interface for Host-bus 16 operation.
285 //!
286 //! \param ulBase is the EPI module base address.
287 //! \param ulConfig is the interface configuration.
288 //! \param ulMaxWait is the maximum number of external clocks to wait
289 //! if a FIFO ready signal is holding off the transaction.
290 //!
291 //! This function is used to configure the interface when used in Host-bus 16
292 //! operation as chosen with the function EPIModeSet(). The parameter
293 //! \e ulConfig is the logical OR of any of the following:
294 //!
295 //! - one of \b EPI_HB16_MODE_ADMUX, \b EPI_HB16_MODE_ADDEMUX,
296 //! \b EPI_HB16_MODE_SRAM, or \b EPI_HB16_MODE_FIFO to select the HB16 mode
297 //! - \b EPI_HB16_USE_TXEMPTY - enable TXEMPTY signal with FIFO
298 //! - \b EPI_HB16_USE_RXFULL - enable RXFULL signal with FIFO
299 //! - \b EPI_HB16_WRHIGH - use active high write strobe, otherwise it is
300 //! active low
301 //! - \b EPI_HB16_RDHIGH - use active high read strobe, otherwise it is
302 //! active low
303 //! - one of \b EPI_HB16_WRWAIT_0, \b EPI_HB16_WRWAIT_1, \b EPI_HB16_WRWAIT_2,
304 //! or \b EPI_HB16_WRWAIT_3 to select the number of write wait states (default
305 //! is 0 wait states)
306 //! - one of \b EPI_HB16_RDWAIT_0, \b EPI_HB16_RDWAIT_1, \b EPI_HB16_RDWAIT_2,
307 //! or \b EPI_HB16_RDWAIT_3 to select the number of read wait states (default
308 //! is 0 wait states)
309 //! - \b EPI_HB16_WORD_ACCESS - use Word Access mode to route bytes to the
310 //! correct byte lanes allowing data to be stored in bits [31:16]. If absent,
311 //! all data transfers use bits [15:0].
312 //! - \b EPI_HB16_BSEL - enables byte selects. In this mode, two EPI signals
313 //! operate as byte selects allowing 8-bit transfers. If this flag is not
314 //! specified, data must be read and written using only 16-bit transfers.
315 //! - \b EPI_HB16_CSBAUD_DUAL - use different baud rates when accessing devices
316 //! on each CSn. CS0n uses the baud rate specified by the lower 16 bits of the
317 //! divider passed to EPIDividerSet() and CS1n uses the divider passed in the
318 //! upper 16 bits. If this option is absent, both chip selects use the baud
319 //! rate resulting from the divider in the lower 16 bits of the parameter passed
320 //! to EPIDividerSet().
321 //! - one of \b EPI_HB16_CSCFG_CS, \b EPI_HB16_CSCFG_ALE,
322 //! \b EPI_HB16_CSCFG_DUAL_CS or \b EPI_HB16_CSCFG_ALE_DUAL_CS.
323 //! \b EPI_HB16_CSCFG_CS sets EPI30 to operate as a Chip Select (CSn) signal.
324 //! \b EPI_HB16_CSCFG_ALE sets EPI30 to operate as an address latch (ALE).
325 //! \b EPI_HB16_CSCFG_DUAL_CS sets EPI30 to operate as CS0n and EPI27 as CS1n
326 //! with the asserted chip select determined from the most significant address
327 //! bit for the respective external address map. \b EPI_HB16_CSCFG_ALE_DUAL_CS
328 //! sets EPI30 as an address latch (ALE), EPI27 as CS0n and EPI26 as CS1n with
329 //! the asserted chip select determined from the most significant address bit
330 //! for the respective external address map.
331 //!
332 //! The parameter \e ulMaxWait is used if the FIFO mode is chosen. If a
333 //! FIFO is used along with RXFULL or TXEMPTY ready signals, then this
334 //! parameter determines the maximum number of clocks to wait when the
335 //! transaction is being held off by by the FIFO using one of these ready
336 //! signals. A value of 0 means to wait forever.
337 //!
338 //! \return None.
339 //
340 //*****************************************************************************
341 void
EPIConfigHB16Set(unsigned long ulBase,unsigned long ulConfig,unsigned long ulMaxWait)342 EPIConfigHB16Set(unsigned long ulBase, unsigned long ulConfig,
343 unsigned long ulMaxWait)
344 {
345 //
346 // Check the arguments.
347 //
348 ASSERT(ulBase == EPI0_BASE);
349 ASSERT(ulMaxWait < 256);
350
351 //
352 // Determine the CS and word access modes.
353 //
354 HWREG(ulBase + EPI_O_HB16CFG2) = (((ulConfig & EPI_HB16_WORD_ACCESS) ?
355 EPI_HB16CFG2_WORD : 0) |
356 ((ulConfig & EPI_HB16_CSBAUD_DUAL) ?
357 EPI_HB16CFG2_CSBAUD : 0) |
358 ((ulConfig & EPI_HB16_CSCFG_MASK) << 15));
359
360 //
361 // Fill in the max wait field of the configuration word.
362 //
363 ulConfig &= ~EPI_HB16CFG_MAXWAIT_M;
364 ulConfig |= ulMaxWait << EPI_HB16CFG_MAXWAIT_S;
365
366 //
367 // Write the main HostBus16 configuration register.
368 //
369 HWREG(ulBase + EPI_O_HB16CFG) = ulConfig;
370 }
371
372 //*****************************************************************************
373 //
374 //! Configures the interface for general-purpose mode operation.
375 //!
376 //! \param ulBase is the EPI module base address.
377 //! \param ulConfig is the interface configuration.
378 //! \param ulFrameCount is the frame size in clocks, if the frame signal
379 //! is used (0-15).
380 //! \param ulMaxWait is the maximum number of external clocks to wait
381 //! when the external clock enable is holding off the transaction (0-255).
382 //!
383 //! This function is used to configure the interface when used in
384 //! general-purpose operation as chosen with the function EPIModeSet(). The
385 //! parameter \e ulConfig is the logical OR of any of the following:
386 //!
387 //! - \b EPI_GPMODE_CLKPIN - interface clock is output on a pin
388 //! - \b EPI_GPMODE_CLKGATE - clock is stopped when there is no transaction,
389 //! otherwise it is free-running
390 //! - \b EPI_GPMODE_RDYEN - the external peripheral drives an iRDY signal into
391 //! pin EPI0S27. If absent, the peripheral is assumed to be ready at all times.
392 //! This flag may only be used with a free-running clock (\b EPI_GPMODE_CLKGATE
393 //! is absent).
394 //! - \b EPI_GPMODE_FRAMEPIN - framing signal is emitted on a pin
395 //! - \b EPI_GPMODE_FRAME50 - framing signal is 50/50 duty cycle, otherwise it
396 //! is a pulse
397 //! - \b EPI_GPMODE_READWRITE - read and write strobes are emitted on pins
398 //! - \b EPI_GPMODE_WRITE2CYCLE - a two-cycle write is used, otherwise a
399 //! single-cycle write is used
400 //! - \b EPI_GPMODE_READ2CYCLE - a two-cycle read is used, otherwise a
401 //! single-cycle read is used
402 //! - \b EPI_GPMODE_ASIZE_NONE, \b EPI_GPMODE_ASIZE_4,
403 //! \b EPI_GPMODE_ASIZE_12, or \b EPI_GPMODE_ASIZE_20 to choose no address
404 //! bus or an address bus size of 4, 12, or 20 bits
405 //! - \b EPI_GPMODE_DSIZE_8, \b EPI_GPMODE_DSIZE_16,
406 //! \b EPI_GPMODE_DSIZE_24, or \b EPI_GPMODE_DSIZE_32 to select a data bus
407 //! size of 8, 16, 24, or 32 bits
408 //! - \b EPI_GPMODE_WORD_ACCESS - use Word Access mode to route bytes to the
409 //! correct byte lanes allowing data to be stored in the upper bits of the word
410 //! when necessary.
411 //!
412 //! The parameter \e ulFrameCount is the number of clocks used to form the
413 //! framing signal, if the framing signal is used. The behavior depends on
414 //! whether the frame signal is a pulse or a 50/50 duty cycle. This value
415 //! is not used if the framing signal is not enabled with the option
416 //! \b EPI_GPMODE_FRAMEPIN.
417 //!
418 //! The parameter \e ulMaxWait is used if the external clock enable is turned
419 //! on with the \b EPI_GPMODE_CLKENA option is used. In the case that
420 //! external clock enable is used, this parameter determines the maximum
421 //! number of clocks to wait when the external clock enable signal is holding
422 //! off a transaction. A value of 0 means to wait forever. If a non-zero
423 //! value is used and exceeded, an interrupt occurs and the transaction
424 //! aborted.
425 //!
426 //! \return None.
427 //
428 //*****************************************************************************
429 void
EPIConfigGPModeSet(unsigned long ulBase,unsigned long ulConfig,unsigned long ulFrameCount,unsigned long ulMaxWait)430 EPIConfigGPModeSet(unsigned long ulBase, unsigned long ulConfig,
431 unsigned long ulFrameCount, unsigned long ulMaxWait)
432 {
433 //
434 // Check the arguments.
435 //
436 ASSERT(ulBase == EPI0_BASE);
437 ASSERT(ulFrameCount < 16);
438 ASSERT(ulMaxWait < 256);
439
440 //
441 // Set the word access mode.
442 //
443 HWREG(ulBase + EPI_O_GPCFG2) = ((ulConfig & EPI_GPMODE_WORD_ACCESS) ?
444 EPI_GPCFG2_WORD : 0);
445
446 //
447 // Fill in the frame count field of the configuration word.
448 //
449 ulConfig &= ~EPI_GPCFG_FRMCNT_M;
450 ulConfig |= ulFrameCount << EPI_GPCFG_FRMCNT_S;
451
452 //
453 // Fill in the max wait field of the configuration word.
454 //
455 ulConfig &= ~EPI_GPCFG_MAXWAIT_M;
456 ulConfig |= ulMaxWait << EPI_GPCFG_MAXWAIT_S;
457
458 //
459 // Write the non-moded configuration register.
460 //
461 HWREG(ulBase + EPI_O_GPCFG) = ulConfig;
462 }
463
464 //*****************************************************************************
465 //
466 //! Configures the address map for the external interface.
467 //!
468 //! \param ulBase is the EPI module base address.
469 //! \param ulMap is the address mapping configuration.
470 //!
471 //! This function is used to configure the address mapping for the external
472 //! interface. This determines the base address of the external memory or
473 //! device within the processor peripheral and/or memory space.
474 //!
475 //! The parameter \e ulMap is the logical OR of the following:
476 //!
477 //! - \b EPI_ADDR_PER_SIZE_256B, \b EPI_ADDR_PER_SIZE_64KB,
478 //! \b EPI_ADDR_PER_SIZE_16MB, or \b EPI_ADDR_PER_SIZE_512MB to choose a
479 //! peripheral address space of 256 bytes, 64 Kbytes, 16 Mbytes or 512 Mbytes
480 //! - \b EPI_ADDR_PER_BASE_NONE, \b EPI_ADDR_PER_BASE_A, or
481 //! \b EPI_ADDR_PER_BASE_C to choose the base address of the peripheral
482 //! space as none, 0xA0000000, or 0xC0000000
483 //! - \b EPI_ADDR_RAM_SIZE_256B, \b EPI_ADDR_RAM_SIZE_64KB,
484 //! \b EPI_ADDR_RAM_SIZE_16MB, or \b EPI_ADDR_RAM_SIZE_512MB to choose a
485 //! RAM address space of 256 bytes, 64 Kbytes, 16 Mbytes or 512 Mbytes
486 //! - \b EPI_ADDR_RAM_BASE_NONE, \b EPI_ADDR_RAM_BASE_6, or
487 //! \b EPI_ADDR_RAM_BASE_8 to choose the base address of the RAM space
488 //! as none, 0x60000000, or 0x80000000
489 //!
490 //! \return None.
491 //
492 //*****************************************************************************
493 void
EPIAddressMapSet(unsigned long ulBase,unsigned long ulMap)494 EPIAddressMapSet(unsigned long ulBase, unsigned long ulMap)
495 {
496 //
497 // Check the arguments.
498 //
499 ASSERT(ulBase == EPI0_BASE);
500 ASSERT(ulMap < 0x100);
501
502 //
503 // Set the value of the address mapping register.
504 //
505 HWREG(ulBase + EPI_O_ADDRMAP) = ulMap;
506 }
507
508 //*****************************************************************************
509 //
510 //! Configures a non-blocking read transaction.
511 //!
512 //! \param ulBase is the EPI module base address.
513 //! \param ulChannel is the read channel (0 or 1).
514 //! \param ulDataSize is the size of the data items to read.
515 //! \param ulAddress is the starting address to read.
516 //!
517 //! This function is used to configure a non-blocking read channel for a
518 //! transaction. Two channels are available which can be used in a ping-pong
519 //! method for continuous reading. It is not necessary to use both channels
520 //! to perform a non-blocking read.
521 //!
522 //! The parameter \e ulDataSize is one of \b EPI_NBCONFIG_SIZE_8,
523 //! \b EPI_NBCONFIG_SIZE_16, or \b EPI_NBCONFIG_SIZE_32 for 8-bit, 16-bit,
524 //! or 32-bit sized data transfers.
525 //!
526 //! The parameter \e ulAddress is the starting address for the read, relative
527 //! to the external device. The start of the device is address 0.
528 //!
529 //! Once configured, the non-blocking read is started by calling
530 //! EPINonBlockingReadStart(). If the addresses to be read from the device
531 //! are in a sequence, it is not necessary to call this function multiple
532 //! times. Until it is changed, the EPI module stores the last address
533 //! that was used for a non-blocking read (per channel).
534 //!
535 //! \return None.
536 //
537 //*****************************************************************************
538 void
EPINonBlockingReadConfigure(unsigned long ulBase,unsigned long ulChannel,unsigned long ulDataSize,unsigned long ulAddress)539 EPINonBlockingReadConfigure(unsigned long ulBase, unsigned long ulChannel,
540 unsigned long ulDataSize, unsigned long ulAddress)
541 {
542 unsigned long ulOffset;
543
544 //
545 // Check the arguments.
546 //
547 ASSERT(ulBase == EPI0_BASE);
548 ASSERT(ulChannel < 2);
549 ASSERT(ulDataSize < 4);
550 ASSERT(ulAddress < 0x20000000);
551
552 //
553 // Compute the offset needed to select the correct channel regs.
554 //
555 ulOffset = ulChannel * (EPI_O_RSIZE1 - EPI_O_RSIZE0);
556
557 //
558 // Write the data size register for the channel.
559 //
560 HWREG(ulBase + EPI_O_RSIZE0 + ulOffset) = ulDataSize;
561
562 //
563 // Write the starting address register for the channel.
564 //
565 HWREG(ulBase + EPI_O_RADDR0 + ulOffset) = ulAddress;
566 }
567
568 //*****************************************************************************
569 //
570 //! Starts a non-blocking read transaction.
571 //!
572 //! \param ulBase is the EPI module base address.
573 //! \param ulChannel is the read channel (0 or 1).
574 //! \param ulCount is the number of items to read (1-4095).
575 //!
576 //! This function starts a non-blocking read that was previously configured
577 //! with the function EPINonBlockingReadConfigure(). Once this function is
578 //! called, the EPI module begins reading data from the external device
579 //! into the read FIFO. The EPI stops reading when the FIFO fills up
580 //! and resumes reading when the application drains the FIFO, until the
581 //! total specified count of data items has been read.
582 //!
583 //! Once a read transaction is completed and the FIFO drained, another
584 //! transaction can be started from the next address by calling this
585 //! function again.
586 //!
587 //! \return None.
588 //
589 //*****************************************************************************
590 void
EPINonBlockingReadStart(unsigned long ulBase,unsigned long ulChannel,unsigned long ulCount)591 EPINonBlockingReadStart(unsigned long ulBase, unsigned long ulChannel,
592 unsigned long ulCount)
593 {
594 unsigned long ulOffset;
595
596 //
597 // Check the arguments.
598 //
599 ASSERT(ulBase == EPI0_BASE);
600 ASSERT(ulChannel < 2);
601 ASSERT(ulCount < 4096);
602
603 //
604 // Compute the offset needed to select the correct channel regs.
605 //
606 ulOffset = ulChannel * (EPI_O_RPSTD1 - EPI_O_RPSTD0);
607
608 //
609 // Write to the read count register.
610 //
611 HWREG(ulBase + EPI_O_RPSTD0 + ulOffset) = ulCount;
612 }
613
614 //*****************************************************************************
615 //
616 //! Stops a non-blocking read transaction.
617 //!
618 //! \param ulBase is the EPI module base address.
619 //! \param ulChannel is the read channel (0 or 1).
620 //!
621 //! This function cancels a non-blocking read transaction that is already
622 //! in progress.
623 //!
624 //! \return None.
625 //
626 //*****************************************************************************
627 void
EPINonBlockingReadStop(unsigned long ulBase,unsigned long ulChannel)628 EPINonBlockingReadStop(unsigned long ulBase, unsigned long ulChannel)
629 {
630 unsigned long ulOffset;
631
632 //
633 // Check the arguments.
634 //
635 ASSERT(ulBase == EPI0_BASE);
636 ASSERT(ulChannel < 2);
637
638 //
639 // Compute the offset needed to select the correct channel regs.
640 //
641 ulOffset = ulChannel * (EPI_O_RPSTD1 - EPI_O_RPSTD0);
642
643 //
644 // Write a 0 to the read count register, which cancels the transaction.
645 //
646 HWREG(ulBase + EPI_O_RPSTD0 + ulOffset) = 0;
647 }
648
649 //*****************************************************************************
650 //
651 //! Get the count remaining for a non-blocking transaction.
652 //!
653 //! \param ulBase is the EPI module base address.
654 //! \param ulChannel is the read channel (0 or 1).
655 //!
656 //! This function gets the remaining count of items for a non-blocking read
657 //! transaction.
658 //!
659 //! \return The number of items remaining in the non-blocking read transaction.
660 //
661 //*****************************************************************************
662 unsigned long
EPINonBlockingReadCount(unsigned long ulBase,unsigned long ulChannel)663 EPINonBlockingReadCount(unsigned long ulBase, unsigned long ulChannel)
664 {
665 unsigned long ulOffset;
666
667 //
668 // Check the arguments.
669 //
670 ASSERT(ulBase == EPI0_BASE);
671 ASSERT(ulChannel < 2);
672
673 //
674 // Compute the offset needed to select the correct channel regs.
675 //
676 ulOffset = ulChannel * (EPI_O_RPSTD1 - EPI_O_RPSTD0);
677
678 //
679 // Read the count remaining and return the value to the caller.
680 //
681 return(HWREG(ulBase + EPI_O_RPSTD0 + ulOffset));
682 }
683
684 //*****************************************************************************
685 //
686 //! Get the count of items available in the read FIFO.
687 //!
688 //! \param ulBase is the EPI module base address.
689 //!
690 //! This function gets the number of items that are available to read in
691 //! the read FIFO. The read FIFO is filled by a non-blocking read transaction
692 //! which is configured by the functions EPINonBlockingReadConfigure() and
693 //! EPINonBlockingReadStart().
694 //!
695 //! \return The number of items available to read in the read FIFO.
696 //
697 //*****************************************************************************
698 unsigned long
EPINonBlockingReadAvail(unsigned long ulBase)699 EPINonBlockingReadAvail(unsigned long ulBase)
700 {
701 //
702 // Check the arguments.
703 //
704 ASSERT(ulBase == EPI0_BASE);
705
706 //
707 // Read the FIFO count and return it to the caller.
708 //
709 return(HWREG(ulBase + EPI_O_RFIFOCNT));
710 }
711
712 //*****************************************************************************
713 //
714 //! Read available data from the read FIFO, as 32-bit data items.
715 //!
716 //! \param ulBase is the EPI module base address.
717 //! \param ulCount is the maximum count of items to read.
718 //! \param pulBuf is the caller supplied buffer where the read data should
719 //! be stored.
720 //!
721 //! This function reads 32-bit data items from the read FIFO and stores
722 //! the values in a caller-supplied buffer. The function reads and stores
723 //! data from the FIFO until there is no more data in the FIFO or the maximum
724 //! count is reached as specified in the parameter \e ulCount. The actual
725 //! count of items is returned.
726 //!
727 //! \return The number of items read from the FIFO.
728 //
729 //*****************************************************************************
730 unsigned long
EPINonBlockingReadGet32(unsigned long ulBase,unsigned long ulCount,unsigned long * pulBuf)731 EPINonBlockingReadGet32(unsigned long ulBase, unsigned long ulCount,
732 unsigned long *pulBuf)
733 {
734 unsigned long ulCountRead = 0;
735
736 //
737 // Check the arguments.
738 //
739 ASSERT(ulBase == EPI0_BASE);
740 ASSERT(ulCount < 4096);
741 ASSERT(pulBuf);
742
743 //
744 // Read from the FIFO while there are any items to read and
745 // the caller's specified count is not exceeded.
746 //
747 while(HWREG(ulBase + EPI_O_RFIFOCNT) && ulCount--)
748 {
749 //
750 // Read from the FIFO and store in the caller supplied buffer.
751 //
752 *pulBuf = HWREG(ulBase + EPI_O_READFIFO);
753
754 //
755 // Update the caller's buffer pointer and the count of items read.
756 //
757 pulBuf++;
758 ulCountRead++;
759 }
760
761 //
762 // Return the count of items read to the caller.
763 //
764 return(ulCountRead);
765 }
766
767 //*****************************************************************************
768 //
769 //! Read available data from the read FIFO, as 16-bit data items.
770 //!
771 //! \param ulBase is the EPI module base address.
772 //! \param ulCount is the maximum count of items to read.
773 //! \param pusBuf is the caller-supplied buffer where the read data should
774 //! be stored.
775 //!
776 //! This function reads 16-bit data items from the read FIFO and stores
777 //! the values in a caller-supplied buffer. The function reads and stores
778 //! data from the FIFO until there is no more data in the FIFO or the maximum
779 //! count is reached as specified in the parameter \e ulCount. The actual
780 //! count of items is returned.
781 //!
782 //! \return The number of items read from the FIFO.
783 //
784 //*****************************************************************************
785 unsigned long
EPINonBlockingReadGet16(unsigned long ulBase,unsigned long ulCount,unsigned short * pusBuf)786 EPINonBlockingReadGet16(unsigned long ulBase, unsigned long ulCount,
787 unsigned short *pusBuf)
788 {
789 unsigned long ulCountRead = 0;
790
791 //
792 // Check the arguments.
793 //
794 ASSERT(ulBase == EPI0_BASE);
795 ASSERT(ulCount < 4096);
796 ASSERT(pusBuf);
797
798 //
799 // Read from the FIFO while there are any items to read, and
800 // the caller's specified count is not exceeded.
801 //
802 while(HWREG(ulBase + EPI_O_RFIFOCNT) && ulCount--)
803 {
804 //
805 // Read from the FIFO and store in the caller-supplied buffer.
806 //
807 *pusBuf = (unsigned short)HWREG(ulBase + EPI_O_READFIFO);
808
809 //
810 // Update the caller's buffer pointer and the count of items read.
811 //
812 pusBuf++;
813 ulCountRead++;
814 }
815
816 //
817 // Return the count of items read to the caller.
818 //
819 return(ulCountRead);
820 }
821
822 //*****************************************************************************
823 //
824 //! Read available data from the read FIFO, as 8-bit data items.
825 //!
826 //! \param ulBase is the EPI module base address.
827 //! \param ulCount is the maximum count of items to read.
828 //! \param pucBuf is the caller-supplied buffer where the read data should
829 //! be stored.
830 //!
831 //! This function reads 8-bit data items from the read FIFO and stores
832 //! the values in a caller-supplied buffer. The function reads and stores
833 //! data from the FIFO until there is no more data in the FIFO or the maximum
834 //! count is reached as specified in the parameter \e ulCount. The actual
835 //! count of items is returned.
836 //!
837 //! \return The number of items read from the FIFO.
838 //
839 //*****************************************************************************
840 unsigned long
EPINonBlockingReadGet8(unsigned long ulBase,unsigned long ulCount,unsigned char * pucBuf)841 EPINonBlockingReadGet8(unsigned long ulBase, unsigned long ulCount,
842 unsigned char *pucBuf)
843 {
844 unsigned long ulCountRead = 0;
845
846 //
847 // Check the arguments.
848 //
849 ASSERT(ulBase == EPI0_BASE);
850 ASSERT(ulCount < 4096);
851 ASSERT(pucBuf);
852
853 //
854 // Read from the FIFO while there are any items to read, and
855 // the caller's specified count is not exceeded.
856 //
857 while(HWREG(ulBase + EPI_O_RFIFOCNT) && ulCount--)
858 {
859 //
860 // Read from the FIFO and store in the caller supplied buffer.
861 //
862 *pucBuf = (unsigned char)HWREG(ulBase + EPI_O_READFIFO);
863
864 //
865 // Update the caller's buffer pointer and the count of items read.
866 //
867 pucBuf++;
868 ulCountRead++;
869 }
870
871 //
872 // Return the count of items read to the caller.
873 //
874 return(ulCountRead);
875 }
876
877 //*****************************************************************************
878 //
879 //! Configures the read FIFO.
880 //!
881 //! \param ulBase is the EPI module base address.
882 //! \param ulConfig is the FIFO configuration.
883 //!
884 //! This function configures the FIFO trigger levels and error
885 //! generation. The parameter \e ulConfig is the logical OR of the
886 //! following:
887 //!
888 //! - \b EPI_FIFO_CONFIG_WTFULLERR - enables an error interrupt when a write is
889 //! attempted and the write FIFO is full
890 //! - \b EPI_FIFO_CONFIG_RSTALLERR - enables an error interrupt when a read is
891 //! stalled due to an interleaved write or other reason
892 //! - \b EPI_FIFO_CONFIG_TX_EMPTY, \b EPI_FIFO_CONFIG_TX_1_4,
893 //! \b EPI_FIFO_CONFIG_TX_1_2, or \b EPI_FIFO_CONFIG_TX_3_4 to set the
894 //! TX FIFO trigger level to empty, 1/4, 1/2, or 3/4 level
895 //! - \b EPI_FIFO_CONFIG_RX_1_8, \b EPI_FIFO_CONFIG_RX_1_4,
896 //! \b EPI_FIFO_CONFIG_RX_1_2, \b EPI_FIFO_CONFIG_RX_3_4,
897 //! \b EPI_FIFO_CONFIG_RX_7_8, or \b EPI_FIFO_CONFIG_RX_FULL to set the
898 //! RX FIFO trigger level to 1/8, 1/4, 1/2, 3/4, 7/8 or full level
899 //!
900 //! \return None.
901 //
902 //*****************************************************************************
903 void
EPIFIFOConfig(unsigned long ulBase,unsigned long ulConfig)904 EPIFIFOConfig(unsigned long ulBase, unsigned long ulConfig)
905 {
906 //
907 // Check the arguments.
908 //
909 ASSERT(ulBase == EPI0_BASE);
910 ASSERT(ulConfig == (ulConfig & 0x00030077));
911
912 //
913 // Load the configuration into the FIFO config reg.
914 //
915 HWREG(ulBase + EPI_O_FIFOLVL) = ulConfig;
916 }
917
918 //*****************************************************************************
919 //
920 //! Reads the number of empty slots in the write transaction FIFO.
921 //!
922 //! \param ulBase is the EPI module base address.
923 //!
924 //! This function returns the number of slots available in the transaction
925 //! FIFO. It can be used in a polling method to avoid attempting a write
926 //! that would stall.
927 //!
928 //! \return The number of empty slots in the transaction FIFO.
929 //
930 //*****************************************************************************
931 unsigned long
EPIWriteFIFOCountGet(unsigned long ulBase)932 EPIWriteFIFOCountGet(unsigned long ulBase)
933 {
934 //
935 // Check the arguments.
936 //
937 ASSERT(ulBase == EPI0_BASE);
938
939 //
940 // Read the FIFO count and return it to the caller.
941 //
942 return(HWREG(ulBase + EPI_O_WFIFOCNT));
943 }
944
945 //*****************************************************************************
946 //
947 //! Enables EPI interrupt sources.
948 //!
949 //! \param ulBase is the EPI module base address.
950 //! \param ulIntFlags is a bit mask of the interrupt sources to be enabled.
951 //!
952 //! This function enables the specified EPI sources to generate interrupts.
953 //! The \e ulIntFlags parameter can be the logical OR of any of the following
954 //! values:
955 //!
956 //! - \b EPI_INT_TXREQ - transmit FIFO is below the trigger level
957 //! - \b EPI_INT_RXREQ - read FIFO is above the trigger level
958 //! - \b EPI_INT_ERR - an error condition occurred
959 //!
960 //! \return Returns None.
961 //
962 //*****************************************************************************
963 void
EPIIntEnable(unsigned long ulBase,unsigned long ulIntFlags)964 EPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
965 {
966 //
967 // Check the arguments.
968 //
969 ASSERT(ulBase == EPI0_BASE);
970 ASSERT(ulIntFlags < 16);
971
972 //
973 // Write the interrupt flags mask to the mask register.
974 //
975 HWREG(ulBase + EPI_O_IM) |= ulIntFlags;
976 }
977
978 //*****************************************************************************
979 //
980 //! Disables EPI interrupt sources.
981 //!
982 //! \param ulBase is the EPI module base address.
983 //! \param ulIntFlags is a bit mask of the interrupt sources to be disabled.
984 //!
985 //! This function disables the specified EPI sources for interrupt
986 //! generation. The \e ulIntFlags parameter can be the logical OR
987 //! of any of the following values: \b EPI_INT_RXREQ, \b EPI_INT_TXREQ, or
988 //! \b I2S_INT_ERR.
989 //!
990 //! \return Returns None.
991 //
992 //*****************************************************************************
993 void
EPIIntDisable(unsigned long ulBase,unsigned long ulIntFlags)994 EPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
995 {
996 //
997 // Check the arguments.
998 //
999 ASSERT(ulBase == EPI0_BASE);
1000 ASSERT(ulIntFlags < 16);
1001
1002 //
1003 // Write the interrupt flags mask to the mask register.
1004 //
1005 HWREG(ulBase + EPI_O_IM) &= ~ulIntFlags;
1006 }
1007
1008 //*****************************************************************************
1009 //
1010 //! Gets the EPI interrupt status.
1011 //!
1012 //! \param ulBase is the EPI module base address.
1013 //! \param bMasked is set \b true to get the masked interrupt status, or
1014 //! \b false to get the raw interrupt status.
1015 //!
1016 //! This function returns the EPI interrupt status. It can return either
1017 //! the raw or masked interrupt status.
1018 //!
1019 //! \return Returns the masked or raw EPI interrupt status, as a bit field
1020 //! of any of the following values: \b EPI_INT_TXREQ, \b EPI_INT_RXREQ,
1021 //! or \b EPI_INT_ERR
1022 //
1023 //*****************************************************************************
1024 unsigned long
EPIIntStatus(unsigned long ulBase,tBoolean bMasked)1025 EPIIntStatus(unsigned long ulBase, tBoolean bMasked)
1026 {
1027 //
1028 // Check the arguments.
1029 //
1030 ASSERT(ulBase == EPI0_BASE);
1031
1032 //
1033 // Return either the interrupt status or the raw interrupt status as
1034 // requested.
1035 //
1036 if(bMasked)
1037 {
1038 return(HWREG(ulBase + EPI_O_MIS));
1039 }
1040 else
1041 {
1042 return(HWREG(ulBase + EPI_O_RIS));
1043 }
1044 }
1045
1046 //*****************************************************************************
1047 //
1048 //! Gets the EPI error interrupt status.
1049 //!
1050 //! \param ulBase is the EPI module base address.
1051 //!
1052 //! This function returns the error status of the EPI. If the return value of
1053 //! the function EPIIntStatus() has the flag \b EPI_INT_ERR set, then this
1054 //! function can be used to determine the cause of the error.
1055 //!
1056 //! This function returns a bit mask of error flags, which can be the logical
1057 //! OR of any of the following:
1058 //!
1059 //! - \b EPI_INT_ERR_WTFULL - occurs when a write stalled when the transaction
1060 //! FIFO was full
1061 //! - \b EPI_INT_ERR_RSTALL - occurs when a read stalled
1062 //! - \b EPI_INT_ERR_TIMEOUT - occurs when the external clock enable held
1063 //! off a transaction longer than the configured maximum wait time
1064 //!
1065 //! \return Returns the interrupt error flags as the logical OR of any of
1066 //! the following: \b EPI_INT_ERR_WTFULL, \b EPI_INT_ERR_RSTALL, or
1067 //! \b EPI_INT_ERR_TIMEOUT.
1068 //
1069 //*****************************************************************************
1070 unsigned long
EPIIntErrorStatus(unsigned long ulBase)1071 EPIIntErrorStatus(unsigned long ulBase)
1072 {
1073 //
1074 // Check the arguments.
1075 //
1076 ASSERT(ulBase == EPI0_BASE);
1077
1078 //
1079 // Read the error status and return to caller.
1080 //
1081 return(HWREG(ulBase + EPI_O_EISC));
1082 }
1083
1084 //*****************************************************************************
1085 //
1086 //! Clears pending EPI error sources.
1087 //!
1088 //! \param ulBase is the EPI module base address.
1089 //! \param ulErrFlags is a bit mask of the error sources to be cleared.
1090 //!
1091 //! This function clears the specified pending EPI errors. The \e ulErrFlags
1092 //! parameter can be the logical OR of any of the following values:
1093 //! \b EPI_INT_ERR_WTFULL, \b EPI_INT_ERR_RSTALL, or \b EPI_INT_ERR_TIMEOUT.
1094 //!
1095 //! \return Returns None.
1096 //
1097 //*****************************************************************************
1098 void
EPIIntErrorClear(unsigned long ulBase,unsigned long ulErrFlags)1099 EPIIntErrorClear(unsigned long ulBase, unsigned long ulErrFlags)
1100 {
1101 //
1102 // Check the arguments.
1103 //
1104 ASSERT(ulBase == EPI0_BASE);
1105 ASSERT(ulErrFlags < 16);
1106
1107 //
1108 // Write the error flags to the register to clear the pending errors.
1109 //
1110 HWREG(ulBase + EPI_O_EISC) = ulErrFlags;
1111 }
1112
1113 //*****************************************************************************
1114 //
1115 //! Registers an interrupt handler for the EPI module.
1116 //!
1117 //! \param ulBase is the EPI module base address.
1118 //! \param pfnHandler is a pointer to the function to be called when the
1119 //! interrupt is activated.
1120 //!
1121 //! This sets and enables the handler to be called when the EPI module
1122 //! generates an interrupt. Specific EPI interrupts must still be enabled
1123 //! with the EPIIntEnable() function.
1124 //!
1125 //! \sa IntRegister() for important information about registering interrupt
1126 //! handlers.
1127 //!
1128 //! \return None.
1129 //
1130 //*****************************************************************************
1131 void
EPIIntRegister(unsigned long ulBase,void (* pfnHandler)(void))1132 EPIIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
1133 {
1134 //
1135 // Check the arguments.
1136 //
1137 ASSERT(ulBase == EPI0_BASE);
1138 ASSERT(pfnHandler);
1139
1140 //
1141 // Register the interrupt handler.
1142 //
1143 IntRegister(INT_EPI0, pfnHandler);
1144
1145 //
1146 // Enable the EPI interface interrupt.
1147 //
1148 IntEnable(INT_EPI0);
1149 }
1150
1151 //*****************************************************************************
1152 //
1153 //! Unregisters an interrupt handler for the EPI module.
1154 //!
1155 //! \param ulBase is the EPI module base address.
1156 //!
1157 //! This function disables and clears the handler to be called when the
1158 //! EPI interrupt occurs.
1159 //!
1160 //! \sa IntRegister() for important information about registering interrupt
1161 //! handlers.
1162 //!
1163 //! \return None.
1164 //
1165 //*****************************************************************************
1166 void
EPIIntUnregister(unsigned long ulBase)1167 EPIIntUnregister(unsigned long ulBase)
1168 {
1169 //
1170 // Check the arguments.
1171 //
1172 ASSERT(ulBase == EPI0_BASE);
1173
1174 //
1175 // Disable the EPI interface interrupt.
1176 //
1177 IntDisable(INT_EPI0);
1178
1179 //
1180 // Unregister the interrupt handler.
1181 //
1182 IntUnregister(INT_EPI0);
1183 }
1184
1185 //*****************************************************************************
1186 //
1187 // Close the Doxygen group.
1188 //! @}
1189 //
1190 //*****************************************************************************
1191