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 2022/02/18 10:22:55 UTC
[mynewt-core] 02/03: Added bsp and mcu packages for dialog_da14695-dk-usb
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 feec1cc17f7cb4a52a6baeb3d79a9164279357f1
Author: Miguel Azevedo <mi...@gmail.com>
AuthorDate: Wed Mar 11 17:14:57 2020 +0000
Added bsp and mcu packages for dialog_da14695-dk-usb
---
hw/bsp/dialog_da14695-dk-usb/boot-da14695.ld | 38 +++
hw/bsp/dialog_da14695-dk-usb/bsp.yml | 70 ++++
hw/bsp/dialog_da14695-dk-usb/da1469x.ld | 27 ++
hw/bsp/dialog_da14695-dk-usb/include/bsp/bsp.h | 76 +++++
hw/bsp/dialog_da14695-dk-usb/pkg.yml | 35 ++
.../src/arch/cortex_m33/gcc_startup_da1469x.S | 357 +++++++++++++++++++++
hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c | 97 ++++++
hw/bsp/dialog_da14695-dk-usb/syscfg.yml | 80 +++++
hw/mcu/dialog/da14695/include/mcu/mcu.h | 163 ++++++++++
hw/mcu/dialog/da14695/pkg.yml | 33 ++
hw/mcu/dialog/da14695/src/da1469x_pd.c | 74 +++++
hw/mcu/dialog/da14695/syscfg.yml | 20 ++
12 files changed, 1070 insertions(+)
diff --git a/hw/bsp/dialog_da14695-dk-usb/boot-da14695.ld b/hw/bsp/dialog_da14695-dk-usb/boot-da14695.ld
new file mode 100755
index 0000000..8568a03
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/boot-da14695.ld
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+MEMORY
+{
+ /*
+ * Flash is remapped at 0x0 by 1st stage bootloader, but this is done with
+ * an offset derived from image header thus it is safer to use remapped
+ * address space at 0x0 instead of QSPI_M address space at 0x16000000.
+ * Bootloader partition is 32K, but 9K is currently reserved for product
+ * header (8K) and image header (1K).
+ * First 512 bytes of SYSRAM are remapped at 0x0 and used as ISR vector
+ * (there's no need to reallocate ISR vector) and thus cannot be used by
+ * application.
+ */
+
+ FLASH (rx) : ORIGIN = (0x00000000), LENGTH = (23 * 1024)
+ RAM (rw) : ORIGIN = (0x20000000), LENGTH = (512 * 1024)
+}
+
+/* The bootloader does not contain an image header */
+_imghdr_size = 0x0;
diff --git a/hw/bsp/dialog_da14695-dk-usb/bsp.yml b/hw/bsp/dialog_da14695-dk-usb/bsp.yml
new file mode 100644
index 0000000..407f9dc
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/bsp.yml
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+bsp.arch: cortex_m33
+bsp.compiler: "@apache-mynewt-core/compiler/arm-none-eabi-m33"
+bsp.downloadscript:
+ "hw/mcu/dialog/da1469x/scripts/dialog_da1469x-download_jlink.sh"
+bsp.debugscript: "hw/mcu/dialog/da1469x/scripts/dialog_da1469x-debug_jlink.sh"
+
+bsp.linkerscript:
+ - "hw/bsp/dialog_da14695-dk-usb/da1469x.ld"
+ - "hw/mcu/dialog/da1469x/da1469x.ld"
+
+bsp.linkerscript.BOOT_LOADER.OVERWRITE:
+ - "hw/bsp/dialog_da14695-dk-usb/boot-da14695.ld"
+ - "hw/mcu/dialog/da1469x/da1469x.ld"
+
+bsp.linkerscript.RAM_RESIDENT.OVERWRITE:
+ - "hw/bsp/dialog_da14695-dk-usb/boot-da14695.ld"
+ - "hw/mcu/dialog/da1469x/da1469x_ram_resident.ld"
+
+bsp.flash_map:
+ areas:
+ # System areas.
+ FLASH_AREA_BOOTLOADER:
+ device: 0
+ offset: 0x00000000
+ # This does not include 9K of headers currently required by 1st
+ # stage bootloader thus effective total size is 32K (0x0000 to 0x8000)
+ size: 23kB
+ FLASH_AREA_IMAGE_0:
+ device: 0
+ offset: 0x00008000
+ size: 384kB
+ FLASH_AREA_IMAGE_1:
+ device: 0
+ offset: 0x00068000
+ size: 384kB
+ FLASH_AREA_IMAGE_SCRATCH:
+ device: 0
+ offset: 0x000C8000
+ size: 64kB
+
+ # User areas.
+ FLASH_AREA_REBOOT_LOG:
+ user_id: 0
+ device: 0
+ offset: 0x000D8000
+ size: 16kB
+ FLASH_AREA_NFFS:
+ user_id: 1
+ device: 0
+ offset: 0x000DC000
+ size: 16kB
diff --git a/hw/bsp/dialog_da14695-dk-usb/da1469x.ld b/hw/bsp/dialog_da14695-dk-usb/da1469x.ld
new file mode 100755
index 0000000..bbc5498
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/da1469x.ld
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+MEMORY
+{
+ FLASH (rx) : ORIGIN = (0x16008000), LENGTH = (384 * 1024)
+ RAM (rw) : ORIGIN = (0x20000000), LENGTH = (512 * 1024)
+}
+
+/* This linker script is used for images and thus contains an image header */
+_imghdr_size = 0x20;
diff --git a/hw/bsp/dialog_da14695-dk-usb/include/bsp/bsp.h b/hw/bsp/dialog_da14695-dk-usb/include/bsp/bsp.h
new file mode 100644
index 0000000..5c0b572
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/include/bsp/bsp.h
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BSP_H
+#define H_BSP_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Define special stackos sections */
+#define sec_data_core __attribute__((section(".data.core")))
+#define sec_bss_core __attribute__((section(".bss.core")))
+#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))
+
+/* More convenient section placement macros. */
+#define bssnz_t sec_bss_nz_core
+
+extern uint8_t _ram_start;
+#define RAM_SIZE 0x80000
+
+/* LED pins */
+#define LED_1 (33) /* P1_1 */
+#define LED_BLINK_PIN LED_1
+
+/* Button pins */
+#define BUTTON_1 (6) /* P0_6 */
+
+/* MikroBUS(R) pins */
+#define MIKROBUS_1_PIN_AN (41) /* P1_9 */
+#define MIKROBUS_1_PIN_CS (20) /* P0_20 */
+#define MIKROBUS_1_PIN_SCK (21) /* P0_21 */
+#define MIKROBUS_1_PIN_MISO (24) /* P0_24 */
+#define MIKROBUS_1_PIN_MOSI (26) /* P0_26 */
+#define MIKROBUS_1_PIN_PWM (33) /* P1_1 */
+#define MIKROBUS_1_PIN_INT (27) /* P1_27 */
+#define MIKROBUS_1_PIN_RX (28) /* P1_28 */
+#define MIKROBUS_1_PIN_TX (29) /* P1_29 */
+#define MIKROBUS_1_PIN_SCL (30) /* P1_30 */
+#define MIKROBUS_1_PIN_SDA (31) /* P1_31 */
+
+#define MIKROBUS_2_PIN_AN (25) /* P0_25 */
+#define MIKROBUS_2_PIN_CS (34) /* P1_2 */
+#define MIKROBUS_2_PIN_SCK (35) /* P1_3 */
+#define MIKROBUS_2_PIN_MISO (36) /* P1_4 */
+#define MIKROBUS_2_PIN_MOSI (37) /* P1_5 */
+#define MIKROBUS_2_PIN_PWM (38) /* P1_6 */
+#define MIKROBUS_2_PIN_INT (39) /* P1_7 */
+#define MIKROBUS_2_PIN_RX (40) /* P1_8 */
+#define MIKROBUS_2_PIN_TX (17) /* P0_17 */
+#define MIKROBUS_2_PIN_SCL (18) /* P0_18 */
+#define MIKROBUS_2_PIN_SDA (19) /* P0_19 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_BSP_H */
diff --git a/hw/bsp/dialog_da14695-dk-usb/pkg.yml b/hw/bsp/dialog_da14695-dk-usb/pkg.yml
new file mode 100644
index 0000000..7979389
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/pkg.yml
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+pkg.name: hw/bsp/dialog_da14695-dk-usb
+pkg.type: bsp
+pkg.description: BSP definition for the Dialog DA14695 USB development kit.
+pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+ - dialog
+ - da1469x
+ - da14695
+
+pkg.cflags.HARDFLOAT:
+ - '-mfloat-abi=hard'
+ - '-mfpu=fpv5-sp-d16'
+
+pkg.deps:
+ - "@apache-mynewt-core/libc/baselibc"
+ - "@apache-mynewt-core/hw/mcu/dialog/da14695"
diff --git a/hw/bsp/dialog_da14695-dk-usb/src/arch/cortex_m33/gcc_startup_da1469x.S b/hw/bsp/dialog_da14695-dk-usb/src/arch/cortex_m33/gcc_startup_da1469x.S
new file mode 100644
index 0000000..c535071
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/src/arch/cortex_m33/gcc_startup_da1469x.S
@@ -0,0 +1,357 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ #include "syscfg/syscfg.h"
+
+ .syntax unified
+ .arch armv7-m
+
+ .section .stack
+ .align 3
+#ifdef __STACK_SIZE
+ .equ Stack_Size, __STACK_SIZE
+#else
+ .equ Stack_Size, 0xC00
+#endif
+ .equ SYS_CTRL_REG, 0x50000024
+ .equ CACHE_FLASH_REG, 0x100C0040
+ .equ RESET_STAT_REG, 0x500000BC
+ .equ MTB_POSITION_REG, 0xE0043000
+ .equ MTB_MASTER_REG, 0xE0043004
+ .equ MTB_FLOW_REG, 0xE0043008
+
+ .globl __StackTop
+ .globl __StackLimit
+__StackLimit:
+ .space Stack_Size
+ .size __StackLimit, . - __StackLimit
+__StackTop:
+ .size __StackTop, . - __StackTop
+
+ .section .heap
+ .align 3
+#ifdef __HEAP_SIZE
+ .equ Heap_Size, __HEAP_SIZE
+#else
+ .equ Heap_Size, 0
+#endif
+ .globl __HeapBase
+ .globl __HeapLimit
+__HeapBase:
+ .if Heap_Size
+ .space Heap_Size
+ .endif
+ .size __HeapBase, . - __HeapBase
+__HeapLimit:
+ .size __HeapLimit, . - __HeapLimit
+
+ .section .isr_vector
+ .align 2
+ .globl __isr_vector
+__isr_vector:
+ .long __StackTop
+ .long Reset_Handler
+ /* Cortex-M33 interrupts */
+ .long NMI_Handler
+ .long HardFault_Handler
+ .long MemoryManagement_Handler
+ .long BusFault_Handler
+ .long UsageFault_Handler
+ .long SecureFault_Handler
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long SVC_Handler
+ .long DebugMonitor_Handler
+ .long 0 /* Reserved */
+ .long PendSV_Handler
+ .long SysTick_Handler
+ /* DA1469x interrupts */
+ .long SENSOR_NODE_IRQHandler
+ .long DMA_IRQHandler
+ .long CHARGER_STATE_IRQHandler
+ .long CHARGER_ERROR_IRQHandler
+ .long CMAC2SYS_IRQHandler
+ .long UART_IRQHandler
+ .long UART2_IRQHandler
+ .long UART3_IRQHandler
+ .long I2C_IRQHandler
+ .long I2C2_IRQHandler
+ .long SPI_IRQHandler
+ .long SPI2_IRQHandler
+ .long PCM_IRQHandler
+ .long SRC_IN_IRQHandler
+ .long SRC_OUT_IRQHandler
+ .long USB_IRQHandler
+ .long TIMER_IRQHandler
+ .long TIMER2_IRQHandler
+ .long RTC_IRQHandler
+ .long KEY_WKUP_GPIO_IRQHandler
+ .long PDC_IRQHandler
+ .long VBUS_IRQHandler
+ .long MRM_IRQHandler
+ .long MOTOR_CONTROLLER_IRQHandler
+ .long TRNG_IRQHandler
+ .long DCDC_IRQHandler
+ .long XTAL32M_RDY_IRQHandler
+ .long ADC_IRQHandler
+ .long ADC2_IRQHandler
+ .long CRYPTO_IRQHandler
+ .long CAPTIMER1_IRQHandler
+ .long RFDIAG_IRQHandler
+ .long LCD_CONTROLLER_IRQHandler
+ .long PLL_LOCK_IRQHandler
+ .long TIMER3_IRQHandler
+ .long TIMER4_IRQHandler
+ .long LRA_IRQHandler
+ .long RTC_EVENT_IRQHandler
+ .long GPIO_P0_IRQHandler
+ .long GPIO_P1_IRQHandler
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .size __isr_vector, . - __isr_vector
+
+ .section .text_ram
+ .thumb
+ .thumb_func
+ .align 2
+ .globl wakeup_handler
+ .type wakeup_handler, %function
+wakeup_handler:
+ ldr r0, =RESET_STAT_REG
+ ldr r0, [r0, #0]
+ teq r0, #0
+ ite eq
+ ldreq r3, =da1469x_m33_wakeup
+ ldrne r3, =Reset_Handler
+ bx r3
+
+ .size wakeup_handler, . - wakeup_handler
+
+ .text
+ .thumb
+ .thumb_func
+ .align 2
+ .globl Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+#if MYNEWT_VAL(RAM_RESIDENT)
+ mov r0, #0
+ msr msplim, r0
+#endif
+
+#if MYNEWT_VAL(MCU_MTB_ENABLE)
+ mov r2, #0
+ ldr r1, =MTB_POSITION_REG
+ str r2, [r1]
+ ldr r1, =MTB_FLOW_REG
+ str r2, [r1]
+ ldr r1, =MTB_MASTER_REG
+#if MYNEWT_VAL(MCU_MTB_AUTO_START)
+ ldr r2, =0x80000009
+#else
+ ldr r2, =0x00000009
+#endif
+ str r2, [r1]
+#else
+ ldr r1, =MTB_MASTER_REG
+ mov r2, #0
+ str r2, [r1]
+#endif
+
+ /* Make sure interrupt vector is remapped at 0x0 */
+ ldr r1, =SYS_CTRL_REG
+ ldrh r2, [r1, #0]
+ orrs r2, r2, #8
+ strh r2, [r1, #0]
+
+#if !MYNEWT_VAL(RAM_RESIDENT)
+/*
+ * Flash is remapped at 0x0 with an offset, i.e. 0x0 does not correspond to
+ * 0x16000000 but to start of an image on flash. This is calculated from product
+ * header by 1st state bootloader and configured in CACHE_FLASH_REG. We need to
+ * retrieve proper offset value for calculations later.
+ */
+ ldr r1, =CACHE_FLASH_REG
+ ldr r4, [r1, #0]
+ mov r2, r4
+ mov r3, #0xFFFF
+ bic r4, r4, r3 /* CACHE_FLASH_REG[FLASH_REGION_BASE] */
+ mov r3, #0xFFF0
+ and r2, r2, r3 /* CACHE_FLASH_REG[FLASH_REGION_OFFSET] */
+ lsr r2, r2, #2
+ orr r4, r4, r2
+
+/* Copy ISR vector from flash to RAM */
+ ldr r1, =__isr_vector_start /* src ptr */
+ ldr r2, =__isr_vector_end /* src end */
+ ldr r3, =__intvect_start__ /* dst ptr */
+/* Make sure we copy from QSPIC address range, not from remapped range */
+ cmp r1, r4
+ itt lt
+ addlt r1, r1, r4
+ addlt r2, r2, r4
+.loop_isr_copy:
+ cmp r1, r2
+ ittt lt
+ ldrlt r0, [r1], #4
+ strlt r0, [r3], #4
+ blt .loop_isr_copy
+
+/* Copy QSPI code from flash to RAM */
+ ldr r1, =__text_ram_addr /* src ptr */
+ ldr r2, =__text_ram_start__ /* ptr */
+ ldr r3, =__text_ram_end__ /* dst end */
+.loop_code_text_ram_copy:
+ cmp r2, r3
+ ittt lt
+ ldrlt r0, [r1], #4
+ strlt r0, [r2], #4
+ blt .loop_code_text_ram_copy
+
+/* Copy data from flash to RAM */
+ ldr r1, =__etext /* src ptr */
+ ldr r2, =__data_start__ /* dst ptr */
+ ldr r3, =__data_end__ /* dst end */
+.loop_data_copy:
+ cmp r2, r3
+ ittt lt
+ ldrlt r0, [r1], #4
+ strlt r0, [r2], #4
+ blt .loop_data_copy
+#endif
+
+/* Clear BSS */
+ movs r0, 0
+ ldr r1, =__bss_start__
+ ldr r2, =__bss_end__
+.loop_bss_clear:
+ cmp r1, r2
+ itt lt
+ strlt r0, [r1], #4
+ blt .loop_bss_clear
+
+ ldr r0, =__HeapBase
+ ldr r1, =__HeapLimit
+ bl _sbrkInit
+
+/* Set reset handler to wakeup handler so we can handle wake up from deep sleep */
+ ldr r0, =__intvect_start__
+ ldr r1, =wakeup_handler
+ str r1, [r0, #4]
+
+ bl SystemInit
+ bl hal_system_init
+ bl _start
+
+ .pool
+ .size Reset_Handler, . - Reset_Handler
+
+/* Default interrupt handler */
+ .type Default_Handler, %function
+Default_Handler:
+#if MYNEWT_VAL(MCU_MTB_ENABLE)
+ /* Disable MTB, otherwise it will quickly fill up buffer with infinite loop branch. */
+ ldr r1, =MTB_POSITION_REG
+ ldr r2, [r1, #4]
+ bic r2, #0x80000000
+ str r2, [r1, #4]
+#endif
+ ldr r1, =SYS_CTRL_REG
+ ldrh r2, [r1, #0]
+ orrs r2, r2, #0x80 /* DEBUGGER_ENABLE */
+ strh r2, [r1, #0]
+ b .
+
+ .size Default_Handler, . - Default_Handler
+
+/* Default handlers for all interrupts */
+ .macro IRQ handler
+ .weak \handler
+ .set \handler, Default_Handler
+ .endm
+
+ /* Cortex-M33 interrupts */
+ IRQ NMI_Handler
+ IRQ HardFault_Handler
+ IRQ MemoryManagement_Handler
+ IRQ BusFault_Handler
+ IRQ UsageFault_Handler
+ IRQ SecureFault_Handler
+ IRQ SVC_Handler
+ IRQ DebugMonitor_Handler
+ IRQ PendSV_Handler
+ IRQ SysTick_Handler
+ /* DA1469x interrupts */
+ IRQ SENSOR_NODE_IRQHandler
+ IRQ DMA_IRQHandler
+ IRQ CHARGER_STATE_IRQHandler
+ IRQ CHARGER_ERROR_IRQHandler
+ IRQ CMAC2SYS_IRQHandler
+ IRQ UART_IRQHandler
+ IRQ UART2_IRQHandler
+ IRQ UART3_IRQHandler
+ IRQ I2C_IRQHandler
+ IRQ I2C2_IRQHandler
+ IRQ SPI_IRQHandler
+ IRQ SPI2_IRQHandler
+ IRQ PCM_IRQHandler
+ IRQ SRC_IN_IRQHandler
+ IRQ SRC_OUT_IRQHandler
+ IRQ USB_IRQHandler
+ IRQ TIMER_IRQHandler
+ IRQ TIMER2_IRQHandler
+ IRQ RTC_IRQHandler
+ IRQ KEY_WKUP_GPIO_IRQHandler
+ IRQ PDC_IRQHandler
+ IRQ VBUS_IRQHandler
+ IRQ MRM_IRQHandler
+ IRQ MOTOR_CONTROLLER_IRQHandler
+ IRQ TRNG_IRQHandler
+ IRQ DCDC_IRQHandler
+ IRQ XTAL32M_RDY_IRQHandler
+ IRQ ADC_IRQHandler
+ IRQ ADC2_IRQHandler
+ IRQ CRYPTO_IRQHandler
+ IRQ CAPTIMER1_IRQHandler
+ IRQ RFDIAG_IRQHandler
+ IRQ LCD_CONTROLLER_IRQHandler
+ IRQ PLL_LOCK_IRQHandler
+ IRQ TIMER3_IRQHandler
+ IRQ TIMER4_IRQHandler
+ IRQ LRA_IRQHandler
+ IRQ RTC_EVENT_IRQHandler
+ IRQ GPIO_P0_IRQHandler
+ IRQ GPIO_P1_IRQHandler
+ IRQ RESERVED40_IRQHandler
+ IRQ RESERVED41_IRQHandler
+ IRQ RESERVED42_IRQHandler
+ IRQ RESERVED43_IRQHandler
+ IRQ RESERVED44_IRQHandler
+ IRQ RESERVED45_IRQHandler
+ IRQ RESERVED46_IRQHandler
+ IRQ RESERVED47_IRQHandler
+
+.end
diff --git a/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c b/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c
new file mode 100644
index 0000000..f5bfacf
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <stdint.h>
+#include <string.h>
+#include "hal/hal_bsp.h"
+#include "hal/hal_flash.h"
+#include "hal/hal_system.h"
+#include "mcu/mcu.h"
+#include "mcu/da1469x_hal.h"
+#include "mcu/da1469x_periph.h"
+#include "bsp/bsp.h"
+
+static const struct hal_bsp_mem_dump dump_cfg[] = {
+ [0] = {
+ .hbmd_start = (void *)MCU_MEM_SYSRAM_START_ADDRESS,
+ .hbmd_size = MCU_MEM_SYSRAM_END_ADDRESS - MCU_MEM_SYSRAM_START_ADDRESS,
+ }
+};
+
+/* Note: This is just dummy implementation.
+ * There is no special register for hardware id.
+ * Most probably it should be generated and stored somewhere in OTP.
+ */
+static char hw_id[] = "DA1469X_HW_ID";
+
+const struct hal_flash *
+hal_bsp_flash_dev(uint8_t id)
+{
+ if (id != 0) {
+ return NULL;
+ }
+
+ return &da1469x_flash_dev;
+}
+
+const struct hal_bsp_mem_dump *
+hal_bsp_core_dump(int *area_cnt)
+{
+ *area_cnt = sizeof(dump_cfg) / sizeof(dump_cfg[0]);
+ return dump_cfg;
+}
+
+int
+hal_bsp_power_state(int state)
+{
+ return 0;
+}
+
+int
+hal_bsp_hw_id_len(void)
+{
+ return sizeof(hw_id);
+}
+
+int
+hal_bsp_hw_id(uint8_t *id, int max_len)
+{
+ int len = sizeof(hw_id);
+
+ assert(max_len > len);
+ memcpy(id, hw_id, len);
+
+ return len;
+}
+
+void
+hal_bsp_init(void)
+{
+ /* Make sure system clocks have started */
+ hal_system_clock_start();
+
+ /* Create all available DA1649x peripherals */
+ da1469x_periph_create();
+}
+
+void
+hal_bsp_deinit(void)
+{
+}
diff --git a/hw/bsp/dialog_da14695-dk-usb/syscfg.yml b/hw/bsp/dialog_da14695-dk-usb/syscfg.yml
new file mode 100644
index 0000000..9b3e7b4
--- /dev/null
+++ b/hw/bsp/dialog_da14695-dk-usb/syscfg.yml
@@ -0,0 +1,80 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+ BOOT_SECURE:
+ description: 'Set to indicate that ROM bootloader is secure'
+ value: 0
+
+ BOOT_AES_SLOT:
+ description: 'Denotes OTP QSPI FW key index used for encryption'
+ value: -1
+
+ BOOT_SIG_SLOT:
+ description: 'Denotes OTP signature key index used for validation'
+ value: -1
+
+ BOOT_AES_KEY:
+ description: 'Specifies path to AES-256-CTR key in base64 format'
+ value: ''
+
+ BOOT_SIG_PEM:
+ description: 'Specifies path to ED25519 private key PEM file'
+ value: ''
+
+ USER_AES_SLOT:
+ description: 'Specifies AES key slot for OTP user data encryption and decryption'
+ value: -1
+
+syscfg.defs.BUS_DRIVER_PRESENT:
+ BSP_FLASH_SPI_NAME:
+ description: 'SPIFLASH device name'
+ value: '"spiflash0"'
+ BSP_FLASH_SPI_BUS:
+ description: 'bus name SPIFLASH is connected to'
+ value:
+
+syscfg.vals:
+ MCU_DCDC_ENABLE: 1
+ # Setting for QSPI Flash
+ QSPI_FLASH_ADDRESS_LENGTH: 24
+ QSPI_FLASH_SECTOR_SIZE: 4096
+ QSPI_FLASH_SECTOR_COUNT: 256
+ QSPI_FLASH_PAGE_SIZE: 256
+ QSPI_FLASH_CMD_QUAD_INPUT_PAGE_PROGRAM: 0x32
+ # Set default pins for peripherals
+ UART_0_PIN_TX: 9
+ UART_0_PIN_RX: 8
+ UART_1_PIN_TX: 9
+ UART_1_PIN_RX: 8
+ UART_1_PIN_RTS: 32
+ UART_1_PIN_CTS: 7
+ I2C_0_PIN_SCL: 29
+ I2C_0_PIN_SDA: 28
+ SPI_0_MASTER_PIN_SCK: 27
+ SPI_0_MASTER_PIN_MOSI: 24
+ SPI_0_MASTER_PIN_MISO: 26
+ # Configure flash areas
+ CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+ REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+ NFFS_FLASH_AREA: FLASH_AREA_NFFS
+ COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
+
+syscfg.vals.'BLE_HCI_TRANSPORT == "dialog_cmac"':
+ TRNG: 1
diff --git a/hw/mcu/dialog/da14695/include/mcu/mcu.h b/hw/mcu/dialog/da14695/include/mcu/mcu.h
new file mode 100644
index 0000000..bdf4ac7
--- /dev/null
+++ b/hw/mcu/dialog/da14695/include/mcu/mcu.h
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __MCU_MCU_H_
+#define __MCU_MCU_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "DA1469xAB.h"
+
+#define sec_text_ram_core __attribute__((section(".text_ram"))) __attribute__((noinline))
+
+#define MCU_SYSVIEW_INTERRUPTS \
+ "I#1=Reset,I#2=MNI,I#3=HardFault,I#4=MemoryMgmt,I#5=BusFault,I#6=UsageFault," \
+ "I#7=SecureFault,I#11=SVCall,I#12=DebugMonitor,I#14=PendSV,I#15=SysTick," \
+ "I#16=SENSOR_NODE,I#17=DMA,I#18=CHARGER_STATE,I#19=CHARGER_ERROR," \
+ "I#20=CMAC2SYS,I#21=UART,I#22=UART2,I#23=UART3,I#24=I2C,I#25=I2C2,I#26=SPI," \
+ "I#27=SPI2,I#28=PCM,I#29=SRC_IN,I#30=SRC_OUT,I#31=USB,I#32=TIMER," \
+ "I#33=TIMER2,I#34=RTC,I#35=KEY_WKUP_GPIO,I#36=PDC,I#37=VBUS,I#38=MRM," \
+ "I#39=MOTOR_CONTROLLER,I#40=TRNG,I#41=DCDC,I#42=XTAL32M_RDY,I#43=ADC," \
+ "I#44=ADC2,I#45=CRYPTO,I#46=CAPTIMER1,I#47=RFDIAG,I#48=LCD_CONTROLLER," \
+ "I#49=PLL_LOCK,I#50=TIMER3,I#51=TIMER4,I#52=LRA,I#53=RTC_EVENT," \
+ "I#54=GPIO_P0,I#55=GPIO_P1"
+
+/**
+ * \brief GPIO function
+ *
+ */
+typedef enum {
+ MCU_GPIO_FUNC_GPIO = 0, /**< GPIO */
+ MCU_GPIO_FUNC_UART_RX = 1, /**< GPIO as UART RX */
+ MCU_GPIO_FUNC_UART_TX = 2, /**< GPIO as UART TX */
+ MCU_GPIO_FUNC_UART2_RX = 3, /**< GPIO as UART2 RX */
+ MCU_GPIO_FUNC_UART2_TX = 4, /**< GPIO as UART2 TX */
+ MCU_GPIO_FUNC_UART2_CTSN = 5, /**< GPIO as UART2 CTSN */
+ MCU_GPIO_FUNC_UART2_RTSN = 6, /**< GPIO as UART2 RTSN */
+ MCU_GPIO_FUNC_UART3_RX = 7, /**< GPIO as UART3 RX */
+ MCU_GPIO_FUNC_UART3_TX = 8, /**< GPIO as UART3 TX */
+ MCU_GPIO_FUNC_UART3_CTSN = 9, /**< GPIO as UART3 CTSN */
+ MCU_GPIO_FUNC_UART3_RTSN = 10, /**< GPIO as UART3 RTSN */
+ MCU_GPIO_FUNC_ISO_CLK = 11, /**< GPIO as ISO CLK */
+ MCU_GPIO_FUNC_ISO_DATA = 12, /**< GPIO as ISO DATA */
+ MCU_GPIO_FUNC_SPI_DI = 13, /**< GPIO as SPI DI */
+ MCU_GPIO_FUNC_SPI_DO = 14, /**< GPIO as SPI DO */
+ MCU_GPIO_FUNC_SPI_CLK = 15, /**< GPIO as SPI CLK */
+ MCU_GPIO_FUNC_SPI_EN = 16, /**< GPIO as SPI EN */
+ MCU_GPIO_FUNC_SPI2_DI = 17, /**< GPIO as SPI2 DI */
+ MCU_GPIO_FUNC_SPI2_DO = 18, /**< GPIO as SPI2 DO */
+ MCU_GPIO_FUNC_SPI2_CLK = 19, /**< GPIO as SPI2 CLK */
+ MCU_GPIO_FUNC_SPI2_EN = 20, /**< GPIO as SPI2 EN */
+ MCU_GPIO_FUNC_I2C_SCL = 21, /**< GPIO as I2C SCL */
+ MCU_GPIO_FUNC_I2C_SDA = 22, /**< GPIO as I2C SDA */
+ MCU_GPIO_FUNC_I2C2_SCL = 23, /**< GPIO as I2C2 SCL */
+ MCU_GPIO_FUNC_I2C2_SDA = 24, /**< GPIO as I2C2 SDA */
+ MCU_GPIO_FUNC_USB_SOF = 25, /**< GPIO as USB SOF */
+ MCU_GPIO_FUNC_ADC = 26, /**< GPIO as ADC (dedicated pin) */
+ MCU_GPIO_FUNC_USB = 27, /**< GPIO as USB */
+ MCU_GPIO_FUNC_PCM_DI = 28, /**< GPIO as PCM DI */
+ MCU_GPIO_FUNC_PCM_DO = 29, /**< GPIO as PCM DO */
+ MCU_GPIO_FUNC_PCM_FSC = 30, /**< GPIO as PCM FSC */
+ MCU_GPIO_FUNC_PCM_CLK = 31, /**< GPIO as PCM CLK */
+ MCU_GPIO_FUNC_PDM_DATA = 32, /**< GPIO as PDM DATA */
+ MCU_GPIO_FUNC_PDM_CLK = 33, /**< GPIO as PDM CLK */
+ MCU_GPIO_FUNC_COEX_EXT_ACT = 34, /**< GPIO as COEX EXT ACT0 */
+ MCU_GPIO_FUNC_COEX_SMART_ACT = 35, /**< GPIO as COEX SMART ACT */
+ MCU_GPIO_FUNC_COEX_SMART_PRI = 36, /**< GPIO as COEX SMART PRI */
+ MCU_GPIO_FUNC_PORT0_DCF = 37, /**< GPIO as PORT0 DCF */
+ MCU_GPIO_FUNC_PORT1_DCF = 38, /**< GPIO as PORT1 DCF */
+ MCU_GPIO_FUNC_PORT2_DCF = 39, /**< GPIO as PORT2 DCF */
+ MCU_GPIO_FUNC_PORT3_DCF = 40, /**< GPIO as PORT3 DCF */
+ MCU_GPIO_FUNC_PORT4_DCF = 41, /**< GPIO as PORT4 DCF */
+ MCU_GPIO_FUNC_CLOCK = 42, /**< GPIO as CLOCK */
+ MCU_GPIO_FUNC_PG = 43, /**< GPIO as PG */
+ MCU_GPIO_FUNC_LCD = 44, /**< GPIO as LCD */
+ MCU_GPIO_FUNC_LCD_SPI_DC = 45, /**< GPIO as LCD SPI DC */
+ MCU_GPIO_FUNC_LCD_SPI_DO = 46, /**< GPIO as LCD SPI DO */
+ MCU_GPIO_FUNC_LCD_SPI_CLK = 47, /**< GPIO as LCD SPI CLK */
+ MCU_GPIO_FUNC_LCD_SPI_EN = 48, /**< GPIO as LCD SPI EN */
+ MCU_GPIO_FUNC_TIM_PWM = 49, /**< GPIO as TIM PWM */
+ MCU_GPIO_FUNC_TIM2_PWM = 50, /**< GPIO as TIM2 PWM */
+ MCU_GPIO_FUNC_TIM_1SHOT = 51, /**< GPIO as TIM 1SHOT */
+ MCU_GPIO_FUNC_TIM2_1SHOT = 52, /**< GPIO as TIM2 1SHOT */
+ MCU_GPIO_FUNC_TIM3_PWM = 53, /**< GPIO as TIM3 PWM */
+ MCU_GPIO_FUNC_TIM4_PWM = 54, /**< GPIO as TIM4 PWM */
+ MCU_GPIO_FUNC_AGC_EXT = 55, /**< GPIO as AGC EXT */
+ MCU_GPIO_FUNC_CMAC_DIAG0 = 56, /**< GPIO as CMAC DIAG0 */
+ MCU_GPIO_FUNC_CMAC_DIAG1 = 57, /**< GPIO as CMAC DIAG1 */
+ MCU_GPIO_FUNC_CMAC_DIAG2 = 58, /**< GPIO as CMAC DIAG2 */
+ MCU_GPIO_FUNC_CMAC_DIAGX = 59, /**< GPIO as CMAC DIAGX */
+ MCU_GPIO_FUNC_LAST,
+} mcu_gpio_func;
+
+#define MCU_GPIO_MODE_INPUT 0x000 /**< GPIO as an input */
+#define MCU_GPIO_MODE_INPUT_PULLUP 0x100 /**< GPIO as an input with pull-up */
+#define MCU_GPIO_MODE_INPUT_PULLDOWN 0x200 /**< GPIO as an input with pull-down */
+#define MCU_GPIO_MODE_OUTPUT 0x300 /**< GPIO as an output */
+#define MCU_GPIO_MODE_OUTPUT_OPEN_DRAIN 0x700 /**< GPIO as an open-drain output */
+
+#define MCU_GPIO_PORT0_PIN_COUNT 32
+#define MCU_GPIO_PORT0(pin) ((0 * 32) + (pin))
+#define MCU_GPIO_PORT1(pin) ((1 * 32) + (pin))
+#define MCU_DMA_CHAN_MAX 8
+
+#define MCU_PIN_USB_DP MCU_GPIO_PORT0(14)
+#define MCU_PIN_USB_DM MCU_GPIO_PORT0(15)
+
+#define MCU_PIN_GPADC_SEL0 MCU_GPIO_PORT1(9)
+#define MCU_PIN_GPADC_SEL1 MCU_GPIO_PORT0(25)
+#define MCU_PIN_GPADC_SEL2 MCU_GPIO_PORT0(8)
+#define MCU_PIN_GPADC_SEL3 MCU_GPIO_PORT0(9)
+#define MCU_PIN_GPADC_DIFF0_P0 MCU_GPIO_PORT1(9)
+#define MCU_PIN_GPADC_DIFF0_P1 MCU_GPIO_PORT0(25)
+#define MCU_PIN_GPADC_DIFF1_P0 MCU_GPIO_PORT0(8)
+#define MCU_PIN_GPADC_DIFF1_P1 MCU_GPIO_PORT0(9)
+
+#define MCU_PIN_SDADC0 MCU_GPIO_PORT1(9)
+#define MCU_PIN_SDADC1 MCU_GPIO_PORT0(25)
+#define MCU_PIN_SDADC2 MCU_GPIO_PORT0(8)
+#define MCU_PIN_SDADC3 MCU_GPIO_PORT0(9)
+
+void mcu_gpio_set_pin_function(int pin, int mode, mcu_gpio_func func);
+void mcu_gpio_enter_sleep(void);
+void mcu_gpio_exit_sleep(void);
+
+#define MCU_MEM_QSPIF_M_END_REMAP_ADDRESS (0x800000)
+#define MCU_MEM_QSPIF_M_START_ADDRESS (0x16000000)
+#define MCU_MEM_QSPIF_M_END_ADDRESS (0x18000000)
+#define MCU_MEM_SYSRAM_START_ADDRESS (0x20000000)
+#define MCU_MEM_SYSRAM_END_ADDRESS (0x20080000)
+#define MCU_MEM_QSPIF_M_RANGE_ADDRESS(x) \
+ ((uint32_t)(x) >= (uint32_t)MCU_MEM_QSPIF_M_START_ADDRESS && \
+ (uint32_t)(x) <= (uint32_t)MCU_MEM_QSPIF_M_END_ADDRESS)
+
+#define MCU_OTPM_BASE 0x30080000UL
+#define MCU_OTPM_SIZE 4096
+
+/* Largest group id seen on a DA14699 was 18 so far */
+#define MCU_TRIMV_GROUP_ID_MAX (18)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MCU_MCU_H_ */
+
diff --git a/hw/mcu/dialog/da14695/pkg.yml b/hw/mcu/dialog/da14695/pkg.yml
new file mode 100644
index 0000000..f53170a
--- /dev/null
+++ b/hw/mcu/dialog/da14695/pkg.yml
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: hw/mcu/dialog/da14695
+pkg.description: MCU definition for Dialog DA14695 ARM Cortex-M33 chip
+pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+ - dialog
+ - da1469x
+ - da14695
+
+pkg.deps:
+ - "@apache-mynewt-core/hw/hal"
+ - "@apache-mynewt-core/hw/cmsis-core"
+ - "@apache-mynewt-core/hw/mcu/dialog/da1469x"
+
diff --git a/hw/mcu/dialog/da14695/src/da1469x_pd.c b/hw/mcu/dialog/da14695/src/da1469x_pd.c
new file mode 100644
index 0000000..d6ca249
--- /dev/null
+++ b/hw/mcu/dialog/da14695/src/da1469x_pd.c
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "mcu/da1469x_pd.h"
+
+static inline uint32_t
+get_reg32(uint32_t addr)
+{
+ volatile uint32_t *reg = (volatile uint32_t *)addr;
+
+ return *reg;
+}
+
+static inline void
+set_reg32(uint32_t addr, uint32_t val)
+{
+ volatile uint32_t *reg = (volatile uint32_t *)addr;
+
+ *reg = val;
+}
+
+static inline void
+set_reg32_mask(uint32_t addr, uint32_t mask, uint32_t val)
+{
+ volatile uint32_t *reg = (volatile uint32_t *)addr;
+
+ *reg = (*reg & (~mask)) | (val & mask);
+}
+
+void
+da1469x_pd_apply_preferred(uint8_t pd)
+{
+ switch (pd) {
+ case MCU_PD_DOMAIN_AON:
+ if (get_reg32(0x500000f8) == 0x00008800) {
+ set_reg32(0x500000f8, 0x00007700);
+ }
+ set_reg32_mask(0x50000050, 0x00001000, 0x00001020);
+ set_reg32(0x500000a4, 0x000000ca);
+ set_reg32_mask(0x50000064, 0x0003ffff, 0x041e6ef4);
+ break;
+ case MCU_PD_DOMAIN_SYS:
+ set_reg32_mask(0x50040400, 0x00000c00, 0x003f6a78);
+ set_reg32_mask(0x50040454, 0x000003ff, 0x00000002);
+ break;
+ case MCU_PD_DOMAIN_TIM:
+ set_reg32_mask(0x50010000, 0x3ff00000, 0x000afd70);
+ set_reg32_mask(0x50010010, 0x000000c0, 0x00000562);
+ set_reg32_mask(0x50010030, 0x43c38002, 0x4801e6b6);
+ set_reg32_mask(0x50010034, 0x007fff00, 0x7500a1a4);
+ set_reg32_mask(0x50010038, 0x00000fff, 0x001e45c4);
+ set_reg32_mask(0x5001003c, 0x40000000, 0x40096255);
+ set_reg32_mask(0x50010040, 0x00c00000, 0x00c00000);
+ set_reg32_mask(0x50010018, 0x000000ff, 0x00000180);
+ break;
+ }
+}
diff --git a/hw/mcu/dialog/da14695/syscfg.yml b/hw/mcu/dialog/da14695/syscfg.yml
new file mode 100644
index 0000000..9b024f3
--- /dev/null
+++ b/hw/mcu/dialog/da14695/syscfg.yml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.vals:
+ MCU_TARGET: DA14695