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

Copyright 2020, Texas Instruments Incorporated