1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
//###########################################################################
//
// FILE: sysctl.h
//
// TITLE: Stellaris style wrapper driver for F2837x system control.
//
//###########################################################################
// $TI Release: F2837xD Support Library v3.05.00.00 $
// $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
// $Copyright:
// Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
#ifndef __SYSCTL_H__
#define __SYSCTL_H__
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
//! \addtogroup sysctl_api
//! @{
//
//*****************************************************************************
#include "inc/hw_types.h"
//*****************************************************************************
//
//! Defined system clock oscillator source speed. Adjust this to reflect your
//! actual clock speed.
//
//*****************************************************************************
#if defined(_LAUNCHXL_F28379D) || defined(_LAUNCHXL_F28377S)
#define SYSTEM_CLOCK_SPEED 10000000
#else
#define SYSTEM_CLOCK_SPEED 20000000
#endif
//*****************************************************************************
//
// The following are values that can be passed to the SysCtlClockSet() API as
// the ui32Config parameter.
//
//*****************************************************************************
#define SYSCTL_SYSDIV_M 0x00001F80
#define SYSCTL_SYSDIV_S 0x00000007
// Only 1 or even values up to 126 are allowed
#define SYSCTL_SYSDIV(x) ((((x == 1) ? 0 : (x / 2)) << SYSCTL_SYSDIV_S) & SYSCTL_SYSDIV_M)
#define SYSCTL_IMULT_M 0x0000007F
#define SYSCTL_IMULT_S 0x00000000
#define SYSCTL_IMULT(x) (((x) << SYSCTL_IMULT_S) & SYSCTL_IMULT_M)
#define SYSCTL_FMULT_M 0x00006000
#define SYSCTL_FMULT_S 0x0000000D
#define SYSCTL_FMULT_0 0x00000000
#define SYSCTL_FMULT_1_4 0x00002000
#define SYSCTL_FMULT_1_2 0x00004000
#define SYSCTL_FMULT_3_4 0x00006000
#define SYSCTL_OSCSRC_M 0x00030000
#define SYSCTL_OSCSRC_S 0x00000010
#define SYSCTL_OSCSRC_OSC2 0x00000000
#define SYSCTL_OSCSRC_XTAL 0x00010000
#define SYSCTL_OSCSRC_OSC1 0x00020000
#define SYSCTL_LSDIV_M 0x00700000
#define SYSCTL_LSDIV_S 0x00000014
// Only 1 or even values up to 14 are allowed
#define SYSCTL_LSDIV(x) (((x == 1) ? 0 : (x / 2)) << SYSCTL_LSDIV_S) & SYSCTL_LSDIV_M)
#define SYSCTL_PLL_ENABLE 0x80000000
#define SYSCTL_PLL_DISABLE 0x00000000
//*****************************************************************************
//
// The following are values that can be passed to the
// SysCtlPeripheralPresent(), SysCtlPeripheralEnable(),
// SysCtlPeripheralDisable(), and SysCtlPeripheralReset() APIs as the
// ui32Peripheral parameter. The peripherals in the fourth group (upper nibble
// is 3) can only be used with the SysCtlPeripheralPresent() API.
//
//*****************************************************************************
#define SYSCTL_PERIPH_REG_M 0x0000001F
#define SYSCTL_PERIPH_REG_S 0x00000000
#define SYSCTL_PERIPH_BIT_M 0x003F0000
#define SYSCTL_PERIPH_BIT_S 0x00000010
//PCLKCR0
#define SYSCTL_PERIPH_CLA1 0x00000000
#define SYSCTL_PERIPH_DMA 0x00020000
#define SYSCTL_PERIPH_TIMER0 0x00030000
#define SYSCTL_PERIPH_TIMER1 0x00040000
#define SYSCTL_PERIPH_TIMER2 0x00050000
#define SYSCTL_PERIPH_HRPWM 0x00100000
#define SYSCTL_PERIPH_TBCLKSYNC 0x00120000
#define SYSCTL_PERIPH_GTBCLKSYNC 0x00130000
//PCLKCR1
#define SYSCTL_PERIPH_EMIF1 0x00000001
#define SYSCTL_PERIPH_EMIF2 0x00010001
//PCLKCR2
#define SYSCTL_PERIPH_EPWM1 0x00000002
#define SYSCTL_PERIPH_EPWM2 0x00010002
#define SYSCTL_PERIPH_EPWM3 0x00020002
#define SYSCTL_PERIPH_EPWM4 0x00030002
#define SYSCTL_PERIPH_EPWM5 0x00040002
#define SYSCTL_PERIPH_EPWM6 0x00050002
#define SYSCTL_PERIPH_EPWM7 0x00060002
#define SYSCTL_PERIPH_EPWM8 0x00070002
#define SYSCTL_PERIPH_EPWM9 0x00080002
#define SYSCTL_PERIPH_EPWM10 0x00090002
#define SYSCTL_PERIPH_EPWM11 0x000A0002
#define SYSCTL_PERIPH_EPWM12 0x000B0002
//PCLKCR3
#define SYSCTL_PERIPH_ECAP1 0x00000003
#define SYSCTL_PERIPH_ECAP2 0x00010003
#define SYSCTL_PERIPH_ECAP3 0x00020003
#define SYSCTL_PERIPH_ECAP4 0x00030003
#define SYSCTL_PERIPH_ECAP5 0x00040003
#define SYSCTL_PERIPH_ECAP6 0x00050003
//PCLKCR4
#define SYSCTL_PERIPH_EQEP1 0x00000004
#define SYSCTL_PERIPH_EQEP2 0x00010004
#define SYSCTL_PERIPH_EQEP3 0x00020004
//PCLKCR5
//Reserved
//PCLKCR6
#define SYSCTL_PERIPH_SD1 0x00000006
#define SYSCTL_PERIPH_SD2 0x00010006
//PCLKCR7
#define SYSCTL_PERIPH_SCI1 0x00000007
#define SYSCTL_PERIPH_SCI2 0x00010007
#define SYSCTL_PERIPH_SCI3 0x00020007
#define SYSCTL_PERIPH_SCI4 0x00030007
//PCLKCR8
#define SYSCTL_PERIPH_SPI1 0x00000008
#define SYSCTL_PERIPH_SPI2 0x00010008
#define SYSCTL_PERIPH_SPI3 0x00020008
//PCLKCR9
#define SYSCTL_PERIPH_I2C1 0x00000009
#define SYSCTL_PERIPH_I2C2 0x00010009
//PCLKCR10
#define SYSCTL_PERIPH_CAN1 0x0000000A
#define SYSCTL_PERIPH_CAN2 0x0001000A
//PCLKCR11
#define SYSCTL_PERIPH_MCBSP1 0x0000000B
#define SYSCTL_PERIPH_MCBSP2 0x0001000B
#define SYSCTL_PERIPH_USB0 0x0010000B
//PCLKCR12
#define SYSCTL_PERIPH_UPP1 0x0000000C
//PCLKCR13
#define SYSCTL_PERIPH_ADC1 0x0000000D
#define SYSCTL_PERIPH_ADC2 0x0001000D
#define SYSCTL_PERIPH_ADC3 0x0002000D
#define SYSCTL_PERIPH_ADC4 0x0003000D
//PCLKCR14
#define SYSCTL_PERIPH_CMPSS1 0x0000000E
#define SYSCTL_PERIPH_CMPSS2 0x0001000E
#define SYSCTL_PERIPH_CMPSS3 0x0002000E
#define SYSCTL_PERIPH_CMPSS4 0x0003000E
#define SYSCTL_PERIPH_CMPSS5 0x0004000E
#define SYSCTL_PERIPH_CMPSS6 0x0005000E
#define SYSCTL_PERIPH_CMPSS7 0x0006000E
#define SYSCTL_PERIPH_CMPSS8 0x0007000E
//PCLKCR15
//Reserved
//PCLKCR16
#define SYSCTL_PERIPH_BUFFDAC1 0x00000010
#define SYSCTL_PERIPH_BUFFDAC2 0x00010010
#define SYSCTL_PERIPH_BUFFDAC3 0x00020010
//old
//#define SYSCTL_PERIPH_UART_A 0x1 // SCI A
//#define SYSCTL_PERIPH_UART_B 0x2 // SCI B
//#define SYSCTL_PERIPH_UART_C 0x3 // SCI C
//#define SYSCTL_PERIPH_UART_D 0x4 // SCI D
//
//#define SYSCTL_PERIPH_SPI_A 0x5 // SPI A
//#define SYSCTL_PERIPH_SPI_B 0x6 // SPI B
//#define SYSCTL_PERIPH_SPI_C 0x7 // SPI C
//
//#define SYSCTL_PERIPH_MCBSP_A 0x8 // McBSP A
//#define SYSCTL_PERIPH_MCBSP_B 0x9 // McBSP B
//
//#define SYSCTL_PERIPH_DMA 0xA // DMA
//
//#define SYSCTL_PERIPH_USB0 0xB // USBA
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
extern uint32_t SysCtlSRAMSizeGet(void);
extern uint32_t SysCtlFlashSizeGet(void);
extern void SysCtlPeripheralReset(uint32_t ui32Peripheral);
extern void SysCtlPeripheralEnable(uint32_t ui32Peripheral);
extern void SysCtlPeripheralDisable(uint32_t ui32Peripheral);
extern bool SysCtlPeripheralPresent(uint32_t ui32Peripheral);
extern void SysCtlDelay(uint32_t ulCount);
extern uint32_t SysCtlClockGet(uint32_t u32ClockIn);
extern void SysCtlClockSet(uint32_t ui32Config);
extern void SysCtlAuxClockSet(uint32_t ui32Config);
extern uint32_t SysCtlLowSpeedClockGet(uint32_t u32ClockIn);
extern void SysCtlUSBPLLEnable(void);
extern void SysCtlUSBPLLDisable(void);
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
#endif // __SYSCTL_H__
|