1 /******************************************************************************
2 * Filename: ssi.h
3 * Revised: 2017-05-23 12:08:52 +0200 (Tue, 23 May 2017)
4 * Revision: 49048
5 *
6 * Description: Defines and macros for the SSI.
7 *
8 * Copyright (c) 2015 - 2017, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38
39 //*****************************************************************************
40 //
41 //! \addtogroup peripheral_group
42 //! @{
43 //! \addtogroup ssi_api
44 //! @{
45 //
46 //*****************************************************************************
47
48 #ifndef __SSI_H__
49 #define __SSI_H__
50
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include "../inc/hw_ints.h"
65 #include "../inc/hw_memmap.h"
66 #include "../inc/hw_types.h"
67 #include "../inc/hw_ssi.h"
68 #include "debug.h"
69 #include "interrupt.h"
70
71 //*****************************************************************************
72 //
73 // Support for DriverLib in ROM:
74 // This section renames all functions that are not "static inline", so that
75 // calling these functions will default to implementation in flash. At the end
76 // of this file a second renaming will change the defaults to implementation in
77 // ROM for available functions.
78 //
79 // To force use of the implementation in flash, e.g. for debugging:
80 // - Globally: Define DRIVERLIB_NOROM at project level
81 // - Per function: Use prefix "NOROM_" when calling the function
82 //
83 //*****************************************************************************
84 #if !defined(DOXYGEN)
85 #define SSIConfigSetExpClk NOROM_SSIConfigSetExpClk
86 #define SSIDataPut NOROM_SSIDataPut
87 #define SSIDataPutNonBlocking NOROM_SSIDataPutNonBlocking
88 #define SSIDataGet NOROM_SSIDataGet
89 #define SSIDataGetNonBlocking NOROM_SSIDataGetNonBlocking
90 #define SSIIntRegister NOROM_SSIIntRegister
91 #define SSIIntUnregister NOROM_SSIIntUnregister
92 #endif
93
94 //*****************************************************************************
95 //
96 // Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear
97 // as the ui32IntFlags parameter, and returned by SSIIntStatus.
98 //
99 //*****************************************************************************
100 #define SSI_TXFF 0x00000008 // TX FIFO half full or less
101 #define SSI_RXFF 0x00000004 // RX FIFO half full or more
102 #define SSI_RXTO 0x00000002 // RX timeout
103 #define SSI_RXOR 0x00000001 // RX overrun
104
105 //*****************************************************************************
106 //
107 // Values that are returned from SSIStatus
108 //
109 //*****************************************************************************
110 #define SSI_RX_FULL 0x00000008 // Receive FIFO full
111 #define SSI_RX_NOT_EMPTY 0x00000004 // Receive FIFO not empty
112 #define SSI_TX_NOT_FULL 0x00000002 // Transmit FIFO not full
113 #define SSI_TX_EMPTY 0x00000001 // Transmit FIFO empty
114 #define SSI_STATUS_MASK 0x0000000F
115
116 //*****************************************************************************
117 //
118 // Values that can be passed to SSIConfigSetExpClk.
119 //
120 //*****************************************************************************
121 #define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0
122 #define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1
123 #define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0
124 #define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1
125 #define SSI_FRF_TI 0x00000010 // TI frame format
126 #define SSI_FRF_NMW 0x00000020 // National MicroWire frame format
127
128 #define SSI_MODE_MASTER 0x00000000 // SSI master
129 #define SSI_MODE_SLAVE 0x00000001 // SSI slave
130 #define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled
131
132 //*****************************************************************************
133 //
134 // Values that can be passed to SSIDMAEnable() and SSIDMADisable().
135 //
136 //*****************************************************************************
137 #define SSI_DMA_TX 0x00000002 // Enable DMA for transmit
138 #define SSI_DMA_RX 0x00000001 // Enable DMA for receive
139
140 //*****************************************************************************
141 //
142 // API Functions and prototypes
143 //
144 //*****************************************************************************
145
146 #ifdef DRIVERLIB_DEBUG
147 //*****************************************************************************
148 //
149 //! \internal
150 //!
151 //! \brief Checks an SSI base address.
152 //!
153 //! This function determines if an SSI module base address is valid.
154 //!
155 //! \param ui32Base specifies the SSI module base address.
156 //!
157 //! \return Returns \c true if the base address is valid and \c false
158 //! otherwise.
159 //
160 //*****************************************************************************
161 static bool
SSIBaseValid(uint32_t ui32Base)162 SSIBaseValid(uint32_t ui32Base)
163 {
164 return(ui32Base == SSI0_BASE || ui32Base == SSI1_BASE);
165 }
166 #endif
167
168 //*****************************************************************************
169 //
170 //! \brief Configures the synchronous serial port.
171 //!
172 //! This function configures the synchronous serial port. It sets
173 //! the SSI protocol, mode of operation, bit rate, and data width.
174 //!
175 //! The \c ui32Protocol parameter defines the data frame format. The Motorola
176 //! frame formats imply the following polarity and phase configurations:
177 //!
178 //! <pre>
179 //! Polarity Phase Mode
180 //! 0 0 SSI_FRF_MOTO_MODE_0
181 //! 0 1 SSI_FRF_MOTO_MODE_1
182 //! 1 0 SSI_FRF_MOTO_MODE_2
183 //! 1 1 SSI_FRF_MOTO_MODE_3
184 //! </pre>
185 //!
186 //! The \c ui32Mode parameter defines the operating mode of the SSI module.
187 //! The SSI module can operate as a master or slave; if a slave, the SSI can be
188 //! configured to disable output on its serial output line.
189 //!
190 //! The \c ui32BitRate parameter defines the bit rate for the SSI. This bit
191 //! rate must satisfy the following clock ratio criteria:
192 //! - Master mode : FSSI >= 2 * bit rate
193 //! - Slave mode : FSSI >= 12 * bit rate
194 //!
195 //! where FSSI is the frequency of the clock supplied to the SSI module.
196 //!
197 //! The \c ui32DataWidth parameter defines the width of the data transfers, and
198 //! can be a value between 4 and 16, inclusive.
199 //!
200 //! \note The peripheral clock is not necessarily the same as the processor clock.
201 //! The frequency of the peripheral clock is set by the system control.
202 //!
203 //! \param ui32Base specifies the SSI module base address.
204 //! \param ui32SSIClk is the rate of the clock supplied to the SSI module.
205 //! \param ui32Protocol specifies the data transfer protocol.
206 //! The parameter can be one of the following values:
207 //! - \ref SSI_FRF_MOTO_MODE_0
208 //! - \ref SSI_FRF_MOTO_MODE_1
209 //! - \ref SSI_FRF_MOTO_MODE_2
210 //! - \ref SSI_FRF_MOTO_MODE_3
211 //! - \ref SSI_FRF_TI
212 //! - \ref SSI_FRF_NMW.
213 //! \param ui32Mode specifies the mode of operation.
214 //! The parameter can be one of the following values:
215 //! - \ref SSI_MODE_MASTER
216 //! - \ref SSI_MODE_SLAVE
217 //! - \ref SSI_MODE_SLAVE_OD
218 //! \param ui32BitRate specifies the clock rate.
219 //! \param ui32DataWidth specifies number of bits transferred per frame.
220 //! Must be a value between 4 and 16, both included.
221 //!
222 //! \return None
223 //
224 //*****************************************************************************
225 extern void SSIConfigSetExpClk(uint32_t ui32Base, uint32_t ui32SSIClk,
226 uint32_t ui32Protocol, uint32_t ui32Mode,
227 uint32_t ui32BitRate, uint32_t ui32DataWidth);
228
229 //*****************************************************************************
230 //
231 //! \brief Enables the synchronous serial port.
232 //!
233 //! This function enables operation of the synchronous serial port. The
234 //! synchronous serial port must be configured before it is enabled.
235 //!
236 //! \param ui32Base specifies the SSI module base address.
237 //!
238 //! \return None
239 //
240 //*****************************************************************************
241 __STATIC_INLINE void
SSIEnable(uint32_t ui32Base)242 SSIEnable(uint32_t ui32Base)
243 {
244 // Check the arguments.
245 ASSERT(SSIBaseValid(ui32Base));
246
247 // Read-modify-write the enable bit.
248 HWREG(ui32Base + SSI_O_CR1) |= SSI_CR1_SSE;
249 }
250
251 //*****************************************************************************
252 //
253 //! \brief Disables the synchronous serial port.
254 //!
255 //! This function disables operation of the synchronous serial port.
256 //!
257 //! \param ui32Base specifies the SSI module base address.
258 //!
259 //! \return None
260 //
261 //*****************************************************************************
262 __STATIC_INLINE void
SSIDisable(uint32_t ui32Base)263 SSIDisable(uint32_t ui32Base)
264 {
265 // Check the arguments.
266 ASSERT(SSIBaseValid(ui32Base));
267
268 // Read-modify-write the enable bit.
269 HWREG(ui32Base + SSI_O_CR1) &= ~(SSI_CR1_SSE);
270 }
271
272 //*****************************************************************************
273 //
274 //! \brief Puts a data element into the SSI transmit FIFO.
275 //!
276 //! This function places the supplied data into the transmit FIFO of the
277 //! specified SSI module.
278 //!
279 //! \note The upper 32 - N bits of the \c ui32Data are discarded by the
280 //! hardware, where N is the data width as configured by \ref SSIConfigSetExpClk().
281 //! For example, if the interface is configured for 8-bit data width, the upper
282 //! 24 bits of \c ui32Data are discarded.
283 //!
284 //! \param ui32Base specifies the SSI module base address.
285 //! \param ui32Data is the data to be transmitted over the SSI interface.
286 //!
287 //! \return None
288 //
289 //*****************************************************************************
290 extern void SSIDataPut(uint32_t ui32Base, uint32_t ui32Data);
291
292 //*****************************************************************************
293 //
294 //! \brief Puts a data element into the SSI transmit FIFO.
295 //!
296 //! This function places the supplied data into the transmit FIFO of the
297 //! specified SSI module. If there is no space in the FIFO, then this function
298 //! returns a zero.
299 //!
300 //! \note The upper 32 - N bits of the \c ui32Data are discarded by the hardware,
301 //! where N is the data width as configured by \ref SSIConfigSetExpClk(). For
302 //! example, if the interface is configured for 8-bit data width, the upper 24
303 //! bits of \c ui32Data are discarded.
304 //!
305 //! \param ui32Base specifies the SSI module base address.
306 //! \param ui32Data is the data to be transmitted over the SSI interface.
307 //!
308 //! \return Returns the number of elements written to the SSI transmit FIFO.
309 //
310 //*****************************************************************************
311 extern int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data);
312
313 //*****************************************************************************
314 //
315 //! \brief Gets a data element from the SSI receive FIFO.
316 //!
317 //! This function gets received data from the receive FIFO of the specified
318 //! SSI module and places that data into the location specified by the
319 //! \c pui32Data parameter.
320 //!
321 //! \note Only the lower N bits of the value written to \c pui32Data contain
322 //! valid data, where N is the data width as configured by
323 //! \ref SSIConfigSetExpClk(). For example, if the interface is configured for
324 //! 8-bit data width, only the lower 8 bits of the value written to
325 //! \c pui32Data contain valid data.
326 //!
327 //! \param ui32Base specifies the SSI module base address.
328 //! \param pui32Data is a pointer to a storage location for data that was
329 //! received over the SSI interface.
330 //!
331 //! \return None
332 //
333 //*****************************************************************************
334 extern void SSIDataGet(uint32_t ui32Base, uint32_t *pui32Data);
335
336 //*****************************************************************************
337 //
338 //! \brief Gets a data element from the SSI receive FIFO.
339 //!
340 //! This function gets received data from the receive FIFO of the specified SSI
341 //! module and places that data into the location specified by the \c ui32Data
342 //! parameter. If there is no data in the FIFO, then this function returns a
343 //! zero.
344 //!
345 //! \note Only the lower N bits of the value written to \c pui32Data contain
346 //! valid data, where N is the data width as configured by
347 //! \ref SSIConfigSetExpClk(). For example, if the interface is configured for
348 //! 8-bit data width, only the lower 8 bits of the value written to \c pui32Data
349 //! contain valid data.
350 //!
351 //! \param ui32Base specifies the SSI module base address.
352 //! \param pui32Data is a pointer to a storage location for data that was
353 //! received over the SSI interface.
354 //!
355 //! \return Returns the number of elements read from the SSI receive FIFO.
356 //
357 //*****************************************************************************
358 extern int32_t SSIDataGetNonBlocking(uint32_t ui32Base, uint32_t *pui32Data);
359
360 //*****************************************************************************
361 //
362 //! \brief Determines whether the SSI transmitter is busy or not.
363 //!
364 //! Allows the caller to determine whether all transmitted bytes have cleared
365 //! the transmitter hardware. If \c false is returned, then the transmit FIFO
366 //! is empty and all bits of the last transmitted word have left the hardware
367 //! shift register.
368 //!
369 //! \param ui32Base is the base address of the SSI port.
370 //!
371 //! \return Returns status of the SSI transmit buffer.
372 //! - \c true : SSI is transmitting.
373 //! - \c false : SSI transmissions are complete.
374 //
375 //*****************************************************************************
376 __STATIC_INLINE bool
SSIBusy(uint32_t ui32Base)377 SSIBusy(uint32_t ui32Base)
378 {
379 // Check the arguments.
380 ASSERT(SSIBaseValid(ui32Base));
381
382 // Determine if the SSI is busy.
383 return((HWREG(ui32Base + SSI_O_SR) & SSI_SR_BSY) ? true : false);
384 }
385
386 //*****************************************************************************
387 //
388 //! \brief Get the status of the SSI data buffers.
389 //!
390 //! This function is used to poll the status of the internal FIFOs in the SSI
391 //! module. The status of both TX and RX FIFO is returned.
392 //!
393 //! \param ui32Base specifies the SSI module base address.
394 //!
395 //! \return Returns the current status of the internal SSI data buffers.
396 //! The status is a bitwise OR'ed combination of:
397 //! - \ref SSI_RX_FULL : Receive FIFO full.
398 //! - \ref SSI_RX_NOT_EMPTY : Receive FIFO not empty.
399 //! - \ref SSI_TX_NOT_FULL : Transmit FIFO not full.
400 //! - \ref SSI_TX_EMPTY : Transmit FIFO empty.
401 //
402 //*****************************************************************************
403 __STATIC_INLINE uint32_t
SSIStatus(uint32_t ui32Base)404 SSIStatus(uint32_t ui32Base)
405 {
406 // Check the arguments.
407 ASSERT(SSIBaseValid(ui32Base));
408
409 // Return the status
410 return (HWREG(ui32Base + SSI_O_SR) & SSI_STATUS_MASK);
411 }
412
413 //*****************************************************************************
414 //
415 //! \brief Registers an interrupt handler for the Synchronous Serial Interface in the dynamic interrupt table.
416 //!
417 //! \note Only use this function if you want to use the dynamic vector table (in SRAM)!
418 //!
419 //! This function registers a function as the interrupt handler for a specific
420 //! interrupt and enables the corresponding interrupt in the interrupt controller.
421 //!
422 //! Specific SSI interrupts must be enabled via \ref SSIIntEnable(). If necessary,
423 //! it is the interrupt handler's responsibility to clear the interrupt source
424 //! via \ref SSIIntClear().
425 //!
426 //! \param ui32Base specifies the SSI module base address.
427 //! \param pfnHandler is a pointer to the function to be called when the
428 //! synchronous serial port interrupt occurs.
429 //!
430 //! \return None
431 //!
432 //! \sa \ref IntRegister() for important information about registering interrupt
433 //! handlers.
434 //
435 //*****************************************************************************
436 extern void SSIIntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
437
438 //*****************************************************************************
439 //
440 //! \brief Unregisters an interrupt handler for the Synchronous Serial Interface in the dynamic interrupt table.
441 //!
442 //! This function will clear the handler to be called when a SSI
443 //! interrupt occurs. This will also mask off the interrupt in the interrupt
444 //! controller so that the interrupt handler no longer is called.
445 //!
446 //! \param ui32Base specifies the SSI module base address.
447 //!
448 //! \return None
449 //!
450 //! \sa \ref IntRegister() for important information about registering interrupt
451 //! handlers.
452 //
453 //*****************************************************************************
454 extern void SSIIntUnregister(uint32_t ui32Base);
455
456 //*****************************************************************************
457 //
458 //! \brief Enables individual SSI interrupt sources.
459 //!
460 //! Enables the indicated SSI interrupt sources. Only the sources that are
461 //! enabled can be reflected to the processor interrupt; disabled sources have
462 //! no effect on the processor.
463 //!
464 //! \param ui32Base specifies the SSI module base address.
465 //! \param ui32IntFlags is a bit mask of the interrupt sources to be enabled.
466 //! - \ref SSI_TXFF
467 //! - \ref SSI_RXFF
468 //! - \ref SSI_RXTO
469 //! - \ref SSI_RXOR
470 //!
471 //! \return None
472 //
473 //*****************************************************************************
474 __STATIC_INLINE void
SSIIntEnable(uint32_t ui32Base,uint32_t ui32IntFlags)475 SSIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
476 {
477 // Check the arguments.
478 ASSERT(SSIBaseValid(ui32Base));
479
480 // Enable the specified interrupts.
481 HWREG(ui32Base + SSI_O_IMSC) |= ui32IntFlags;
482 }
483
484 //*****************************************************************************
485 //
486 //! \brief Disables individual SSI interrupt sources.
487 //!
488 //! Disables the indicated SSI interrupt sources.
489 //!
490 //! \param ui32Base specifies the SSI module base address.
491 //! \param ui32IntFlags is a bit mask of the interrupt sources to be disabled.
492 //! - \ref SSI_TXFF
493 //! - \ref SSI_RXFF
494 //! - \ref SSI_RXTO
495 //! - \ref SSI_RXOR
496 //!
497 //! \return None
498 //
499 //*****************************************************************************
500 __STATIC_INLINE void
SSIIntDisable(uint32_t ui32Base,uint32_t ui32IntFlags)501 SSIIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
502 {
503 // Check the arguments.
504 ASSERT(SSIBaseValid(ui32Base));
505
506 // Disable the specified interrupts.
507 HWREG(ui32Base + SSI_O_IMSC) &= ~(ui32IntFlags);
508 }
509
510 //*****************************************************************************
511 //
512 //! \brief Clears SSI interrupt sources.
513 //!
514 //! The specified SSI interrupt sources are cleared so that they no longer
515 //! assert. This function must be called in the interrupt handler to keep the
516 //! interrupts from being recognized again immediately upon exit.
517 //!
518 //! \note Due to write buffers and synchronizers in the system it may take several
519 //! clock cycles from a register write clearing an event in a module and until the
520 //! event is actually cleared in the NVIC of the system CPU. It is recommended to
521 //! clear the event source early in the interrupt service routine (ISR) to allow
522 //! the event clear to propagate to the NVIC before returning from the ISR.
523 //! At the same time, an early event clear allows new events of the same type to be
524 //! pended instead of ignored if the event is cleared later in the ISR.
525 //! It is the responsibility of the programmer to make sure that enough time has passed
526 //! before returning from the ISR to avoid false re-triggering of the cleared event.
527 //! A simple, although not necessarily optimal, way of clearing an event before
528 //! returning from the ISR is:
529 //! -# Write to clear event (interrupt source). (buffered write)
530 //! -# Dummy read from the event source module. (making sure the write has propagated)
531 //! -# Wait two system CPU clock cycles (user code or two NOPs). (allowing cleared event to propagate through any synchronizers)
532 //!
533 //! \param ui32Base specifies the SSI module base address.
534 //! \param ui32IntFlags is a bit mask of the interrupt sources to be cleared.
535 //! The parameter can consist of either or both of:
536 //! - \ref SSI_RXTO : Timeout interrupt.
537 //! - \ref SSI_RXOR : Overrun interrupt.
538 //!
539 //! \return None
540 //
541 //*****************************************************************************
542 __STATIC_INLINE void
SSIIntClear(uint32_t ui32Base,uint32_t ui32IntFlags)543 SSIIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
544 {
545 // Check the arguments.
546 ASSERT(SSIBaseValid(ui32Base));
547
548 // Clear the requested interrupt sources.
549 HWREG(ui32Base + SSI_O_ICR) = ui32IntFlags;
550 }
551
552 //*****************************************************************************
553 //
554 //! \brief Gets the current interrupt status.
555 //!
556 //! This function returns the interrupt status for the SSI module. Either the
557 //! raw interrupt status or the status of interrupts that are allowed to
558 //! reflect to the processor can be returned.
559 //!
560 //! \param ui32Base specifies the SSI module base address.
561 //! \param bMasked selects either raw or masked interrupt.
562 //! \c false : Raw interrupt status is required.
563 //! \c true : Masked interrupt status is required.
564 //!
565 //! \return Returns the current interrupt status as an OR'ed combination of:
566 //! - \ref SSI_TXFF
567 //! - \ref SSI_RXFF
568 //! - \ref SSI_RXTO
569 //! - \ref SSI_RXOR
570 //
571 //*****************************************************************************
572 __STATIC_INLINE uint32_t
SSIIntStatus(uint32_t ui32Base,bool bMasked)573 SSIIntStatus(uint32_t ui32Base, bool bMasked)
574 {
575 // Check the arguments.
576 ASSERT(SSIBaseValid(ui32Base));
577
578 // Return either the interrupt status or the raw interrupt status as
579 // requested.
580 if(bMasked)
581 {
582 return(HWREG(ui32Base + SSI_O_MIS));
583 }
584 else
585 {
586 return(HWREG(ui32Base + SSI_O_RIS));
587 }
588 }
589
590 //*****************************************************************************
591 //
592 //! \brief Enable SSI DMA operation.
593 //!
594 //! The specified SSI DMA features are enabled. The SSI can be
595 //! configured to use DMA for transmit and/or receive data transfers.
596 //!
597 //! \note The uDMA controller must also be set up before DMA can be used
598 //! with the SSI.
599 //!
600 //! \param ui32Base is the base address of the SSI port.
601 //! \param ui32DMAFlags is a bit mask of the DMA features to enable.
602 //! The parameter is the bitwise OR of any of the following values:
603 //! - \ref SSI_DMA_RX : Enable DMA for receive.
604 //! - \ref SSI_DMA_TX : Enable DMA for transmit.
605 //!
606 //! \return None
607 //
608 //*****************************************************************************
609 __STATIC_INLINE void
SSIDMAEnable(uint32_t ui32Base,uint32_t ui32DMAFlags)610 SSIDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags)
611 {
612 // Check the arguments.
613 ASSERT(SSIBaseValid(ui32Base));
614
615 // Set the requested bits in the SSI DMA control register.
616 HWREG(ui32Base + SSI_O_DMACR) |= ui32DMAFlags;
617 }
618
619 //*****************************************************************************
620 //
621 //! \brief Disable SSI DMA operation.
622 //!
623 //! This function is used to disable SSI DMA features that were enabled
624 //! by \ref SSIDMAEnable(). The specified SSI DMA features are disabled.
625 //!
626 //! \param ui32Base is the base address of the SSI port.
627 //! \param ui32DMAFlags is a bit mask of the DMA features to disable.
628 //! The parameter is the bitwise OR of any of the following values:
629 //! - \ref SSI_DMA_RX : Disable DMA for receive.
630 //! - \ref SSI_DMA_TX : Disable DMA for transmit.
631 //!
632 //! \return None
633 //
634 //*****************************************************************************
635 __STATIC_INLINE void
SSIDMADisable(uint32_t ui32Base,uint32_t ui32DMAFlags)636 SSIDMADisable(uint32_t ui32Base, uint32_t ui32DMAFlags)
637 {
638 // Check the arguments.
639 ASSERT(SSIBaseValid(ui32Base));
640
641 // Clear the requested bits in the SSI DMA control register.
642 HWREG(ui32Base + SSI_O_DMACR) &= ~ui32DMAFlags;
643 }
644
645 //*****************************************************************************
646 //
647 // Support for DriverLib in ROM:
648 // Redirect to implementation in ROM when available.
649 //
650 //*****************************************************************************
651 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
652 #include "../driverlib/rom.h"
653 #ifdef ROM_SSIConfigSetExpClk
654 #undef SSIConfigSetExpClk
655 #define SSIConfigSetExpClk ROM_SSIConfigSetExpClk
656 #endif
657 #ifdef ROM_SSIDataPut
658 #undef SSIDataPut
659 #define SSIDataPut ROM_SSIDataPut
660 #endif
661 #ifdef ROM_SSIDataPutNonBlocking
662 #undef SSIDataPutNonBlocking
663 #define SSIDataPutNonBlocking ROM_SSIDataPutNonBlocking
664 #endif
665 #ifdef ROM_SSIDataGet
666 #undef SSIDataGet
667 #define SSIDataGet ROM_SSIDataGet
668 #endif
669 #ifdef ROM_SSIDataGetNonBlocking
670 #undef SSIDataGetNonBlocking
671 #define SSIDataGetNonBlocking ROM_SSIDataGetNonBlocking
672 #endif
673 #ifdef ROM_SSIIntRegister
674 #undef SSIIntRegister
675 #define SSIIntRegister ROM_SSIIntRegister
676 #endif
677 #ifdef ROM_SSIIntUnregister
678 #undef SSIIntUnregister
679 #define SSIIntUnregister ROM_SSIIntUnregister
680 #endif
681 #endif
682
683 //*****************************************************************************
684 //
685 // Mark the end of the C bindings section for C++ compilers.
686 //
687 //*****************************************************************************
688 #ifdef __cplusplus
689 }
690 #endif
691
692 #endif // __SSI_H__
693
694 //*****************************************************************************
695 //
696 //! Close the Doxygen group.
697 //! @}
698 //! @}
699 //
700 //*****************************************************************************
701