]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/driverlib/sysctl.h
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / driverlib / sysctl.h
1 /*
2  * -------------------------------------------
3  *    MSP432 DriverLib - v01_04_00_18 
4  * -------------------------------------------
5  *
6  * --COPYRIGHT--,BSD,BSD
7  * Copyright (c) 2015, Texas Instruments Incorporated
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * *  Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  *
17  * *  Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * *  Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  * --/COPYRIGHT--*/
37 #ifndef __SYSCTL_H__
38 #define __SYSCTL_H__
39
40 //*****************************************************************************
41 //
42 //! \addtogroup sysctl_api
43 //! @{
44 //
45 //*****************************************************************************
46
47 //*****************************************************************************
48 //
49 // If building with a C++ compiler, make all of the definitions in this header
50 // have a C binding.
51 //
52 //*****************************************************************************
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57
58 #include <stdint.h>
59 #include <msp.h>
60
61 //*****************************************************************************
62 //
63 // Control specific variables 
64 //
65 //*****************************************************************************
66 #define SYSCTL_SRAM_BANK7 SYSCTL_SRAM_BANKEN_BNK7_EN
67 #define SYSCTL_SRAM_BANK6 SYSCTL_SRAM_BANKEN_BNK6_EN
68 #define SYSCTL_SRAM_BANK5 SYSCTL_SRAM_BANKEN_BNK5_EN
69 #define SYSCTL_SRAM_BANK4 SYSCTL_SRAM_BANKEN_BNK4_EN
70 #define SYSCTL_SRAM_BANK3 SYSCTL_SRAM_BANKEN_BNK3_EN
71 #define SYSCTL_SRAM_BANK2 SYSCTL_SRAM_BANKEN_BNK2_EN
72 #define SYSCTL_SRAM_BANK1 SYSCTL_SRAM_BANKEN_BNK1_EN
73
74 #define SYSCTL_HARD_RESET 1
75 #define SYSCTL_SOFT_RESET 0
76
77 #define SYSCTL_PERIPH_DMA SYSCTL_PERIHALT_CTL_DMA
78 #define SYSCTL_PERIPH_WDT SYSCTL_PERIHALT_CTL_WDT
79 #define SYSCTL_PERIPH_ADC SYSCTL_PERIHALT_CTL_ADC
80 #define SYSCTL_PERIPH_EUSCIB3 SYSCTL_PERIHALT_CTL_EUB3
81 #define SYSCTL_PERIPH_EUSCIB2 SYSCTL_PERIHALT_CTL_EUB2
82 #define SYSCTL_PERIPH_EUSCIB1 SYSCTL_PERIHALT_CTL_EUB1
83 #define SYSCTL_PERIPH_EUSCIB0 SYSCTL_PERIHALT_CTL_EUB0
84 #define SYSCTL_PERIPH_EUSCIA3 SYSCTL_PERIHALT_CTL_EUA3
85 #define SYSCTL_PERIPH_EUSCIA2 SYSCTL_PERIHALT_CTL_EUA2
86 #define SYSCTL_PERIPH_EUSCIA1 SYSCTL_PERIHALT_CTL_EUA1
87 #define SYSCTL_PERIPH_EUSCIA0 SYSCTL_PERIHALT_CTL_EUA0
88 #define SYSCTL_PERIPH_TIMER32_0_MODULE SYSCTL_PERIHALT_CTL_T32_0
89 #define SYSCTL_PERIPH_TIMER16_3 SYSCTL_PERIHALT_CTL_T16_3
90 #define SYSCTL_PERIPH_TIMER16_2 SYSCTL_PERIHALT_CTL_T16_2
91 #define SYSCTL_PERIPH_TIMER16_1 SYSCTL_PERIHALT_CTL_T16_1
92 #define SYSCTL_PERIPH_TIMER16_0 SYSCTL_PERIHALT_CTL_T16_0
93
94 #define SYSCTL_NMIPIN_SRC SYSCTL_NMI_CTLSTAT_PIN_SRC
95 #define SYSCTL_PCM_SRC SYSCTL_NMI_CTLSTAT_PCM_SRC
96 #define SYSCTL_PSS_SRC SYSCTL_NMI_CTLSTAT_PSS_SRC
97 #define SYSCTL_CS_SRC SYSCTL_NMI_CTLSTAT_CS_SRC
98
99 #define SYSCTL_REBOOT_KEY   0x6900
100
101 #define SYSCTL_1_2V_REF        OFS_TLV_ADC14_REF1P2V_TS30C
102 #define SYSCTL_1_45V_REF       OFS_TLV_ADC14_REF1P45V_TS30C
103 #define SYSCTL_2_5V_REF        OFS_TLV_ADC14_REF2P5V_TS30C
104
105 #define SYSCTL_85_DEGREES_C    0
106 #define SYSCTL_30_DEGREES_C    16
107
108 //*****************************************************************************
109 //
110 // Prototypes for the APIs.
111 //
112 //*****************************************************************************
113
114 //*****************************************************************************
115 //
116 //! Gets the size of the SRAM.
117 //!
118 //! \return The total number of bytes of SRAM.
119 //
120 //*****************************************************************************
121 extern uint_least32_t SysCtl_getSRAMSize(void);
122
123 //*****************************************************************************
124 //
125 //! Gets the size of the flash.
126 //!
127 //! \return The total number of bytes of flash.
128 //
129 //*****************************************************************************
130 extern uint_least32_t SysCtl_getFlashSize(void);
131
132 //*****************************************************************************
133 //
134 //! Reboots the device and causes the device to re-initialize itself.
135 //!
136 //! \return This function does not return.
137 //
138 //*****************************************************************************
139 extern void SysCtl_rebootDevice(void);
140
141 //*****************************************************************************
142 //
143 //! Enables a set of banks in the SRAM. This can be used to optimize power
144 //! consumption when every SRAM bank isn't needed. It is important to note
145 //! that when a  higher bank is enabled, all of the SRAM banks below that bank
146 //! are also enabled. For example, if the user enables SYSCTL_SRAM_BANK7,
147 //! the banks SYSCTL_SRAM_BANK1 through SYSCTL_SRAM_BANK7 will be enabled
148 //! (SRAM_BANK0 is reserved and always enabled).
149 //!
150 //! \param sramBank The SRAM bank tier to enable.
151 //!        Must be only one of the following values:
152 //!                 - \b SYSCTL_SRAM_BANK1,
153 //!                 - \b SYSCTL_SRAM_BANK2,
154 //!                 - \b SYSCTL_SRAM_BANK3,
155 //!                 - \b SYSCTL_SRAM_BANK4,
156 //!                 - \b SYSCTL_SRAM_BANK5,
157 //!                 - \b SYSCTL_SRAM_BANK6,
158 //!                 - \b SYSCTL_SRAM_BANK7
159 //!
160 //! \note \b SYSCTL_SRAM_BANK0 is reserved and always enabled.
161 //!
162 //! \return None.
163 //
164 //*****************************************************************************
165 extern void SysCtl_enableSRAMBank(uint_fast8_t sramBank);
166
167 //*****************************************************************************
168 //
169 //! Disables a set of banks in the SRAM. This can be used to optimize power
170 //! consumption when every SRAM bank isn't needed. It is important to note
171 //! that when a  higher bank is disabled, all of the SRAM banks above that bank
172 //! are also disabled. For example, if the user disables SYSCTL_SRAM_BANK5,
173 //! the banks SYSCTL_SRAM_BANK6 through SYSCTL_SRAM_BANK7 will be disabled.
174 //!
175 //! \param sramBank The SRAM bank tier to disable.
176 //!        Must be only one of the following values:
177 //!                 - \b SYSCTL_SRAM_BANK1,
178 //!                 - \b SYSCTL_SRAM_BANK2,
179 //!                 - \b SYSCTL_SRAM_BANK3,
180 //!                 - \b SYSCTL_SRAM_BANK4,
181 //!                 - \b SYSCTL_SRAM_BANK5,
182 //!                 - \b SYSCTL_SRAM_BANK6,
183 //!                 - \b SYSCTL_SRAM_BANK7
184 //!
185 //! \note \b SYSCTL_SRAM_BANK0 is reserved and always enabled.
186 //!
187 //! \return None.
188 //
189 //*****************************************************************************
190 extern void SysCtl_disableSRAMBank(uint_fast8_t sramBank);
191
192 //*****************************************************************************
193 //
194 //! Enables retention of the specified SRAM bank register when the device goes
195 //! into LPM3 mode. When the system is placed in LPM3 mode, the SRAM
196 //! banks specified with this function will be placed into retention mode. By
197 //! default, retention of every SRAM bank except SYSCTL_SRAM_BANK0 (reserved) is
198 //! disabled. Retention of individual banks can be set without the restrictions
199 //! of the enable/disable functions.
200 //!
201 //! \param sramBank The SRAM banks to enable retention
202 //!        Can be a bitwise OR of the following values:
203 //!                 - \b SYSCTL_SRAM_BANK1,
204 //!                 - \b SYSCTL_SRAM_BANK2,
205 //!                 - \b SYSCTL_SRAM_BANK3,
206 //!                 - \b SYSCTL_SRAM_BANK4,
207 //!                 - \b SYSCTL_SRAM_BANK5,
208 //!                 - \b SYSCTL_SRAM_BANK6,
209 //!                 - \b SYSCTL_SRAM_BANK7
210 //! \note  \b SYSCTL_SRAM_BANK0 is reserved and retention is always enabled.
211 //!
212 //!
213 //! \return None.
214 //
215 //*****************************************************************************
216 extern void SysCtl_enableSRAMBankRetention(uint_fast8_t sramBank);
217
218 //*****************************************************************************
219 //
220 //! Disables retention of the specified SRAM bank register when the device goes
221 //! into LPM3 mode. When the system is placed in LPM3 mode, the SRAM
222 //! banks specified with this function will not be placed into retention mode.
223 //! By default, retention of every SRAM bank except SYSCTL_SRAM_BANK0 (reserved)
224 //! is disabled. Retention of individual banks can be set without the
225 //! restrictions of the enable/disable SRAM bank functions.
226 //!
227 //! \param sramBank The SRAM banks to disable retention
228 //!        Can be a bitwise OR of the following values:
229 //!                 - \b SYSCTL_SRAM_BANK1,
230 //!                 - \b SYSCTL_SRAM_BANK2,
231 //!                 - \b SYSCTL_SRAM_BANK3,
232 //!                 - \b SYSCTL_SRAM_BANK4,
233 //!                 - \b SYSCTL_SRAM_BANK5,
234 //!                 - \b SYSCTL_SRAM_BANK6,
235 //!                 - \b SYSCTL_SRAM_BANK7
236 //! \note  \b SYSCTL_SRAM_BANK0 is reserved and retention is always enabled.
237 //!
238 //! \return None.
239 //
240 //
241 //*****************************************************************************
242 extern void SysCtl_disableSRAMBankRetention(uint_fast8_t sramBank);
243
244 //*****************************************************************************
245 //
246 //! Makes it so that the provided peripherals will either halt execution after
247 //! a CPU HALT. Parameters in this function can be combined to account for
248 //! multiple peripherals. By default, all peripherals keep running after a
249 //! CPU HALT.
250 //!
251 //! \param devices The peripherals to continue running after a CPU HALT
252 //!         This can be a bitwise OR of the following values:
253 //!                 - \b SYSCTL_PERIPH_DMA,
254 //!                 - \b SYSCTL_PERIPH_WDT,
255 //!                 - \b SYSCTL_PERIPH_ADC,
256 //!                 - \b SYSCTL_PERIPH_EUSCIB3,
257 //!                 - \b SYSCTL_PERIPH_EUSCIB2,
258 //!                 - \b SYSCTL_PERIPH_EUSCIB1
259 //!                 - \b SYSCTL_PERIPH_EUSCIB0,
260 //!                 - \b SYSCTL_PERIPH_EUSCIA3,
261 //!                 - \b SYSCTL_PERIPH_EUSCIA2
262 //!                 - \b SYSCTL_PERIPH_EUSCIA1,
263 //!                 - \b SYSCTL_PERIPH_EUSCIA0,
264 //!                 - \b SYSCTL_PERIPH_TIMER32_0_MODULE,
265 //!                 - \b SYSCTL_PERIPH_TIMER16_3,
266 //!                 - \b SYSCTL_PERIPH_TIMER16_2,
267 //!                 - \b SYSCTL_PERIPH_TIMER16_1,
268 //!                 - \b SYSCTL_PERIPH_TIMER16_0
269 //!
270 //! \return None.
271 //
272 //
273 //*****************************************************************************
274 extern void SysCtl_enablePeripheralAtCPUHalt(uint_fast16_t devices);
275
276 //*****************************************************************************
277 //
278 //! Makes it so that the provided peripherals will either halt execution after
279 //! a CPU HALT. Parameters in this function can be combined to account for
280 //! multiple peripherals. By default, all peripherals keep running after a
281 //! CPU HALT.
282 //!
283 //! \param devices The peripherals to disable after a CPU HALT
284 //!
285 //! The \e devices parameter can be a bitwise OR of the following values:
286 //!         This can be a bitwise OR of the following values:
287 //!                 - \b SYSCTL_PERIPH_DMA,
288 //!                 - \b SYSCTL_PERIPH_WDT,
289 //!                 - \b SYSCTL_PERIPH_ADC,
290 //!                 - \b SYSCTL_PERIPH_EUSCIB3,
291 //!                 - \b SYSCTL_PERIPH_EUSCIB2,
292 //!                 - \b SYSCTL_PERIPH_EUSCIB1
293 //!                 - \b SYSCTL_PERIPH_EUSCIB0,
294 //!                 - \b SYSCTL_PERIPH_EUSCIA3,
295 //!                 - \b SYSCTL_PERIPH_EUSCIA2
296 //!                 - \b SYSCTL_PERIPH_EUSCIA1,
297 //!                 - \b SYSCTL_PERIPH_EUSCIA0,
298 //!                 - \b SYSCTL_PERIPH_TIMER32_0_MODULE,
299 //!                 - \b SYSCTL_PERIPH_TIMER16_3,
300 //!                 - \b SYSCTL_PERIPH_TIMER16_2,
301 //!                 - \b SYSCTL_PERIPH_TIMER16_1,
302 //!                 - \b SYSCTL_PERIPH_TIMER16_0
303 //!
304 //! \return None.
305 //
306 //
307 //*****************************************************************************
308 extern void SysCtl_disablePeripheralAtCPUHalt(uint_fast16_t devices);
309
310 //*****************************************************************************
311 //
312 //! Sets the type of RESET that happens when a watchdog timeout occurs.
313 //!
314 //! \param resetType The type of reset to set
315 //!
316 //! The \e resetType parameter must be only one of the following values:
317 //!         - \b SYSCTL_HARD_RESET,
318 //!         - \b SYSCTL_SOFT_RESET
319 //!
320 //! \return None.
321 //
322 //
323 //*****************************************************************************
324 extern void SysCtl_setWDTTimeoutResetType(uint_fast8_t resetType);
325
326 //*****************************************************************************
327 //
328 //! Sets the type of RESET that happens when a watchdog password violation
329 //! occurs.
330 //!
331 //! \param resetType The type of reset to set
332 //!
333 //! The \e resetType parameter must be only one of the following values:
334 //!         - \b SYSCTL_HARD_RESET,
335 //!         - \b SYSCTL_SOFT_RESET
336 //!
337 //! \return None.
338 //
339 //
340 //*****************************************************************************
341 extern void SysCtl_setWDTPasswordViolationResetType(uint_fast8_t resetType);
342
343 //*****************************************************************************
344 //
345 //! Disables NMIs for the provided modules. When disabled, a NMI flag will not
346 //! occur when a fault condition comes from the corresponding modules.
347 //!
348 //! \param flags The NMI sources to disable
349 //! Can be a bitwise OR of the following parameters:
350 //!         - \b SYSCTL_NMIPIN_SRC,
351 //!         - \b SYSCTL_PCM_SRC,
352 //!         - \b SYSCTL_PSS_SRC,
353 //!         - \b SYSCTL_CS_SRC
354 //!
355 //
356 //*****************************************************************************
357 extern void SysCtl_disableNMISource(uint_fast8_t flags);
358
359 //*****************************************************************************
360 //
361 //! Enables NMIs for the provided modules. When enabled, a NMI flag will
362 //! occur when a fault condition comes from the corresponding modules.
363 //!
364 //! \param flags The NMI sources to enable
365 //! Can be a bitwise OR of the following parameters:
366 //!         - \b SYSCTL_NMIPIN_SRC,
367 //!         - \b SYSCTL_PCM_SRC,
368 //!         - \b SYSCTL_PSS_SRC,
369 //!         - \b SYSCTL_CS_SRC
370 //!
371 //
372 //*****************************************************************************
373 extern void SysCtl_enableNMISource(uint_fast8_t flags);
374
375 //*****************************************************************************
376 //
377 //! Returns the current sources of NMIs that are enabled
378 //!
379 //! \return Bitwise OR of NMI flags that are enabled
380 //
381 //*****************************************************************************
382 extern uint_fast8_t SysCtl_getNMISourceStatus(void);
383
384 //*****************************************************************************
385 //
386 //! Enables glitch suppression on the reset pin of the device. Refer to the
387 //! device data sheet for specific information about glitch suppression
388 //!
389 //! \return None.
390 //
391 //
392 //*****************************************************************************
393 extern void SysCtl_enableGlitchFilter(void);
394
395 //*****************************************************************************
396 //
397 //! Disables glitch suppression on the reset pin of the device. Refer to the
398 //! device data sheet for specific information about glitch suppression
399 //!
400 //! \return None.
401 //
402 //
403 //*****************************************************************************
404 extern void SysCtl_disableGlitchFilter(void);
405
406 //*****************************************************************************
407 //
408 //! Retrieves the calibration constant of the temperature sensor to be used
409 //! in temperature calculation.
410 //!
411 //! \param refVoltage Reference voltage being used.
412 //!
413 //! The \e resetType parameter must be only one of the following values:
414 //!         - \b SYSCTL_1_2V_REF
415 //!         - \b SYSCTL_1_45V_REF
416 //!         - \b SYSCTL_2_5V_REF
417 //!
418 //! \param temperature is the calibration temperature that the user wants to be
419 //!     returned.
420 //!
421 //! The \e temperature parameter must be only one of the following values:
422 //!         - \b SYSCTL_30_DEGREES_C
423 //!         - \b SYSCTL_85_DEGREES_C
424 //!
425 //! \return None.
426 //
427 //
428 //*****************************************************************************
429 extern uint_fast16_t SysCtl_getTempCalibrationConstant(uint32_t refVoltage,
430         uint32_t temperature);
431
432 //*****************************************************************************
433 //
434 // Mark the end of the C bindings section for C++ compilers.
435 //
436 //*****************************************************************************
437 #ifdef __cplusplus
438 }
439 #endif
440
441 //*****************************************************************************
442 //
443 // Close the Doxygen group.
444 //! @}
445 //
446 //*****************************************************************************
447
448 #endif // __SYSCTL_H__