1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// hw_ssi.h - Macros used when accessing the SSI hardware.
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// Software License Agreement
|
8 |
|
|
//
|
9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
10 |
|
|
// exclusively on LMI's microcontroller products.
|
11 |
|
|
//
|
12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
13 |
|
|
// applicable copyright laws. All rights are reserved. You may not combine
|
14 |
|
|
// this software with "viral" open-source software in order to form a larger
|
15 |
|
|
// program. Any use in violation of the foregoing restrictions may subject
|
16 |
|
|
// the user to criminal sanctions under applicable laws, as well as to civil
|
17 |
|
|
// liability for the breach of the terms and conditions of this license.
|
18 |
|
|
//
|
19 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
20 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
21 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
22 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
23 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
24 |
|
|
//
|
25 |
|
|
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
|
26 |
|
|
//
|
27 |
|
|
//*****************************************************************************
|
28 |
|
|
|
29 |
|
|
#ifndef __HW_SSI_H__
|
30 |
|
|
#define __HW_SSI_H__
|
31 |
|
|
|
32 |
|
|
//*****************************************************************************
|
33 |
|
|
//
|
34 |
|
|
// The following are defines for the SSI register offsets.
|
35 |
|
|
//
|
36 |
|
|
//*****************************************************************************
|
37 |
|
|
#define SSI_O_CR0 0x00000000 // Control register 0
|
38 |
|
|
#define SSI_O_CR1 0x00000004 // Control register 1
|
39 |
|
|
#define SSI_O_DR 0x00000008 // Data register
|
40 |
|
|
#define SSI_O_SR 0x0000000C // Status register
|
41 |
|
|
#define SSI_O_CPSR 0x00000010 // Clock prescale register
|
42 |
|
|
#define SSI_O_IM 0x00000014 // Int mask set and clear register
|
43 |
|
|
#define SSI_O_RIS 0x00000018 // Raw interrupt register
|
44 |
|
|
#define SSI_O_MIS 0x0000001C // Masked interrupt register
|
45 |
|
|
#define SSI_O_ICR 0x00000020 // Interrupt clear register
|
46 |
|
|
#define SSI_O_DMACTL 0x00000024 // SSI DMA Control
|
47 |
|
|
|
48 |
|
|
//*****************************************************************************
|
49 |
|
|
//
|
50 |
|
|
// The following are defines for the bit fields in the SSI Control register 0.
|
51 |
|
|
//
|
52 |
|
|
//*****************************************************************************
|
53 |
|
|
#define SSI_CR0_SCR_M 0x0000FF00 // SSI Serial Clock Rate.
|
54 |
|
|
#define SSI_CR0_SPH 0x00000080 // SSPCLKOUT phase
|
55 |
|
|
#define SSI_CR0_SPO 0x00000040 // SSPCLKOUT polarity
|
56 |
|
|
#define SSI_CR0_FRF_M 0x00000030 // Frame format mask
|
57 |
|
|
#define SSI_CR0_FRF_MOTO 0x00000000 // Motorola SPI frame format
|
58 |
|
|
#define SSI_CR0_FRF_TI 0x00000010 // TI sync serial frame format
|
59 |
|
|
#define SSI_CR0_FRF_NMW 0x00000020 // National Microwire frame format
|
60 |
|
|
#define SSI_CR0_DSS_M 0x0000000F // SSI Data Size Select.
|
61 |
|
|
#define SSI_CR0_DSS_4 0x00000003 // 4 bit data
|
62 |
|
|
#define SSI_CR0_DSS_5 0x00000004 // 5 bit data
|
63 |
|
|
#define SSI_CR0_DSS_6 0x00000005 // 6 bit data
|
64 |
|
|
#define SSI_CR0_DSS_7 0x00000006 // 7 bit data
|
65 |
|
|
#define SSI_CR0_DSS_8 0x00000007 // 8 bit data
|
66 |
|
|
#define SSI_CR0_DSS_9 0x00000008 // 9 bit data
|
67 |
|
|
#define SSI_CR0_DSS_10 0x00000009 // 10 bit data
|
68 |
|
|
#define SSI_CR0_DSS_11 0x0000000A // 11 bit data
|
69 |
|
|
#define SSI_CR0_DSS_12 0x0000000B // 12 bit data
|
70 |
|
|
#define SSI_CR0_DSS_13 0x0000000C // 13 bit data
|
71 |
|
|
#define SSI_CR0_DSS_14 0x0000000D // 14 bit data
|
72 |
|
|
#define SSI_CR0_DSS_15 0x0000000E // 15 bit data
|
73 |
|
|
#define SSI_CR0_DSS_16 0x0000000F // 16 bit data
|
74 |
|
|
#define SSI_CR0_SCR_S 8
|
75 |
|
|
|
76 |
|
|
//*****************************************************************************
|
77 |
|
|
//
|
78 |
|
|
// The following are defines for the bit fields in the SSI Control register 1.
|
79 |
|
|
//
|
80 |
|
|
//*****************************************************************************
|
81 |
|
|
#define SSI_CR1_SOD 0x00000008 // Slave mode output disable
|
82 |
|
|
#define SSI_CR1_MS 0x00000004 // Master or slave mode select
|
83 |
|
|
#define SSI_CR1_SSE 0x00000002 // Sync serial port enable
|
84 |
|
|
#define SSI_CR1_LBM 0x00000001 // Loopback mode
|
85 |
|
|
|
86 |
|
|
//*****************************************************************************
|
87 |
|
|
//
|
88 |
|
|
// The following are defines for the bit fields in the SSI Status register.
|
89 |
|
|
//
|
90 |
|
|
//*****************************************************************************
|
91 |
|
|
#define SSI_SR_BSY 0x00000010 // SSI busy
|
92 |
|
|
#define SSI_SR_RFF 0x00000008 // RX FIFO full
|
93 |
|
|
#define SSI_SR_RNE 0x00000004 // RX FIFO not empty
|
94 |
|
|
#define SSI_SR_TNF 0x00000002 // TX FIFO not full
|
95 |
|
|
#define SSI_SR_TFE 0x00000001 // TX FIFO empty
|
96 |
|
|
|
97 |
|
|
//*****************************************************************************
|
98 |
|
|
//
|
99 |
|
|
// The following are defines for the bit fields in the SSI clock prescale
|
100 |
|
|
// register.
|
101 |
|
|
//
|
102 |
|
|
//*****************************************************************************
|
103 |
|
|
#define SSI_CPSR_CPSDVSR_M 0x000000FF // SSI Clock Prescale Divisor.
|
104 |
|
|
#define SSI_CPSR_CPSDVSR_S 0
|
105 |
|
|
|
106 |
|
|
//*****************************************************************************
|
107 |
|
|
//
|
108 |
|
|
// The following are defines for the bit fields in the SSI_O_DR register.
|
109 |
|
|
//
|
110 |
|
|
//*****************************************************************************
|
111 |
|
|
#define SSI_DR_DATA_M 0x0000FFFF // SSI Receive/Transmit Data.
|
112 |
|
|
#define SSI_DR_DATA_S 0
|
113 |
|
|
|
114 |
|
|
//*****************************************************************************
|
115 |
|
|
//
|
116 |
|
|
// The following are defines for the bit fields in the SSI_O_IM register.
|
117 |
|
|
//
|
118 |
|
|
//*****************************************************************************
|
119 |
|
|
#define SSI_IM_TXIM 0x00000008 // SSI Transmit FIFO Interrupt
|
120 |
|
|
// Mask.
|
121 |
|
|
#define SSI_IM_RXIM 0x00000004 // SSI Receive FIFO Interrupt Mask.
|
122 |
|
|
#define SSI_IM_RTIM 0x00000002 // SSI Receive Time-Out Interrupt
|
123 |
|
|
// Mask.
|
124 |
|
|
#define SSI_IM_RORIM 0x00000001 // SSI Receive Overrun Interrupt
|
125 |
|
|
// Mask.
|
126 |
|
|
|
127 |
|
|
//*****************************************************************************
|
128 |
|
|
//
|
129 |
|
|
// The following are defines for the bit fields in the SSI_O_RIS register.
|
130 |
|
|
//
|
131 |
|
|
//*****************************************************************************
|
132 |
|
|
#define SSI_RIS_TXRIS 0x00000008 // SSI Transmit FIFO Raw Interrupt
|
133 |
|
|
// Status.
|
134 |
|
|
#define SSI_RIS_RXRIS 0x00000004 // SSI Receive FIFO Raw Interrupt
|
135 |
|
|
// Status.
|
136 |
|
|
#define SSI_RIS_RTRIS 0x00000002 // SSI Receive Time-Out Raw
|
137 |
|
|
// Interrupt Status.
|
138 |
|
|
#define SSI_RIS_RORRIS 0x00000001 // SSI Receive Overrun Raw
|
139 |
|
|
// Interrupt Status.
|
140 |
|
|
|
141 |
|
|
//*****************************************************************************
|
142 |
|
|
//
|
143 |
|
|
// The following are defines for the bit fields in the SSI_O_MIS register.
|
144 |
|
|
//
|
145 |
|
|
//*****************************************************************************
|
146 |
|
|
#define SSI_MIS_TXMIS 0x00000008 // SSI Transmit FIFO Masked
|
147 |
|
|
// Interrupt Status.
|
148 |
|
|
#define SSI_MIS_RXMIS 0x00000004 // SSI Receive FIFO Masked
|
149 |
|
|
// Interrupt Status.
|
150 |
|
|
#define SSI_MIS_RTMIS 0x00000002 // SSI Receive Time-Out Masked
|
151 |
|
|
// Interrupt Status.
|
152 |
|
|
#define SSI_MIS_RORMIS 0x00000001 // SSI Receive Overrun Masked
|
153 |
|
|
// Interrupt Status.
|
154 |
|
|
|
155 |
|
|
//*****************************************************************************
|
156 |
|
|
//
|
157 |
|
|
// The following are defines for the bit fields in the SSI_O_ICR register.
|
158 |
|
|
//
|
159 |
|
|
//*****************************************************************************
|
160 |
|
|
#define SSI_ICR_RTIC 0x00000002 // SSI Receive Time-Out Interrupt
|
161 |
|
|
// Clear.
|
162 |
|
|
#define SSI_ICR_RORIC 0x00000001 // SSI Receive Overrun Interrupt
|
163 |
|
|
// Clear.
|
164 |
|
|
|
165 |
|
|
//*****************************************************************************
|
166 |
|
|
//
|
167 |
|
|
// The following are defines for the bit fields in the SSI_O_DMACTL register.
|
168 |
|
|
//
|
169 |
|
|
//*****************************************************************************
|
170 |
|
|
#define SSI_DMACTL_TXDMAE 0x00000002 // Transmit DMA Enable.
|
171 |
|
|
#define SSI_DMACTL_RXDMAE 0x00000001 // Receive DMA Enable.
|
172 |
|
|
|
173 |
|
|
//*****************************************************************************
|
174 |
|
|
//
|
175 |
|
|
// The following definitions are deprecated.
|
176 |
|
|
//
|
177 |
|
|
//*****************************************************************************
|
178 |
|
|
#ifndef DEPRECATED
|
179 |
|
|
|
180 |
|
|
//*****************************************************************************
|
181 |
|
|
//
|
182 |
|
|
// The following are deprecated defines for the bit fields in the SSI Control
|
183 |
|
|
// register 0.
|
184 |
|
|
//
|
185 |
|
|
//*****************************************************************************
|
186 |
|
|
#define SSI_CR0_SCR 0x0000FF00 // Serial clock rate
|
187 |
|
|
#define SSI_CR0_FRF_MASK 0x00000030 // Frame format mask
|
188 |
|
|
#define SSI_CR0_DSS 0x0000000F // Data size select
|
189 |
|
|
|
190 |
|
|
//*****************************************************************************
|
191 |
|
|
//
|
192 |
|
|
// The following are deprecated defines for the bit fields in the SSI clock
|
193 |
|
|
// prescale register.
|
194 |
|
|
//
|
195 |
|
|
//*****************************************************************************
|
196 |
|
|
#define SSI_CPSR_CPSDVSR_MASK 0x000000FF // Clock prescale
|
197 |
|
|
|
198 |
|
|
//*****************************************************************************
|
199 |
|
|
//
|
200 |
|
|
// The following are deprecated defines for the SSI controller's FIFO size.
|
201 |
|
|
//
|
202 |
|
|
//*****************************************************************************
|
203 |
|
|
#define TX_FIFO_SIZE (8) // Number of entries in the TX FIFO
|
204 |
|
|
#define RX_FIFO_SIZE (8) // Number of entries in the RX FIFO
|
205 |
|
|
|
206 |
|
|
//*****************************************************************************
|
207 |
|
|
//
|
208 |
|
|
// The following are deprecated defines for the bit fields in the interrupt
|
209 |
|
|
// mask set and clear, raw interrupt, masked interrupt, and interrupt clear
|
210 |
|
|
// registers.
|
211 |
|
|
//
|
212 |
|
|
//*****************************************************************************
|
213 |
|
|
#define SSI_INT_TXFF 0x00000008 // TX FIFO interrupt
|
214 |
|
|
#define SSI_INT_RXFF 0x00000004 // RX FIFO interrupt
|
215 |
|
|
#define SSI_INT_RXTO 0x00000002 // RX timeout interrupt
|
216 |
|
|
#define SSI_INT_RXOR 0x00000001 // RX overrun interrupt
|
217 |
|
|
|
218 |
|
|
#endif
|
219 |
|
|
|
220 |
|
|
#endif // __HW_SSI_H__
|