2 * Copyright (c) 2014, Texas Instruments Incorporated
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
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.
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.
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.
32 //*****************************************************************************
34 // sysctl.h - Driver for the SYSCTL Module.
36 //*****************************************************************************
38 #ifndef __MSP430WARE_SYSCTL_H__
39 #define __MSP430WARE_SYSCTL_H__
41 #include "inc/hw_memmap.h"
43 #ifdef __MSP430_HAS_SYS__
45 //*****************************************************************************
47 // If building with a C++ compiler, make all of the definitions in this header
50 //*****************************************************************************
56 //*****************************************************************************
58 // The following are values that can be passed to the mailboxSizeSelect
59 // parameter for functions: SysCtl_initJTAGMailbox().
61 //*****************************************************************************
62 #define SYSCTL_JTAGMBSIZE_16BIT (!(JMBMODE))
63 #define SYSCTL_JTAGMBSIZE_32BIT (JMBMODE)
65 //*****************************************************************************
67 // The following are values that can be passed to the autoClearInboxFlagSelect
68 // parameter for functions: SysCtl_initJTAGMailbox().
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)
76 //*****************************************************************************
78 // The following are values that can be passed to the mailboxFlagMask parameter
79 // for functions: SysCtl_getJTAGMailboxFlagStatus(), and
80 // SysCtl_clearJTAGMailboxFlagStatus().
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)
88 //*****************************************************************************
90 // The following are values that can be passed to the inboxSelect parameter for
91 // functions: SysCtl_getJTAGInboxMessage16Bit().
93 //*****************************************************************************
94 #define SYSCTL_JTAGINBOX_0 (0x0)
95 #define SYSCTL_JTAGINBOX_1 (0x2)
97 //*****************************************************************************
99 // The following are values that can be passed to the outboxSelect parameter
100 // for functions: SysCtl_setJTAGOutgoingMessage16Bit().
102 //*****************************************************************************
103 #define SYSCTL_JTAGOUTBOX_0 (0x0)
104 #define SYSCTL_JTAGOUTBOX_1 (0x2)
106 //*****************************************************************************
108 // The following are values that can be passed toThe following are values that
109 // can be returned by the SysCtl_getBSLEntryIndication() function.
111 //*****************************************************************************
112 #define SYSCTL_BSLENTRY_INDICATED (0x1)
113 #define SYSCTL_BSLENTRY_NOTINDICATED (0x0)
115 //*****************************************************************************
117 // Prototypes for the APIs.
119 //*****************************************************************************
121 //*****************************************************************************
123 //! \brief Sets the JTAG pins to be exclusively for JTAG until a BOR occurs.
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
132 //*****************************************************************************
133 extern void SysCtl_enableDedicatedJTAGPins(void);
135 //*****************************************************************************
137 //! \brief Returns the indication of a BSL entry sequence from the Spy-Bi-Wire.
139 //! This function returns the indication of a BSL entry sequence from the Spy-
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
148 //*****************************************************************************
149 extern uint8_t SysCtl_getBSLEntryIndication(void);
151 //*****************************************************************************
153 //! \brief Enables PMM Access Protection.
155 //! This function enables the PMM Access Protection, which will lock any
156 //! changes on the PMM control registers until a BOR occurs.
161 //*****************************************************************************
162 extern void SysCtl_enablePMMAccessProtect(void);
164 //*****************************************************************************
166 //! \brief Enables RAM-based Interrupt Vectors.
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.
175 //*****************************************************************************
176 extern void SysCtl_enableRAMBasedInterruptVectors(void);
178 //*****************************************************************************
180 //! \brief Disables RAM-based Interrupt Vectors.
182 //! This function disables the interrupt vectors from being generated at the
188 //*****************************************************************************
189 extern void SysCtl_disableRAMBasedInterruptVectors(void);
191 //*****************************************************************************
193 //! \brief Initializes JTAG Mailbox with selected properties.
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.
202 //! \param mailboxSizeSelect is the size of the JTAG Mailboxes, whether 16- or
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
230 //*****************************************************************************
231 extern void SysCtl_initJTAGMailbox(uint8_t mailboxSizeSelect,
232 uint8_t autoClearInboxFlagSelect);
234 //*****************************************************************************
236 //! \brief Returns the status of the selected JTAG Mailbox flags.
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.
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
249 //! \return A bit mask of the status of the selected mailbox flags.
251 //*****************************************************************************
252 extern uint8_t SysCtl_getJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
254 //*****************************************************************************
256 //! \brief Clears the status of the selected JTAG Mailbox flags.
258 //! This function clears the selected JTAG Mailbox flags.
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
270 //*****************************************************************************
271 extern void SysCtl_clearJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
273 //*****************************************************************************
275 //! \brief Returns the contents of the selected JTAG Inbox in a 16 bit format.
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.
281 //! \param inboxSelect is the chosen JTAG inbox that the contents of should be
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
287 //! \return The contents of the selected JTAG inbox in a 16 bit format.
289 //*****************************************************************************
290 extern uint16_t SysCtl_getJTAGInboxMessage16Bit(uint8_t inboxSelect);
292 //*****************************************************************************
294 //! \brief Returns the contents of JTAG Inboxes in a 32 bit format.
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.
303 //! \return The contents of both JTAG messages in a 32 bit format.
305 //*****************************************************************************
306 extern uint32_t SysCtl_getJTAGInboxMessage32Bit(void);
308 //*****************************************************************************
310 //! \brief Sets a 16 bit outgoing message in to the selected JTAG Outbox.
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.
316 //! \param outboxSelect is the chosen JTAG outbox that the message should be
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.
326 //*****************************************************************************
327 extern void SysCtl_setJTAGOutgoingMessage16Bit(uint8_t outboxSelect,
328 uint16_t outgoingMessage);
330 //*****************************************************************************
332 //! \brief Sets a 32 bit message in to both JTAG Outboxes.
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.
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.
343 //*****************************************************************************
344 extern void SysCtl_setJTAGOutgoingMessage32Bit(uint32_t outgoingMessage);
346 //*****************************************************************************
348 // Mark the end of the C bindings section for C++ compilers.
350 //*****************************************************************************
356 #endif // __MSP430WARE_SYSCTL_H__