MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
sysctl.h
1 //*****************************************************************************
2 //
3 // sysctl.h - Driver for the SYSCTL Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_SYSCTL_H__
8 #define __MSP430WARE_SYSCTL_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_SYS__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the BSLRAMAssignment
28 // parameter for functions: SysCtl_setRAMAssignedToBSL().
29 //
30 //*****************************************************************************
31 #define SYSCTL_BSLRAMASSIGN_NORAM (!(SYSBSLR))
32 #define SYSCTL_BSLRAMASSIGN_LOWEST16BYTES (SYSBSLR)
33 
34 //*****************************************************************************
35 //
36 // The following are values that can be passed to the BSLSizeSelect parameter
37 // for functions: SysCtl_setBSLSize().
38 //
39 //*****************************************************************************
40 #define SYSCTL_BSLSIZE_SEG3 (~(SYSBSLSIZE0 + SYSBSLSIZE1))
41 #define SYSCTL_BSLSIZE_SEGS23 (SYSBSLSIZE0)
42 #define SYSCTL_BSLSIZE_SEGS123 (SYSBSLSIZE1)
43 #define SYSCTL_BSLSIZE_SEGS1234 (SYSBSLSIZE0 + SYSBSLSIZE1)
44 
45 //*****************************************************************************
46 //
47 // The following are values that can be passed to the mailboxSizeSelect
48 // parameter for functions: SysCtl_initJTAGMailbox().
49 //
50 //*****************************************************************************
51 #define SYSCTL_JTAGMBSIZE_16BIT (!(JMBMODE))
52 #define SYSCTL_JTAGMBSIZE_32BIT (JMBMODE)
53 
54 //*****************************************************************************
55 //
56 // The following are values that can be passed to the autoClearInboxFlagSelect
57 // parameter for functions: SysCtl_initJTAGMailbox().
58 //
59 //*****************************************************************************
60 #define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO (!(JMBCLR0OFF + JMBCLR1OFF))
61 #define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW (JMBCLR1OFF)
62 #define SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO (JMBCLR0OFF)
63 #define SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW (JMBCLR0OFF + JMBCLR1OFF)
64 
65 //*****************************************************************************
66 //
67 // The following are values that can be passed to the mailboxFlagMask parameter
68 // for functions: SysCtl_getJTAGMailboxFlagStatus(), and
69 // SysCtl_clearJTAGMailboxFlagStatus().
70 //
71 //*****************************************************************************
72 #define SYSCTL_JTAGOUTBOX_FLAG0 (JMBOUT0FG)
73 #define SYSCTL_JTAGOUTBOX_FLAG1 (JMBOUT1FG)
74 #define SYSCTL_JTAGINBOX_FLAG0 (JMBIN0FG)
75 #define SYSCTL_JTAGINBOX_FLAG1 (JMBIN1FG)
76 
77 //*****************************************************************************
78 //
79 // The following are values that can be passed to the inboxSelect parameter for
80 // functions: SysCtl_getJTAGInboxMessage16Bit().
81 //
82 //*****************************************************************************
83 #define SYSCTL_JTAGINBOX_0 (0x0)
84 #define SYSCTL_JTAGINBOX_1 (0x2)
85 
86 //*****************************************************************************
87 //
88 // The following are values that can be passed to the outboxSelect parameter
89 // for functions: SysCtl_setJTAGOutgoingMessage16Bit().
90 //
91 //*****************************************************************************
92 #define SYSCTL_JTAGOUTBOX_0 (0x0)
93 #define SYSCTL_JTAGOUTBOX_1 (0x2)
94 
95 //*****************************************************************************
96 //
97 // The following are values that can be passed toThe following are values that
98 // can be returned by the SysCtl_getBSLEntryIndication() function.
99 //
100 //*****************************************************************************
101 #define SYSCTL_BSLENTRY_INDICATED (0x1)
102 #define SYSCTL_BSLENTRY_NOTINDICATED (0x0)
103 
104 //*****************************************************************************
105 //
106 // Prototypes for the APIs.
107 //
108 //*****************************************************************************
109 
110 //*****************************************************************************
111 //
112 //! \brief Sets the JTAG pins to be exclusively for JTAG until a BOR occurs.
113 //!
114 //! This function sets the JTAG pins to be exclusively used for the JTAG, and
115 //! not to be shared with the GPIO pins. This setting can only be cleared when
116 //! a BOR occurs.
117 //!
118 //!
119 //! \return None
120 //
121 //*****************************************************************************
122 extern void SysCtl_enableDedicatedJTAGPins(void);
123 
124 //*****************************************************************************
125 //
126 //! \brief Returns the indication of a BSL entry sequence from the Spy-Bi-Wire.
127 //!
128 //! This function returns the indication of a BSL entry sequence from the Spy-
129 //! Bi-Wire.
130 //!
131 //!
132 //! \return One of the following:
133 //! - \b SYSCTL_BSLENTRY_INDICATED
134 //! - \b SYSCTL_BSLENTRY_NOTINDICATED
135 //! \n indicating if a BSL entry sequence was detected
136 //
137 //*****************************************************************************
138 extern uint8_t SysCtl_getBSLEntryIndication(void);
139 
140 //*****************************************************************************
141 //
142 //! \brief Enables PMM Access Protection.
143 //!
144 //! This function enables the PMM Access Protection, which will lock any
145 //! changes on the PMM control registers until a BOR occurs.
146 //!
147 //!
148 //! \return None
149 //
150 //*****************************************************************************
151 extern void SysCtl_enablePMMAccessProtect(void);
152 
153 //*****************************************************************************
154 //
155 //! \brief Enables RAM-based Interrupt Vectors.
156 //!
157 //! This function enables RAM-base Interrupt Vectors, which means that
158 //! interrupt vectors are generated with the end address at the top of RAM,
159 //! instead of the top of the lower 64kB of flash.
160 //!
161 //!
162 //! \return None
163 //
164 //*****************************************************************************
165 extern void SysCtl_enableRAMBasedInterruptVectors(void);
166 
167 //*****************************************************************************
168 //
169 //! \brief Disables RAM-based Interrupt Vectors.
170 //!
171 //! This function disables the interrupt vectors from being generated at the
172 //! top of the RAM.
173 //!
174 //!
175 //! \return None
176 //
177 //*****************************************************************************
179 
180 //*****************************************************************************
181 //
182 //! \brief Enables BSL memory protection.
183 //!
184 //! This function enables protection on the BSL memory, which prevents any
185 //! reading, programming, or erasing of the BSL memory.
186 //!
187 //!
188 //! \return None
189 //
190 //*****************************************************************************
191 extern void SysCtl_enableBSLProtect(void);
192 
193 //*****************************************************************************
194 //
195 //! \brief Disables BSL memory protection.
196 //!
197 //! This function disables protection on the BSL memory.
198 //!
199 //!
200 //! \return None
201 //
202 //*****************************************************************************
203 extern void SysCtl_disableBSLProtect(void);
204 
205 //*****************************************************************************
206 //
207 //! \brief Enables BSL memory.
208 //!
209 //! This function enables BSL memory, which allows BSL memory to be addressed
210 //!
211 //!
212 //! \return None
213 //
214 //*****************************************************************************
215 extern void SysCtl_enableBSLMemory(void);
216 
217 //*****************************************************************************
218 //
219 //! \brief Disables BSL memory.
220 //!
221 //! This function disables BSL memory, which makes BSL memory act like vacant
222 //! memory.
223 //!
224 //!
225 //! \return None
226 //
227 //*****************************************************************************
228 extern void SysCtl_disableBSLMemory(void);
229 
230 //*****************************************************************************
231 //
232 //! \brief Sets RAM assignment to BSL area.
233 //!
234 //! This function allows RAM to be assigned to BSL, based on the selection of
235 //! the BSLRAMAssignment parameter.
236 //!
237 //! \param BSLRAMAssignment is the selection of if the BSL should be placed in
238 //! RAM or not.
239 //! Valid values are:
240 //! - \b SYSCTL_BSLRAMASSIGN_NORAM [Default]
241 //! - \b SYSCTL_BSLRAMASSIGN_LOWEST16BYTES
242 //! \n Modified bits are \b SYSBSLR of \b SYSBSLC register.
243 //!
244 //! \return None
245 //
246 //*****************************************************************************
247 extern void SysCtl_setRAMAssignedToBSL(uint8_t BSLRAMAssignment);
248 
249 //*****************************************************************************
250 //
251 //! \brief Sets the size of the BSL in Flash.
252 //!
253 //! This function sets the size of the BSL in Flash memory.
254 //!
255 //! \param BSLSizeSelect is the amount of segments the BSL should take.
256 //! Valid values are:
257 //! - \b SYSCTL_BSLSIZE_SEG3
258 //! - \b SYSCTL_BSLSIZE_SEGS23
259 //! - \b SYSCTL_BSLSIZE_SEGS123
260 //! - \b SYSCTL_BSLSIZE_SEGS1234 [Default]
261 //! \n Modified bits are \b SYSBSLSIZE of \b SYSBSLC register.
262 //!
263 //! \return None
264 //
265 //*****************************************************************************
266 extern void SysCtl_setBSLSize(uint8_t BSLSizeSelect);
267 
268 //*****************************************************************************
269 //
270 //! \brief Initializes JTAG Mailbox with selected properties.
271 //!
272 //! This function sets the specified settings for the JTAG Mailbox system. The
273 //! settings that can be set are the size of the JTAG messages, and the auto-
274 //! clearing of the inbox flags. If the inbox flags are set to auto-clear, then
275 //! the inbox flags will be cleared upon reading of the inbox message buffer,
276 //! otherwise they will have to be reset by software using the
277 //! SYS_clearJTAGMailboxFlagStatus() function.
278 //!
279 //! \param mailboxSizeSelect is the size of the JTAG Mailboxes, whether 16- or
280 //! 32-bits.
281 //! Valid values are:
282 //! - \b SYSCTL_JTAGMBSIZE_16BIT [Default] - the JTAG messages will take
283 //! up only one JTAG mailbox (i. e. an outgoing message will take up
284 //! only 1 outbox of the JTAG mailboxes)
285 //! - \b SYSCTL_JTAGMBSIZE_32BIT - the JTAG messages will be contained
286 //! within both JTAG mailboxes (i. e. an outgoing message will take
287 //! up both Outboxes of the JTAG mailboxes)
288 //! \n Modified bits are \b JMBMODE of \b SYSJMBC register.
289 //! \param autoClearInboxFlagSelect decides how the JTAG inbox flags should be
290 //! cleared, whether automatically after the corresponding outbox has
291 //! been written to, or manually by software.
292 //! Valid values are:
293 //! - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO [Default] - both JTAG
294 //! inbox flags will be reset automatically when the corresponding
295 //! inbox is read from.
296 //! - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW - only JTAG inbox 0 flag is
297 //! reset automatically, while JTAG inbox 1 is reset with the
298 //! - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO - only JTAG inbox 1 flag is
299 //! reset automatically, while JTAG inbox 0 is reset with the
300 //! - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW - both JTAG inbox flags will
301 //! need to be reset manually by the
302 //! \n Modified bits are \b JMBCLR0OFF and \b JMBCLR1OFF of \b SYSJMBC
303 //! register.
304 //!
305 //! \return None
306 //
307 //*****************************************************************************
308 extern void SysCtl_initJTAGMailbox(uint8_t mailboxSizeSelect,
309  uint8_t autoClearInboxFlagSelect);
310 
311 //*****************************************************************************
312 //
313 //! \brief Returns the status of the selected JTAG Mailbox flags.
314 //!
315 //! This function will return the status of the selected JTAG Mailbox flags in
316 //! bit mask format matching that passed into the mailboxFlagMask parameter.
317 //!
318 //! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the
319 //! status of should be returned.
320 //! Mask value is the logical OR of any of the following:
321 //! - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0
322 //! - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1
323 //! - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0
324 //! - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1
325 //!
326 //! \return A bit mask of the status of the selected mailbox flags.
327 //
328 //*****************************************************************************
329 extern uint8_t SysCtl_getJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
330 
331 //*****************************************************************************
332 //
333 //! \brief Clears the status of the selected JTAG Mailbox flags.
334 //!
335 //! This function clears the selected JTAG Mailbox flags.
336 //!
337 //! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the
338 //! status of should be cleared.
339 //! Mask value is the logical OR of any of the following:
340 //! - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0
341 //! - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1
342 //! - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0
343 //! - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1
344 //!
345 //! \return None
346 //
347 //*****************************************************************************
348 extern void SysCtl_clearJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
349 
350 //*****************************************************************************
351 //
352 //! \brief Returns the contents of the selected JTAG Inbox in a 16 bit format.
353 //!
354 //! This function returns the message contents of the selected JTAG inbox. If
355 //! the auto clear settings for the Inbox flags were set, then using this
356 //! function will automatically clear the corresponding JTAG inbox flag.
357 //!
358 //! \param inboxSelect is the chosen JTAG inbox that the contents of should be
359 //! returned
360 //! Valid values are:
361 //! - \b SYSCTL_JTAGINBOX_0 - return contents of JTAG inbox 0
362 //! - \b SYSCTL_JTAGINBOX_1 - return contents of JTAG inbox 1
363 //!
364 //! \return The contents of the selected JTAG inbox in a 16 bit format.
365 //
366 //*****************************************************************************
367 extern uint16_t SysCtl_getJTAGInboxMessage16Bit(uint8_t inboxSelect);
368 
369 //*****************************************************************************
370 //
371 //! \brief Returns the contents of JTAG Inboxes in a 32 bit format.
372 //!
373 //! This function returns the message contents of both JTAG inboxes in a 32 bit
374 //! format. This function should be used if 32-bit messaging has been set in
375 //! the SYS_initJTAGMailbox() function. If the auto clear settings for the
376 //! Inbox flags were set, then using this function will automatically clear
377 //! both JTAG inbox flags.
378 //!
379 //!
380 //! \return The contents of both JTAG messages in a 32 bit format.
381 //
382 //*****************************************************************************
383 extern uint32_t SysCtl_getJTAGInboxMessage32Bit(void);
384 
385 //*****************************************************************************
386 //
387 //! \brief Sets a 16 bit outgoing message in to the selected JTAG Outbox.
388 //!
389 //! This function sets the outgoing message in the selected JTAG outbox. The
390 //! corresponding JTAG outbox flag is cleared after this function, and set
391 //! after the JTAG has read the message.
392 //!
393 //! \param outboxSelect is the chosen JTAG outbox that the message should be
394 //! set it.
395 //! Valid values are:
396 //! - \b SYSCTL_JTAGOUTBOX_0 - set the contents of JTAG outbox 0
397 //! - \b SYSCTL_JTAGOUTBOX_1 - set the contents of JTAG outbox 1
398 //! \param outgoingMessage is the message to send to the JTAG.
399 //! \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register.
400 //!
401 //! \return None
402 //
403 //*****************************************************************************
404 extern void SysCtl_setJTAGOutgoingMessage16Bit(uint8_t outboxSelect,
405  uint16_t outgoingMessage);
406 
407 //*****************************************************************************
408 //
409 //! \brief Sets a 32 bit message in to both JTAG Outboxes.
410 //!
411 //! This function sets the 32-bit outgoing message in both JTAG outboxes. The
412 //! JTAG outbox flags are cleared after this function, and set after the JTAG
413 //! has read the message.
414 //!
415 //! \param outgoingMessage is the message to send to the JTAG.
416 //! \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register.
417 //!
418 //! \return None
419 //
420 //*****************************************************************************
421 extern void SysCtl_setJTAGOutgoingMessage32Bit(uint32_t outgoingMessage);
422 
423 //*****************************************************************************
424 //
425 // Mark the end of the C bindings section for C++ compilers.
426 //
427 //*****************************************************************************
428 #ifdef __cplusplus
429 }
430 #endif
431 
432 #endif
433 #endif // __MSP430WARE_SYSCTL_H__
void SysCtl_disableBSLProtect(void)
Disables BSL memory protection.
Definition: sysctl.c:55
void SysCtl_setJTAGOutgoingMessage16Bit(uint8_t outboxSelect, uint16_t outgoingMessage)
Sets a 16 bit outgoing message in to the selected JTAG Outbox.
Definition: sysctl.c:113
void SysCtl_setBSLSize(uint8_t BSLSizeSelect)
Sets the size of the BSL in Flash.
Definition: sysctl.c:76
void SysCtl_enableRAMBasedInterruptVectors(void)
Enables RAM-based Interrupt Vectors.
Definition: sysctl.c:40
void SysCtl_enableBSLMemory(void)
Enables BSL memory.
Definition: sysctl.c:60
uint16_t SysCtl_getJTAGInboxMessage16Bit(uint8_t inboxSelect)
Returns the contents of the selected JTAG Inbox in a 16 bit format.
Definition: sysctl.c:100
void SysCtl_enableBSLProtect(void)
Enables BSL memory protection.
Definition: sysctl.c:50
void SysCtl_setRAMAssignedToBSL(uint8_t BSLRAMAssignment)
Sets RAM assignment to BSL area.
Definition: sysctl.c:70
uint8_t SysCtl_getBSLEntryIndication(void)
Returns the indication of a BSL entry sequence from the Spy-Bi-Wire.
Definition: sysctl.c:26
void SysCtl_setJTAGOutgoingMessage32Bit(uint32_t outgoingMessage)
Sets a 32 bit message in to both JTAG Outboxes.
Definition: sysctl.c:119
void SysCtl_disableRAMBasedInterruptVectors(void)
Disables RAM-based Interrupt Vectors.
Definition: sysctl.c:45
void SysCtl_enablePMMAccessProtect(void)
Enables PMM Access Protection.
Definition: sysctl.c:35
void SysCtl_clearJTAGMailboxFlagStatus(uint8_t mailboxFlagMask)
Clears the status of the selected JTAG Mailbox flags.
Definition: sysctl.c:95
void SysCtl_enableDedicatedJTAGPins(void)
Sets the JTAG pins to be exclusively for JTAG until a BOR occurs.
Definition: sysctl.c:21
uint8_t SysCtl_getJTAGMailboxFlagStatus(uint8_t mailboxFlagMask)
Returns the status of the selected JTAG Mailbox flags.
Definition: sysctl.c:90
void SysCtl_initJTAGMailbox(uint8_t mailboxSizeSelect, uint8_t autoClearInboxFlagSelect)
Initializes JTAG Mailbox with selected properties.
Definition: sysctl.c:82
uint32_t SysCtl_getJTAGInboxMessage32Bit(void)
Returns the contents of JTAG Inboxes in a 32 bit format.
Definition: sysctl.c:105
void SysCtl_disableBSLMemory(void)
Disables BSL memory.
Definition: sysctl.c:65

Copyright 2020, Texas Instruments Incorporated