1 //*****************************************************************************
2 //
3 // ssi.h - Prototypes for the Synchronous Serial Interface Driver.
4 //
5 // Copyright (c) 2005-2011 Texas Instruments Incorporated.  All rights reserved.
6 // Software License Agreement
7 //
8 // Texas Instruments (TI) is supplying this software for use solely and
9 // exclusively on TI's microcontroller products. The software is owned by
10 // TI and/or its suppliers, and is protected under applicable copyright
11 // laws. You may not combine this software with "viral" open-source
12 // software in order to form a larger program.
13 //
14 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
15 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
16 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
18 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
19 // DAMAGES, FOR ANY REASON WHATSOEVER.
20 //
21 // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
22 //
23 //*****************************************************************************
24 
25 #ifndef __SSI_H__
26 #define __SSI_H__
27 
28 //*****************************************************************************
29 //
30 // If building with a C++ compiler, make all of the definitions in this header
31 // have a C binding.
32 //
33 //*****************************************************************************
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 //*****************************************************************************
40 //
41 // Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear
42 // as the ulIntFlags parameter, and returned by SSIIntStatus.
43 //
44 //*****************************************************************************
45 #define SSI_TXFF                0x00000008  // TX FIFO half full or less
46 #define SSI_RXFF                0x00000004  // RX FIFO half full or more
47 #define SSI_RXTO                0x00000002  // RX timeout
48 #define SSI_RXOR                0x00000001  // RX overrun
49 
50 //*****************************************************************************
51 //
52 // Values that can be passed to SSIConfigSetExpClk.
53 //
54 //*****************************************************************************
55 #define SSI_FRF_MOTO_MODE_0     0x00000000  // Moto fmt, polarity 0, phase 0
56 #define SSI_FRF_MOTO_MODE_1     0x00000002  // Moto fmt, polarity 0, phase 1
57 #define SSI_FRF_MOTO_MODE_2     0x00000001  // Moto fmt, polarity 1, phase 0
58 #define SSI_FRF_MOTO_MODE_3     0x00000003  // Moto fmt, polarity 1, phase 1
59 #define SSI_FRF_TI              0x00000010  // TI frame format
60 #define SSI_FRF_NMW             0x00000020  // National MicroWire frame format
61 
62 #define SSI_MODE_MASTER         0x00000000  // SSI master
63 #define SSI_MODE_SLAVE          0x00000001  // SSI slave
64 #define SSI_MODE_SLAVE_OD       0x00000002  // SSI slave with output disabled
65 
66 //*****************************************************************************
67 //
68 // Values that can be passed to SSIDMAEnable() and SSIDMADisable().
69 //
70 //*****************************************************************************
71 #define SSI_DMA_TX              0x00000002  // Enable DMA for transmit
72 #define SSI_DMA_RX              0x00000001  // Enable DMA for receive
73 
74 //*****************************************************************************
75 //
76 // Values that can be passed to SSIClockSourceSet() or returned from
77 // SSIClockSourceGet().
78 //
79 //*****************************************************************************
80 #define SSI_CLOCK_SYSTEM        0x00000000
81 #define SSI_CLOCK_PIOSC         0x00000001
82 
83 //*****************************************************************************
84 //
85 // Prototypes for the APIs.
86 //
87 //*****************************************************************************
88 extern void SSIConfigSetExpClk(unsigned long ulBase, unsigned long ulSSIClk,
89                                unsigned long ulProtocol, unsigned long ulMode,
90                                unsigned long ulBitRate,
91                                unsigned long ulDataWidth);
92 extern void SSIDataGet(unsigned long ulBase, unsigned long *pulData);
93 extern long SSIDataGetNonBlocking(unsigned long ulBase,
94                                   unsigned long *pulData);
95 extern void SSIDataPut(unsigned long ulBase, unsigned long ulData);
96 extern long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData);
97 extern void SSIDisable(unsigned long ulBase);
98 extern void SSIEnable(unsigned long ulBase);
99 extern void SSIIntClear(unsigned long ulBase, unsigned long ulIntFlags);
100 extern void SSIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
101 extern void SSIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
102 extern void SSIIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
103 extern unsigned long SSIIntStatus(unsigned long ulBase, tBoolean bMasked);
104 extern void SSIIntUnregister(unsigned long ulBase);
105 extern void SSIDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags);
106 extern void SSIDMADisable(unsigned long ulBase, unsigned long ulDMAFlags);
107 extern tBoolean SSIBusy(unsigned long ulBase);
108 extern void SSIClockSourceSet(unsigned long ulBase, unsigned long ulSource);
109 extern unsigned long SSIClockSourceGet(unsigned long ulBase);
110 
111 //*****************************************************************************
112 //
113 // Several SSI APIs have been renamed, with the original function name being
114 // deprecated.  These defines provide backward compatibility.
115 //
116 //*****************************************************************************
117 #ifndef DEPRECATED
118 #include "driverlib/sysctl.h"
119 #define SSIConfig(a, b, c, d, e)                            \
120         SSIConfigSetExpClk(a, SysCtlClockGet(), b, c, d, e)
121 #define SSIDataNonBlockingGet(a, b) \
122         SSIDataGetNonBlocking(a, b)
123 #define SSIDataNonBlockingPut(a, b) \
124         SSIDataPutNonBlocking(a, b)
125 #endif
126 
127 //*****************************************************************************
128 //
129 // Mark the end of the C bindings section for C++ compilers.
130 //
131 //*****************************************************************************
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif // __SSI_H__
137