1 /*
2 * Copyright (c) 2012 - 2024, Nordic Semiconductor ASA
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef NRF_NVMC_H__
35 #define NRF_NVMC_H__
36
37 #include <nrfx.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /**
44 * @defgroup nrf_nvmc_hal NVMC HAL
45 * @{
46 * @ingroup nrf_nvmc
47 * @brief Hardware access layer (HAL) for managing the Non-Volatile Memory Controller (NVMC) peripheral.
48 */
49
50 #if defined(NVMC_ERASEPAGEPARTIALCFG_DURATION_Msk) || defined(NVMC_CONFIG_WEN_PEen) || \
51 defined(__NRFX_DOXYGEN__)
52 /** @brief Symbol indicating whether the option of page partial erase is present. */
53 #define NRF_NVMC_HAS_PARTIAL_ERASE 1
54 #else
55 #define NRF_NVMC_HAS_PARTIAL_ERASE 0
56 #endif
57
58 #if defined(NVMC_CONFIGNS_WEN_Msk) || defined (__NRFX_DOXYGEN__)
59 /** @brief Symbol indicating whether NVMC has non-secure operations available. */
60 #define NRF_NVMC_HAS_NON_SECURE_OPERATIONS 1
61 #else
62 #define NRF_NVMC_HAS_NON_SECURE_OPERATIONS 0
63 #endif
64
65 #if defined(NVMC_ERASEUICR_ERASEUICR_Msk) || defined (__NRFX_DOXYGEN__)
66 /** @brief Symbol indicating whether NVMC has UICR erase available. */
67 #define NRF_NVMC_HAS_UICR_ERASE 1
68 #else
69 #define NRF_NVMC_HAS_UICR_ERASE 0
70 #endif
71
72 /** @brief NVMC modes. */
73 typedef enum
74 {
75 NRF_NVMC_MODE_READONLY = NVMC_CONFIG_WEN_Ren, ///< NVMC in read-only mode.
76 NRF_NVMC_MODE_WRITE = NVMC_CONFIG_WEN_Wen, ///< NVMC in read and write mode.
77 NRF_NVMC_MODE_ERASE = NVMC_CONFIG_WEN_Een, ///< NVMC in read and erase mode.
78 #if defined(NVMC_CONFIG_WEN_PEen)
79 NRF_NVMC_MODE_PARTIAL_ERASE = NVMC_CONFIG_WEN_PEen ///< NVMC in read and partial erase mode.
80 #endif
81 } nrf_nvmc_mode_t;
82
83 #if NRF_NVMC_HAS_NON_SECURE_OPERATIONS
84 /** @brief Non-secure NVMC modes. */
85 typedef enum
86 {
87 NRF_NVMC_NS_MODE_READONLY = NVMC_CONFIGNS_WEN_Ren, ///< Non-secure NVMC in read-only mode.
88 NRF_NVMC_NS_MODE_WRITE = NVMC_CONFIGNS_WEN_Wen, ///< Non-secure NVMC in read and write mode.
89 NRF_NVMC_NS_MODE_ERASE = NVMC_CONFIGNS_WEN_Een, ///< Non-secure NVMC in read and erase mode.
90 } nrf_nvmc_ns_mode_t;
91 #endif
92
93 #if defined(NVMC_FEATURE_CACHE_PRESENT)
94 /** @brief NVMC ICache configuration. */
95 typedef enum
96 {
97 NRF_NVMC_ICACHE_DISABLE = NVMC_ICACHECNF_CACHEEN_Disabled, ///< Instruction Cache disabled.
98 NRF_NVMC_ICACHE_ENABLE = NVMC_ICACHECNF_CACHEEN_Enabled, ///< Instruction Cache enabled.
99 NRF_NVMC_ICACHE_ENABLE_WITH_PROFILING = NVMC_ICACHECNF_CACHEEN_Enabled | ///< Instruction Cache with cache profiling enabled.
100 NVMC_ICACHECNF_CACHEPROFEN_Msk
101 } nrf_nvmc_icache_config_t;
102 #endif // defined(NVMC_FEATURE_CACHE_PRESENT)
103
104 /**
105 * @brief Function for checking if NVMC is ready to perform write or erase operation.
106 *
107 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
108 *
109 * @retval true NVMC can perform write or erase.
110 * @retval false NVMC is busy and cannot perform next operation yet.
111 */
112 NRF_STATIC_INLINE bool nrf_nvmc_ready_check(NRF_NVMC_Type const * p_reg);
113
114 #if defined(NVMC_READYNEXT_READYNEXT_Msk) || defined(__NRFX_DOXYGEN__)
115 /**
116 * @brief Function for checking if NVMC is ready to accept the next write operation.
117 *
118 * NVM writing time can be reduced by using this function.
119 *
120 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
121 *
122 * @retval true NVMC can accept the next write. It will be buffered and will be taken
123 * into account as soon as the ongoing write operation is completed.
124 * @retval false NVMC is busy and cannot accept the next write yet.
125 */
126 NRF_STATIC_INLINE bool nrf_nvmc_write_ready_check(NRF_NVMC_Type const * p_reg);
127 #endif // defined(NVMC_READYNEXT_READYNEXT_Msk) || defined(__NRFX_DOXYGEN__)
128
129 /**
130 * @brief Function for setting the NVMC mode.
131 *
132 * Only activate erase and write modes when they are actively used.
133 * If Instruction Cache (ICache) is present, enabling write or erase will
134 * invalidate the cache and keep it invalidated.
135 *
136 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
137 * @param[in] mode Desired operating mode for NVMC.
138 */
139 NRF_STATIC_INLINE void nrf_nvmc_mode_set(NRF_NVMC_Type * p_reg,
140 nrf_nvmc_mode_t mode);
141
142 #if NRF_NVMC_HAS_NON_SECURE_OPERATIONS
143 /**
144 * @brief Function for setting the NVMC mode for non-secure Flash page operations.
145 *
146 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
147 * @param[in] mode Desired operating mode for NVMC.
148 */
149 NRF_STATIC_INLINE void nrf_nvmc_nonsecure_mode_set(NRF_NVMC_Type * p_reg,
150 nrf_nvmc_ns_mode_t mode);
151 #endif
152
153 /**
154 * @brief Function for writing a 32-bit word to flash.
155 *
156 * @note Before calling this function, the caller must ensure that:
157 * - the @p address is word-aligned,
158 * - write mode is enabled, using @ref nrf_nvmc_mode_set,
159 * - the NVMC is ready to accept another write, using
160 * @ref nrf_nvmc_ready_check or @ref nrf_nvmc_write_ready_check,
161 * - read-only mode is enabled as soon as writing is no longer needed,
162 * using @ref nrf_nvmc_mode_set.
163 *
164 * @warning It is recommended to use @ref nrfx_nvmc_word_write function instead.
165 *
166 * Using this function when accessing the flash gives the possibility
167 * to run the code in an environment where the flash is simulated.
168 *
169 * @param[in] address Address of the word to write.
170 * @param[in] value Value to write.
171 */
172 NRF_STATIC_INLINE void nrf_nvmc_word_write(uint32_t address,
173 uint32_t value);
174
175 /**
176 * @brief Function for reading a byte from the flash.
177 *
178 * Using this function when accessing the flash gives the possibility
179 * to run the code in an environment where the flash is simulated.
180 *
181 * @param[in] address Address of the byte to read.
182 *
183 * @return Value read from flash.
184 */
185 NRF_STATIC_INLINE uint8_t nrf_nvmc_byte_read(uint32_t address);
186
187 /**
188 * @brief Function for reading a 16-bit halfword from the flash.
189 *
190 * Using this function when accessing the flash gives the possibility
191 * to run the code in an environment where the flash is simulated.
192 *
193 * @param[in] address Address of the halfword to read.
194 *
195 * @return Value read from flash.
196 */
197 NRF_STATIC_INLINE uint16_t nrf_nvmc_halfword_read(uint32_t address);
198
199 /**
200 * @brief Function for reading a 32-bit word from the flash.
201 *
202 * Using this function when accessing the flash gives the possibility
203 * to run the code in an environment where the flash is simulated.
204 *
205 * @param[in] address Address of the word to read.
206 *
207 * @return Value read from flash.
208 */
209 NRF_STATIC_INLINE uint32_t nrf_nvmc_word_read(uint32_t address);
210
211 /**
212 * @brief Function for reading a given number of bytes from the flash into the specified buffer.
213 *
214 * Using this function when accessing the flash gives the possibility
215 * to run the code in an environment where the flash is simulated.
216 *
217 * @param[in] dst Pointer to the buffer to store the data.
218 * @param[in] address Address of the first byte to read.
219 * @param[in] num_bytes Number of bytes to read.
220 *
221 */
222 NRF_STATIC_INLINE void nrf_nvmc_buffer_read(void * dst,
223 uint32_t address,
224 uint32_t num_bytes);
225
226 /**
227 * @brief Function for starting a single page erase in the Flash memory.
228 *
229 * The NVMC mode must be correctly configured with @ref nrf_nvmc_mode_set
230 * before starting the erase operation.
231 *
232 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
233 * @param[in] page_addr Address of the first word of the page to erase.
234 */
235 NRF_STATIC_INLINE void nrf_nvmc_page_erase_start(NRF_NVMC_Type * p_reg,
236 uint32_t page_addr);
237
238 #if NRF_NVMC_HAS_UICR_ERASE
239 /**
240 * @brief Function for starting the user information configuration registers (UICR) erase.
241 *
242 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
243 */
244 NRF_STATIC_INLINE void nrf_nvmc_uicr_erase_start(NRF_NVMC_Type * p_reg);
245 #endif
246
247 /**
248 * @brief Function for starting the erase of the whole NVM, including UICR.
249 *
250 * This function purges all user code.
251 *
252 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
253 */
254 NRF_STATIC_INLINE void nrf_nvmc_erase_all_start(NRF_NVMC_Type * p_reg);
255
256 #if NRF_NVMC_HAS_PARTIAL_ERASE
257 /**
258 * @brief Function for configuring the page partial erase duration in milliseconds.
259 *
260 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
261 * @param[in] duration_ms Page partial erase duration in milliseconds.
262 */
263 NRF_STATIC_INLINE void nrf_nvmc_partial_erase_duration_set(NRF_NVMC_Type * p_reg,
264 uint32_t duration_ms);
265
266 /**
267 * @brief Function for getting the current setting for the page partial erase duration.
268 *
269 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
270 *
271 * @retval Interval duration setting in milliseconds.
272 */
273 NRF_STATIC_INLINE uint32_t nrf_nvmc_partial_erase_duration_get(NRF_NVMC_Type const * p_reg);
274
275 /**
276 * @brief Function for starting a partial erase operation.
277 *
278 * It must be called successively until the page erase time is reached.
279 *
280 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
281 * @param[in] page_addr Address of the first word of the page to erase.
282 */
283 NRF_STATIC_INLINE void nrf_nvmc_page_partial_erase_start(NRF_NVMC_Type * p_reg,
284 uint32_t page_addr);
285 #endif // NRF_NVMC_HAS_PARTIAL_ERASE
286
287 #if defined(NVMC_FEATURE_CACHE_PRESENT)
288 /**
289 * @brief Function for applying the Instruction Cache (ICache) configuration.
290 *
291 * Enabling the cache can increase CPU performance and reduce power
292 * consumption by reducing the number of wait cycles and the number
293 * of flash accesses.
294 *
295 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
296 * @param[in] config ICache configuration.
297 */
298 NRF_STATIC_INLINE void nrf_nvmc_icache_config_set(NRF_NVMC_Type * p_reg,
299 nrf_nvmc_icache_config_t config);
300
301 /**
302 * @brief Function for checking if ICache is enabled.
303 *
304 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
305 *
306 * @retval true ICache enabled.
307 * @retval false ICache disabled.
308 */
309 NRF_STATIC_INLINE bool nrf_nvmc_icache_enable_check(NRF_NVMC_Type const * p_reg);
310
311 /**
312 * @brief Function for checking if the ICache profiling option is enabled.
313 *
314 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
315 *
316 * @retval true ICache profiling enabled.
317 * @retval false ICache profiling disabled.
318 */
319 NRF_STATIC_INLINE bool nrf_nvmc_icache_profiling_enable_check(NRF_NVMC_Type const * p_reg);
320
321 /**
322 * @brief Function for getting the number of ICache hits.
323 *
324 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
325 *
326 * @retval Number of the ICache hits.
327 */
328 NRF_STATIC_INLINE uint32_t nrf_nvmc_icache_hit_get(NRF_NVMC_Type const * p_reg);
329
330 /**
331 * @brief Function for getting the number of ICache misses.
332 *
333 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
334 *
335 * @retval Number of the ICache misses.
336 */
337 NRF_STATIC_INLINE uint32_t nrf_nvmc_icache_miss_get(NRF_NVMC_Type const * p_reg);
338
339 /**
340 * @brief Function for resetting the ICache hit and miss counters.
341 *
342 * @param[in] p_reg Pointer to the structure of registers of the peripheral.
343 */
344 NRF_STATIC_INLINE void nrf_nvmc_icache_hit_miss_reset(NRF_NVMC_Type * p_reg);
345 #endif // defined(NVMC_FEATURE_CACHE_PRESENT)
346
347 #ifndef NRF_DECLARE_ONLY
348
nrf_nvmc_ready_check(NRF_NVMC_Type const * p_reg)349 NRF_STATIC_INLINE bool nrf_nvmc_ready_check(NRF_NVMC_Type const * p_reg)
350 {
351 return (bool)(p_reg->READY & NVMC_READY_READY_Msk);
352 }
353
354 #if defined(NVMC_READYNEXT_READYNEXT_Msk)
nrf_nvmc_write_ready_check(NRF_NVMC_Type const * p_reg)355 NRF_STATIC_INLINE bool nrf_nvmc_write_ready_check(NRF_NVMC_Type const * p_reg)
356 {
357 return (bool)(p_reg->READYNEXT & NVMC_READYNEXT_READYNEXT_Msk);
358 }
359 #endif
360
nrf_nvmc_mode_set(NRF_NVMC_Type * p_reg,nrf_nvmc_mode_t mode)361 NRF_STATIC_INLINE void nrf_nvmc_mode_set(NRF_NVMC_Type * p_reg,
362 nrf_nvmc_mode_t mode)
363 {
364 p_reg->CONFIG = (uint32_t)mode;
365 }
366
367 #if NRF_NVMC_HAS_NON_SECURE_OPERATIONS
nrf_nvmc_nonsecure_mode_set(NRF_NVMC_Type * p_reg,nrf_nvmc_ns_mode_t mode)368 NRF_STATIC_INLINE void nrf_nvmc_nonsecure_mode_set(NRF_NVMC_Type * p_reg,
369 nrf_nvmc_ns_mode_t mode)
370 {
371 p_reg->CONFIGNS = (uint32_t)mode;
372 }
373 #endif
374
nrf_nvmc_word_write(uint32_t address,uint32_t value)375 NRF_STATIC_INLINE void nrf_nvmc_word_write(uint32_t address,
376 uint32_t value)
377 {
378 *(volatile uint32_t *)address = value;
379 }
380
nrf_nvmc_byte_read(uint32_t address)381 NRF_STATIC_INLINE uint8_t nrf_nvmc_byte_read(uint32_t address)
382 {
383 return *(volatile uint8_t *)address;
384 }
385
nrf_nvmc_halfword_read(uint32_t address)386 NRF_STATIC_INLINE uint16_t nrf_nvmc_halfword_read(uint32_t address)
387 {
388 return *(volatile uint16_t *)address;
389 }
390
nrf_nvmc_word_read(uint32_t address)391 NRF_STATIC_INLINE uint32_t nrf_nvmc_word_read(uint32_t address)
392 {
393 return *(volatile uint32_t *)address;
394 }
395
nrf_nvmc_buffer_read(void * dst,uint32_t address,uint32_t num_bytes)396 NRF_STATIC_INLINE void nrf_nvmc_buffer_read(void * dst,
397 uint32_t address,
398 uint32_t num_bytes)
399 {
400 memcpy(dst, (void *)address, num_bytes);
401 }
402
nrf_nvmc_page_erase_start(NRF_NVMC_Type * p_reg,uint32_t page_addr)403 NRF_STATIC_INLINE void nrf_nvmc_page_erase_start(NRF_NVMC_Type * p_reg,
404 uint32_t page_addr)
405 {
406 #if defined(NRF51)
407 /* On nRF51, the code area can be divided into two regions: CR0 and CR1.
408 * The length of CR0 is specified in the CLENR0 register of UICR.
409 * If CLENR0 contains the 0xFFFFFFFF value, CR0 is not set.
410 * Moreover, the page from CR0 can be written or erased only from code
411 * running in CR0.*/
412 uint32_t cr0_len = NRF_UICR->CLENR0 == 0xFFFFFFFF ? 0 : NRF_UICR->CLENR0;
413 if (page_addr < cr0_len)
414 {
415 p_reg->ERASEPCR0 = page_addr;
416 }
417 else
418 {
419 p_reg->ERASEPCR1 = page_addr;
420 }
421 #elif defined(NRF52_SERIES)
422 p_reg->ERASEPAGE = page_addr;
423 #elif defined(NRF53_SERIES) || defined(NRF91_SERIES)
424 *(volatile uint32_t *)page_addr = 0xFFFFFFFF;
425 (void)p_reg;
426 #else
427 #error "Unknown device."
428 #endif
429 }
430
431 #if NRF_NVMC_HAS_UICR_ERASE
nrf_nvmc_uicr_erase_start(NRF_NVMC_Type * p_reg)432 NRF_STATIC_INLINE void nrf_nvmc_uicr_erase_start(NRF_NVMC_Type * p_reg)
433 {
434 p_reg->ERASEUICR = 1;
435 }
436 #endif
437
nrf_nvmc_erase_all_start(NRF_NVMC_Type * p_reg)438 NRF_STATIC_INLINE void nrf_nvmc_erase_all_start(NRF_NVMC_Type * p_reg)
439 {
440 p_reg->ERASEALL = 1;
441 }
442
443 #if NRF_NVMC_HAS_PARTIAL_ERASE
nrf_nvmc_partial_erase_duration_set(NRF_NVMC_Type * p_reg,uint32_t duration_ms)444 NRF_STATIC_INLINE void nrf_nvmc_partial_erase_duration_set(NRF_NVMC_Type * p_reg,
445 uint32_t duration_ms)
446 {
447 p_reg->ERASEPAGEPARTIALCFG = duration_ms;
448 }
449
nrf_nvmc_partial_erase_duration_get(NRF_NVMC_Type const * p_reg)450 NRF_STATIC_INLINE uint32_t nrf_nvmc_partial_erase_duration_get(NRF_NVMC_Type const * p_reg)
451 {
452 return p_reg->ERASEPAGEPARTIALCFG;
453 }
454
nrf_nvmc_page_partial_erase_start(NRF_NVMC_Type * p_reg,uint32_t page_addr)455 NRF_STATIC_INLINE void nrf_nvmc_page_partial_erase_start(NRF_NVMC_Type * p_reg,
456 uint32_t page_addr)
457 {
458 #if defined(NVMC_ERASEPAGEPARTIAL_ERASEPAGEPARTIAL_Msk)
459 p_reg->ERASEPAGEPARTIAL = page_addr;
460 #elif defined(NRF53_SERIES) || defined(NRF91_SERIES)
461 nrf_nvmc_page_erase_start(p_reg, page_addr);
462 #else
463 #error "Unknown device."
464 #endif
465 }
466 #endif // NRF_NVMC_HAS_PARTIAL_ERASE
467
468 #if defined(NVMC_FEATURE_CACHE_PRESENT)
nrf_nvmc_icache_config_set(NRF_NVMC_Type * p_reg,nrf_nvmc_icache_config_t config)469 NRF_STATIC_INLINE void nrf_nvmc_icache_config_set(NRF_NVMC_Type * p_reg,
470 nrf_nvmc_icache_config_t config)
471 {
472 #if defined(NRF5340_XXAA_NETWORK) || defined(NRF91_SERIES)
473 // Apply workaround for the anomalies:
474 // - 6 for the nRF53.
475 // - 21 for the nRF91.
476 if (config == NRF_NVMC_ICACHE_DISABLE)
477 {
478 NRFX_CRITICAL_SECTION_ENTER();
479 __ISB();
480 p_reg->ICACHECNF = (uint32_t)NRF_NVMC_ICACHE_DISABLE;
481 __ISB();
482 NRFX_CRITICAL_SECTION_EXIT();
483 }
484 else
485 #endif
486 {
487 p_reg->ICACHECNF = (uint32_t)config;
488 }
489 }
490
nrf_nvmc_icache_enable_check(NRF_NVMC_Type const * p_reg)491 NRF_STATIC_INLINE bool nrf_nvmc_icache_enable_check(NRF_NVMC_Type const * p_reg)
492 {
493 return (bool)(p_reg->ICACHECNF & NVMC_ICACHECNF_CACHEEN_Msk);
494 }
495
nrf_nvmc_icache_profiling_enable_check(NRF_NVMC_Type const * p_reg)496 NRF_STATIC_INLINE bool nrf_nvmc_icache_profiling_enable_check(NRF_NVMC_Type const * p_reg)
497 {
498 return (bool)(p_reg->ICACHECNF & NVMC_ICACHECNF_CACHEPROFEN_Msk);
499 }
500
nrf_nvmc_icache_hit_get(NRF_NVMC_Type const * p_reg)501 NRF_STATIC_INLINE uint32_t nrf_nvmc_icache_hit_get(NRF_NVMC_Type const * p_reg)
502 {
503 return p_reg->IHIT;
504 }
505
nrf_nvmc_icache_miss_get(NRF_NVMC_Type const * p_reg)506 NRF_STATIC_INLINE uint32_t nrf_nvmc_icache_miss_get(NRF_NVMC_Type const * p_reg)
507 {
508 return p_reg->IMISS;
509 }
510
nrf_nvmc_icache_hit_miss_reset(NRF_NVMC_Type * p_reg)511 NRF_STATIC_INLINE void nrf_nvmc_icache_hit_miss_reset(NRF_NVMC_Type * p_reg)
512 {
513 p_reg->IHIT = 0;
514 p_reg->IMISS = 0;
515 }
516 #endif // defined(NVMC_FEATURE_CACHE_PRESENT)
517
518 #endif // NRF_DECLARE_ONLY
519
520 /** @} */
521
522 #ifdef __cplusplus
523 }
524 #endif
525
526 #endif // NRF_NVMC_H__
527