1 //###########################################################################
2 //
3 // FILE:   F2837xD_device.h
4 //
5 // TITLE:  F2837xD Device Definitions.
6 //
7 //###########################################################################
8 // $TI Release: F2837xD Support Library v3.05.00.00 $
9 // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
10 // $Copyright:
11 // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
12 //
13 // Redistribution and use in source and binary forms, with or without
14 // modification, are permitted provided that the following conditions
15 // are met:
16 //
17 //   Redistributions of source code must retain the above copyright
18 //   notice, this list of conditions and the following disclaimer.
19 //
20 //   Redistributions in binary form must reproduce the above copyright
21 //   notice, this list of conditions and the following disclaimer in the
22 //   documentation and/or other materials provided with the
23 //   distribution.
24 //
25 //   Neither the name of Texas Instruments Incorporated nor the names of
26 //   its contributors may be used to endorse or promote products derived
27 //   from this software without specific prior written permission.
28 //
29 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 // $
41 //###########################################################################
42 
43 #ifndef F2837xD_DEVICE_H
44 #define F2837xD_DEVICE_H
45 
46 #if (!defined(CPU1) && !defined(CPU2))
47 #error "You must define CPU1 or CPU2 in your project properties.  Otherwise, the offsets in your header files will be inaccurate."
48 #endif
49 
50 #if (defined(CPU1) && defined(CPU2))
51 #error "You have defined both CPU1 and CPU2 in your project properties.  Only a single CPU should be defined."
52 #endif
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 #define   TARGET   1
59 
60 //
61 // User To Select Target Device:
62 //
63 #define   F28_2837xD    TARGET
64 
65 //
66 // Common CPU Definitions:
67 //
68 extern __cregister volatile unsigned int IFR;
69 extern __cregister volatile unsigned int IER;
70 
71 #define  EINT   __asm(" clrc INTM")
72 #define  DINT   __asm(" setc INTM")
73 #define  ERTM   __asm(" clrc DBGM")
74 #define  DRTM   __asm(" setc DBGM")
75 #ifndef  EALLOW
76 #define  EALLOW __asm(" EALLOW")
77 #endif
78 #ifndef  EDIS
79 #define  EDIS   __asm(" EDIS")
80 #endif
81 #define  ESTOP0 __asm(" ESTOP0")
82 
83 #define M_INT1  0x0001
84 #define M_INT2  0x0002
85 #define M_INT3  0x0004
86 #define M_INT4  0x0008
87 #define M_INT5  0x0010
88 #define M_INT6  0x0020
89 #define M_INT7  0x0040
90 #define M_INT8  0x0080
91 #define M_INT9  0x0100
92 #define M_INT10 0x0200
93 #define M_INT11 0x0400
94 #define M_INT12 0x0800
95 #define M_INT13 0x1000
96 #define M_INT14 0x2000
97 #define M_DLOG  0x4000
98 #define M_RTOS  0x8000
99 
100 #ifndef C28X_BIT0
101 #define C28X_BIT0    0x00000001
102 #endif
103 
104 #ifndef C28X_BIT1
105 #define C28X_BIT1    0x00000002
106 #endif
107 
108 #ifndef C28X_BIT2
109 #define C28X_BIT2    0x00000004
110 #endif
111 
112 #ifndef C28X_BIT3
113 #define C28X_BIT3    0x00000008
114 #endif
115 
116 #ifndef C28X_BIT4
117 #define C28X_BIT4    0x00000010
118 #endif
119 
120 #ifndef C28X_BIT5
121 #define C28X_BIT5    0x00000020
122 #endif
123 
124 #ifndef C28X_BIT6
125 #define C28X_BIT6    0x00000040
126 #endif
127 
128 #ifndef C28X_BIT7
129 #define C28X_BIT7    0x00000080
130 #endif
131 
132 #ifndef C28X_BIT8
133 #define C28X_BIT8    0x00000100
134 #endif
135 
136 #ifndef C28X_BIT9
137 #define C28X_BIT9    0x00000200
138 #endif
139 
140 #ifndef C28X_BIT10
141 #define C28X_BIT10   0x00000400
142 #endif
143 
144 #ifndef C28X_BIT11
145 #define C28X_BIT11   0x00000800
146 #endif
147 
148 #ifndef C28X_BIT12
149 #define C28X_BIT12   0x00001000
150 #endif
151 
152 #ifndef C28X_BIT13
153 #define C28X_BIT13   0x00002000
154 #endif
155 
156 #ifndef C28X_BIT14
157 #define C28X_BIT14   0x00004000
158 #endif
159 
160 #ifndef C28X_BIT15
161 #define C28X_BIT15   0x00008000
162 #endif
163 
164 #ifndef C28X_BIT16
165 #define C28X_BIT16   0x00010000
166 #endif
167 
168 #ifndef C28X_BIT17
169 #define C28X_BIT17   0x00020000
170 #endif
171 
172 #ifndef C28X_BIT18
173 #define C28X_BIT18   0x00040000
174 #endif
175 
176 #ifndef C28X_BIT19
177 #define C28X_BIT19   0x00080000
178 #endif
179 
180 #ifndef C28X_BIT20
181 #define C28X_BIT20   0x00100000
182 #endif
183 
184 #ifndef C28X_BIT21
185 #define C28X_BIT21   0x00200000
186 #endif
187 
188 #ifndef C28X_BIT22
189 #define C28X_BIT22   0x00400000
190 #endif
191 
192 #ifndef C28X_BIT23
193 #define C28X_BIT23   0x00800000
194 #endif
195 
196 #ifndef C28X_BIT24
197 #define C28X_BIT24   0x01000000
198 #endif
199 
200 #ifndef C28X_BIT25
201 #define C28X_BIT25   0x02000000
202 #endif
203 
204 #ifndef C28X_BIT26
205 #define C28X_BIT26   0x04000000
206 #endif
207 
208 #ifndef C28X_BIT27
209 #define C28X_BIT27   0x08000000
210 #endif
211 
212 #ifndef C28X_BIT28
213 #define C28X_BIT28   0x10000000
214 #endif
215 
216 #ifndef C28X_BIT29
217 #define C28X_BIT29   0x20000000
218 #endif
219 
220 #ifndef C28X_BIT30
221 #define C28X_BIT30   0x40000000
222 #endif
223 
224 #ifndef C28X_BIT31
225 #define C28X_BIT31   0x80000000
226 #endif
227 
228 //
229 // For Portability, User Is Recommended To Use the C99 Standard integer types
230 //
231 #if !defined(__TMS320C28XX_CLA__)
232 #include <assert.h>
233 #include <stdarg.h>
234 #endif //__TMS320C28XX_CLA__
235 #include <stdbool.h>
236 #include <stddef.h>
237 #include <stdint.h>
238 
239 //
240 // C++ Bool Compatibility
241 //
242 #if defined(__cplusplus)
243 typedef bool _Bool;
244 #endif
245 
246 //
247 // C99 defines boolean type to be _Bool, but this doesn't match the format of
248 // the other standard integer types.  bool_t has been defined to fill this gap.
249 //
250 typedef _Bool bool_t;
251 
252 //
253 //used for a bool function return status
254 //
255 typedef _Bool status_t;
256 
257 #ifndef SUCCESS
258 #define SUCCESS     true
259 #endif
260 
261 #ifndef FAIL
262 #define FAIL        false
263 #endif
264 
265 //
266 // The following data types are included for compatibility with legacy code,
267 // they are not recommended for use in new software.  Please use the C99
268 // types included above
269 //
270 #ifndef DSP28_DATA_TYPES
271 #define DSP28_DATA_TYPES
272 typedef int             	int16;
273 typedef long            	int32;
274 typedef long long			int64;
275 typedef unsigned int    	Uint16;
276 typedef unsigned long   	Uint32;
277 typedef unsigned long long	Uint64;
278 typedef float           	float32;
279 typedef long double     	float64;
280 #endif
281 
282 //
283 // The following data types are for use with byte addressable peripherals.
284 // See compiler documentation on the byte_peripheral type attribute.
285 //
286 #ifndef __TMS320C28XX_CLA__
287 #if __TI_COMPILER_VERSION__ >= 16006000
288 typedef unsigned int bp_16 __attribute__((byte_peripheral));
289 typedef unsigned long bp_32 __attribute__((byte_peripheral));
290 #endif
291 #endif
292 
293 //
294 // Include All Peripheral Header Files:
295 //
296 #include "F2837xD_adc.h"
297 #include "F2837xD_analogsubsys.h"
298 #include "F2837xD_cla.h"
299 #include "F2837xD_cmpss.h"
300 #include "F2837xD_cputimer.h"
301 #include "F2837xD_dac.h"
302 #include "F2837xD_dcsm.h"
303 #include "F2837xD_dma.h"
304 #include "F2837xD_ecap.h"
305 #include "F2837xD_emif.h"
306 #include "F2837xD_epwm.h"                // Enhanced PWM
307 #include "F2837xD_epwm_xbar.h"
308 #include "F2837xD_eqep.h"
309 #include "F2837xD_flash.h"
310 #include "F2837xD_gpio.h"                // General Purpose I/O Registers
311 #include "F2837xD_i2c.h"
312 #include "F2837xD_input_xbar.h"
313 #include "F2837xD_ipc.h"
314 #include "F2837xD_mcbsp.h"
315 #include "F2837xD_memconfig.h"
316 #include "F2837xD_nmiintrupt.h"          // NMI Interrupt Registers
317 #include "F2837xD_output_xbar.h"
318 #include "F2837xD_piectrl.h"             // PIE Control Registers
319 #include "F2837xD_pievect.h"
320 #include "F2837xD_sci.h"
321 #include "F2837xD_sdfm.h"
322 #include "F2837xD_spi.h"
323 #include "F2837xD_sysctrl.h"             // System Control/Power Modes
324 #include "F2837xD_upp.h"
325 #include "F2837xD_xbar.h"
326 #include "F2837xD_xint.h"                // External Interrupts
327 
328 //
329 // byte_peripheral attribute is only supported on the C28
330 //
331 #ifndef __TMS320C28XX_CLA__
332 #if __TI_COMPILER_VERSION__ >= 16006000
333 #include "F2837xD_can.h"
334 #endif
335 #endif
336 
337 #ifdef __cplusplus
338 }
339 #endif                                  // extern "C"
340 
341 #endif                                  // end of F2837xD_DEVICE_H definition
342 
343 //
344 // End of file.
345 //
346