2 * Copyright (c) 2014, Texas Instruments Incorporated
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
9 * * Redistributions of source code must retain the above copyright
\r
10 * notice, this list of conditions and the following disclaimer.
\r
12 * * Redistributions in binary form must reproduce the above copyright
\r
13 * notice, this list of conditions and the following disclaimer in the
\r
14 * documentation and/or other materials provided with the distribution.
\r
16 * * Neither the name of Texas Instruments Incorporated nor the names of
\r
17 * its contributors may be used to endorse or promote products derived
\r
18 * from this software without specific prior written permission.
\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
\r
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\r
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
\r
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
\r
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
\r
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
\r
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
32 //*****************************************************************************
\r
34 // sysctl.h - Driver for the SYSCTL Module.
\r
36 //*****************************************************************************
\r
38 #ifndef __MSP430WARE_SYSCTL_H__
\r
39 #define __MSP430WARE_SYSCTL_H__
\r
41 #include "inc/hw_memmap.h"
\r
43 #ifdef __MSP430_HAS_SYS__
\r
45 //*****************************************************************************
\r
47 // If building with a C++ compiler, make all of the definitions in this header
\r
48 // have a C binding.
\r
50 //*****************************************************************************
\r
56 //*****************************************************************************
\r
58 // The following are values that can be passed to the mailboxSizeSelect
\r
59 // parameter for functions: SysCtl_initJTAGMailbox().
\r
61 //*****************************************************************************
\r
62 #define SYSCTL_JTAGMBSIZE_16BIT (!(JMBMODE))
\r
63 #define SYSCTL_JTAGMBSIZE_32BIT (JMBMODE)
\r
65 //*****************************************************************************
\r
67 // The following are values that can be passed to the autoClearInboxFlagSelect
\r
68 // parameter for functions: SysCtl_initJTAGMailbox().
\r
70 //*****************************************************************************
\r
71 #define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO (!(JMBCLR0OFF + JMBCLR1OFF))
\r
72 #define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW (JMBCLR1OFF)
\r
73 #define SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO (JMBCLR0OFF)
\r
74 #define SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW (JMBCLR0OFF + JMBCLR1OFF)
\r
76 //*****************************************************************************
\r
78 // The following are values that can be passed to the mailboxFlagMask parameter
\r
79 // for functions: SysCtl_getJTAGMailboxFlagStatus(), and
\r
80 // SysCtl_clearJTAGMailboxFlagStatus().
\r
82 //*****************************************************************************
\r
83 #define SYSCTL_JTAGOUTBOX_FLAG0 (JMBOUT0FG)
\r
84 #define SYSCTL_JTAGOUTBOX_FLAG1 (JMBOUT1FG)
\r
85 #define SYSCTL_JTAGINBOX_FLAG0 (JMBIN0FG)
\r
86 #define SYSCTL_JTAGINBOX_FLAG1 (JMBIN1FG)
\r
88 //*****************************************************************************
\r
90 // The following are values that can be passed to the inboxSelect parameter for
\r
91 // functions: SysCtl_getJTAGInboxMessage16Bit().
\r
93 //*****************************************************************************
\r
94 #define SYSCTL_JTAGINBOX_0 (0x0)
\r
95 #define SYSCTL_JTAGINBOX_1 (0x2)
\r
97 //*****************************************************************************
\r
99 // The following are values that can be passed to the outboxSelect parameter
\r
100 // for functions: SysCtl_setJTAGOutgoingMessage16Bit().
\r
102 //*****************************************************************************
\r
103 #define SYSCTL_JTAGOUTBOX_0 (0x0)
\r
104 #define SYSCTL_JTAGOUTBOX_1 (0x2)
\r
106 //*****************************************************************************
\r
108 // The following are values that can be passed toThe following are values that
\r
109 // can be returned by the SysCtl_getBSLEntryIndication() function.
\r
111 //*****************************************************************************
\r
112 #define SYSCTL_BSLENTRY_INDICATED (0x1)
\r
113 #define SYSCTL_BSLENTRY_NOTINDICATED (0x0)
\r
115 //*****************************************************************************
\r
117 // Prototypes for the APIs.
\r
119 //*****************************************************************************
\r
121 //*****************************************************************************
\r
123 //! \brief Sets the JTAG pins to be exclusively for JTAG until a BOR occurs.
\r
125 //! This function sets the JTAG pins to be exclusively used for the JTAG, and
\r
126 //! not to be shared with the GPIO pins. This setting can only be cleared when
\r
132 //*****************************************************************************
\r
133 extern void SysCtl_enableDedicatedJTAGPins(void);
\r
135 //*****************************************************************************
\r
137 //! \brief Returns the indication of a BSL entry sequence from the Spy-Bi-Wire.
\r
139 //! This function returns the indication of a BSL entry sequence from the Spy-
\r
143 //! \return One of the following:
\r
144 //! - \b SysCtl_BSLENTRY_INDICATED
\r
145 //! - \b SysCtl_BSLENTRY_NOTINDICATED
\r
146 //! \n indicating if a BSL entry sequence was detected
\r
148 //*****************************************************************************
\r
149 extern uint8_t SysCtl_getBSLEntryIndication(void);
\r
151 //*****************************************************************************
\r
153 //! \brief Enables PMM Access Protection.
\r
155 //! This function enables the PMM Access Protection, which will lock any
\r
156 //! changes on the PMM control registers until a BOR occurs.
\r
161 //*****************************************************************************
\r
162 extern void SysCtl_enablePMMAccessProtect(void);
\r
164 //*****************************************************************************
\r
166 //! \brief Enables RAM-based Interrupt Vectors.
\r
168 //! This function enables RAM-base Interrupt Vectors, which means that
\r
169 //! interrupt vectors are generated with the end address at the top of RAM,
\r
170 //! instead of the top of the lower 64kB of flash.
\r
175 //*****************************************************************************
\r
176 extern void SysCtl_enableRAMBasedInterruptVectors(void);
\r
178 //*****************************************************************************
\r
180 //! \brief Disables RAM-based Interrupt Vectors.
\r
182 //! This function disables the interrupt vectors from being generated at the
\r
183 //! top of the RAM.
\r
188 //*****************************************************************************
\r
189 extern void SysCtl_disableRAMBasedInterruptVectors(void);
\r
191 //*****************************************************************************
\r
193 //! \brief Initializes JTAG Mailbox with selected properties.
\r
195 //! This function sets the specified settings for the JTAG Mailbox system. The
\r
196 //! settings that can be set are the size of the JTAG messages, and the auto-
\r
197 //! clearing of the inbox flags. If the inbox flags are set to auto-clear, then
\r
198 //! the inbox flags will be cleared upon reading of the inbox message buffer,
\r
199 //! otherwise they will have to be reset by software using the
\r
200 //! SYS_clearJTAGMailboxFlagStatus() function.
\r
202 //! \param mailboxSizeSelect is the size of the JTAG Mailboxes, whether 16- or
\r
204 //! Valid values are:
\r
205 //! - \b SYSCTL_JTAGMBSIZE_16BIT [Default] - the JTAG messages will take
\r
206 //! up only one JTAG mailbox (i. e. an outgoing message will take up
\r
207 //! only 1 outbox of the JTAG mailboxes)
\r
208 //! - \b SYSCTL_JTAGMBSIZE_32BIT - the JTAG messages will be contained
\r
209 //! within both JTAG mailboxes (i. e. an outgoing message will take
\r
210 //! up both Outboxes of the JTAG mailboxes)
\r
211 //! \n Modified bits are \b JMBMODE of \b SYSJMBC register.
\r
212 //! \param autoClearInboxFlagSelect decides how the JTAG inbox flags should be
\r
213 //! cleared, whether automatically after the corresponding outbox has
\r
214 //! been written to, or manually by software.
\r
215 //! Valid values are:
\r
216 //! - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO [Default] - both JTAG
\r
217 //! inbox flags will be reset automatically when the corresponding
\r
218 //! inbox is read from.
\r
219 //! - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW - only JTAG inbox 0 flag is
\r
220 //! reset automatically, while JTAG inbox 1 is reset with the
\r
221 //! - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO - only JTAG inbox 1 flag is
\r
222 //! reset automatically, while JTAG inbox 0 is reset with the
\r
223 //! - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW - both JTAG inbox flags will
\r
224 //! need to be reset manually by the
\r
225 //! \n Modified bits are \b JMBCLR0OFF and \b JMBCLR1OFF of \b SYSJMBC
\r
230 //*****************************************************************************
\r
231 extern void SysCtl_initJTAGMailbox(uint8_t mailboxSizeSelect,
\r
232 uint8_t autoClearInboxFlagSelect);
\r
234 //*****************************************************************************
\r
236 //! \brief Returns the status of the selected JTAG Mailbox flags.
\r
238 //! This function will return the status of the selected JTAG Mailbox flags in
\r
239 //! bit mask format matching that passed into the mailboxFlagMask parameter.
\r
241 //! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the
\r
242 //! status of should be returned.
\r
243 //! Mask value is the logical OR of any of the following:
\r
244 //! - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0
\r
245 //! - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1
\r
246 //! - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0
\r
247 //! - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1
\r
249 //! \return A bit mask of the status of the selected mailbox flags.
\r
251 //*****************************************************************************
\r
252 extern uint8_t SysCtl_getJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
\r
254 //*****************************************************************************
\r
256 //! \brief Clears the status of the selected JTAG Mailbox flags.
\r
258 //! This function clears the selected JTAG Mailbox flags.
\r
260 //! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the
\r
261 //! status of should be cleared.
\r
262 //! Mask value is the logical OR of any of the following:
\r
263 //! - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0
\r
264 //! - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1
\r
265 //! - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0
\r
266 //! - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1
\r
270 //*****************************************************************************
\r
271 extern void SysCtl_clearJTAGMailboxFlagStatus(uint8_t mailboxFlagMask);
\r
273 //*****************************************************************************
\r
275 //! \brief Returns the contents of the selected JTAG Inbox in a 16 bit format.
\r
277 //! This function returns the message contents of the selected JTAG inbox. If
\r
278 //! the auto clear settings for the Inbox flags were set, then using this
\r
279 //! function will automatically clear the corresponding JTAG inbox flag.
\r
281 //! \param inboxSelect is the chosen JTAG inbox that the contents of should be
\r
283 //! Valid values are:
\r
284 //! - \b SYSCTL_JTAGINBOX_0 - return contents of JTAG inbox 0
\r
285 //! - \b SYSCTL_JTAGINBOX_1 - return contents of JTAG inbox 1
\r
287 //! \return The contents of the selected JTAG inbox in a 16 bit format.
\r
289 //*****************************************************************************
\r
290 extern uint16_t SysCtl_getJTAGInboxMessage16Bit(uint8_t inboxSelect);
\r
292 //*****************************************************************************
\r
294 //! \brief Returns the contents of JTAG Inboxes in a 32 bit format.
\r
296 //! This function returns the message contents of both JTAG inboxes in a 32 bit
\r
297 //! format. This function should be used if 32-bit messaging has been set in
\r
298 //! the SYS_initJTAGMailbox() function. If the auto clear settings for the
\r
299 //! Inbox flags were set, then using this function will automatically clear
\r
300 //! both JTAG inbox flags.
\r
303 //! \return The contents of both JTAG messages in a 32 bit format.
\r
305 //*****************************************************************************
\r
306 extern uint32_t SysCtl_getJTAGInboxMessage32Bit(void);
\r
308 //*****************************************************************************
\r
310 //! \brief Sets a 16 bit outgoing message in to the selected JTAG Outbox.
\r
312 //! This function sets the outgoing message in the selected JTAG outbox. The
\r
313 //! corresponding JTAG outbox flag is cleared after this function, and set
\r
314 //! after the JTAG has read the message.
\r
316 //! \param outboxSelect is the chosen JTAG outbox that the message should be
\r
318 //! Valid values are:
\r
319 //! - \b SYSCTL_JTAGOUTBOX_0 - set the contents of JTAG outbox 0
\r
320 //! - \b SYSCTL_JTAGOUTBOX_1 - set the contents of JTAG outbox 1
\r
321 //! \param outgoingMessage is the message to send to the JTAG.
\r
322 //! \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register.
\r
326 //*****************************************************************************
\r
327 extern void SysCtl_setJTAGOutgoingMessage16Bit(uint8_t outboxSelect,
\r
328 uint16_t outgoingMessage);
\r
330 //*****************************************************************************
\r
332 //! \brief Sets a 32 bit message in to both JTAG Outboxes.
\r
334 //! This function sets the 32-bit outgoing message in both JTAG outboxes. The
\r
335 //! JTAG outbox flags are cleared after this function, and set after the JTAG
\r
336 //! has read the message.
\r
338 //! \param outgoingMessage is the message to send to the JTAG.
\r
339 //! \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register.
\r
343 //*****************************************************************************
\r
344 extern void SysCtl_setJTAGOutgoingMessage32Bit(uint32_t outgoingMessage);
\r
346 //*****************************************************************************
\r
348 // Mark the end of the C bindings section for C++ compilers.
\r
350 //*****************************************************************************
\r
356 #endif // __MSP430WARE_SYSCTL_H__
\r