Skip to content

Commit

Permalink
hw/mcu/nordic: Add common flash HAL
Browse files Browse the repository at this point in the history
  • Loading branch information
m-gorecki committed Dec 2, 2024
1 parent 0b2a79c commit b19f333
Show file tree
Hide file tree
Showing 56 changed files with 165 additions and 1,131 deletions.
2 changes: 1 addition & 1 deletion hw/bsp/ada_feather_nrf52/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/arduino_primo_nrf52/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/bbc_microbit/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/ble400/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/bmd200/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/bmd300eval/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/calliope_mini/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/dwm1001-dev/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/fanstel-ev-bt840/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const struct hal_flash *
hal_bsp_flash_dev(uint8_t id)
{
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nina-b1/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10028-16k/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10028/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
4 changes: 2 additions & 2 deletions hw/bsp/nordic_pca10040/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static sec_data_secret struct eflash_nrf5x_dev enc_flash_dev0 = {
.efd_hal = {
.hf_itf = &enc_flash_funcs,
},
.efd_hwdev = &nrf52k_flash_dev
.efd_hwdev = &nrf_flash_dev
}
};

Expand All @@ -63,7 +63,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(ENC_FLASH_DEV)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10056/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(QSPI_ENABLE)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10059/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(QSPI_ENABLE)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10090/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf91k_flash_dev;
return &nrf_flash_dev;
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10095/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf5340_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(QSPI_ENABLE)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10095_net/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf5340_flash_dev;
return &nrf_flash_dev;
}
#if MCUBOOT_MYNEWT
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10121/net/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf5340_flash_dev;
return &nrf_flash_dev;
}
#if MCUBOOT_MYNEWT
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca10121/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf5340_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(QSPI_ENABLE)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca20020/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nordic_thingy53/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf5340_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(QSPI_ENABLE)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nrf51-arduino_101/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/nrf51-blenano/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/pinetime/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct bus_spi_node_cfg flash_spi_cfg = {

static const struct hal_flash *flash_devs[] = {
/* MCU internal flash. */
[0] = &nrf52k_flash_dev,
[0] = &nrf_flash_dev,
#if MYNEWT_VAL(SPIFLASH)
/* External SPI Flash. */
[1] = &spiflash_dev.hal,
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/puckjs/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/rb-blend2/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/rb-nano2/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/reel_board/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const struct hal_flash *
hal_bsp_flash_dev(uint8_t id)
{
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/ruuvitag_rev_b/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/telee02/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/ublox_bmd_345/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hal_bsp_flash_dev(uint8_t id)
* Internal flash mapped to id 0.
*/
if (id == 0) {
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}
#if MYNEWT_VAL(QSPI_ENABLE)
if (id == 1) {
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/vbluno51/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf51_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/vbluno52/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ hal_bsp_flash_dev(uint8_t id)
if (id != 0) {
return NULL;
}
return &nrf52k_flash_dev;
return &nrf_flash_dev;
}

const struct hal_bsp_mem_dump *
Expand Down
2 changes: 1 addition & 1 deletion hw/drivers/flash/ipc_nrf5340_flash/src/ipc_nrf5340_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ nrf5340_ipc_flash_std_resp(struct ipc_msg *req, int rc, void *data, uint32_t dat
static int
nrf5340_ipc_flash_info_resp(struct ipc_msg *req)
{
return nrf5340_ipc_flash_std_resp(req, 0, (void *)&nrf5340_flash_dev, sizeof(nrf5340_flash_dev));
return nrf5340_ipc_flash_std_resp(req, 0, (void *)&nrf_flash_dev, sizeof(nrf_flash_dev));
}

static int
Expand Down
4 changes: 1 addition & 3 deletions hw/mcu/nordic/nrf51xxx/include/mcu/nrf51_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct nrf51_uart_cfg {
int8_t suc_pin_rts;
int8_t suc_pin_cts;
};

const struct nrf51_uart_cfg *bsp_uart_config(void);

struct nrf51_hal_i2c_cfg {
Expand All @@ -48,9 +49,6 @@ struct nrf51_hal_spi_cfg {
uint8_t ss_pin;
};

struct hal_flash;
extern const struct hal_flash nrf51_flash_dev;

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions hw/mcu/nordic/nrf51xxx/include/nrfx_config_nrf51.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#define NRFX_UART_ENABLED 0
#define NRFX_UART0_ENABLED 0
#define NRFX_WDT_ENABLED 0
#define NRFX_NVMC_ENABLED 1

#if MYNEWT_VAL(ADC_0)
#define NRFX_ADC_ENABLED 1
Expand Down
Loading

0 comments on commit b19f333

Please sign in to comment.