2 * -------------------------------------------
3 * MSP432 DriverLib - v01_04_00_18
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2015, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
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.
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.
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.
40 //*****************************************************************************
42 //! \addtogroup sysctl_api
45 //*****************************************************************************
47 //*****************************************************************************
49 // If building with a C++ compiler, make all of the definitions in this header
52 //*****************************************************************************
61 //*****************************************************************************
63 // Control specific variables
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
74 #define SYSCTL_HARD_RESET 1
75 #define SYSCTL_SOFT_RESET 0
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
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
99 #define SYSCTL_REBOOT_KEY 0x6900
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
105 #define SYSCTL_85_DEGREES_C 0
106 #define SYSCTL_30_DEGREES_C 16
108 //*****************************************************************************
110 // Prototypes for the APIs.
112 //*****************************************************************************
114 //*****************************************************************************
116 //! Gets the size of the SRAM.
118 //! \return The total number of bytes of SRAM.
120 //*****************************************************************************
121 extern uint_least32_t SysCtl_getSRAMSize(void);
123 //*****************************************************************************
125 //! Gets the size of the flash.
127 //! \return The total number of bytes of flash.
129 //*****************************************************************************
130 extern uint_least32_t SysCtl_getFlashSize(void);
132 //*****************************************************************************
134 //! Reboots the device and causes the device to re-initialize itself.
136 //! \return This function does not return.
138 //*****************************************************************************
139 extern void SysCtl_rebootDevice(void);
141 //*****************************************************************************
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).
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
160 //! \note \b SYSCTL_SRAM_BANK0 is reserved and always enabled.
164 //*****************************************************************************
165 extern void SysCtl_enableSRAMBank(uint_fast8_t sramBank);
167 //*****************************************************************************
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.
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
185 //! \note \b SYSCTL_SRAM_BANK0 is reserved and always enabled.
189 //*****************************************************************************
190 extern void SysCtl_disableSRAMBank(uint_fast8_t sramBank);
192 //*****************************************************************************
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.
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.
215 //*****************************************************************************
216 extern void SysCtl_enableSRAMBankRetention(uint_fast8_t sramBank);
218 //*****************************************************************************
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.
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.
241 //*****************************************************************************
242 extern void SysCtl_disableSRAMBankRetention(uint_fast8_t sramBank);
244 //*****************************************************************************
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
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
273 //*****************************************************************************
274 extern void SysCtl_enablePeripheralAtCPUHalt(uint_fast16_t devices);
276 //*****************************************************************************
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
283 //! \param devices The peripherals to disable after a CPU HALT
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
307 //*****************************************************************************
308 extern void SysCtl_disablePeripheralAtCPUHalt(uint_fast16_t devices);
310 //*****************************************************************************
312 //! Sets the type of RESET that happens when a watchdog timeout occurs.
314 //! \param resetType The type of reset to set
316 //! The \e resetType parameter must be only one of the following values:
317 //! - \b SYSCTL_HARD_RESET,
318 //! - \b SYSCTL_SOFT_RESET
323 //*****************************************************************************
324 extern void SysCtl_setWDTTimeoutResetType(uint_fast8_t resetType);
326 //*****************************************************************************
328 //! Sets the type of RESET that happens when a watchdog password violation
331 //! \param resetType The type of reset to set
333 //! The \e resetType parameter must be only one of the following values:
334 //! - \b SYSCTL_HARD_RESET,
335 //! - \b SYSCTL_SOFT_RESET
340 //*****************************************************************************
341 extern void SysCtl_setWDTPasswordViolationResetType(uint_fast8_t resetType);
343 //*****************************************************************************
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.
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
356 //*****************************************************************************
357 extern void SysCtl_disableNMISource(uint_fast8_t flags);
359 //*****************************************************************************
361 //! Enables NMIs for the provided modules. When enabled, a NMI flag will
362 //! occur when a fault condition comes from the corresponding modules.
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
372 //*****************************************************************************
373 extern void SysCtl_enableNMISource(uint_fast8_t flags);
375 //*****************************************************************************
377 //! Returns the current sources of NMIs that are enabled
379 //! \return Bitwise OR of NMI flags that are enabled
381 //*****************************************************************************
382 extern uint_fast8_t SysCtl_getNMISourceStatus(void);
384 //*****************************************************************************
386 //! Enables glitch suppression on the reset pin of the device. Refer to the
387 //! device data sheet for specific information about glitch suppression
392 //*****************************************************************************
393 extern void SysCtl_enableGlitchFilter(void);
395 //*****************************************************************************
397 //! Disables glitch suppression on the reset pin of the device. Refer to the
398 //! device data sheet for specific information about glitch suppression
403 //*****************************************************************************
404 extern void SysCtl_disableGlitchFilter(void);
406 //*****************************************************************************
408 //! Retrieves the calibration constant of the temperature sensor to be used
409 //! in temperature calculation.
411 //! \param refVoltage Reference voltage being used.
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
418 //! \param temperature is the calibration temperature that the user wants to be
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
428 //*****************************************************************************
429 extern uint_fast16_t SysCtl_getTempCalibrationConstant(uint32_t refVoltage,
430 uint32_t temperature);
432 //*****************************************************************************
434 // Mark the end of the C bindings section for C++ compilers.
436 //*****************************************************************************
441 //*****************************************************************************
443 // Close the Doxygen group.
446 //*****************************************************************************
448 #endif // __SYSCTL_H__