aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth McMullin2015-03-11 20:40:48 -0700
committerGareth McMullin2015-03-11 20:47:51 -0700
commit1196b03d66c9187b12f6cc6502589e88df11c5aa (patch)
tree077af27dd1179205651c3381ec8b334fa78d5d67
parent3d28c1418c11cb62e6c4c2f483a0bb7f308255a4 (diff)
stm32l0: Fix pointer/integer casting warnings.
-rw-r--r--src/include/stm32lx-nvm.h25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/include/stm32lx-nvm.h b/src/include/stm32lx-nvm.h
index 190a8ab..2e9d8c5 100644
--- a/src/include/stm32lx-nvm.h
+++ b/src/include/stm32lx-nvm.h
@@ -159,25 +159,12 @@ namespace {
typedef uint32_t stm32lx_stub_pointer_t;
-struct stm32lx_nvm {
- volatile uint32_t acr;
- volatile uint32_t pecr;
- volatile uint32_t pdkeyr;
- volatile uint32_t pekeyr;
- volatile uint32_t prgkeyr;
- volatile uint32_t optkeyr;
- volatile uint32_t sr;
- volatile uint32_t optr; /* or obr */
- volatile uint32_t wrprot; /* or wprot1 */
-};
-
-#define STM32Lx_NVM(p) (*(struct stm32lx_nvm*) (p))
-#define STM32Lx_NVM_PECR(p) ((uint32_t) &STM32Lx_NVM(p).pecr)
-#define STM32Lx_NVM_PEKEYR(p) ((uint32_t) &STM32Lx_NVM(p).pekeyr)
-#define STM32Lx_NVM_PRGKEYR(p) ((uint32_t) &STM32Lx_NVM(p).prgkeyr)
-#define STM32Lx_NVM_OPTKEYR(p) ((uint32_t) &STM32Lx_NVM(p).optkeyr)
-#define STM32Lx_NVM_SR(p) ((uint32_t) &STM32Lx_NVM(p).sr)
-#define STM32Lx_NVM_OPTR(p) ((uint32_t) &STM32Lx_NVM(p).optr)
+#define STM32Lx_NVM_PECR(p) ((p) + 0x04)
+#define STM32Lx_NVM_PEKEYR(p) ((p) + 0x0C)
+#define STM32Lx_NVM_PRGKEYR(p) ((p) + 0x10)
+#define STM32Lx_NVM_OPTKEYR(p) ((p) + 0x14)
+#define STM32Lx_NVM_SR(p) ((p) + 0x18)
+#define STM32Lx_NVM_OPTR(p) ((p) + 0x1C)
#endif