1 /*
2  * Copyright (c) 2020 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef _NRF_HW_MODEL_NVMC_H
7 #define _NRF_HW_MODEL_NVMC_H
8 
9 #include "nrfx.h"
10 #include "NRF_hw_args.h"
11 #include "bs_types.h"
12 
13 #ifdef __cplusplus
14 extern "C"{
15 #endif
16 
17 #define FLASH_PAGE_SIZE (4*1024)
18 #define FLASH_N_PAGES    128
19 #define FLASH_SIZE (FLASH_N_PAGES*FLASH_PAGE_SIZE)
20 
21 #define UICR_DATA_SIZE 64 /* Words */
22 #define UICR_SIZE ( UICR_DATA_SIZE*4 )
23 
24 extern NRF_NVMC_Type NRF_NVMC_regs;
25 
26 void nrfhw_nvmc_uicr_pre_init(void);
27 void nrfhw_nvmc_uicr_init(void);
28 void nrfhw_nvmc_uicr_clean_up(void);
29 void nrfhw_nvmc_timer_triggered(void);
30 void nrfhw_nvmc_regw_sideeffects_ERASEPAGE();
31 void nrf_nvmc_regw_sideeffects_ERASEPCR0();
32 void nrfhw_nvmc_regw_sideeffects_ERASEUICR();
33 void nrfhw_nvmc_regw_sideeffects_ERASEALL();
34 void nrfhw_nvmc_regw_sideeffects_ERASEPAGEPARTIAL();
35 void nrfhw_nmvc_write_word(uint32_t address, uint32_t value);
36 uint32_t nrfhw_nmvc_read_word(uint32_t address);
37 uint16_t nrfhw_nmvc_read_halfword(uint32_t address);
38 uint8_t nrfhw_nmvc_read_byte(uint32_t address);
39 void nrfhw_nmvc_read_buffer(void *dest, uint32_t address, size_t size);
40 void* nrfhw_nmvc_flash_get_base_address(void);
41 bs_time_t nrfhw_nvmc_time_to_ready(void);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif
48