You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2016/11/04 23:07:23 UTC

incubator-mynewt-core git commit: MYNEWT-474 NRF51 and NRF52 fix HAL flash en/dis

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 7d080f729 -> 1191f1e52


MYNEWT-474 NRF51 and NRF52 fix HAL flash en/dis

- It was treating the NVMC_CONFIG register as being bitfield but it is a
  value register instead, not sure if this fixes anything but it surely
  makes it explicit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/1191f1e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/1191f1e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/1191f1e5

Branch: refs/heads/develop
Commit: 1191f1e5214d241105193945b3a1fe975cf9d89b
Parents: 7d080f7
Author: Vipul Rahane <vi...@apache.org>
Authored: Fri Nov 4 15:43:32 2016 -0700
Committer: Vipul Rahane <vi...@apache.org>
Committed: Fri Nov 4 16:07:16 2016 -0700

----------------------------------------------------------------------
 hw/mcu/nordic/nrf51xxx/src/hal_flash.c | 8 ++++----
 hw/mcu/nordic/nrf52xxx/src/hal_flash.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1191f1e5/hw/mcu/nordic/nrf51xxx/src/hal_flash.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_flash.c b/hw/mcu/nordic/nrf51xxx/src/hal_flash.c
index ac3159c..43004d8 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_flash.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_flash.c
@@ -88,7 +88,7 @@ nrf51_flash_write(uint32_t address, const void *src, uint32_t num_bytes)
         return -1;
     }
     __HAL_DISABLE_INTERRUPTS(sr);
-    NRF_NVMC->CONFIG |= NVMC_CONFIG_WEN_Wen; /* Enable erase OP */
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; /* Enable erase OP */
     tmp = address & 0x3;
     if (tmp) {
         if (nrf51_flash_wait_ready()) {
@@ -139,7 +139,7 @@ nrf51_flash_write(uint32_t address, const void *src, uint32_t num_bytes)
         goto out;
     }
 out:
-    NRF_NVMC->CONFIG &= ~NVMC_CONFIG_WEN_Wen;
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
     __HAL_ENABLE_INTERRUPTS(sr);
     return rc;
 }
@@ -154,7 +154,7 @@ nrf51_flash_erase_sector(uint32_t sector_address)
         return -1;
     }
     __HAL_DISABLE_INTERRUPTS(sr);
-    NRF_NVMC->CONFIG |= NVMC_CONFIG_WEN_Een; /* Enable erase OP */
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een; /* Enable erase OP */
     if (nrf51_flash_wait_ready()) {
         goto out;
     }
@@ -165,7 +165,7 @@ nrf51_flash_erase_sector(uint32_t sector_address)
     }
     rc = 0;
 out:
-    NRF_NVMC->CONFIG &= ~NVMC_CONFIG_WEN_Een; /* Disable erase OP */
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; /* Disable erase OP */
     __HAL_ENABLE_INTERRUPTS(sr);
     return rc;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/1191f1e5/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_flash.c b/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
index 197c404..c727581 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_flash.c
@@ -88,7 +88,7 @@ nrf52k_flash_write(uint32_t address, const void *src, uint32_t num_bytes)
         return -1;
     }
     __HAL_DISABLE_INTERRUPTS(sr);
-    NRF_NVMC->CONFIG |= NVMC_CONFIG_WEN_Wen; /* Enable erase OP */
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; /* Enable erase OP */
     tmp = address & 0x3;
     if (tmp) {
         if (nrf52k_flash_wait_ready()) {
@@ -138,7 +138,7 @@ nrf52k_flash_write(uint32_t address, const void *src, uint32_t num_bytes)
         goto out;
     }
 out:
-    NRF_NVMC->CONFIG &= ~NVMC_CONFIG_WEN_Wen;
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
     __HAL_ENABLE_INTERRUPTS(sr);
     return rc;
 }
@@ -153,7 +153,7 @@ nrf52k_flash_erase_sector(uint32_t sector_address)
         return -1;
     }
     __HAL_DISABLE_INTERRUPTS(sr);
-    NRF_NVMC->CONFIG |= NVMC_CONFIG_WEN_Een; /* Enable erase OP */
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een; /* Enable erase OP */
     if (nrf52k_flash_wait_ready()) {
         goto out;
     }
@@ -164,7 +164,7 @@ nrf52k_flash_erase_sector(uint32_t sector_address)
     }
     rc = 0;
 out:
-    NRF_NVMC->CONFIG &= ~NVMC_CONFIG_WEN_Een; /* Disable erase OP */
+    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; /* Disable erase OP */
     __HAL_ENABLE_INTERRUPTS(sr);
     return rc;
 }