You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/06/30 13:04:54 UTC

[mynewt-core] 03/04: hw/bsp/nrf5340: Add support for ipc flash

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 5f958495d8bf30265763e2e6a9c2f2f7bd63ed37
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Jun 23 15:51:34 2021 +0200

    hw/bsp/nrf5340: Add support for ipc flash
    
    Both APP and NET core are can now use other core flash.
---
 hw/bsp/nordic_pca10095/pkg.yml                          | 3 +++
 hw/bsp/nordic_pca10095/src/hal_bsp.c                    | 5 +++++
 hw/bsp/nordic_pca10095_net/pkg.yml                      | 1 +
 hw/bsp/nordic_pca10095_net/src/hal_bsp.c                | 5 +++++
 hw/mcu/nordic/nrf5340/include/mcu/nrf5340_hal.h         | 1 +
 hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h | 1 +
 6 files changed, 16 insertions(+)

diff --git a/hw/bsp/nordic_pca10095/pkg.yml b/hw/bsp/nordic_pca10095/pkg.yml
index aae8402..7d73ca4 100644
--- a/hw/bsp/nordic_pca10095/pkg.yml
+++ b/hw/bsp/nordic_pca10095/pkg.yml
@@ -38,5 +38,8 @@ pkg.deps:
     - "@apache-mynewt-core/libc/baselibc"
     - "@apache-mynewt-core/sys/flash_map"
 
+pkg.deps.BSP_NRF5340_NET_ENABLE:
+    - "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
+
 pkg.deps.SOFT_PWM:
     - "@apache-mynewt-core/hw/drivers/pwm/soft_pwm"
diff --git a/hw/bsp/nordic_pca10095/src/hal_bsp.c b/hw/bsp/nordic_pca10095/src/hal_bsp.c
index 38e6dde..c23347f 100644
--- a/hw/bsp/nordic_pca10095/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10095/src/hal_bsp.c
@@ -60,6 +60,11 @@ hal_bsp_flash_dev(uint8_t id)
         return &nrf5340_qspi_dev;
     }
 #endif
+#if MYNEWT_VAL(IPC_NRF5340_FLASH_CLIENT)
+    if (id == 2) {
+        return ipc_flash();
+    }
+#endif
     return NULL;
 }
 
diff --git a/hw/bsp/nordic_pca10095_net/pkg.yml b/hw/bsp/nordic_pca10095_net/pkg.yml
index 91000c7..110e694 100644
--- a/hw/bsp/nordic_pca10095_net/pkg.yml
+++ b/hw/bsp/nordic_pca10095_net/pkg.yml
@@ -34,3 +34,4 @@ pkg.deps:
     - "@apache-mynewt-core/hw/mcu/nordic/nrf5340_net"
     - "@apache-mynewt-core/libc/baselibc"
     - "@apache-mynewt-core/sys/flash_map"
+    - "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
diff --git a/hw/bsp/nordic_pca10095_net/src/hal_bsp.c b/hw/bsp/nordic_pca10095_net/src/hal_bsp.c
index 395981d..d26bce9 100644
--- a/hw/bsp/nordic_pca10095_net/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10095_net/src/hal_bsp.c
@@ -61,6 +61,11 @@ hal_bsp_flash_dev(uint8_t id)
         return &nrf5340_net_vflash_dev.nv_flash;
     }
 #endif
+#if MYNEWT_VAL(IPC_NRF5340_FLASH_CLIENT)
+    if (id == 2) {
+        return ipc_flash();
+    }
+#endif
 
     return NULL;
 }
diff --git a/hw/mcu/nordic/nrf5340/include/mcu/nrf5340_hal.h b/hw/mcu/nordic/nrf5340/include/mcu/nrf5340_hal.h
index a6015b3..ba72c5d 100644
--- a/hw/mcu/nordic/nrf5340/include/mcu/nrf5340_hal.h
+++ b/hw/mcu/nordic/nrf5340/include/mcu/nrf5340_hal.h
@@ -49,6 +49,7 @@ const struct nrf5340_uart_cfg *bsp_uart_config(void);
 struct hal_flash;
 extern const struct hal_flash nrf5340_flash_dev;
 extern const struct hal_flash nrf5340_qspi_dev;
+extern const struct hal_flash *ipc_flash(void);
 
 /* SPI configuration (used for both master and slave) */
 struct nrf5340_hal_spi_cfg {
diff --git a/hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h b/hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h
index 1fff277..3d33af6 100644
--- a/hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h
+++ b/hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h
@@ -57,6 +57,7 @@ struct nrf5340_vflash {
 extern struct nrf5340_vflash nrf5340_net_vflash_dev;
 
 extern const struct hal_flash nrf5340_flash_dev;
+extern const struct hal_flash *ipc_flash(void);
 
 /* SPI configuration (used for both master and slave) */
 struct nrf5340_net_hal_spi_cfg {