MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.91.13.01
framctl_a.h
1 //*****************************************************************************
2 //
3 // framctl_a.h - Driver for the FRAMCTL_A Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_FRAMCTL_A_H__
8 #define __MSP430WARE_FRAMCTL_A_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_FRCTL_A__
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: FRAMCtl_A_enableInterrupt(), and
29 // FRAMCtl_A_disableInterrupt().
30 //
31 //*****************************************************************************
32 #define FRAMCTL_A_PUC_ON_UNCORRECTABLE_BIT UBDRSTEN
33 #define FRAMCTL_A_UNCORRECTABLE_BIT_INTERRUPT UBDIE
34 #define FRAMCTL_A_CORRECTABLE_BIT_INTERRUPT CBDIE
35 #define FRAMCTL_A_ACCESS_TIME_ERROR_INTERRUPT ACCTEIE
36 #define FRAMCTL_A_WRITE_PROTECTION_INTERRUPT WPIE
37 
38 //*****************************************************************************
39 //
40 // The following are values that can be passed to the interruptFlagMask
41 // parameter for functions: FRAMCtl_A_getInterruptStatus(), and
42 // FRAMCtl_A_clearInterrupt() as well as returned by the
43 // FRAMCtl_A_getInterruptStatus() function.
44 //
45 //*****************************************************************************
46 #define FRAMCTL_A_ACCESS_TIME_ERROR_FLAG ACCTEIFG
47 #define FRAMCTL_A_UNCORRECTABLE_BIT_FLAG UBDIFG
48 #define FRAMCTL_A_CORRECTABLE_BIT_FLAG CBDIFG
49 #define FRAMCTL_A_WRITE_PROTECTION_FLAG WPIFG
50 
51 //*****************************************************************************
52 //
53 // The following are values that can be passed to the waitState parameter for
54 // functions: FRAMCtl_A_configureWaitStateControl().
55 //
56 //*****************************************************************************
57 #define FRAMCTL_A_ACCESS_TIME_CYCLES_0 NWAITS_0
58 #define FRAMCTL_A_ACCESS_TIME_CYCLES_1 NWAITS_1
59 #define FRAMCTL_A_ACCESS_TIME_CYCLES_2 NWAITS_2
60 #define FRAMCTL_A_ACCESS_TIME_CYCLES_3 NWAITS_3
61 #define FRAMCTL_A_ACCESS_TIME_CYCLES_4 NWAITS_4
62 #define FRAMCTL_A_ACCESS_TIME_CYCLES_5 NWAITS_5
63 #define FRAMCTL_A_ACCESS_TIME_CYCLES_6 NWAITS_6
64 #define FRAMCTL_A_ACCESS_TIME_CYCLES_7 NWAITS_7
65 #define FRAMCTL_A_ACCESS_TIME_CYCLES_8 NWAITS_8
66 #define FRAMCTL_A_ACCESS_TIME_CYCLES_9 NWAITS_9
67 #define FRAMCTL_A_ACCESS_TIME_CYCLES_10 NWAITS_10
68 #define FRAMCTL_A_ACCESS_TIME_CYCLES_11 NWAITS_11
69 #define FRAMCTL_A_ACCESS_TIME_CYCLES_12 NWAITS_12
70 #define FRAMCTL_A_ACCESS_TIME_CYCLES_13 NWAITS_13
71 #define FRAMCTL_A_ACCESS_TIME_CYCLES_14 NWAITS_14
72 #define FRAMCTL_A_ACCESS_TIME_CYCLES_15 NWAITS_15
73 
74 //*****************************************************************************
75 //
76 // The following are values that can be passed to the delayStatus parameter for
77 // functions: FRAMCtl_A_delayPowerUpFromLPM().
78 //
79 //*****************************************************************************
80 #define FRAMCTL_A_DELAY_FROM_LPM_ENABLE 0x00
81 #define FRAMCTL_A_DELAY_FROM_LPM_DISABLE FRPWR
82 
83 //*****************************************************************************
84 //
85 // Prototypes for the APIs.
86 //
87 //*****************************************************************************
88 
89 //*****************************************************************************
90 //
91 //! \brief Write data into the fram memory in byte format.
92 //!
93 //! \param dataPtr is the pointer to the data to be written
94 //! \param framPtr is the pointer into which to write the data
95 //! \param numberOfBytes is the number of bytes to be written
96 //!
97 //! \return None
98 //
99 //*****************************************************************************
100 extern void FRAMCtl_A_write8(uint8_t *dataPtr,
101  uint8_t *framPtr,
102  uint16_t numberOfBytes);
103 
104 //*****************************************************************************
105 //
106 //! \brief Write data into the fram memory in word format.
107 //!
108 //! \param dataPtr is the pointer to the data to be written
109 //! \param framPtr is the pointer into which to write the data
110 //! \param numberOfWords is the number of words to be written
111 //!
112 //! \return None
113 //
114 //*****************************************************************************
115 extern void FRAMCtl_A_write16(uint16_t *dataPtr,
116  uint16_t *framPtr,
117  uint16_t numberOfWords);
118 
119 //*****************************************************************************
120 //
121 //! \brief Write data into the fram memory in long format, pass by reference
122 //!
123 //! \param dataPtr is the pointer to the data to be written
124 //! \param framPtr is the pointer into which to write the data
125 //! \param count is the number of 32 bit words to be written
126 //!
127 //! \return None
128 //
129 //*****************************************************************************
130 extern void FRAMCtl_A_write32(uint32_t *dataPtr,
131  uint32_t *framPtr,
132  uint16_t count);
133 
134 //*****************************************************************************
135 //
136 //! \brief Write data into the fram memory in long format, pass by value
137 //!
138 //! \param value is the value to written to FRAMCTL_A memory
139 //! \param framPtr is the pointer into which to write the data
140 //! \param count is the number of 32 bit addresses to fill
141 //!
142 //! \return None
143 //
144 //*****************************************************************************
145 extern void FRAMCtl_A_fillMemory32(uint32_t value,
146  uint32_t *framPtr,
147  uint16_t count);
148 
149 //*****************************************************************************
150 //
151 //! \brief Enables selected FRAMCtl_A interrupt sources.
152 //!
153 //! Enables the indicated FRAMCtl_A interrupt sources. Only the sources that
154 //! are enabled can be reflected to the processor interrupt; disabled sources
155 //! have no effect on the processor. Does not clear interrupt flags.
156 //!
157 //! \param interruptMask is the bit mask of the memory buffer interrupt sources
158 //! to be disabled.
159 //! Mask value is the logical OR of any of the following:
160 //! - \b FRAMCTL_A_PUC_ON_UNCORRECTABLE_BIT - Enable PUC reset if
161 //! FRAMCtl_A uncorrectable bit error detected.
162 //! - \b FRAMCTL_A_UNCORRECTABLE_BIT_INTERRUPT - Interrupts when an
163 //! uncorrectable bit error is detected.
164 //! - \b FRAMCTL_A_CORRECTABLE_BIT_INTERRUPT - Interrupts when a
165 //! correctable bit error is detected.
166 //! - \b FRAMCTL_A_ACCESS_TIME_ERROR_INTERRUPT - Interrupts when an
167 //! access time error occurs.
168 //! - \b FRAMCTL_A_WRITE_PROTECTION_INTERRUPT - Interrupts when
169 //! detecting a write access to FRAM.
170 //!
171 //! Modified bits of \b GCCTL0 register and bits of \b FRCTL0 register.
172 //!
173 //! \return None
174 //
175 //*****************************************************************************
176 extern void FRAMCtl_A_enableInterrupt(uint8_t interruptMask);
177 
178 //*****************************************************************************
179 //
180 //! \brief Returns the status of the selected FRAMCtl_A interrupt flags.
181 //!
182 //! \param interruptFlagMask is a bit mask of the interrupt flags status to be
183 //! returned.
184 //! Mask value is the logical OR of any of the following:
185 //! - \b FRAMCTL_A_ACCESS_TIME_ERROR_FLAG - Interrupt flag is set if a
186 //! wrong setting for NPRECHG and NACCESS is set and FRAMCtl_A access
187 //! time is not hold.
188 //! - \b FRAMCTL_A_UNCORRECTABLE_BIT_FLAG - Interrupt flag is set if an
189 //! uncorrectable bit error has been detected in the FRAMCtl_A memory
190 //! error detection logic.
191 //! - \b FRAMCTL_A_CORRECTABLE_BIT_FLAG - Interrupt flag is set if a
192 //! correctable bit error has been detected and corrected in the
193 //! FRAMCtl_A memory error detection logic.
194 //! - \b FRAMCTL_A_WRITE_PROTECTION_FLAG - Interrupt flag is set if a
195 //! write access to FRAM memory
196 //!
197 //! \return Logical OR of any of the following:
198 //! - \b FRAMCTL_A_ACCESS_TIME_ERROR_FLAG Interrupt flag is set if a
199 //! wrong setting for NPRECHG and NACCESS is set and FRAMCtl_A access
200 //! time is not hold.
201 //! - \b FRAMCTL_A_UNCORRECTABLE_BIT_FLAG Interrupt flag is set if an
202 //! uncorrectable bit error has been detected in the FRAMCtl_A memory
203 //! error detection logic.
204 //! - \b FRAMCTL_A_CORRECTABLE_BIT_FLAG Interrupt flag is set if a
205 //! correctable bit error has been detected and corrected in the
206 //! FRAMCtl_A memory error detection logic.
207 //! - \b FRAMCTL_A_WRITE_PROTECTION_FLAG Interrupt flag is set if a
208 //! write access to FRAM memory
209 //! \n indicating the status of the masked flags
210 //
211 //*****************************************************************************
212 extern uint8_t FRAMCtl_A_getInterruptStatus(uint16_t interruptFlagMask);
213 
214 //*****************************************************************************
215 //
216 //! \brief Disables selected FRAMCtl_A interrupt sources.
217 //!
218 //! Disables the indicated FRAMCtl_A interrupt sources. Only the sources that
219 //! are enabled can be reflected to the processor interrupt; disabled sources
220 //! have no effect on the processor.
221 //!
222 //! \param interruptMask is the bit mask of the memory buffer interrupt sources
223 //! to be disabled.
224 //! Mask value is the logical OR of any of the following:
225 //! - \b FRAMCTL_A_PUC_ON_UNCORRECTABLE_BIT - Enable PUC reset if
226 //! FRAMCtl_A uncorrectable bit error detected.
227 //! - \b FRAMCTL_A_UNCORRECTABLE_BIT_INTERRUPT - Interrupts when an
228 //! uncorrectable bit error is detected.
229 //! - \b FRAMCTL_A_CORRECTABLE_BIT_INTERRUPT - Interrupts when a
230 //! correctable bit error is detected.
231 //! - \b FRAMCTL_A_ACCESS_TIME_ERROR_INTERRUPT - Interrupts when an
232 //! access time error occurs.
233 //! - \b FRAMCTL_A_WRITE_PROTECTION_INTERRUPT - Interrupts when
234 //! detecting a write access to FRAM.
235 //!
236 //! \return None
237 //
238 //*****************************************************************************
239 extern void FRAMCtl_A_disableInterrupt(uint16_t interruptMask);
240 
241 //*****************************************************************************
242 //
243 //! \brief Clears selected FRAMCtl_A interrupt status flag.
244 //!
245 //! Clears the indicated FRAMCtl_A interrupt status flag. These interrupt
246 //! status flag can also be cleared through reading the system reset vector
247 //! word SYSRSTIV.
248 //!
249 //! \param interruptFlagMask is a bit mask of the interrupt flags status to be
250 //! cleared.
251 //! Mask value is the logical OR of any of the following:
252 //! - \b FRAMCTL_A_ACCESS_TIME_ERROR_FLAG - Interrupt flag is set if a
253 //! wrong setting for NPRECHG and NACCESS is set and FRAMCtl_A access
254 //! time is not hold.
255 //! - \b FRAMCTL_A_UNCORRECTABLE_BIT_FLAG - Interrupt flag is set if an
256 //! uncorrectable bit error has been detected in the FRAMCtl_A memory
257 //! error detection logic.
258 //! - \b FRAMCTL_A_CORRECTABLE_BIT_FLAG - Interrupt flag is set if a
259 //! correctable bit error has been detected and corrected in the
260 //! FRAMCtl_A memory error detection logic.
261 //! - \b FRAMCTL_A_WRITE_PROTECTION_FLAG - Interrupt flag is set if a
262 //! write access to FRAM memory
263 //!
264 //! \return None
265 //
266 //*****************************************************************************
267 extern void FRAMCtl_A_clearInterrupt(uint16_t interruptFlagMask);
268 
269 //*****************************************************************************
270 //
271 //! \brief Configures the access time of the FRAMCtl_A module
272 //!
273 //! Configures the access time of the FRAMCtl_A module.
274 //!
275 //! \param waitState defines the number of CPU cycles required for access time
276 //! defined in the datasheet
277 //! Valid values are:
278 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_0
279 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_1
280 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_2
281 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_3
282 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_4
283 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_5
284 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_6
285 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_7
286 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_8
287 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_9
288 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_10
289 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_11
290 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_12
291 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_13
292 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_14
293 //! - \b FRAMCTL_A_ACCESS_TIME_CYCLES_15
294 //!
295 //! Modified bits are \b NWAITS of \b GCCTL0 register.
296 //!
297 //! \return None
298 //
299 //*****************************************************************************
300 extern void FRAMCtl_A_configureWaitStateControl(uint8_t waitState);
301 
302 //*****************************************************************************
303 //
304 //! \brief Configures when the FRAMCtl_A module will power up after LPM exit
305 //!
306 //! Configures when the FRAMCtl_A module will power up after LPM exit. The
307 //! module can either wait until the first FRAM access to power up or power up
308 //! immediately after leaving LPM. If FRAM power is disabled, the FRAM memory
309 //! remains in inactive mode until the FRAM memory is actually accessed. If
310 //! FRAM power is enabled, the FRAM wil be immediately powered up (active
311 //! mode).
312 //!
313 //! \param delayStatus chooses if FRAMCTL_A should power up instantly with LPM
314 //! exit or to wait until first FRAMCTL_A access after LPM exit
315 //! Valid values are:
316 //! - \b FRAMCTL_A_DELAY_FROM_LPM_ENABLE
317 //! - \b FRAMCTL_A_DELAY_FROM_LPM_DISABLE
318 //!
319 //! \return None
320 //
321 //*****************************************************************************
322 extern void FRAMCtl_A_delayPowerUpFromLPM(uint8_t delayStatus);
323 
324 //*****************************************************************************
325 //
326 //! \brief Enables FRAM write protection
327 //!
328 //! This function enables FRAM write protection and protect entire FRAM memory
329 //! from unintended write. It should be used as temporary protection. The
330 //! permanent FRAM memory protection should be done via MPU segments related
331 //! APIs.
332 //!
333 //!
334 //! Modified bits are \b WPROT of \b FRCTL0 register.
335 //!
336 //! \return None
337 //
338 //*****************************************************************************
339 extern void FRAMCtl_A_enableWriteProtection(void);
340 
341 //*****************************************************************************
342 //
343 //! \brief Disables FRAM write protection
344 //!
345 //! Disables the FRAM write protection. Writing to FRAM memory is allowed.
346 //!
347 //!
348 //! Modified bits are \b WPROT of \b FRCTL0 register.
349 //!
350 //! \return None
351 //
352 //*****************************************************************************
353 extern void FRAMCtl_A_disableWriteProtection(void);
354 
355 //*****************************************************************************
356 //
357 // Mark the end of the C bindings section for C++ compilers.
358 //
359 //*****************************************************************************
360 #ifdef __cplusplus
361 }
362 #endif
363 
364 #endif
365 #endif // __MSP430WARE_FRAMCTL_A_H__
void FRAMCtl_A_configureWaitStateControl(uint8_t waitState)
Configures the access time of the FRAMCtl_A module.
Definition: framctl_a.c:105
void FRAMCtl_A_disableWriteProtection(void)
Disables FRAM write protection.
Definition: framctl_a.c:132
void FRAMCtl_A_write32(uint32_t *dataPtr, uint32_t *framPtr, uint16_t count)
Write data into the fram memory in long format, pass by reference.
Definition: framctl_a.c:45
void FRAMCtl_A_write8(uint8_t *dataPtr, uint8_t *framPtr, uint16_t numberOfBytes)
Write data into the fram memory in byte format.
Definition: framctl_a.c:21
void FRAMCtl_A_disableInterrupt(uint16_t interruptMask)
Disables selected FRAMCtl_A interrupt sources.
Definition: framctl_a.c:85
void FRAMCtl_A_clearInterrupt(uint16_t interruptFlagMask)
Clears selected FRAMCtl_A interrupt status flag.
Definition: framctl_a.c:95
void FRAMCtl_A_enableInterrupt(uint8_t interruptMask)
Enables selected FRAMCtl_A interrupt sources.
Definition: framctl_a.c:69
void FRAMCtl_A_delayPowerUpFromLPM(uint8_t delayStatus)
Configures when the FRAMCtl_A module will power up after LPM exit.
Definition: framctl_a.c:114
void FRAMCtl_A_fillMemory32(uint32_t value, uint32_t *framPtr, uint16_t count)
Write data into the fram memory in long format, pass by value.
Definition: framctl_a.c:56
uint8_t FRAMCtl_A_getInterruptStatus(uint16_t interruptFlagMask)
Returns the status of the selected FRAMCtl_A interrupt flags.
Definition: framctl_a.c:80
void FRAMCtl_A_enableWriteProtection(void)
Enables FRAM write protection.
Definition: framctl_a.c:125
void FRAMCtl_A_write16(uint16_t *dataPtr, uint16_t *framPtr, uint16_t numberOfWords)
Write data into the fram memory in word format.
Definition: framctl_a.c:34

Copyright 2020, Texas Instruments Incorporated