]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/driverlib/MSP430FR5xx_6xx/sfr.h
Rename /Demo/MSP430FR5969_LaunchPad to /Demo/MSP430X_MSP430FR5969_LaunchPad for consi...
[freertos] / FreeRTOS / Demo / MSP430X_MSP430FR5969_LaunchPad / driverlib / MSP430FR5xx_6xx / sfr.h
1 /* --COPYRIGHT--,BSD\r
2  * Copyright (c) 2014, Texas Instruments Incorporated\r
3  * All rights reserved.\r
4  *\r
5  * Redistribution and use in source and binary forms, with or without\r
6  * modification, are permitted provided that the following conditions\r
7  * are met:\r
8  *\r
9  * *  Redistributions of source code must retain the above copyright\r
10  *    notice, this list of conditions and the following disclaimer.\r
11  *\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
15  *\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
19  *\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
31  * --/COPYRIGHT--*/\r
32 //*****************************************************************************\r
33 //\r
34 // sfr.h - Driver for the SFR Module.\r
35 //\r
36 //*****************************************************************************\r
37 \r
38 #ifndef __MSP430WARE_SFR_H__\r
39 #define __MSP430WARE_SFR_H__\r
40 \r
41 #include "inc/hw_memmap.h"\r
42 \r
43 #ifdef __MSP430_HAS_SFR__\r
44 \r
45 //*****************************************************************************\r
46 //\r
47 // If building with a C++ compiler, make all of the definitions in this header\r
48 // have a C binding.\r
49 //\r
50 //*****************************************************************************\r
51 #ifdef __cplusplus\r
52 extern "C"\r
53 {\r
54 #endif\r
55 \r
56 //*****************************************************************************\r
57 //\r
58 // The following are values that can be passed to the interruptMask parameter\r
59 // for functions: SFR_enableInterrupt(), and SFR_disableInterrupt(); the\r
60 // interruptFlagMask parameter for functions: SFR_getInterruptStatus(), and\r
61 // SFR_clearInterrupt() as well as returned by the SFR_getInterruptStatus()\r
62 // function.\r
63 //\r
64 //*****************************************************************************\r
65 #define SFR_JTAG_OUTBOX_INTERRUPT                                      JMBOUTIE\r
66 #define SFR_JTAG_INBOX_INTERRUPT                                        JMBINIE\r
67 #define SFR_NMI_PIN_INTERRUPT                                             NMIIE\r
68 #define SFR_VACANT_MEMORY_ACCESS_INTERRUPT                                VMAIE\r
69 #define SFR_OSCILLATOR_FAULT_INTERRUPT                                     OFIE\r
70 #define SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT                             WDTIE\r
71 \r
72 //*****************************************************************************\r
73 //\r
74 // The following are values that can be passed to the pullResistorSetup\r
75 // parameter for functions: SFR_setResetPinPullResistor().\r
76 //\r
77 //*****************************************************************************\r
78 #define SFR_RESISTORDISABLE                            (!(SYSRSTRE + SYSRSTUP))\r
79 #define SFR_RESISTORENABLE_PULLUP                         (SYSRSTRE + SYSRSTUP)\r
80 #define SFR_RESISTORENABLE_PULLDOWN                                  (SYSRSTRE)\r
81 \r
82 //*****************************************************************************\r
83 //\r
84 // The following are values that can be passed to the edgeDirection parameter\r
85 // for functions: SFR_setNMIEdge().\r
86 //\r
87 //*****************************************************************************\r
88 #define SFR_NMI_RISINGEDGE                                       (!(SYSNMIIES))\r
89 #define SFR_NMI_FALLINGEDGE                                         (SYSNMIIES)\r
90 \r
91 //*****************************************************************************\r
92 //\r
93 // The following are values that can be passed to the resetPinFunction\r
94 // parameter for functions: SFR_setResetNMIPinFunction().\r
95 //\r
96 //*****************************************************************************\r
97 #define SFR_RESETPINFUNC_RESET                                      (!(SYSNMI))\r
98 #define SFR_RESETPINFUNC_NMI                                           (SYSNMI)\r
99 \r
100 //*****************************************************************************\r
101 //\r
102 // Prototypes for the APIs.\r
103 //\r
104 //*****************************************************************************\r
105 \r
106 //*****************************************************************************\r
107 //\r
108 //! \brief Enables selected SFR interrupt sources.\r
109 //!\r
110 //! This function enables the selected SFR interrupt sources. Only the sources\r
111 //! that are enabled can be reflected to the processor interrupt; disabled\r
112 //! sources have no effect on the processor. Does not clear interrupt flags.\r
113 //!\r
114 //! \param interruptMask is the bit mask of interrupts that will be enabled.\r
115 //!        Mask value is the logical OR of any of the following:\r
116 //!        - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt\r
117 //!        - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt\r
118 //!        - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is\r
119 //!           chosen\r
120 //!        - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access\r
121 //!           interrupt\r
122 //!        - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt\r
123 //!        - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer\r
124 //!           interrupt\r
125 //!\r
126 //! \return None\r
127 //\r
128 //*****************************************************************************\r
129 extern void SFR_enableInterrupt(uint8_t interruptMask);\r
130 \r
131 //*****************************************************************************\r
132 //\r
133 //! \brief Disables selected SFR interrupt sources.\r
134 //!\r
135 //! This function disables the selected SFR interrupt sources. Only the sources\r
136 //! that are enabled can be reflected to the processor interrupt; disabled\r
137 //! sources have no effect on the processor.\r
138 //!\r
139 //! \param interruptMask is the bit mask of interrupts that will be disabled.\r
140 //!        Mask value is the logical OR of any of the following:\r
141 //!        - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt\r
142 //!        - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt\r
143 //!        - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is\r
144 //!           chosen\r
145 //!        - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access\r
146 //!           interrupt\r
147 //!        - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt\r
148 //!        - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer\r
149 //!           interrupt\r
150 //!\r
151 //! \return None\r
152 //\r
153 //*****************************************************************************\r
154 extern void SFR_disableInterrupt(uint8_t interruptMask);\r
155 \r
156 //*****************************************************************************\r
157 //\r
158 //! \brief Returns the status of the selected SFR interrupt flags.\r
159 //!\r
160 //! This function returns the status of the selected SFR interrupt flags in a\r
161 //! bit mask format matching that passed into the interruptFlagMask parameter.\r
162 //!\r
163 //! \param interruptFlagMask is the bit mask of interrupt flags that the status\r
164 //!        of should be returned.\r
165 //!        Mask value is the logical OR of any of the following:\r
166 //!        - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt\r
167 //!        - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt\r
168 //!        - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is\r
169 //!           chosen\r
170 //!        - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access\r
171 //!           interrupt\r
172 //!        - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt\r
173 //!        - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer\r
174 //!           interrupt\r
175 //!\r
176 //! \return A bit mask of the status of the selected interrupt flags.\r
177 //!         Return Logical OR of any of the following:\r
178 //!         - \b SFR_JTAG_OUTBOX_INTERRUPT JTAG outbox interrupt\r
179 //!         - \b SFR_JTAG_INBOX_INTERRUPT JTAG inbox interrupt\r
180 //!         - \b SFR_NMI_PIN_INTERRUPT NMI pin interrupt, if NMI function is\r
181 //!         chosen\r
182 //!         - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT Vacant memory access\r
183 //!         interrupt\r
184 //!         - \b SFR_OSCILLATOR_FAULT_INTERRUPT Oscillator fault interrupt\r
185 //!         - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT Watchdog interval timer\r
186 //!         interrupt\r
187 //!         \n indicating the status of the masked interrupts\r
188 //\r
189 //*****************************************************************************\r
190 extern uint8_t SFR_getInterruptStatus(uint8_t interruptFlagMask);\r
191 \r
192 //*****************************************************************************\r
193 //\r
194 //! \brief Clears the selected SFR interrupt flags.\r
195 //!\r
196 //! This function clears the status of the selected SFR interrupt flags.\r
197 //!\r
198 //! \param interruptFlagMask is the bit mask of interrupt flags that will be\r
199 //!        cleared.\r
200 //!        Mask value is the logical OR of any of the following:\r
201 //!        - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt\r
202 //!        - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt\r
203 //!        - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is\r
204 //!           chosen\r
205 //!        - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access\r
206 //!           interrupt\r
207 //!        - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt\r
208 //!        - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer\r
209 //!           interrupt\r
210 //!\r
211 //! \return None\r
212 //\r
213 //*****************************************************************************\r
214 extern void SFR_clearInterrupt(uint8_t interruptFlagMask);\r
215 \r
216 //*****************************************************************************\r
217 //\r
218 //! \brief Sets the pull-up/down resistor on the ~RST/NMI pin.\r
219 //!\r
220 //! This function sets the pull-up/down resistors on the ~RST/NMI pin to the\r
221 //! settings from the pullResistorSetup parameter.\r
222 //!\r
223 //! \param pullResistorSetup is the selection of how the pull-up/down resistor\r
224 //!        on the ~RST/NMI pin should be setup or disabled.\r
225 //!        Valid values are:\r
226 //!        - \b SFR_RESISTORDISABLE\r
227 //!        - \b SFR_RESISTORENABLE_PULLUP [Default]\r
228 //!        - \b SFR_RESISTORENABLE_PULLDOWN\r
229 //!        \n Modified bits are \b SYSRSTUP and \b SYSRSTRE of \b SFRRPCR\r
230 //!        register.\r
231 //!\r
232 //! \return None\r
233 //\r
234 //*****************************************************************************\r
235 extern void SFR_setResetPinPullResistor(uint16_t pullResistorSetup);\r
236 \r
237 //*****************************************************************************\r
238 //\r
239 //! \brief Sets the edge direction that will assert an NMI from a signal on the\r
240 //! ~RST/NMI pin if NMI function is active.\r
241 //!\r
242 //! This function sets the edge direction that will assert an NMI from a signal\r
243 //! on the ~RST/NMI pin if the NMI function is active. To activate the NMI\r
244 //! function of the ~RST/NMI use the SFR_setResetNMIPinFunction() passing\r
245 //! SFR_RESETPINFUNC_NMI into the resetPinFunction parameter.\r
246 //!\r
247 //! \param edgeDirection is the direction that the signal on the ~RST/NMI pin\r
248 //!        should go to signal an interrupt, if enabled.\r
249 //!        Valid values are:\r
250 //!        - \b SFR_NMI_RISINGEDGE [Default]\r
251 //!        - \b SFR_NMI_FALLINGEDGE\r
252 //!        \n Modified bits are \b SYSNMIIES of \b SFRRPCR register.\r
253 //!\r
254 //! \return None\r
255 //\r
256 //*****************************************************************************\r
257 extern void SFR_setNMIEdge(uint16_t edgeDirection);\r
258 \r
259 //*****************************************************************************\r
260 //\r
261 //! \brief Sets the function of the ~RST/NMI pin.\r
262 //!\r
263 //! This function sets the functionality of the ~RST/NMI pin, whether in reset\r
264 //! mode which will assert a reset if a low signal is observed on that pin, or\r
265 //! an NMI which will assert an interrupt from an edge of the signal dependent\r
266 //! on the setting of the edgeDirection parameter in SFR_setNMIEdge().\r
267 //!\r
268 //! \param resetPinFunction is the function that the ~RST/NMI pin should take\r
269 //!        on.\r
270 //!        Valid values are:\r
271 //!        - \b SFR_RESETPINFUNC_RESET [Default]\r
272 //!        - \b SFR_RESETPINFUNC_NMI\r
273 //!        \n Modified bits are \b SYSNMI of \b SFRRPCR register.\r
274 //!\r
275 //! \return None\r
276 //\r
277 //*****************************************************************************\r
278 extern void SFR_setResetNMIPinFunction(uint8_t resetPinFunction);\r
279 \r
280 //*****************************************************************************\r
281 //\r
282 // Mark the end of the C bindings section for C++ compilers.\r
283 //\r
284 //*****************************************************************************\r
285 #ifdef __cplusplus\r
286 }\r
287 #endif\r
288 \r
289 #endif\r
290 #endif // __MSP430WARE_SFR_H__\r