1 //***************************************************************************** 2 // 3 // ssi.h - Prototypes for the Synchronous Serial Interface Driver. 4 // 5 // Copyright (c) 2005-2020 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 2.2.0.295 of the Tiva Peripheral Driver Library. 37 // 38 //***************************************************************************** 39 40 #ifndef __DRIVERLIB_SSI_H__ 41 #define __DRIVERLIB_SSI_H__ 42 43 //***************************************************************************** 44 // 45 // If building with a C++ compiler, make all of the definitions in this header 46 // have a C binding. 47 // 48 //***************************************************************************** 49 #ifdef __cplusplus 50 extern "C" 51 { 52 #endif 53 54 //***************************************************************************** 55 // 56 // Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear 57 // as the ui32IntFlags parameter, and returned by SSIIntStatus. 58 // 59 //***************************************************************************** 60 #define SSI_TXEOT 0x00000040 // Transmit FIFO is empty 61 #define SSI_DMATX 0x00000020 // DMA Transmit complete 62 #define SSI_DMARX 0x00000010 // DMA Receive complete 63 #define SSI_TXFF 0x00000008 // TX FIFO half full or less 64 #define SSI_RXFF 0x00000004 // RX FIFO half full or more 65 #define SSI_RXTO 0x00000002 // RX timeout 66 #define SSI_RXOR 0x00000001 // RX overrun 67 68 //***************************************************************************** 69 // 70 // Values that can be passed to SSIConfigSetExpClk. 71 // 72 //***************************************************************************** 73 #define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0 74 #define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1 75 #define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0 76 #define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1 77 #define SSI_FRF_TI 0x00000010 // TI frame format 78 #define SSI_FRF_NMW 0x00000020 // National MicroWire frame format 79 80 #define SSI_MODE_MASTER 0x00000000 // SSI master 81 #define SSI_MODE_SLAVE 0x00000001 // SSI slave 82 #define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled 83 84 //***************************************************************************** 85 // 86 // Values that can be passed to SSIDMAEnable() and SSIDMADisable(). 87 // 88 //***************************************************************************** 89 #define SSI_DMA_TX 0x00000002 // Enable DMA for transmit 90 #define SSI_DMA_RX 0x00000001 // Enable DMA for receive 91 92 //***************************************************************************** 93 // 94 // Values that can be passed to SSIClockSourceSet() or returned from 95 // SSIClockSourceGet(). 96 // 97 //***************************************************************************** 98 #define SSI_CLOCK_SYSTEM 0x00000000 99 #define SSI_CLOCK_PIOSC 0x00000005 100 101 //***************************************************************************** 102 // 103 // Values that can be passed to SSIAdvModeSet(). 104 // 105 //***************************************************************************** 106 #define SSI_ADV_MODE_LEGACY 0x00000000 107 #define SSI_ADV_MODE_READ_WRITE 0x000001c0 108 #define SSI_ADV_MODE_WRITE 0x000000c0 109 #define SSI_ADV_MODE_BI_READ 0x00000140 110 #define SSI_ADV_MODE_BI_WRITE 0x00000040 111 #define SSI_ADV_MODE_QUAD_READ 0x00000180 112 #define SSI_ADV_MODE_QUAD_WRITE 0x00000080 113 114 //***************************************************************************** 115 // 116 // Prototypes for the APIs. 117 // 118 //***************************************************************************** 119 extern void SSIConfigSetExpClk(uint32_t ui32Base, uint32_t ui32SSIClk, 120 uint32_t ui32Protocol, uint32_t ui32Mode, 121 uint32_t ui32BitRate, 122 uint32_t ui32DataWidth); 123 extern void SSIDataGet(uint32_t ui32Base, uint32_t *pui32Data); 124 extern int32_t SSIDataGetNonBlocking(uint32_t ui32Base, 125 uint32_t *pui32Data); 126 extern void SSIDataPut(uint32_t ui32Base, uint32_t ui32Data); 127 extern int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data); 128 extern void SSIDisable(uint32_t ui32Base); 129 extern void SSIEnable(uint32_t ui32Base); 130 extern void SSIIntClear(uint32_t ui32Base, uint32_t ui32IntFlags); 131 extern void SSIIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags); 132 extern void SSIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags); 133 extern void SSIIntRegister(uint32_t ui32Base, void (*pfnHandler)(void)); 134 extern uint32_t SSIIntStatus(uint32_t ui32Base, bool bMasked); 135 extern void SSIIntUnregister(uint32_t ui32Base); 136 extern void SSIDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags); 137 extern void SSIDMADisable(uint32_t ui32Base, uint32_t ui32DMAFlags); 138 extern bool SSIBusy(uint32_t ui32Base); 139 extern void SSIClockSourceSet(uint32_t ui32Base, uint32_t ui32Source); 140 extern uint32_t SSIClockSourceGet(uint32_t ui32Base); 141 extern void SSIAdvModeSet(uint32_t ui32Base, uint32_t ui32Mode); 142 extern void SSIAdvDataPutFrameEnd(uint32_t ui32Base, uint32_t ui32Data); 143 extern int32_t SSIAdvDataPutFrameEndNonBlocking(uint32_t ui32Base, 144 uint32_t ui32Data); 145 extern void SSIAdvFrameHoldEnable(uint32_t ui32Base); 146 extern void SSIAdvFrameHoldDisable(uint32_t ui32Base); 147 extern void SSILoopbackEnable(uint32_t ui32Base); 148 extern void SSILoopbackDisable(uint32_t ui32Base); 149 150 //***************************************************************************** 151 // 152 // Mark the end of the C bindings section for C++ compilers. 153 // 154 //***************************************************************************** 155 #ifdef __cplusplus 156 } 157 #endif 158 159 #endif // __DRIVERLIB_SSI_H__ 160