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