]> begriffs open source - cmsis-freertos/blob - Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/driverlib/MSP430FR5xx_6xx/sysctl.h
Update README.md - branch main is now the base branch
[cmsis-freertos] / Demo / MSP430X_MSP430FR5969_LaunchPad_IAR_CCS / driverlib / MSP430FR5xx_6xx / sysctl.h
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2014, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 //*****************************************************************************
33 //
34 // sysctl.h - Driver for the SYSCTL Module.
35 //
36 //*****************************************************************************
37
38 #ifndef __MSP430WARE_SYSCTL_H__
39 #define __MSP430WARE_SYSCTL_H__
40
41 #include "inc/hw_memmap.h"
42
43 #ifdef __MSP430_HAS_SYS__
44
45 //*****************************************************************************
46 //
47 // If building with a C++ compiler, make all of the definitions in this header
48 // have a C binding.
49 //
50 //*****************************************************************************
51 #ifdef __cplusplus
52 extern "C"
53 {
54 #endif
55
56 //*****************************************************************************
57 //
58 // The following are values that can be passed to the mailboxSizeSelect
59 // parameter for functions: SysCtl_initJTAGMailbox().
60 //
61 //*****************************************************************************
62 #define SYSCTL_JTAGMBSIZE_16BIT                                    (!(JMBMODE))
63 #define SYSCTL_JTAGMBSIZE_32BIT                                       (JMBMODE)
64
65 //*****************************************************************************
66 //
67 // The following are values that can be passed to the autoClearInboxFlagSelect
68 // parameter for functions: SysCtl_initJTAGMailbox().
69 //
70 //*****************************************************************************
71 #define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO       (!(JMBCLR0OFF + JMBCLR1OFF))
72 #define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW                         (JMBCLR1OFF)
73 #define SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO                         (JMBCLR0OFF)
74 #define SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW              (JMBCLR0OFF + JMBCLR1OFF)
75
76 //*****************************************************************************
77 //
78 // The following are values that can be passed to the mailboxFlagMask parameter
79 // for functions: SysCtl_getJTAGMailboxFlagStatus(), and
80 // SysCtl_clearJTAGMailboxFlagStatus().
81 //
82 //*****************************************************************************
83 #define SYSCTL_JTAGOUTBOX_FLAG0                                     (JMBOUT0FG)
84 #define SYSCTL_JTAGOUTBOX_FLAG1                                     (JMBOUT1FG)
85 #define SYSCTL_JTAGINBOX_FLAG0                                       (JMBIN0FG)
86 #define SYSCTL_JTAGINBOX_FLAG1                                       (JMBIN1FG)
87
88 //*****************************************************************************
89 //
90 // The following are values that can be passed to the inboxSelect parameter for
91 // functions: SysCtl_getJTAGInboxMessage16Bit().
92 //
93 //*****************************************************************************
94 #define SYSCTL_JTAGINBOX_0                                                (0x0)
95 #define SYSCTL_JTAGINBOX_1                                                (0x2)
96
97 //*****************************************************************************
98 //
99 // The following are values that can be passed to the outboxSelect parameter
100 // for functions: SysCtl_setJTAGOutgoingMessage16Bit().
101 //
102 //*****************************************************************************
103 #define SYSCTL_JTAGOUTBOX_0                                               (0x0)
104 #define SYSCTL_JTAGOUTBOX_1                                               (0x2)
105
106 //*****************************************************************************
107 //
108 // The following are values that can be passed toThe following are values that
109 // can be returned by the SysCtl_getBSLEntryIndication() function.
110 //
111 //*****************************************************************************
112 #define SYSCTL_BSLENTRY_INDICATED                                         (0x1)
113 #define SYSCTL_BSLENTRY_NOTINDICATED                                      (0x0)
114
115 //*****************************************************************************
116 //
117 // Prototypes for the APIs.
118 //
119 //*****************************************************************************
120
121 //*****************************************************************************
122 //
123 //! \brief Sets the JTAG pins to be exclusively for JTAG until a BOR occurs.
124 //!
125 //! This function sets the JTAG pins to be exclusively used for the JTAG, and
126 //! not to be shared with the GPIO pins. This setting can only be cleared when
127 //! a BOR occurs.
128 //!
129 //!
130 //! \return None
131 //
132 //*****************************************************************************
133 extern void SysCtl_enableDedicatedJTAGPins(void);
134
135 //*****************************************************************************
136 //
137 //! \brief Returns the indication of a BSL entry sequence from the Spy-Bi-Wire.
138 //!
139 //! This function returns the indication of a BSL entry sequence from the Spy-
140 //! Bi-Wire.
141 //!
142 //!
143 //! \return One of the following:
144 //!         - \b SysCtl_BSLENTRY_INDICATED
145 //!         - \b SysCtl_BSLENTRY_NOTINDICATED
146 //!         \n indicating if a BSL entry sequence was detected
147 //
148 //*****************************************************************************
149 extern uint8_t SysCtl_getBSLEntryIndication(void);
150
151 //*****************************************************************************
152 //
153 //! \brief Enables PMM Access Protection.
154 //!
155 //! This function enables the PMM Access Protection, which will lock any
156 //! changes on the PMM control registers until a BOR occurs.
157 //!
158 //!
159 //! \return None
160 //
161 //*****************************************************************************
162 extern void SysCtl_enablePMMAccessProtect(void);
163
164 //*****************************************************************************
165 //
166 //! \brief Enables RAM-based Interrupt Vectors.
167 //!
168 //! This function enables RAM-base Interrupt Vectors, which means that
169 //! interrupt vectors are generated with the end address at the top of RAM,
170 //! instead of the top of the lower 64kB of flash.
171 //!
172 //!
173 //! \return None
174 //
175 //*****************************************************************************
176 extern void SysCtl_enableRAMBasedInterruptVectors(void);
177
178 //*****************************************************************************
179 //
180 //! \brief Disables RAM-based Interrupt Vectors.
181 //!
182 //! This function disables the interrupt vectors from being generated at the
183 //! top of the RAM.
184 //!
185 //!
186 //! \return None
187 //
188 //*****************************************************************************
189 extern void SysCtl_disableRAMBasedInterruptVectors(void);
190
191 //*****************************************************************************
192 //
193 //! \brief Initializes JTAG Mailbox with selected properties.
194 //!
195 //! This function sets the specified settings for the JTAG Mailbox system. The
196 //! settings that can be set are the size of the JTAG messages, and the auto-
197 //! clearing of the inbox flags. If the inbox flags are set to auto-clear, then
198 //! the inbox flags will be cleared upon reading of the inbox message buffer,
199 //! otherwise they will have to be reset by software using the
200 //! SYS_clearJTAGMailboxFlagStatus() function.
201 //!
202 //! \param mailboxSizeSelect is the size of the JTAG Mailboxes, whether 16- or
203 //!        32-bits.
204 //!        Valid values are:
205 //!        - \b SYSCTL_JTAGMBSIZE_16BIT [Default] - the JTAG messages will take
206 //!           up only one JTAG mailbox (i. e. an outgoing message will take up
207 //!           only 1 outbox of the JTAG mailboxes)
208 //!        - \b SYSCTL_JTAGMBSIZE_32BIT - the JTAG messages will be contained
209 //!           within both JTAG mailboxes (i. e. an outgoing message will take
210 //!           up both Outboxes of the JTAG mailboxes)
211 //!        \n Modified bits are \b JMBMODE of \b SYSJMBC register.
212 //! \param autoClearInboxFlagSelect decides how the JTAG inbox flags should be
213 //!        cleared, whether automatically after the corresponding outbox has
214 //!        been written to, or manually by software.
215 //!        Valid values are:
216 //!        - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO [Default] - both JTAG
217 //!           inbox flags will be reset automatically when the corresponding
218 //!           inbox is read from.
219 //!        - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW - only JTAG inbox 0 flag is
220 //!           reset automatically, while JTAG inbox 1 is reset with the
221 //!        - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO - only JTAG inbox 1 flag is
222 //!           reset automatically, while JTAG inbox 0 is reset with the
223 //!        - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW - both JTAG inbox flags will
224 //!           need to be reset manually by the
225 //!        \n Modified bits are \b JMBCLR0OFF and \b JMBCLR1OFF of \b SYSJMBC
226 //!        register.
227 //!
228 //! \return None
229 //
230 //*****************************************************************************
231 extern void SysCtl_initJTAGMailbox(uint8_t mailboxSizeSelect,
232                                    uint8_t autoClearInboxFlagSelect);
233
234 //*****************************************************************************
235 //
236 //! \brief Returns the status of the selected JTAG Mailbox flags.
237 //!
238 //! This function will return the status of the selected JTAG Mailbox flags in
239 //! bit mask format matching that passed into the mailboxFlagMask parameter.
240 //!
241 //! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the
242 //!        status of should be returned.
243 //!        Mask value is the logical OR of any of the following:
244 //!        - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0
245 //!        - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1
246 //!        - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0
247 //!        - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1
248 //!
249 //! \return A bit mask of the status of the selected mailbox flags.
250 //
251 //*****************************************************************************
252 extern uint8_t SysCtl_getJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
253
254 //*****************************************************************************
255 //
256 //! \brief Clears the status of the selected JTAG Mailbox flags.
257 //!
258 //! This function clears the selected JTAG Mailbox flags.
259 //!
260 //! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the
261 //!        status of should be cleared.
262 //!        Mask value is the logical OR of any of the following:
263 //!        - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0
264 //!        - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1
265 //!        - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0
266 //!        - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1
267 //!
268 //! \return None
269 //
270 //*****************************************************************************
271 extern void SysCtl_clearJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
272
273 //*****************************************************************************
274 //
275 //! \brief Returns the contents of the selected JTAG Inbox in a 16 bit format.
276 //!
277 //! This function returns the message contents of the selected JTAG inbox. If
278 //! the auto clear settings for the Inbox flags were set, then using this
279 //! function will automatically clear the corresponding JTAG inbox flag.
280 //!
281 //! \param inboxSelect is the chosen JTAG inbox that the contents of should be
282 //!        returned
283 //!        Valid values are:
284 //!        - \b SYSCTL_JTAGINBOX_0 - return contents of JTAG inbox 0
285 //!        - \b SYSCTL_JTAGINBOX_1 - return contents of JTAG inbox 1
286 //!
287 //! \return The contents of the selected JTAG inbox in a 16 bit format.
288 //
289 //*****************************************************************************
290 extern uint16_t SysCtl_getJTAGInboxMessage16Bit(uint8_t inboxSelect);
291
292 //*****************************************************************************
293 //
294 //! \brief Returns the contents of JTAG Inboxes in a 32 bit format.
295 //!
296 //! This function returns the message contents of both JTAG inboxes in a 32 bit
297 //! format. This function should be used if 32-bit messaging has been set in
298 //! the SYS_initJTAGMailbox() function. If the auto clear settings for the
299 //! Inbox flags were set, then using this function will automatically clear
300 //! both JTAG inbox flags.
301 //!
302 //!
303 //! \return The contents of both JTAG messages in a 32 bit format.
304 //
305 //*****************************************************************************
306 extern uint32_t SysCtl_getJTAGInboxMessage32Bit(void);
307
308 //*****************************************************************************
309 //
310 //! \brief Sets a 16 bit outgoing message in to the selected JTAG Outbox.
311 //!
312 //! This function sets the outgoing message in the selected JTAG outbox. The
313 //! corresponding JTAG outbox flag is cleared after this function, and set
314 //! after the JTAG has read the message.
315 //!
316 //! \param outboxSelect is the chosen JTAG outbox that the message should be
317 //!        set it.
318 //!        Valid values are:
319 //!        - \b SYSCTL_JTAGOUTBOX_0 - set the contents of JTAG outbox 0
320 //!        - \b SYSCTL_JTAGOUTBOX_1 - set the contents of JTAG outbox 1
321 //! \param outgoingMessage is the message to send to the JTAG.
322 //!        \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register.
323 //!
324 //! \return None
325 //
326 //*****************************************************************************
327 extern void SysCtl_setJTAGOutgoingMessage16Bit(uint8_t outboxSelect,
328                                                uint16_t outgoingMessage);
329
330 //*****************************************************************************
331 //
332 //! \brief Sets a 32 bit message in to both JTAG Outboxes.
333 //!
334 //! This function sets the 32-bit outgoing message in both JTAG outboxes. The
335 //! JTAG outbox flags are cleared after this function, and set after the JTAG
336 //! has read the message.
337 //!
338 //! \param outgoingMessage is the message to send to the JTAG.
339 //!        \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register.
340 //!
341 //! \return None
342 //
343 //*****************************************************************************
344 extern void SysCtl_setJTAGOutgoingMessage32Bit(uint32_t outgoingMessage);
345
346 //*****************************************************************************
347 //
348 // Mark the end of the C bindings section for C++ compilers.
349 //
350 //*****************************************************************************
351 #ifdef __cplusplus
352 }
353 #endif
354
355 #endif
356 #endif // __MSP430WARE_SYSCTL_H__