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