PDK API Guide for J721E
mcspi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 - 2017 Texas Instruments Incorporated - www.ti.com
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
86 #ifndef MCSPI_H_
87 #define MCSPI_H_
88 
89 #ifdef __cplusplus
90 extern "C"
91 {
92 #endif
93 
94 /* ========================================================================== */
95 /* Include Files */
96 /* ========================================================================== */
97 #include <ti/csl/cslr_mcspi.h>
98 #include <ti/csl/hw_types.h>
99 
100 /* ========================================================================== */
101 /* Macros & Typedefs */
102 /* ========================================================================== */
103 
104 /*
105  * \name Values used to determine the channel number used for McSPI
106  * communication.
107  * @{
108  */
112 #define MCSPI_CHANNEL_0 (0U)
113 
117 #define MCSPI_CHANNEL_1 (1U)
118 
122 #define MCSPI_CHANNEL_2 (2U)
123 
127 #define MCSPI_CHANNEL_3 (3U)
128 /* @} */
129 
130 /*
131  * \name Values of polarity and phase of SPICLK that are used to configure the
132  * clock value in various modes of operation.
133  * @{
134  */
139 #define MCSPI_CLK_MODE_0 (((uint32_t) MCSPI_CH0CONF_POL_ACTIVEHIGH \
140  << MCSPI_CH0CONF_POL_SHIFT) | \
141  MCSPI_CH0CONF_PHA_ODD)
142 
147 #define MCSPI_CLK_MODE_1 (((uint32_t) MCSPI_CH0CONF_POL_ACTIVEHIGH \
148  << MCSPI_CH0CONF_POL_SHIFT) | \
149  MCSPI_CH0CONF_PHA_EVEN)
150 
155 #define MCSPI_CLK_MODE_2 (((uint32_t) MCSPI_CH0CONF_POL_ACTIVELOW << \
156  MCSPI_CH0CONF_POL_SHIFT) | \
157  MCSPI_CH0CONF_PHA_ODD)
158 
163 #define MCSPI_CLK_MODE_3 (((uint32_t) MCSPI_CH0CONF_POL_ACTIVELOW << \
164  MCSPI_CH0CONF_POL_SHIFT) | \
165  MCSPI_CH0CONF_PHA_EVEN)
166 /* @} */
167 
168 /*
169  * \name McSPI Register Offset for MCSPI_CHxCONF, MCSPI_CHxSTAT, MCSPI_CHxCTRL,
170  * MCSPI_TXx and MCSPI_RXx register set.
171  * @{
172  */
177 #define MCSPI_REG_OFFSET (0x14U)
178 
182 #define MCSPI_CHCONF(x) ((uint32_t) MCSPI_CH0CONF + \
183  (uint32_t) ((uint32_t) MCSPI_REG_OFFSET * \
184  ((uint32_t) (x))))
185 
189 #define MCSPI_CHSTAT(x) ((uint32_t) MCSPI_CH0STAT + \
190  (uint32_t) ((uint32_t) MCSPI_REG_OFFSET * \
191  ((uint32_t) (x))))
192 
196 #define MCSPI_CHCTRL(x) ((uint32_t) MCSPI_CH0CTRL + \
197  (uint32_t) ((uint32_t) MCSPI_REG_OFFSET * \
198  ((uint32_t) (x))))
199 
204 #define MCSPI_CHTX(x) ((uint32_t) MCSPI_TX0 + \
205  (uint32_t) ((uint32_t) MCSPI_REG_OFFSET * \
206  ((uint32_t) (x))))
207 
212 #define MCSPI_CHRX(x) ((uint32_t) MCSPI_RX0 + \
213  (uint32_t) ((uint32_t) MCSPI_REG_OFFSET * \
214  ((uint32_t) (x))))
215 /* @} */
216 
217 /*
218  * \name Values of minumum & maximum word lengths that is valid for SPI channel
219  * config.
220  * @{
221  */
225 #define MCSPI_WORD_LENGTH_MIN ((uint32_t) 4U)
226 
230 #define MCSPI_WORD_LENGTH_MAX ((uint32_t) 32U)
231 /* @} */
232 
233 /*
234  * \name Values used to set the word length for McSPI communication.
235  * 'n' can take values only between 4 <= n <= 32.
236  * @{
237  */
242 #define MCSPI_WORD_LENGTH(n) ((((uint32_t) (n)) - \
243  (uint32_t) 1U) << MCSPI_CH0CONF_WL_SHIFT)
244 /* @} */
245 
246 /*
247  * \name Values used to configure the chip select time control(TCS).
248  * @{
249  */
254 #define MCSPI_CS_TCS_0PNT5_CLK ((uint32_t) MCSPI_CH0CONF_TCS0_ZEROCYCLEDLY \
255  << MCSPI_CH0CONF_TCS0_SHIFT)
256 
261 #define MCSPI_CS_TCS_1PNT5_CLK ((uint32_t) MCSPI_CH0CONF_TCS0_ONECYCLEDLY \
262  << MCSPI_CH0CONF_TCS0_SHIFT)
263 
268 #define MCSPI_CS_TCS_2PNT5_CLK ((uint32_t) MCSPI_CH0CONF_TCS0_TWOCYCLEDLY \
269  << MCSPI_CH0CONF_TCS0_SHIFT)
270 
275 #define MCSPI_CS_TCS_3PNT5_CLK ((uint32_t) \
276  MCSPI_CH0CONF_TCS0_THREECYCLEDLY << \
277  MCSPI_CH0CONF_TCS0_SHIFT)
278 /* @} */
279 
280 /*
281  * \name Value used to set the polarity for start bit for McSPI communication.
282  * @{
283  */
287 #define MCSPI_START_BIT_POL_LOW (MCSPI_CH0CONF_SBPOL_LOWLEVEL)
288 
292 #define MCSPI_START_BIT_POL_HIGH (MCSPI_CH0CONF_SBPOL_HIGHLEVEL)
293 /* @} */
294 
295 /*
296  * \name Values used to determine transmit/receive modes of McSPI peripheral in
297  * master mode.
298  * @{
299  */
303 #define MCSPI_TX_RX_MODE ((uint32_t) MCSPI_CH0CONF_TRM_TRANSRECEI << \
304  MCSPI_CH0CONF_TRM_SHIFT)
305 
309 #define MCSPI_RX_ONLY_MODE ((uint32_t) MCSPI_CH0CONF_TRM_RECEIVONLY << \
310  MCSPI_CH0CONF_TRM_SHIFT)
311 
315 #define MCSPI_TX_ONLY_MODE ((uint32_t) MCSPI_CH0CONF_TRM_TRANSONLY << \
316  MCSPI_CH0CONF_TRM_SHIFT)
317 /* @} */
318 
319 /*
320  * \name Values used to configure communication on data line pins.
321  * @{
322  */
329 #define MCSPI_DATA_LINE_COMM_MODE_0 (((uint32_t) MCSPI_CH0CONF_IS_LINE0 << \
330  MCSPI_CH0CONF_IS_SHIFT) | \
331  ((uint32_t) MCSPI_CH0CONF_DPE1_ENABLED << \
332  MCSPI_CH0CONF_DPE1_SHIFT) | \
333  ((uint32_t) MCSPI_CH0CONF_DPE0_ENABLED << \
334  MCSPI_CH0CONF_DPE0_SHIFT))
335 
342 #define MCSPI_DATA_LINE_COMM_MODE_1 (((uint32_t) MCSPI_CH0CONF_IS_LINE0 << \
343  MCSPI_CH0CONF_IS_SHIFT) | \
344  ((uint32_t) MCSPI_CH0CONF_DPE1_ENABLED << \
345  MCSPI_CH0CONF_DPE1_SHIFT) | \
346  ((uint32_t) MCSPI_CH0CONF_DPE0_DISABLED \
347  << MCSPI_CH0CONF_DPE0_SHIFT))
348 
355 #define MCSPI_DATA_LINE_COMM_MODE_2 (((uint32_t) MCSPI_CH0CONF_IS_LINE0 << \
356  MCSPI_CH0CONF_IS_SHIFT) | \
357  ((uint32_t) MCSPI_CH0CONF_DPE1_DISABLED \
358  << MCSPI_CH0CONF_DPE1_SHIFT) | \
359  ((uint32_t) MCSPI_CH0CONF_DPE0_ENABLED << \
360  MCSPI_CH0CONF_DPE0_SHIFT))
361 
368 #define MCSPI_DATA_LINE_COMM_MODE_3 (((uint32_t) MCSPI_CH0CONF_IS_LINE0 << \
369  MCSPI_CH0CONF_IS_SHIFT) | \
370  ((uint32_t) MCSPI_CH0CONF_DPE1_DISABLED \
371  << MCSPI_CH0CONF_DPE1_SHIFT) | \
372  ((uint32_t) MCSPI_CH0CONF_DPE0_DISABLED \
373  << MCSPI_CH0CONF_DPE0_SHIFT))
374 
381 #define MCSPI_DATA_LINE_COMM_MODE_4 (((uint32_t) MCSPI_CH0CONF_IS_LINE1 << \
382  MCSPI_CH0CONF_IS_SHIFT) | \
383  ((uint32_t) MCSPI_CH0CONF_DPE1_ENABLED << \
384  MCSPI_CH0CONF_DPE1_SHIFT) | \
385  ((uint32_t) MCSPI_CH0CONF_DPE0_ENABLED << \
386  MCSPI_CH0CONF_DPE0_SHIFT))
387 
394 #define MCSPI_DATA_LINE_COMM_MODE_5 (((uint32_t) MCSPI_CH0CONF_IS_LINE1 << \
395  MCSPI_CH0CONF_IS_SHIFT) | \
396  ((uint32_t) MCSPI_CH0CONF_DPE1_ENABLED << \
397  MCSPI_CH0CONF_DPE1_SHIFT) | \
398  ((uint32_t) MCSPI_CH0CONF_DPE0_DISABLED \
399  << MCSPI_CH0CONF_DPE0_SHIFT))
400 
407 #define MCSPI_DATA_LINE_COMM_MODE_6 (((uint32_t) MCSPI_CH0CONF_IS_LINE1 << \
408  MCSPI_CH0CONF_IS_SHIFT) | \
409  ((uint32_t) MCSPI_CH0CONF_DPE1_DISABLED \
410  << MCSPI_CH0CONF_DPE1_SHIFT) | \
411  ((uint32_t) MCSPI_CH0CONF_DPE0_ENABLED << \
412  MCSPI_CH0CONF_DPE0_SHIFT))
413 
420 #define MCSPI_DATA_LINE_COMM_MODE_7 (((uint32_t) MCSPI_CH0CONF_IS_LINE1 << \
421  MCSPI_CH0CONF_IS_SHIFT) | \
422  ((uint32_t) MCSPI_CH0CONF_DPE1_DISABLED \
423  << MCSPI_CH0CONF_DPE1_SHIFT) | \
424  ((uint32_t) MCSPI_CH0CONF_DPE0_DISABLED \
425  << MCSPI_CH0CONF_DPE0_SHIFT))
426 /* @} */
427 
428 /*
429  * \name Values used to enable/disable the Tx/Rx FIFOs of McSPI peripheral.
430  * @{
431  */
435 #define MCSPI_RX_FIFO_ENABLE ((uint32_t) MCSPI_CH0CONF_FFER_FFENABLED \
436  << \
437  MCSPI_CH0CONF_FFER_SHIFT)
438 
442 #define MCSPI_RX_FIFO_DISABLE ((uint32_t) MCSPI_CH0CONF_FFER_FFDISABLED \
443  << MCSPI_CH0CONF_FFER_SHIFT)
444 
448 #define MCSPI_TX_FIFO_ENABLE ((uint32_t) MCSPI_CH0CONF_FFEW_FFENABLED \
449  << MCSPI_CH0CONF_FFEW_SHIFT)
450 
454 #define MCSPI_TX_FIFO_DISABLE ((uint32_t) MCSPI_CH0CONF_FFEW_FFDISABLED \
455  << MCSPI_CH0CONF_FFEW_SHIFT)
456 /* @} */
457 
458 /*
459  * \name Values used to enable/disable the read/write DMA events of McSPI
460  * peripheral.
461  * @{
462  */
466 #define MCSPI_DMA_RX_EVENT ((uint32_t) MCSPI_CH0CONF_DMAR_ENABLED << \
467  MCSPI_CH0CONF_DMAR_SHIFT)
468 
472 #define MCSPI_DMA_TX_EVENT ((uint32_t) MCSPI_CH0CONF_DMAW_ENABLED << \
473  MCSPI_CH0CONF_DMAW_SHIFT)
474 /* @} */
475 
476 /*
477  * \name Values that can be passed to enable/disable/clear status of the
478  * various interrupts of McSPI peripheral.
479  * These macros can also be used to check the status obtained from
480  * 'McSPIIntStatusGet' API.
481  * @{
482  */
487 #define MCSPI_INT_TX_EMPTY(chan) ((uint32_t) \
488  MCSPI_IRQENABLE_TX0_EMPTY_ENABLE_MASK << \
489  ((chan) * 4U))
490 
495 #define MCSPI_INT_TX_UNDERFLOW(chan) ((uint32_t) \
496  MCSPI_IRQENABLE_TX0_UNDERFLOW_ENABLE_MASK \
497  << ((chan) * 4U))
498 
503 #define MCSPI_INT_RX_FULL(chan) ((uint32_t) \
504  MCSPI_IRQENABLE_RX0_FULL_ENABLE_MASK << \
505  ((chan) * 4U))
506 
510 #define MCSPI_INT_RX0_OVERFLOW ((uint32_t) \
511  MCSPI_IRQSTATUS_RX0_OVERFLOW_MASK)
512 
516 #define MCSPI_INT_EOWKE ((uint32_t) \
517  MCSPI_IRQENABLE_EOW_ENABLE_IRQENABLED << \
518  MCSPI_IRQENABLE_EOW_ENABLE_SHIFT)
519 /* @} */
520 
521 /*
522  * \name Values used to enable initial delay for first transfer from McSPI
523  * peripheral.
524  * @{
525  */
529 #define MCSPI_INITDLY_0 ((uint32_t) \
530  MCSPI_MODULCTRL_INITDLY_NODELAY << \
531  MCSPI_MODULCTRL_INITDLY_SHIFT)
532 
536 #define MCSPI_INITDLY_4 ((uint32_t) \
537  MCSPI_MODULCTRL_INITDLY_4CLKDLY << \
538  MCSPI_MODULCTRL_INITDLY_SHIFT)
539 
544 #define MCSPI_INITDLY_8 ((uint32_t) \
545  MCSPI_MODULCTRL_INITDLY_8CLKDLY << \
546  MCSPI_MODULCTRL_INITDLY_SHIFT)
547 
552 #define MCSPI_INITDLY_16 ((uint32_t) \
553  MCSPI_MODULCTRL_INITDLY_16CLKDLY << \
554  MCSPI_MODULCTRL_INITDLY_SHIFT)
555 
560 #define MCSPI_INITDLY_32 ((uint32_t) \
561  MCSPI_MODULCTRL_INITDLY_32CLKDLY << \
562  MCSPI_MODULCTRL_INITDLY_SHIFT)
563 /* @} */
564 
565 /*
566  * \name Values used to check the status of McSPI channel status registers and
567  * FIFO.
568  * @{
569  */
573 #define MCSPI_CH_STAT_RXS_FULL ((uint32_t) MCSPI_CH0STAT_RXS_FULL << \
574  MCSPI_CH0STAT_RXS_SHIFT)
575 
579 #define MCSPI_CH_STAT_TXS_EMPTY ((uint32_t) MCSPI_CH0STAT_TXS_EMPTY << \
580  MCSPI_CH0STAT_TXS_SHIFT)
581 
585 #define MCSPI_CH_STAT_EOT ((uint32_t) MCSPI_CH0STAT_EOT_COMPLETED << \
586  MCSPI_CH0STAT_EOT_SHIFT)
587 
591 #define MCSPI_CH_TXFFE ((uint32_t) MCSPI_CH0STAT_TXFFE_EMPTY << \
592  MCSPI_CH0STAT_TXFFE_SHIFT)
593 
597 #define MCSPI_CH_TXFFF ((uint32_t) MCSPI_CH0STAT_TXFFF_FULL << \
598  MCSPI_CH0STAT_TXFFF_SHIFT)
599 
603 #define MCSPI_CH_RXFFE ((uint32_t) MCSPI_CH0STAT_RXFFE_EMPTY << \
604  MCSPI_CH0STAT_RXFFE_SHIFT)
605 
609 #define MCSPI_CH_RXFFF ((uint32_t) MCSPI_CH0STAT_RXFFF_FULL << \
610  MCSPI_CH0STAT_RXFFF_SHIFT)
611 /* @} */
612 
613 /*
614  * \name Value used to enable/disable multiple word ocp access.
615  * @{
616  */
620 #define MCSPI_MOA_ENABLE ((uint32_t) MCSPI_MODULCTRL_MOA_MULTIACCES \
621  << MCSPI_MODULCTRL_MOA_SHIFT)
622 
626 #define MCSPI_MOA_DISABLE ((uint32_t) \
627  MCSPI_MODULCTRL_MOA_NOMULTIACCESS << \
628  MCSPI_MODULCTRL_MOA_SHIFT)
629 /* @} */
630 
631 /*
632  * \name Value used to configure to single/multiple channel.
633  * @{
634  */
638 #define MCSPI_SINGLE_CH ((uint32_t) MCSPI_MODULCTRL_SINGLE_SINGLE << \
639  MCSPI_MODULCTRL_SINGLE_SHIFT)
640 
644 #define MCSPI_MULTI_CH ((uint32_t) MCSPI_MODULCTRL_SINGLE_MULTI << \
645  MCSPI_MODULCTRL_SINGLE_SHIFT)
646 /* @} */
647 
648 /*
649  * \name Value used to configure the Chip select Polarity
650  * @{
651  */
655 #define MCSPI_CS_POL_HIGH ((uint32_t) MCSPI_CH0CONF_EPOL_ACTIVEHIGH << \
656  MCSPI_CH0CONF_EPOL_SHIFT)
657 
661 #define MCSPI_CS_POL_LOW ((uint32_t) MCSPI_CH0CONF_EPOL_ACTIVELOW << \
662  MCSPI_CH0CONF_EPOL_SHIFT)
663 /* @} */
664 
665 /*
666  * \name Value used to enable/disable FDAA operation of McSPI peripheral.
667  * @{
668  */
672 #define MCSPI_FDAA_DISABLE ((uint32_t) \
673  MCSPI_MODULCTRL_FDAA_SHADOWREGEN << \
674  MCSPI_MODULCTRL_FDAA_SHIFT)
675 
679 #define MCSPI_FDAA_ENABLE ((uint32_t) \
680  MCSPI_MODULCTRL_FDAA_NOSHADOWREG << \
681  MCSPI_MODULCTRL_FDAA_SHIFT)
682 /* @} */
683 
684 /*
685  * \name Values used to configure the SYSCONFIG
686  * @{
687  */
691 #define MCSPI_CLOCKS_OCP_OFF_FUNC_OFF ((uint32_t) \
692  MCSPI_SYSCONFIG_CLOCKACTIVITY_NONE << \
693  MCSPI_SYSCONFIG_CLOCKACTIVITY_SHIFT)
694 
698 #define MCSPI_CLOCKS_OCP_ON_FUNC_OFF ((uint32_t) \
699  MCSPI_SYSCONFIG_CLOCKACTIVITY_OCP << \
700  MCSPI_SYSCONFIG_CLOCKACTIVITY_SHIFT)
701 
705 #define MCSPI_CLOCKS_OCP_OFF_FUNC_ON ((uint32_t) \
706  MCSPI_SYSCONFIG_CLOCKACTIVITY_FUNC << \
707  MCSPI_SYSCONFIG_CLOCKACTIVITY_SHIFT)
708 
712 #define MCSPI_CLOCKS_OCP_ON_FUNC_ON ((uint32_t) \
713  MCSPI_SYSCONFIG_CLOCKACTIVITY_BOTH << \
714  MCSPI_SYSCONFIG_CLOCKACTIVITY_SHIFT)
715 
719 #define MCSPI_SIDLEMODE_FORCE ((uint32_t) \
720  MCSPI_SYSCONFIG_SIDLEMODE_FORCE << \
721  MCSPI_SYSCONFIG_SIDLEMODE_SHIFT)
722 
726 #define MCSPI_SIDLEMODE_NO ((uint32_t) MCSPI_SYSCONFIG_SIDLEMODE_NO \
727  << MCSPI_SYSCONFIG_SIDLEMODE_SHIFT)
728 
732 #define MCSPI_SIDLEMODE_SMART_IDLE ((uint32_t) \
733  MCSPI_SYSCONFIG_SIDLEMODE_SMART << \
734  MCSPI_SYSCONFIG_SIDLEMODE_SHIFT)
735 
736 /*TI_INSPECTED 67 X : MISRAC_2012_D.4.5
737  * "Reason - LDRA tool issue : Not able to understand unique Identifier with
738  * "-" " */
742 #define MCSPI_WAKEUP_ENABLE ((uint32_t) MCSPI_SYSCONFIG_ENAWAKEUP_ON \
743  << MCSPI_SYSCONFIG_ENAWAKEUP_SHIFT)
744 
748 #define MCSPI_WAKEUP_DISABLE ((uint32_t) \
749  MCSPI_SYSCONFIG_ENAWAKEUP_NOWAKEUP << \
750  MCSPI_SYSCONFIG_ENAWAKEUP_SHIFT)
751 
755 #define MCSPI_AUTOIDLE_ON ((uint32_t) MCSPI_SYSCONFIG_AUTOIDLE_ON \
756  << MCSPI_SYSCONFIG_AUTOIDLE_SHIFT)
757 
761 #define MCSPI_AUTOIDLE_OFF ((uint32_t) MCSPI_SYSCONFIG_AUTOIDLE_OFF \
762  << MCSPI_SYSCONFIG_AUTOIDLE_SHIFT)
763 /* @} */
764 
765 /* ========================================================================== */
766 /* Function Declarations */
767 /* ========================================================================== */
768 
803 extern void McSPIClkConfig(uint32_t baseAddr,
804  uint32_t spiInClk,
805  uint32_t spiOutClk,
806  uint32_t chNum,
807  uint32_t clkMode);
834 extern void McSPIWordLengthSet(uint32_t baseAddr,
835  uint32_t wordLength,
836  uint32_t chNum);
837 
848 extern void McSPICSEnable(uint32_t baseAddr);
849 
857 extern void McSPICSDisable(uint32_t baseAddr);
858 
881 extern void McSPICSPolarityConfig(uint32_t baseAddr,
882  uint32_t spiEnPol,
883  uint32_t chNum);
884 
905 extern void McSPICSTimeControlSet(uint32_t baseAddr,
906  uint32_t csTimeControl,
907  uint32_t chNum);
908 
922 static inline void McSPICSAssert(uint32_t baseAddr, uint32_t chNum);
923 
937 static inline void McSPICSDeAssert(uint32_t baseAddr, uint32_t chNum);
938 
952 extern void McSPIStartBitEnable(uint32_t baseAddr, uint32_t chNum);
953 
974 extern void McSPIStartBitPolarityConfig(uint32_t baseAddr,
975  uint32_t startBitPol,
976  uint32_t chNum);
977 
991 extern void McSPIStartBitDisable(uint32_t baseAddr, uint32_t chNum);
992 
1000 extern void McSPIMasterModeEnable(uint32_t baseAddr);
1001 
1009 extern void McSPISlaveModeEnable(uint32_t baseAddr);
1010 
1049 extern uint32_t McSPIMasterModeConfig(uint32_t baseAddr,
1050  uint32_t channelMode,
1051  uint32_t trMode,
1052  uint32_t pinMode,
1053  uint32_t chNum);
1054 
1071 static inline void McSPIChannelEnable(uint32_t baseAddr, uint32_t chNum);
1072 
1086 static inline void McSPIChannelDisable(uint32_t baseAddr, uint32_t chNum);
1087 
1095 extern void McSPIReset(uint32_t baseAddr);
1096 
1112 extern void McSPITurboModeEnable(uint32_t baseAddr, uint32_t chNum);
1113 
1127 extern void McSPITurboModeDisable(uint32_t baseAddr, uint32_t chNum);
1128 
1149 extern void McSPITxFIFOConfig(uint32_t baseAddr,
1150  uint32_t txFifo,
1151  uint32_t chNum);
1152 
1173 extern void McSPIRxFIFOConfig(uint32_t baseAddr,
1174  uint32_t rxFifo,
1175  uint32_t chNum);
1176 
1210 extern void McSPIFIFOTrigLvlSet(uint32_t baseAddr,
1211  uint8_t afl,
1212  uint8_t ael,
1213  uint32_t trMode);
1214 
1223 extern void McSPIWordCountSet(uint32_t baseAddr, uint16_t wCnt);
1224 
1244 extern void McSPIDMAEnable(uint32_t baseAddr,
1245  uint32_t dmaFlags,
1246  uint32_t chNum);
1247 
1267 extern void McSPIDMADisable(uint32_t baseAddr,
1268  uint32_t dmaFlags,
1269  uint32_t chNum);
1270 
1282 extern void McSPIIntEnable(uint32_t baseAddr, uint32_t intFlags);
1283 
1312 extern void McSPIIntDisable(uint32_t baseAddr, uint32_t intFlags);
1313 
1332 extern void McSPIInitDelayConfig(uint32_t baseAddr, uint32_t initDelay);
1333 
1350 static inline void McSPITransmitData(uint32_t baseAddr,
1351  uint32_t txData,
1352  uint32_t chNum);
1353 
1367 extern uint32_t McSPIReceiveData(uint32_t baseAddr, uint32_t chNum);
1368 
1385 extern uint32_t McSPIIntStatusGet(uint32_t baseAddr);
1386 
1398 extern void McSPIIntStatusClear(uint32_t baseAddr, uint32_t intFlags);
1399 
1421 static inline uint32_t McSPIChannelStatusGet(uint32_t baseAddr, uint32_t chNum);
1422 
1436 extern void McSPIMultipleWordAccessConfig(uint32_t baseAddr, uint32_t moa);
1437 
1451 extern void McSPIFIFODatManagementConfig(uint32_t baseAddr, uint32_t fdaa);
1452 
1489 extern void MCSPISysConfigSetup(uint32_t baseAddr,
1490  uint32_t clockActivity,
1491  uint32_t sidleMode,
1492  uint32_t wakeUp,
1493  uint32_t autoIdle);
1494 
1529 extern uint32_t MCSPIPinDirSet(uint32_t baseAddr,
1530  uint32_t trMode,
1531  uint32_t pinMode,
1532  uint32_t chNum);
1533 
1542 extern void MCSPISingleChModeEnable(uint32_t baseAddr);
1543 
1552 extern void MCSPIMultiChModeEnable(uint32_t baseAddr);
1553 
1576 extern void McSPISetSlaveChipSel(uint32_t baseAddr,
1577  uint32_t chNum,
1578  uint32_t slaveChipSel);
1579 
1588 static inline uint32_t McSPIGetChannelCtrl(uint32_t baseAddr, uint32_t chNum);
1589 
1599 static inline void McSPISetChannelCtrl(uint32_t baseAddr, uint32_t chNum, uint32_t regVal);
1600 
1609 static inline uint32_t McSPIGetChannelConf(uint32_t baseAddr, uint32_t chNum);
1610 
1620 static inline void McSPISetChannelConf(uint32_t baseAddr, uint32_t chNum, uint32_t regVal);
1621 
1622 /* ========================================================================== */
1623 /* Static Inline Function Definitions */
1624 /* ========================================================================== */
1625 
1626 static inline uint32_t McSPIChannelStatusGet(uint32_t baseAddr, uint32_t chNum)
1627 {
1628  /* Return the status from MCSPI_CHSTAT register. */
1629  return (HW_RD_REG32(baseAddr + MCSPI_CHSTAT(chNum)));
1630 }
1631 
1632 /*TI_INSPECTED 65 D : MISRAC_2012_R.2.2
1633  * "Reason - Void function does have side effect. It enables the channel
1634  * register field in McSPI register" */
1635 static inline void McSPIChannelEnable(uint32_t baseAddr, uint32_t chNum)
1636 {
1637  /* Set the EN field of MCSPI_CHCTRL register. */
1638  HW_WR_FIELD32(
1639  baseAddr + MCSPI_CHCTRL(chNum),
1640  MCSPI_CH0CTRL_EN,
1642 
1643 }
1644 
1645 /*TI_INSPECTED 65 D : MISRAC_2012_R.2.2
1646  * "Reason - Void function does have side effect. It is setting the force bit
1647  * register field in McSPI register for McSPI channel configiration" */
1648 static inline void McSPICSAssert(uint32_t baseAddr, uint32_t chNum)
1649 {
1650  /* Set the FORCE bit of MCSPI_CHCONF register. */
1651  HW_WR_FIELD32(
1652  baseAddr + MCSPI_CHCONF(chNum),
1653  MCSPI_CH0CONF_FORCE,
1655 }
1656 
1657 /*TI_INSPECTED 65 D : MISRAC_2012_R.2.2
1658  * "Reason - Void function does have side effect. It clears the force bit
1659  * register field in McSPI register for McSPI channel configiration" */
1660 static inline void McSPICSDeAssert(uint32_t baseAddr, uint32_t chNum)
1661 {
1662  /* Clear the FORCE bit of MCSPI_CHCONF register. */
1663  HW_WR_FIELD32(
1664  baseAddr + MCSPI_CHCONF(chNum),
1665  MCSPI_CH0CONF_FORCE,
1667 }
1668 
1669 /*TI_INSPECTED 65 D : MISRAC_2012_R.2.2
1670  * "Reason - Void function does have side effect. It disables the channel
1671  * register field in McSPI register" */
1672 static inline void McSPIChannelDisable(uint32_t baseAddr, uint32_t chNum)
1673 {
1674  /* Clear the EN field of MCSPI_CHCTRL register. */
1675  HW_WR_FIELD32(
1676  baseAddr + MCSPI_CHCTRL(chNum),
1677  MCSPI_CH0CTRL_EN,
1679 }
1680 
1681 /*TI_INSPECTED 1 D 1: MISRA-C:2012_R.2.7
1682  * "Reason - Ensured procedure parameter is used" */
1683 static inline void McSPITransmitData(uint32_t baseAddr,
1684  uint32_t txData,
1685  uint32_t chNum)
1686 {
1687  /* Load the MCSPI_TX register with the data to be transmitted */
1688  HW_WR_REG32(baseAddr + MCSPI_CHTX(chNum), txData);
1689 }
1690 
1691 static inline uint32_t McSPIGetChannelCtrl(uint32_t baseAddr, uint32_t chNum)
1692 {
1693  return HW_RD_REG32(baseAddr + MCSPI_CHCTRL(chNum));
1694 }
1695 
1696 static inline void McSPISetChannelCtrl(uint32_t baseAddr, uint32_t chNum, uint32_t regVal)
1697 {
1698  HW_WR_REG32(baseAddr + MCSPI_CHCTRL(chNum), regVal);
1699 }
1700 
1701 static inline uint32_t McSPIGetChannelConf(uint32_t baseAddr, uint32_t chNum)
1702 {
1703  return HW_RD_REG32(baseAddr + MCSPI_CHCONF(chNum));
1704 }
1705 
1706 static inline void McSPISetChannelConf(uint32_t baseAddr, uint32_t chNum, uint32_t regVal)
1707 {
1708  HW_WR_REG32(baseAddr + MCSPI_CHCONF(chNum), regVal);
1709 }
1710 
1711 #ifdef __cplusplus
1712 }
1713 #endif
1714 #endif /* MCSPI_H_ */
1715 
1716 /********************************* End of file ******************************/
void McSPIStartBitDisable(uint32_t baseAddr, uint32_t chNum)
This API will disable the start bit mode of McSPI peripheral.
#define MCSPI_CHSTAT(x)
Base address of McSPI Channel status : McSPI_CHSTAT(x)
Definition: mcspi.h:189
void McSPIFIFODatManagementConfig(uint32_t baseAddr, uint32_t fdaa)
This API will enable/disable the FIFO DMA address 256-bit aligned feature of McSPI peripheral.
static void McSPIChannelEnable(uint32_t baseAddr, uint32_t chNum)
This API will enable the channel of McSPI controller.
Definition: mcspi.h:1635
void McSPISetSlaveChipSel(uint32_t baseAddr, uint32_t chNum, uint32_t slaveChipSel)
McSPISetSlaveChipSel() description for void McSPISetSlaveChipSel(). This call will activate the user ...
void McSPIIntDisable(uint32_t baseAddr, uint32_t intFlags)
This API will disable the McSPI Interrupts.
void McSPICSEnable(uint32_t baseAddr)
This API will enable the chip select pin.
void McSPIIntStatusClear(uint32_t baseAddr, uint32_t intFlags)
This API will clear the status of McSPI Interrupts.
void McSPIFIFOTrigLvlSet(uint32_t baseAddr, uint8_t afl, uint8_t ael, uint32_t trMode)
This API will set the transfer levels used by FIFO depending on the various McSPI transmit/receive mo...
static void McSPISetChannelCtrl(uint32_t baseAddr, uint32_t chNum, uint32_t regVal)
This API sets Channel control register value.
Definition: mcspi.h:1696
void McSPICSDisable(uint32_t baseAddr)
This API will disable the chip select pin.
uint32_t McSPIIntStatusGet(uint32_t baseAddr)
This API will return the status of the McSPI peripheral interrupts.
void McSPICSPolarityConfig(uint32_t baseAddr, uint32_t spiEnPol, uint32_t chNum)
This API will configure the chip select polarity.
void McSPITxFIFOConfig(uint32_t baseAddr, uint32_t txFifo, uint32_t chNum)
This API will enable/disable the Tx FIFOs of McSPI peripheral.
#define MCSPI_CH0CTRL_EN_NACT
Definition: hw_mcspi.h:688
static void McSPITransmitData(uint32_t baseAddr, uint32_t txData, uint32_t chNum)
This API will put the data on to the McSPI Channel transmit register.
Definition: mcspi.h:1683
#define MCSPI_CH0CONF_FORCE_DEASSERT
Definition: hw_mcspi.h:547
static void McSPIChannelDisable(uint32_t baseAddr, uint32_t chNum)
This API will disable the channel of McSPI controller.
Definition: mcspi.h:1672
static uint32_t McSPIChannelStatusGet(uint32_t baseAddr, uint32_t chNum)
This API will return the status of the McSPI channel currently in use.
Definition: mcspi.h:1626
void McSPITurboModeEnable(uint32_t baseAddr, uint32_t chNum)
This API will enable the McSPI turbo mode of operation.
void MCSPISingleChModeEnable(uint32_t baseAddr)
MCSPISingleChModeEnable() description for void MCSPISingleChModeEnable(). This call will configure Mc...
#define MCSPI_CH0CONF_FORCE_ASSERT
Definition: hw_mcspi.h:548
void McSPIStartBitPolarityConfig(uint32_t baseAddr, uint32_t startBitPol, uint32_t chNum)
This API will configure the polarity of start bit.
void McSPICSTimeControlSet(uint32_t baseAddr, uint32_t csTimeControl, uint32_t chNum)
This API will configure the chip select time control.
#define MCSPI_CHTX(x)
Base address of McSPI_CHTX(x) which is used to store data to be transmitted.
Definition: mcspi.h:204
static void McSPISetChannelConf(uint32_t baseAddr, uint32_t chNum, uint32_t regVal)
This API sets Channel Config register value.
Definition: mcspi.h:1706
void McSPIWordLengthSet(uint32_t baseAddr, uint32_t wordLength, uint32_t chNum)
Configure the word length.
void McSPIDMADisable(uint32_t baseAddr, uint32_t dmaFlags, uint32_t chNum)
This API will disable the DMA read/write events of McSPI.
void McSPIMasterModeEnable(uint32_t baseAddr)
This API will enable the McSPI controller in master mode.
void McSPIClkConfig(uint32_t baseAddr, uint32_t spiInClk, uint32_t spiOutClk, uint32_t chNum, uint32_t clkMode)
Configures the clock.
void McSPIStartBitEnable(uint32_t baseAddr, uint32_t chNum)
This API will enable start bit.
void McSPISlaveModeEnable(uint32_t baseAddr)
This call will enable the McSPI controller in Slave mode. .
uint32_t MCSPIPinDirSet(uint32_t baseAddr, uint32_t trMode, uint32_t pinMode, uint32_t chNum)
MCSPIPinDirSet() description for void MCSPIPinDirSet(). This call will configure the Pin Direction an...
static uint32_t McSPIGetChannelCtrl(uint32_t baseAddr, uint32_t chNum)
This API returns Channel control register value.
Definition: mcspi.h:1691
void McSPIIntEnable(uint32_t baseAddr, uint32_t intFlags)
This API will enable the McSPI Interrupts.
void McSPIWordCountSet(uint32_t baseAddr, uint16_t wCnt)
This API will set the McSPI word counter value.
static uint32_t McSPIGetChannelConf(uint32_t baseAddr, uint32_t chNum)
This API returns Channel Config register value.
Definition: mcspi.h:1701
void McSPIMultipleWordAccessConfig(uint32_t baseAddr, uint32_t moa)
This API will enable/disable multiple word OCP access for McSPI peripheral.
void McSPIDMAEnable(uint32_t baseAddr, uint32_t dmaFlags, uint32_t chNum)
This API will enable the DMA read/write events of McSPI.
void McSPIRxFIFOConfig(uint32_t baseAddr, uint32_t rxFifo, uint32_t chNum)
This API will enable/disable the Rx FIFOs of McSPI peripheral.
#define MCSPI_CHCONF(x)
Base address of McSPI Channel configuration : MCSPI_CHCONF(x)
Definition: mcspi.h:182
void McSPIInitDelayConfig(uint32_t baseAddr, uint32_t initDelay)
This API will set initial delay for first transfer from McSPI peripheral.
void McSPITurboModeDisable(uint32_t baseAddr, uint32_t chNum)
This API will disable the McSPI turbo mode of operation.
uint32_t McSPIMasterModeConfig(uint32_t baseAddr, uint32_t channelMode, uint32_t trMode, uint32_t pinMode, uint32_t chNum)
This API will enable the McSPI controller in master mode and configure other parameters required for ...
static void McSPICSDeAssert(uint32_t baseAddr, uint32_t chNum)
This API will deactivate the chip select line.
Definition: mcspi.h:1660
static void McSPICSAssert(uint32_t baseAddr, uint32_t chNum)
This API will activate the chip select line.
Definition: mcspi.h:1648
uint32_t McSPIReceiveData(uint32_t baseAddr, uint32_t chNum)
This API will return the data present in the MCSPI_RX register.
void McSPIReset(uint32_t baseAddr)
This API will reset the McSPI peripheral.
void MCSPIMultiChModeEnable(uint32_t baseAddr)
MCSPIMultiChModeEnable() description for void MCSPIMultiChModeEnable(). This call will configure McSP...
#define MCSPI_CH0CTRL_EN_ACT
Definition: hw_mcspi.h:687
#define MCSPI_CHCTRL(x)
Base address of McSPI_CHCTRL(x) which is used to enable channel.
Definition: mcspi.h:196
void MCSPISysConfigSetup(uint32_t baseAddr, uint32_t clockActivity, uint32_t sidleMode, uint32_t wakeUp, uint32_t autoIdle)
MCSPISysConfigSetup() description for void MCSPISysConfigSetup(). This call will setup the SYSCONFIG ...