summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernard <[email protected]>2021-09-23 10:54:09 +0000
committerGitee <[email protected]>2021-09-23 10:54:09 +0000
commit554d5bd80714ff15d417cff2aeac12484dd9bdba (patch)
tree6e93d14850b0a656ee3479b77b223a6037e74cf7
parent1e663b72ce2115ffb01e0a7ca931a8d9f0fd881a (diff)
parentd0c0e4e674bcf33d88ff745465f06462c3484d99 (diff)
!327 增加bsp工程hc32l136
Merge pull request !327 from ching/pjq_hc32l13x
-rw-r--r--bsp/hc32l136/.config574
-rw-r--r--bsp/hc32l136/.ignore_format.yml9
-rw-r--r--bsp/hc32l136/Kconfig23
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/base_types.h155
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/board_stkhc32l13x.h120
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/ddl_device.h76
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/hc32l136.h9620
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l136.h107
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l13x.h111
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/ARM/startup_hc32l136.s294
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/IAR/startup_hc32l136.s353
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/interrupts_hc32l136.c477
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l136.h107
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l13x.c91
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armcc.h894
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang.h1444
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang_ltm.h1891
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_compiler.h283
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_gcc.h2168
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_iccarm.h964
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/cmsis_version.h39
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_armv81mml.h2968
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mbl.h1921
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mml.h2835
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm0.h952
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm0plus.h1085
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm1.h979
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm23.h1996
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm3.h1937
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm33.h2910
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm35p.h2910
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm4.h2124
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_cm7.h2725
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_sc000.h1025
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/core_sc300.h1912
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv7.h272
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv8.h346
-rw-r--r--bsp/hc32l136/Libraries/CMSIS/Include/tz_context.h70
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adc.h486
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adt.h819
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/aes.h108
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bgr.h109
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bt.h770
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/crc.h120
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/ddl.h207
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/debug.h129
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/dmac.h327
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/flash.h196
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/gpio.h506
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/hdiv.h119
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/i2c.h167
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/interrupts_hc32l136.h103
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lcd.h270
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpm.h147
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpt.h211
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpuart.h325
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lvd.h208
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/opa.h205
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pca.h301
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pcnt.h214
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/reset.h166
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rng.h108
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rtc.h298
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/spi.h212
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/sysctrl.h457
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer0.h788
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer3.h788
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/trim.h186
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/uart.h297
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/vc.h311
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/wdt.h127
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adc.c1022
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adt.c1952
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/aes.c176
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bgr.c155
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bt.c1608
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/crc.c438
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/ddl.c292
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/debug.c119
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/dmac.c1537
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/flash.c688
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/gpio.c613
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/hdiv.c176
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/i2c.c666
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/interrupts_hc32l136.c477
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lcd.c579
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpm.c134
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpt.c289
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpuart.c966
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lvd.c327
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/opa.c438
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pca.c834
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pcnt.c417
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/reset.c163
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rng.c191
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rtc.c875
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/spi.c526
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/sysctrl.c776
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer0.c1390
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer3.c1399
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/trim.c348
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/uart.c910
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/vc.c674
-rw-r--r--bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/wdt.c184
-rw-r--r--bsp/hc32l136/Libraries/LICENSE29
-rw-r--r--bsp/hc32l136/Libraries/SConscript48
-rw-r--r--bsp/hc32l136/README.md100
-rw-r--r--bsp/hc32l136/SConscript15
-rw-r--r--bsp/hc32l136/SConstruct45
-rw-r--r--bsp/hc32l136/applications/SConscript12
-rw-r--r--bsp/hc32l136/applications/main.c89
-rw-r--r--bsp/hc32l136/board/Kconfig57
-rw-r--r--bsp/hc32l136/board/SConscript14
-rw-r--r--bsp/hc32l136/board/board.c101
-rw-r--r--bsp/hc32l136/board/board.h47
-rw-r--r--bsp/hc32l136/board/linker_scripts/link.icf28
-rw-r--r--bsp/hc32l136/board/linker_scripts/link.lds203
-rw-r--r--bsp/hc32l136/board/linker_scripts/link.sct15
-rw-r--r--bsp/hc32l136/drivers/SConscript22
-rw-r--r--bsp/hc32l136/drivers/drv_gpio.c381
-rw-r--r--bsp/hc32l136/drivers/drv_gpio.h151
-rw-r--r--bsp/hc32l136/drivers/drv_usart.c622
-rw-r--r--bsp/hc32l136/drivers/drv_usart.h74
-rw-r--r--bsp/hc32l136/figures/board.pngbin0 -> 322618 bytes
-rw-r--r--bsp/hc32l136/project.ewp2157
-rw-r--r--bsp/hc32l136/project.eww10
-rw-r--r--bsp/hc32l136/project.uvoptx924
-rw-r--r--bsp/hc32l136/project.uvprojx713
-rw-r--r--bsp/hc32l136/rtconfig.h180
-rw-r--r--bsp/hc32l136/rtconfig.py132
-rw-r--r--bsp/hc32l136/template.ewp1933
-rw-r--r--bsp/hc32l136/template.eww10
-rw-r--r--bsp/hc32l136/template.uvoptx184
-rw-r--r--bsp/hc32l136/template.uvprojx391
134 files changed, 88578 insertions, 0 deletions
diff --git a/bsp/hc32l136/.config b/bsp/hc32l136/.config
new file mode 100644
index 0000000000..732d1347cc
--- /dev/null
+++ b/bsp/hc32l136/.config
@@ -0,0 +1,574 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# RT-Thread Project Configuration
+#
+
+#
+# RT-Thread Kernel
+#
+CONFIG_RT_NAME_MAX=8
+# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
+# CONFIG_RT_USING_SMP is not set
+CONFIG_RT_ALIGN_SIZE=4
+# CONFIG_RT_THREAD_PRIORITY_8 is not set
+CONFIG_RT_THREAD_PRIORITY_32=y
+# CONFIG_RT_THREAD_PRIORITY_256 is not set
+CONFIG_RT_THREAD_PRIORITY_MAX=32
+CONFIG_RT_TICK_PER_SECOND=1000
+CONFIG_RT_USING_OVERFLOW_CHECK=y
+CONFIG_RT_USING_HOOK=y
+CONFIG_RT_USING_IDLE_HOOK=y
+CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
+CONFIG_IDLE_THREAD_STACK_SIZE=256
+CONFIG_RT_USING_TIMER_SOFT=y
+CONFIG_RT_TIMER_THREAD_PRIO=4
+CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
+
+#
+# kservice optimization
+#
+# CONFIG_RT_KSERVICE_USING_STDLIB is not set
+# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
+CONFIG_RT_DEBUG=y
+# CONFIG_RT_DEBUG_COLOR is not set
+# CONFIG_RT_DEBUG_INIT_CONFIG is not set
+# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
+# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
+# CONFIG_RT_DEBUG_IPC_CONFIG is not set
+# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
+# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
+# CONFIG_RT_DEBUG_MEM_CONFIG is not set
+# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
+# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
+# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
+
+#
+# Inter-Thread communication
+#
+CONFIG_RT_USING_SEMAPHORE=y
+CONFIG_RT_USING_MUTEX=y
+CONFIG_RT_USING_EVENT=y
+CONFIG_RT_USING_MAILBOX=y
+CONFIG_RT_USING_MESSAGEQUEUE=y
+# CONFIG_RT_USING_SIGNALS is not set
+
+#
+# Memory Management
+#
+CONFIG_RT_USING_MEMPOOL=y
+# CONFIG_RT_USING_MEMHEAP is not set
+# CONFIG_RT_USING_NOHEAP is not set
+CONFIG_RT_USING_SMALL_MEM=y
+# CONFIG_RT_USING_SLAB is not set
+# CONFIG_RT_USING_USERHEAP is not set
+# CONFIG_RT_USING_MEMTRACE is not set
+CONFIG_RT_USING_HEAP=y
+
+#
+# Kernel Device Object
+#
+CONFIG_RT_USING_DEVICE=y
+# CONFIG_RT_USING_DEVICE_OPS is not set
+# CONFIG_RT_USING_INTERRUPT_INFO is not set
+CONFIG_RT_USING_CONSOLE=y
+CONFIG_RT_CONSOLEBUF_SIZE=128
+CONFIG_RT_CONSOLE_DEVICE_NAME="uart1"
+# CONFIG_RT_PRINTF_LONGLONG is not set
+CONFIG_RT_VER_NUM=0x40003
+CONFIG_ARCH_ARM=y
+# CONFIG_RT_USING_CPU_FFS is not set
+CONFIG_ARCH_ARM_CORTEX_M=y
+CONFIG_ARCH_ARM_CORTEX_M0=y
+# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
+
+#
+# RT-Thread Components
+#
+CONFIG_RT_USING_COMPONENTS_INIT=y
+CONFIG_RT_USING_USER_MAIN=y
+CONFIG_RT_MAIN_THREAD_STACK_SIZE=512
+CONFIG_RT_MAIN_THREAD_PRIORITY=10
+
+#
+# C++ features
+#
+# CONFIG_RT_USING_CPLUSPLUS is not set
+
+#
+# Command shell
+#
+CONFIG_RT_USING_FINSH=y
+CONFIG_FINSH_THREAD_NAME="tshell"
+CONFIG_FINSH_USING_HISTORY=y
+CONFIG_FINSH_HISTORY_LINES=5
+CONFIG_FINSH_USING_SYMTAB=y
+CONFIG_FINSH_USING_DESCRIPTION=y
+# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
+CONFIG_FINSH_THREAD_PRIORITY=20
+CONFIG_FINSH_THREAD_STACK_SIZE=512
+CONFIG_FINSH_CMD_SIZE=80
+# CONFIG_FINSH_USING_AUTH is not set
+CONFIG_FINSH_USING_MSH=y
+CONFIG_FINSH_USING_MSH_DEFAULT=y
+# CONFIG_FINSH_USING_MSH_ONLY is not set
+CONFIG_FINSH_ARG_MAX=10
+
+#
+# Device virtual file system
+#
+# CONFIG_RT_USING_DFS is not set
+
+#
+# Device Drivers
+#
+CONFIG_RT_USING_DEVICE_IPC=y
+CONFIG_RT_PIPE_BUFSZ=512
+# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
+CONFIG_RT_USING_SERIAL=y
+# CONFIG_RT_SERIAL_USING_DMA is not set
+CONFIG_RT_SERIAL_RB_BUFSZ=64
+# CONFIG_RT_USING_CAN is not set
+# CONFIG_RT_USING_HWTIMER is not set
+# CONFIG_RT_USING_CPUTIME is not set
+# CONFIG_RT_USING_I2C is not set
+# CONFIG_RT_USING_PHY is not set
+CONFIG_RT_USING_PIN=y
+# CONFIG_RT_USING_ADC is not set
+# CONFIG_RT_USING_DAC is not set
+# CONFIG_RT_USING_PWM is not set
+# CONFIG_RT_USING_MTD_NOR is not set
+# CONFIG_RT_USING_MTD_NAND is not set
+# CONFIG_RT_USING_PM is not set
+# CONFIG_RT_USING_RTC is not set
+# CONFIG_RT_USING_SDIO is not set
+# CONFIG_RT_USING_SPI is not set
+# CONFIG_RT_USING_WDT is not set
+# CONFIG_RT_USING_AUDIO is not set
+# CONFIG_RT_USING_SENSOR is not set
+# CONFIG_RT_USING_TOUCH is not set
+# CONFIG_RT_USING_HWCRYPTO is not set
+# CONFIG_RT_USING_PULSE_ENCODER is not set
+# CONFIG_RT_USING_INPUT_CAPTURE is not set
+# CONFIG_RT_USING_WIFI is not set
+
+#
+# Using USB
+#
+# CONFIG_RT_USING_USB_HOST is not set
+# CONFIG_RT_USING_USB_DEVICE is not set
+
+#
+# POSIX layer and C standard library
+#
+# CONFIG_RT_USING_LIBC is not set
+# CONFIG_RT_USING_PTHREADS is not set
+# CONFIG_RT_LIBC_USING_TIME is not set
+
+#
+# Network
+#
+
+#
+# Socket abstraction layer
+#
+# CONFIG_RT_USING_SAL is not set
+
+#
+# Network interface device
+#
+# CONFIG_RT_USING_NETDEV is not set
+
+#
+# light weight TCP/IP stack
+#
+# CONFIG_RT_USING_LWIP is not set
+
+#
+# AT commands
+#
+# CONFIG_RT_USING_AT is not set
+
+#
+# VBUS(Virtual Software BUS)
+#
+# CONFIG_RT_USING_VBUS is not set
+
+#
+# Utilities
+#
+# CONFIG_RT_USING_RYM is not set
+# CONFIG_RT_USING_ULOG is not set
+# CONFIG_RT_USING_UTEST is not set
+# CONFIG_RT_USING_LWP is not set
+
+#
+# RT-Thread online packages
+#
+
+#
+# IoT - internet of things
+#
+# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
+# CONFIG_PKG_USING_PAHOMQTT is not set
+# CONFIG_PKG_USING_UMQTT is not set
+# CONFIG_PKG_USING_WEBCLIENT is not set
+# CONFIG_PKG_USING_WEBNET is not set
+# CONFIG_PKG_USING_MONGOOSE is not set
+# CONFIG_PKG_USING_MYMQTT is not set
+# CONFIG_PKG_USING_KAWAII_MQTT is not set
+# CONFIG_PKG_USING_BC28_MQTT is not set
+# CONFIG_PKG_USING_WEBTERMINAL is not set
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_LIBMODBUS is not set
+# CONFIG_PKG_USING_FREEMODBUS is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_EZXML is not set
+# CONFIG_PKG_USING_NANOPB is not set
+
+#
+# Wi-Fi
+#
+
+#
+# Marvell WiFi
+#
+# CONFIG_PKG_USING_WLANMARVELL is not set
+
+#
+# Wiced WiFi
+#
+# CONFIG_PKG_USING_WLAN_WICED is not set
+# CONFIG_PKG_USING_RW007 is not set
+# CONFIG_PKG_USING_COAP is not set
+# CONFIG_PKG_USING_NOPOLL is not set
+# CONFIG_PKG_USING_NETUTILS is not set
+# CONFIG_PKG_USING_CMUX is not set
+# CONFIG_PKG_USING_PPP_DEVICE is not set
+# CONFIG_PKG_USING_AT_DEVICE is not set
+# CONFIG_PKG_USING_ATSRV_SOCKET is not set
+# CONFIG_PKG_USING_WIZNET is not set
+# CONFIG_PKG_USING_ZB_COORDINATOR is not set
+
+#
+# IoT Cloud
+#
+# CONFIG_PKG_USING_ONENET is not set
+# CONFIG_PKG_USING_GAGENT_CLOUD is not set
+# CONFIG_PKG_USING_ALI_IOTKIT is not set
+# CONFIG_PKG_USING_AZURE is not set
+# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
+# CONFIG_PKG_USING_JIOT-C-SDK is not set
+# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
+# CONFIG_PKG_USING_JOYLINK is not set
+# CONFIG_PKG_USING_NIMBLE is not set
+# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
+# CONFIG_PKG_USING_IPMSG is not set
+# CONFIG_PKG_USING_LSSDP is not set
+# CONFIG_PKG_USING_AIRKISS_OPEN is not set
+# CONFIG_PKG_USING_LIBRWS is not set
+# CONFIG_PKG_USING_TCPSERVER is not set
+# CONFIG_PKG_USING_PROTOBUF_C is not set
+# CONFIG_PKG_USING_DLT645 is not set
+# CONFIG_PKG_USING_QXWZ is not set
+# CONFIG_PKG_USING_SMTP_CLIENT is not set
+# CONFIG_PKG_USING_ABUP_FOTA is not set
+# CONFIG_PKG_USING_LIBCURL2RTT is not set
+# CONFIG_PKG_USING_CAPNP is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_AGILE_TELNET is not set
+# CONFIG_PKG_USING_NMEALIB is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+# CONFIG_PKG_USING_PDULIB is not set
+# CONFIG_PKG_USING_BTSTACK is not set
+# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
+# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
+# CONFIG_PKG_USING_MAVLINK is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_BSAL is not set
+# CONFIG_PKG_USING_AGILE_MODBUS is not set
+# CONFIG_PKG_USING_AGILE_FTP is not set
+# CONFIG_PKG_USING_EMBEDDEDPROTO is not set
+# CONFIG_PKG_USING_RT_LINK_HW is not set
+
+#
+# security packages
+#
+# CONFIG_PKG_USING_MBEDTLS is not set
+# CONFIG_PKG_USING_libsodium is not set
+# CONFIG_PKG_USING_TINYCRYPT is not set
+# CONFIG_PKG_USING_TFM is not set
+# CONFIG_PKG_USING_YD_CRYPTO is not set
+
+#
+# language packages
+#
+# CONFIG_PKG_USING_LUA is not set
+# CONFIG_PKG_USING_JERRYSCRIPT is not set
+# CONFIG_PKG_USING_MICROPYTHON is not set
+
+#
+# multimedia packages
+#
+# CONFIG_PKG_USING_OPENMV is not set
+# CONFIG_PKG_USING_MUPDF is not set
+# CONFIG_PKG_USING_STEMWIN is not set
+# CONFIG_PKG_USING_WAVPLAYER is not set
+# CONFIG_PKG_USING_TJPGD is not set
+# CONFIG_PKG_USING_PDFGEN is not set
+# CONFIG_PKG_USING_HELIX is not set
+# CONFIG_PKG_USING_AZUREGUIX is not set
+# CONFIG_PKG_USING_TOUCHGFX2RTT is not set
+# CONFIG_PKG_USING_NUEMWIN is not set
+# CONFIG_PKG_USING_MP3PLAYER is not set
+# CONFIG_PKG_USING_TINYJPEG is not set
+
+#
+# tools packages
+#
+# CONFIG_PKG_USING_CMBACKTRACE is not set
+# CONFIG_PKG_USING_EASYFLASH is not set
+# CONFIG_PKG_USING_EASYLOGGER is not set
+# CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_SEGGER_RTT is not set
+# CONFIG_PKG_USING_RDB is not set
+# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
+# CONFIG_PKG_USING_ULOG_FILE is not set
+# CONFIG_PKG_USING_LOGMGR is not set
+# CONFIG_PKG_USING_ADBD is not set
+# CONFIG_PKG_USING_COREMARK is not set
+# CONFIG_PKG_USING_DHRYSTONE is not set
+# CONFIG_PKG_USING_MEMORYPERF is not set
+# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
+# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
+# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
+# CONFIG_PKG_USING_BS8116A is not set
+# CONFIG_PKG_USING_GPS_RMC is not set
+# CONFIG_PKG_USING_URLENCODE is not set
+# CONFIG_PKG_USING_UMCN is not set
+# CONFIG_PKG_USING_LWRB2RTT is not set
+# CONFIG_PKG_USING_CPU_USAGE is not set
+# CONFIG_PKG_USING_GBK2UTF8 is not set
+# CONFIG_PKG_USING_VCONSOLE is not set
+# CONFIG_PKG_USING_KDB is not set
+# CONFIG_PKG_USING_WAMR is not set
+# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set
+# CONFIG_PKG_USING_LWLOG is not set
+# CONFIG_PKG_USING_ANV_TRACE is not set
+# CONFIG_PKG_USING_ANV_MEMLEAK is not set
+# CONFIG_PKG_USING_ANV_TESTSUIT is not set
+# CONFIG_PKG_USING_ANV_BENCH is not set
+# CONFIG_PKG_USING_DEVMEM is not set
+# CONFIG_PKG_USING_REGEX is not set
+# CONFIG_PKG_USING_MEM_SANDBOX is not set
+# CONFIG_PKG_USING_SOLAR_TERMS is not set
+# CONFIG_PKG_USING_GAN_ZHI is not set
+
+#
+# system packages
+#
+
+#
+# acceleration: Assembly language or algorithmic acceleration packages
+#
+# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
+# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
+# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
+# CONFIG_PKG_USING_QFPLIB_M3 is not set
+
+#
+# Micrium: Micrium software products porting for RT-Thread
+#
+# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
+# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
+# CONFIG_PKG_USING_UC_CRC is not set
+# CONFIG_PKG_USING_UC_CLK is not set
+# CONFIG_PKG_USING_UC_COMMON is not set
+# CONFIG_PKG_USING_UC_MODBUS is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
+# CONFIG_PKG_USING_CAIRO is not set
+# CONFIG_PKG_USING_PIXMAN is not set
+# CONFIG_PKG_USING_PARTITION is not set
+# CONFIG_PKG_USING_FAL is not set
+# CONFIG_PKG_USING_FLASHDB is not set
+# CONFIG_PKG_USING_SQLITE is not set
+# CONFIG_PKG_USING_RTI is not set
+# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_CMSIS is not set
+# CONFIG_PKG_USING_DFS_YAFFS is not set
+# CONFIG_PKG_USING_LITTLEFS is not set
+# CONFIG_PKG_USING_DFS_JFFS2 is not set
+# CONFIG_PKG_USING_DFS_UFFS is not set
+# CONFIG_PKG_USING_LWEXT4 is not set
+# CONFIG_PKG_USING_THREAD_POOL is not set
+# CONFIG_PKG_USING_ROBOTS is not set
+# CONFIG_PKG_USING_EV is not set
+# CONFIG_PKG_USING_SYSWATCH is not set
+# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
+# CONFIG_PKG_USING_PLCCORE is not set
+# CONFIG_PKG_USING_RAMDISK is not set
+# CONFIG_PKG_USING_MININI is not set
+# CONFIG_PKG_USING_QBOOT is not set
+# CONFIG_PKG_USING_PPOOL is not set
+# CONFIG_PKG_USING_OPENAMP is not set
+# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
+# CONFIG_PKG_USING_LPM is not set
+# CONFIG_PKG_USING_TLSF is not set
+# CONFIG_PKG_USING_EVENT_RECORDER is not set
+
+#
+# peripheral libraries and drivers
+#
+# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
+# CONFIG_PKG_USING_REALTEK_AMEBA is not set
+# CONFIG_PKG_USING_SHT2X is not set
+# CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_AS7341 is not set
+# CONFIG_PKG_USING_STM32_SDIO is not set
+# CONFIG_PKG_USING_ICM20608 is not set
+# CONFIG_PKG_USING_U8G2 is not set
+# CONFIG_PKG_USING_BUTTON is not set
+# CONFIG_PKG_USING_PCF8574 is not set
+# CONFIG_PKG_USING_SX12XX is not set
+# CONFIG_PKG_USING_SIGNAL_LED is not set
+# CONFIG_PKG_USING_LEDBLINK is not set
+# CONFIG_PKG_USING_LITTLED is not set
+# CONFIG_PKG_USING_LKDGUI is not set
+# CONFIG_PKG_USING_NRF5X_SDK is not set
+# CONFIG_PKG_USING_NRFX is not set
+# CONFIG_PKG_USING_WM_LIBRARIES is not set
+# CONFIG_PKG_USING_KENDRYTE_SDK is not set
+# CONFIG_PKG_USING_INFRARED is not set
+# CONFIG_PKG_USING_AGILE_BUTTON is not set
+# CONFIG_PKG_USING_AGILE_LED is not set
+# CONFIG_PKG_USING_AT24CXX is not set
+# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
+# CONFIG_PKG_USING_AD7746 is not set
+# CONFIG_PKG_USING_PCA9685 is not set
+# CONFIG_PKG_USING_I2C_TOOLS is not set
+# CONFIG_PKG_USING_NRF24L01 is not set
+# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
+# CONFIG_PKG_USING_MAX17048 is not set
+# CONFIG_PKG_USING_RPLIDAR is not set
+# CONFIG_PKG_USING_AS608 is not set
+# CONFIG_PKG_USING_RC522 is not set
+# CONFIG_PKG_USING_WS2812B is not set
+# CONFIG_PKG_USING_EMBARC_BSP is not set
+# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
+# CONFIG_PKG_USING_MULTI_RTIMER is not set
+# CONFIG_PKG_USING_MAX7219 is not set
+# CONFIG_PKG_USING_BEEP is not set
+# CONFIG_PKG_USING_EASYBLINK is not set
+# CONFIG_PKG_USING_PMS_SERIES is not set
+# CONFIG_PKG_USING_CAN_YMODEM is not set
+# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set
+# CONFIG_PKG_USING_QLED is not set
+# CONFIG_PKG_USING_PAJ7620 is not set
+# CONFIG_PKG_USING_AGILE_CONSOLE is not set
+# CONFIG_PKG_USING_LD3320 is not set
+# CONFIG_PKG_USING_WK2124 is not set
+# CONFIG_PKG_USING_LY68L6400 is not set
+# CONFIG_PKG_USING_DM9051 is not set
+# CONFIG_PKG_USING_SSD1306 is not set
+# CONFIG_PKG_USING_QKEY is not set
+# CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_NES is not set
+# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
+# CONFIG_PKG_USING_VDEVICE is not set
+# CONFIG_PKG_USING_SGM706 is not set
+# CONFIG_PKG_USING_STM32WB55_SDK is not set
+# CONFIG_PKG_USING_RDA58XX is not set
+# CONFIG_PKG_USING_LIBNFC is not set
+# CONFIG_PKG_USING_MFOC is not set
+# CONFIG_PKG_USING_TMC51XX is not set
+# CONFIG_PKG_USING_TCA9534 is not set
+# CONFIG_PKG_USING_KOBUKI is not set
+# CONFIG_PKG_USING_ROSSERIAL is not set
+# CONFIG_PKG_USING_MICRO_ROS is not set
+# CONFIG_PKG_USING_MCP23008 is not set
+
+#
+# AI packages
+#
+# CONFIG_PKG_USING_LIBANN is not set
+# CONFIG_PKG_USING_NNOM is not set
+# CONFIG_PKG_USING_ONNX_BACKEND is not set
+# CONFIG_PKG_USING_ONNX_PARSER is not set
+# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
+# CONFIG_PKG_USING_ELAPACK is not set
+# CONFIG_PKG_USING_ULAPACK is not set
+# CONFIG_PKG_USING_QUEST is not set
+# CONFIG_PKG_USING_NAXOS is not set
+
+#
+# miscellaneous packages
+#
+# CONFIG_PKG_USING_LIBCSV is not set
+# CONFIG_PKG_USING_OPTPARSE is not set
+# CONFIG_PKG_USING_FASTLZ is not set
+# CONFIG_PKG_USING_MINILZO is not set
+# CONFIG_PKG_USING_QUICKLZ is not set
+# CONFIG_PKG_USING_LZMA is not set
+# CONFIG_PKG_USING_MULTIBUTTON is not set
+# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
+# CONFIG_PKG_USING_CANFESTIVAL is not set
+# CONFIG_PKG_USING_ZLIB is not set
+# CONFIG_PKG_USING_MINIZIP is not set
+# CONFIG_PKG_USING_DSTR is not set
+# CONFIG_PKG_USING_TINYFRAME is not set
+# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
+# CONFIG_PKG_USING_DIGITALCTRL is not set
+# CONFIG_PKG_USING_UPACKER is not set
+# CONFIG_PKG_USING_UPARAM is not set
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+# CONFIG_PKG_USING_HELLO is not set
+# CONFIG_PKG_USING_VI is not set
+# CONFIG_PKG_USING_KI is not set
+# CONFIG_PKG_USING_ARMv7M_DWT is not set
+# CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_UKAL is not set
+# CONFIG_PKG_USING_CRCLIB is not set
+
+#
+# entertainment: terminal games and other interesting software packages
+#
+# CONFIG_PKG_USING_THREES is not set
+# CONFIG_PKG_USING_2048 is not set
+# CONFIG_PKG_USING_SNAKE is not set
+# CONFIG_PKG_USING_TETRIS is not set
+# CONFIG_PKG_USING_DONUT is not set
+# CONFIG_PKG_USING_ACLOCK is not set
+# CONFIG_PKG_USING_LWGPS is not set
+# CONFIG_PKG_USING_STATE_MACHINE is not set
+# CONFIG_PKG_USING_MCURSES is not set
+# CONFIG_PKG_USING_COWSAY is not set
+
+#
+# Hardware Drivers Config
+#
+CONFIG_MCU_HC32L136=y
+
+#
+# Onboard Peripheral Drivers
+#
+
+#
+# On-chip Peripheral Drivers
+#
+CONFIG_BSP_USING_GPIO=y
+CONFIG_BSP_USING_UART=y
+# CONFIG_BSP_USING_UART0 is not set
+CONFIG_BSP_USING_UART1=y
+# CONFIG_BSP_USING_I2C1 is not set
+
+#
+# Board extended module Drivers
+#
diff --git a/bsp/hc32l136/.ignore_format.yml b/bsp/hc32l136/.ignore_format.yml
new file mode 100644
index 0000000000..53148ea970
--- /dev/null
+++ b/bsp/hc32l136/.ignore_format.yml
@@ -0,0 +1,9 @@
+# files format check exclude path, please follow the instructions below to modify;
+# If you need to exclude an entire folder, add the folder path in dir_path;
+# If you need to exclude a file, add the path to the file in file_path.
+
+file_path:
+
+
+dir_path:
+- libraries \ No newline at end of file
diff --git a/bsp/hc32l136/Kconfig b/bsp/hc32l136/Kconfig
new file mode 100644
index 0000000000..f4ed99b3fa
--- /dev/null
+++ b/bsp/hc32l136/Kconfig
@@ -0,0 +1,23 @@
+mainmenu "RT-Thread Project Configuration"
+
+config BSP_DIR
+ string
+ option env="BSP_ROOT"
+ default "."
+
+config RTT_DIR
+ string
+ option env="RTT_ROOT"
+ default "../.."
+
+config PKGS_DIR
+ string
+ option env="PKGS_ROOT"
+ default "packages"
+
+source "$RTT_DIR/Kconfig"
+source "$PKGS_DIR/Kconfig"
+source "board/Kconfig"
+
+
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/base_types.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/base_types.h
new file mode 100644
index 0000000000..d3feeaff73
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/base_types.h
@@ -0,0 +1,155 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file base_types.h
+ **
+ ** base type common define.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-03-09 1.0 Lux First version.
+ **
+ ******************************************************************************/
+
+#ifndef __BASE_TYPES_H__
+#define __BASE_TYPES_H__
+
+/*****************************************************************************/
+/* Include files */
+/*****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <assert.h>
+
+
+/*****************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/*****************************************************************************/
+#ifndef TRUE
+ /** Value is true (boolean_t type) */
+ #define TRUE ((boolean_t) 1u)
+#endif
+
+#ifndef FALSE
+ /** Value is false (boolean_t type) */
+ #define FALSE ((boolean_t) 0u)
+#endif
+
+#if defined (__ICCARM__)
+#define __WEAKDEF __WEAK __ATTRIBUTES
+#elif defined (__CC_ARM)
+#define __WEAKDEF __weak
+#else
+#error "unsupported compiler!!"
+#endif
+
+/** Returns the minimum value out of two values */
+#define MINIMUM( X, Y ) ((X) < (Y) ? (X) : (Y))
+
+/** Returns the maximum value out of two values */
+#define MAXIMUM( X, Y ) ((X) > (Y) ? (X) : (Y))
+
+/** Returns the dimension of an array */
+#define ARRAY_SZ( X ) (sizeof(X) / sizeof((X)[0]))
+
+#ifdef __DEBUG_ASSERT
+ #define ASSERT(x) do{ assert((x)> 0u) ; }while(0);
+#else
+ #define ASSERT(x) {}
+#endif
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/** logical datatype (only values are TRUE and FALSE) */
+typedef uint8_t boolean_t;
+
+/** single precision floating point number (4 byte) */
+typedef float float32_t;
+
+/** double precision floating point number (8 byte) */
+typedef double float64_t;
+
+/** ASCII character for string generation (8 bit) */
+typedef char char_t;
+
+/** function pointer type to void/void function */
+typedef void (*func_ptr_t)(void);
+
+/** function pointer type to void/uint8_t function */
+typedef void (*func_ptr_arg1_t)(uint8_t u8Param);
+
+/** generic error codes */
+typedef enum en_result
+{
+ Ok = 0u, ///< No error
+ Error = 1u, ///< Non-specific error code
+ ErrorAddressAlignment = 2u, ///< Address alignment does not match
+ ErrorAccessRights = 3u, ///< Wrong mode (e.g. user/system) mode is set
+ ErrorInvalidParameter = 4u, ///< Provided parameter is not valid
+ ErrorOperationInProgress = 5u, ///< A conflicting or requested operation is still in progress
+ ErrorInvalidMode = 6u, ///< Operation not allowed in current mode
+ ErrorUninitialized = 7u, ///< Module (or part of it) was not initialized properly
+ ErrorBufferFull = 8u, ///< Circular buffer can not be written because the buffer is full
+ ErrorTimeout = 9u, ///< Time Out error occurred (e.g. I2C arbitration lost, Flash time-out, etc.)
+ ErrorNotReady = 10u, ///< A requested final state is not reached
+ OperationInProgress = 11u ///< Indicator for operation in progress
+} en_result_t;
+
+
+/*****************************************************************************/
+/* Global variable declarations ('extern', definition in C source) */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Global function prototypes ('extern', definition in C source) */
+/*****************************************************************************/
+
+#endif /* __BASE_TYPES_H__ */
+
+/******************************************************************************/
+/* EOF (not truncated) */
+/******************************************************************************/
+
+
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/board_stkhc32l13x.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/board_stkhc32l13x.h
new file mode 100644
index 0000000000..e5c194c7c2
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/board_stkhc32l13x.h
@@ -0,0 +1,120 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file stkhc32l13x.h
+ **
+ ** stk board common define.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-03-09 1.0 Lux First version.
+ **
+ ******************************************************************************/
+#ifndef __BOARD_STKHC32L13X_H__
+#define __BOARD_STKHC32L13X_H__
+
+///< STK GPIO DEFINE
+///< USER KEY
+#define STK_USER_PORT GpioPortD
+#define STK_USER_PIN GpioPin4
+
+///< LED
+#define STK_LED_PORT GpioPortD
+#define STK_LED_PIN GpioPin5
+
+///< XTH
+#define SYSTEM_XTH (32*1000*1000u) ///< 32MHz
+
+#define STK_XTHI_PORT GpioPortD
+#define STK_XTHI_PIN GpioPin0
+#define STK_XTHO_PORT GpioPortD
+#define STK_XTHO_PIN GpioPin1
+
+///< XTL
+#define SYSTEM_XTL (32768u) ///< 32768Hz
+#define STK_XTLI_PORT GpioPortC
+#define STK_XTLI_PIN GpioPin14
+#define STK_XTLO_PORT GpioPortC
+#define STK_XTLO_PIN GpioPin15
+
+///< LCD
+#define STK_LCD_COM0_PORT GpioPortA
+#define STK_LCD_COM0_PIN GpioPin9
+#define STK_LCD_COM1_PORT GpioPortA
+#define STK_LCD_COM1_PIN GpioPin10
+#define STK_LCD_COM2_PORT GpioPortA
+#define STK_LCD_COM2_PIN GpioPin11
+#define STK_LCD_COM3_PORT GpioPortA
+#define STK_LCD_COM3_PIN GpioPin12
+#define STK_LCD_SEG0_PORT GpioPortA
+#define STK_LCD_SEG0_PIN GpioPin8
+#define STK_LCD_SEG1_PORT GpioPortC
+#define STK_LCD_SEG1_PIN GpioPin9
+#define STK_LCD_SEG2_PORT GpioPortC
+#define STK_LCD_SEG2_PIN GpioPin8
+#define STK_LCD_SEG3_PORT GpioPortC
+#define STK_LCD_SEG3_PIN GpioPin7
+#define STK_LCD_SEG4_PORT GpioPortC
+#define STK_LCD_SEG4_PIN GpioPin6
+#define STK_LCD_SEG5_PORT GpioPortB
+#define STK_LCD_SEG5_PIN GpioPin15
+#define STK_LCD_SEG6_PORT GpioPortB
+#define STK_LCD_SEG6_PIN GpioPin14
+#define STK_LCD_SEG7_PORT GpioPortB
+#define STK_LCD_SEG7_PIN GpioPin13
+
+///< I2C EEPROM
+#define EVB_I2C0_EEPROM_SCL_PORT GpioPortB
+#define EVB_I2C0_EEPROM_SCL_PIN GpioPin6
+#define EVB_I2C0_EEPROM_SDA_PORT GpioPortB
+#define EVB_I2C0_EEPROM_SDA_PIN GpioPin7
+
+///< SPI0
+#define EVB_SPI0_FLASH_CS_PORT GpioPortE
+#define EVB_SPI0_FLASH_CS_PIN GpioPin12
+#define EVB_SPI0_FLASH_SCK_PORT GpioPortE
+#define EVB_SPI0_FLASH_SCK_PIN GpioPin13
+#define EVB_SPI0_FLASH_MISO_PORT GpioPortE
+#define EVB_SPI0_FLASH_MISO_PIN GpioPin14
+#define EVB_SPI0_FLASH_MOSI_PORT GpioPortE
+#define EVB_SPI0_FLASH_MOSI_PIN GpioPin15
+
+#endif
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/ddl_device.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/ddl_device.h
new file mode 100644
index 0000000000..6ee91e5f2e
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/ddl_device.h
@@ -0,0 +1,76 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file ddl_device.h
+ **
+ ** Device define
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-04-15
+ **
+ *****************************************************************************/
+
+#ifndef __DDL_DEVICE_H__
+#define __DDL_DEVICE_H__
+
+/**
+ *******************************************************************************
+ ** \brief Global device series definition
+ **
+ ** \note
+ ******************************************************************************/
+#define DDL_MCU_SERIES DDL_DEVICE_SERIES_HC32L13X
+
+
+/**
+ *******************************************************************************
+ ** \brief Global package definition
+ **
+ ** \note This definition is used for device package settings
+ ******************************************************************************/
+#define DDL_MCU_PACKAGE DDL_DEVICE_PACKAGE_HC_K
+
+#endif /* __DDL_DEVICE_H__ */
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/hc32l136.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/hc32l136.h
new file mode 100644
index 0000000000..a162e9e5a2
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/hc32l136.h
@@ -0,0 +1,9620 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \\file HC32L136.h
+**
+** Auto generate.
+** Headerfile for HC32L136 series MCU
+**
+** History:
+**
+** - 2018-09-14 0.1 Lux First version.
+**
+******************************************************************************/
+
+#ifndef __HC32L136_H__
+#define __HC32L136_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************
+* Configuration of the Cortex-M0P Processor and Core Peripherals
+******************************************************************************/
+#define __MPU_PRESENT 0 /* No MPU */
+#define __NVIC_PRIO_BITS 2 /* M0P uses 2 Bits for the Priority Levels */
+#define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */
+
+/******************************************************************************
+* Interrupt Number Definition
+******************************************************************************/
+typedef enum IRQn
+{
+ NMI_IRQn = -14, /* 2 Non Maskable */
+ HardFault_IRQn = -13, /* 3 Hard Fault */
+ SVC_IRQn = -5, /* 11 SV Call */
+ PendSV_IRQn = -2, /* 14 Pend SV */
+ SysTick_IRQn = -1, /* 15 System Tick */
+
+ PORTA_IRQn = 0 ,
+ PORTB_IRQn = 1 ,
+ PORTC_IRQn = 2 ,
+ PORTD_IRQn = 3 ,
+ DMAC_IRQn = 4 ,
+ TIM3_IRQn = 5 ,
+ UART0_IRQn = 6 ,
+ UART1_IRQn = 7 ,
+ LPUART0_IRQn = 8 ,
+ LPUART1_IRQn = 9 ,
+ SPI0_IRQn = 10,
+ SPI1_IRQn = 11,
+ I2C0_IRQn = 12,
+ I2C1_IRQn = 13,
+ TIM0_IRQn = 14,
+ TIM1_IRQn = 15,
+ TIM2_IRQn = 16,
+ LPTIM_IRQn = 17,
+ TIM4_IRQn = 18,
+ TIM5_IRQn = 19,
+ TIM6_IRQn = 20,
+ PCA_IRQn = 21,
+ WDT_IRQn = 22,
+ RTC_IRQn = 23,
+ ADC_IRQn = 24,
+ PCNT_IRQn = 25,
+ VC0_IRQn = 26,
+ VC1_IRQn = 27,
+ LVD_IRQn = 28,
+ LCD_IRQn = 29,
+ FLASH_RAM_IRQn = 30,
+ CLK_TRIM_IRQn = 31,
+
+
+} IRQn_Type;
+
+
+#include <core_cm0plus.h>
+#include <stdint.h>
+
+#define SUCCESS (0)
+#define ERROR (-1)
+
+#ifndef NULL
+#define NULL (0)
+#endif
+
+
+/******************************************************************************/
+/* Device Specific Peripheral Registers structures */
+/******************************************************************************/
+
+#if defined ( __CC_ARM )
+#pragma anon_unions
+#endif
+
+typedef struct
+{
+ __IO uint32_t EN : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CLKDIV : 2;
+ __IO uint32_t SGLMUX : 5;
+ __IO uint32_t REF : 2;
+ __IO uint32_t BUF : 1;
+ __IO uint32_t SAM : 2;
+ __IO uint32_t INREFEN : 1;
+ __IO uint32_t IE : 1;
+} stc_adc_cr0_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 2;
+ __IO uint32_t ALIGN : 1;
+ __IO uint32_t THCH : 5;
+ __IO uint32_t DMASQR : 1;
+ __IO uint32_t DMAJQR : 1;
+ __IO uint32_t MODE : 1;
+ __IO uint32_t RACCEN : 1;
+ __IO uint32_t LTCMP : 1;
+ __IO uint32_t HTCMP : 1;
+ __IO uint32_t REGCMP : 1;
+ __IO uint32_t RACCCLR : 1;
+} stc_adc_cr1_field_t;
+
+typedef struct
+{
+ __IO uint32_t CH0MUX : 5;
+ __IO uint32_t CH1MUX : 5;
+ __IO uint32_t CH2MUX : 5;
+ __IO uint32_t CH3MUX : 5;
+ __IO uint32_t CH4MUX : 5;
+ __IO uint32_t CH5MUX : 5;
+} stc_adc_sqr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CH6MUX : 5;
+ __IO uint32_t CH7MUX : 5;
+ __IO uint32_t CH8MUX : 5;
+ __IO uint32_t CH9MUX : 5;
+ __IO uint32_t CH10MUX : 5;
+ __IO uint32_t CH11MUX : 5;
+} stc_adc_sqr1_field_t;
+
+typedef struct
+{
+ __IO uint32_t CH12MUX : 5;
+ __IO uint32_t CH13MUX : 5;
+ __IO uint32_t CH14MUX : 5;
+ __IO uint32_t CH15MUX : 5;
+ __IO uint32_t CNT : 4;
+} stc_adc_sqr2_field_t;
+
+typedef struct
+{
+ __IO uint32_t CH0MUX : 5;
+ __IO uint32_t CH1MUX : 5;
+ __IO uint32_t CH2MUX : 5;
+ __IO uint32_t CH3MUX : 5;
+ __IO uint32_t CNT : 2;
+} stc_adc_jqr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult0_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult1_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult2_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult3_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult4_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult5_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult6_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult7_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult8_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult9_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult10_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult11_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult12_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqr_result13_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult14_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_sqrresult15_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_jqrresult0_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_jqrresult1_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_jqrresult2_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_jqrresult3_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :12;
+} stc_adc_result_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULTACC :20;
+} stc_adc_resultacc_field_t;
+
+typedef struct
+{
+ __IO uint32_t HT :12;
+} stc_adc_ht_field_t;
+
+typedef struct
+{
+ __IO uint32_t LT :12;
+} stc_adc_lt_field_t;
+
+typedef struct
+{
+ __IO uint32_t SGLIF : 1;
+ __IO uint32_t LTIF : 1;
+ __IO uint32_t HTIF : 1;
+ __IO uint32_t REGIF : 1;
+ __IO uint32_t SQRIF : 1;
+ __IO uint32_t JQRIF : 1;
+} stc_adc_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SGLIC : 1;
+ __IO uint32_t LTIC : 1;
+ __IO uint32_t HTIC : 1;
+ __IO uint32_t REGIC : 1;
+ __IO uint32_t SQRIC : 1;
+ __IO uint32_t JQRIC : 1;
+} stc_adc_icr_field_t;
+
+typedef struct
+{
+ __IO uint32_t TIM0 : 1;
+ __IO uint32_t TIM1 : 1;
+ __IO uint32_t TIM2 : 1;
+ __IO uint32_t TIM3 : 1;
+ __IO uint32_t TIM4 : 1;
+ __IO uint32_t TIM5 : 1;
+ __IO uint32_t TIM6 : 1;
+ __IO uint32_t UART0 : 1;
+ __IO uint32_t UART1 : 1;
+ __IO uint32_t LPUART0 : 1;
+ __IO uint32_t LPUART1 : 1;
+ __IO uint32_t VC0 : 1;
+ __IO uint32_t VC1 : 1;
+ __IO uint32_t RTC : 1;
+ __IO uint32_t PCA : 1;
+ __IO uint32_t SPI0 : 1;
+ __IO uint32_t SPI1 : 1;
+ __IO uint32_t DMA : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PD07 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PA15 : 1;
+ __IO uint32_t PB15 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_adc_exttrigger0_field_t;
+
+typedef struct
+{
+ __IO uint32_t TIM0 : 1;
+ __IO uint32_t TIM1 : 1;
+ __IO uint32_t TIM2 : 1;
+ __IO uint32_t TIM3 : 1;
+ __IO uint32_t TIM4 : 1;
+ __IO uint32_t TIM5 : 1;
+ __IO uint32_t TIM6 : 1;
+ __IO uint32_t UART0 : 1;
+ __IO uint32_t UART1 : 1;
+ __IO uint32_t LPUART0 : 1;
+ __IO uint32_t LPUART1 : 1;
+ __IO uint32_t VC0 : 1;
+ __IO uint32_t VC1 : 1;
+ __IO uint32_t RTC : 1;
+ __IO uint32_t PCA : 1;
+ __IO uint32_t SPI0 : 1;
+ __IO uint32_t SPI1 : 1;
+ __IO uint32_t DMA : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PD07 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PA15 : 1;
+ __IO uint32_t PB15 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_adc_exttrigger1_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+} stc_adc_sglstart_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+} stc_adc_sqrstart_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+} stc_adc_jqrstart_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+ __IO uint32_t MODE : 1;
+} stc_aes_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA0 :32;
+} stc_aes_data0_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA0 :32;
+} stc_aes_data1_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA0 :32;
+} stc_aes_data2_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA0 :32;
+} stc_aes_data3_field_t;
+
+typedef struct
+{
+ __IO uint32_t KEY0 :32;
+} stc_aes_key0_field_t;
+
+typedef struct
+{
+ __IO uint32_t KEY0 :32;
+} stc_aes_key1_field_t;
+
+typedef struct
+{
+ __IO uint32_t KEY0 :32;
+} stc_aes_key2_field_t;
+
+typedef struct
+{
+ __IO uint32_t KEY0 :32;
+} stc_aes_key3_field_t;
+
+typedef struct
+{
+ __IO uint32_t BGR_EN : 1;
+ __IO uint32_t TS_EN : 1;
+} stc_bgr_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t TRIM_START : 1;
+ __IO uint32_t REFCLK_SEL : 3;
+ __IO uint32_t CALCLK_SEL : 2;
+ __IO uint32_t MON_EN : 1;
+ __IO uint32_t IE : 1;
+ __IO uint32_t CALCLK_SEL2 : 1;
+} stc_clk_trim_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCNTVAL :32;
+} stc_clk_trim_refcon_field_t;
+
+typedef struct
+{
+ __IO uint32_t REFCNT :32;
+} stc_clk_trim_refcnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CALCNT :32;
+} stc_clk_trim_calcnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t STOP : 1;
+ __IO uint32_t CALCNT_OF : 1;
+ __IO uint32_t XTL_FAULT : 1;
+ __IO uint32_t XTH_FAULT : 1;
+ __IO uint32_t PLL_FAULT : 1;
+} stc_clk_trim_ifr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 2;
+ __IO uint32_t XTL_FAULT_CLR : 1;
+ __IO uint32_t XTH_FAULT_CLR : 1;
+ __IO uint32_t PLL_FAULT_CLR : 1;
+} stc_clk_trim_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCNTVAL :32;
+} stc_clk_trim_calcon_field_t;
+
+typedef struct
+{
+ __IO uint32_t CR : 1;
+ __IO uint32_t FLAG : 1;
+} stc_crc_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RESULT :32;
+} stc_crc_result_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA :32;
+} stc_crc_data_field_t;
+
+typedef struct
+{
+ __IO uint32_t TIM0 : 1;
+ __IO uint32_t TIM1 : 1;
+ __IO uint32_t TIM2 : 1;
+ __IO uint32_t LPTIM : 1;
+ __IO uint32_t TIM4 : 1;
+ __IO uint32_t TIM5 : 1;
+ __IO uint32_t TIM6 : 1;
+ __IO uint32_t PCA : 1;
+ __IO uint32_t WDT : 1;
+ __IO uint32_t RTC : 1;
+ uint32_t RESERVED10 : 1;
+ __IO uint32_t TIM3 : 1;
+} stc_debug_active_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 :24;
+ __IO uint32_t HALT : 4;
+ __IO uint32_t PRIO : 1;
+ uint32_t RESERVED29 : 1;
+ __IO uint32_t ST : 1;
+ __IO uint32_t EN : 1;
+} stc_dmac_conf_field_t;
+
+typedef struct
+{
+ __IO uint32_t TC :16;
+ __IO uint32_t BC : 4;
+ uint32_t RESERVED20 : 3;
+ __IO uint32_t TRI_SEL : 6;
+ __IO uint32_t ST : 1;
+ __IO uint32_t PAS : 1;
+ __IO uint32_t ENS : 1;
+} stc_dmac_confa0_field_t;
+
+typedef struct
+{
+ __IO uint32_t MSK : 1;
+ uint32_t RESERVED1 :15;
+ __IO uint32_t STAT : 3;
+ __IO uint32_t FIS_IE : 1;
+ __IO uint32_t ERR_IE : 1;
+ __IO uint32_t RD : 1;
+ __IO uint32_t RS : 1;
+ __IO uint32_t RC : 1;
+ __IO uint32_t FD : 1;
+ __IO uint32_t FS : 1;
+ __IO uint32_t WIDTH : 2;
+ __IO uint32_t MODE : 2;
+} stc_dmac_confb0_field_t;
+
+typedef struct
+{
+ __IO uint32_t SRCADR :32;
+} stc_dmac_srcadr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t DSTADR :32;
+} stc_dmac_dstadr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t TC :16;
+ __IO uint32_t BC : 4;
+ uint32_t RESERVED20 : 3;
+ __IO uint32_t TRI_SEL : 6;
+ __IO uint32_t ST : 1;
+ __IO uint32_t PAS : 1;
+ __IO uint32_t ENS : 1;
+} stc_dmac_confa1_field_t;
+
+typedef struct
+{
+ __IO uint32_t MSK : 1;
+ uint32_t RESERVED1 :15;
+ __IO uint32_t STAT : 3;
+ __IO uint32_t FIS_IE : 1;
+ __IO uint32_t ERR_IE : 1;
+ __IO uint32_t RD : 1;
+ __IO uint32_t RS : 1;
+ __IO uint32_t RC : 1;
+ __IO uint32_t FD : 1;
+ __IO uint32_t FS : 1;
+ __IO uint32_t WIDTH : 2;
+ __IO uint32_t MODE : 2;
+} stc_dmac_confb1_field_t;
+
+typedef struct
+{
+ __IO uint32_t SRCADR :32;
+} stc_dmac_srcadr1_field_t;
+
+typedef struct
+{
+ __IO uint32_t DSTADR :32;
+} stc_dmac_dstadr1_field_t;
+
+typedef struct
+{
+ __IO uint32_t TNVS : 9;
+} stc_flash_tnvs_field_t;
+
+typedef struct
+{
+ __IO uint32_t TPGS : 8;
+} stc_flash_tpgs_field_t;
+
+typedef struct
+{
+ __IO uint32_t TPROG : 9;
+} stc_flash_tprog_field_t;
+
+typedef struct
+{
+ __IO uint32_t TSERASE :18;
+} stc_flash_tserase_field_t;
+
+typedef struct
+{
+ __IO uint32_t TMERASE :21;
+} stc_flash_tmerase_field_t;
+
+typedef struct
+{
+ __IO uint32_t TPRCV :12;
+} stc_flash_tprcv_field_t;
+
+typedef struct
+{
+ __IO uint32_t TSRCV :12;
+} stc_flash_tsrcv_field_t;
+
+typedef struct
+{
+ __IO uint32_t TMRCV :13;
+} stc_flash_tmrcv_field_t;
+
+typedef struct
+{
+ __IO uint32_t OP : 2;
+ __IO uint32_t WAIT : 2;
+ __IO uint32_t BUSY : 1;
+ __IO uint32_t IE : 2;
+ uint32_t RESERVED7 : 2;
+ __IO uint32_t DPSTB_EN : 1;
+} stc_flash_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t IF0 : 1;
+ __IO uint32_t IF1 : 1;
+} stc_flash_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ICLR0 : 1;
+ __IO uint32_t ICLR1 : 1;
+} stc_flash_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t BYSEQ :16;
+} stc_flash_bypass_field_t;
+
+typedef struct
+{
+ __IO uint32_t SLOCK :32;
+} stc_flash_slock_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa00_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa01_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa02_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa03_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa04_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa05_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa06_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa07_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa08_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa09_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa10_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa11_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa12_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa13_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa14_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pa15_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb00_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb01_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb02_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb03_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb04_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb05_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb06_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb07_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb08_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb09_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb10_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb11_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb12_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb13_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb14_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pb15_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc00_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc01_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc02_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc03_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc04_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc05_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc06_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc07_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc08_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc09_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc10_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc11_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc12_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc13_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc14_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pc15_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd00_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd01_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd02_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd03_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd04_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd05_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd06_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t SEL : 3;
+} stc_gpio_pd07_sel_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_padir_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pain_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_paout_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_paads_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pabset_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pabclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PABCLR :16;
+ __IO uint32_t PABSET :16;
+} stc_gpio_pabsetclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_padr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_papu_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_papd_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_paod_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pahie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_palie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_parie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pafie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbdir_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbin_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbout_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbads_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbbset_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbbclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PBBCLR :16;
+ __IO uint32_t PBBSET :16;
+} stc_gpio_pbbsetclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbdr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbpu_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbpd_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbod_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbhie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pblie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbrie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pbfie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcdir_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcin_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcout_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcads_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcbset_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcbclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PCBCLR :16;
+ __IO uint32_t PCBSET :16;
+} stc_gpio_pcbsetclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcdr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcpu_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcpd_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcod_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pchie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pclie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcrie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pcfie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pddir_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdin_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdout_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdads_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdbset_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdbclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PDBCLR : 8;
+ uint32_t RESERVED8 : 8;
+ __IO uint32_t PDBSET : 8;
+} stc_gpio_pdbsetclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pddr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdpu_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdpd_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdod_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdhie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdlie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdrie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pdfie_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pa_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t PA00 : 1;
+ __IO uint32_t PA01 : 1;
+ __IO uint32_t PA02 : 1;
+ __IO uint32_t PA03 : 1;
+ __IO uint32_t PA04 : 1;
+ __IO uint32_t PA05 : 1;
+ __IO uint32_t PA06 : 1;
+ __IO uint32_t PA07 : 1;
+ __IO uint32_t PA08 : 1;
+ __IO uint32_t PA09 : 1;
+ __IO uint32_t PA10 : 1;
+ __IO uint32_t PA11 : 1;
+ __IO uint32_t PA12 : 1;
+ __IO uint32_t PA13 : 1;
+ __IO uint32_t PA14 : 1;
+ __IO uint32_t PA15 : 1;
+} stc_gpio_pa_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pb_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t PB00 : 1;
+ __IO uint32_t PB01 : 1;
+ __IO uint32_t PB02 : 1;
+ __IO uint32_t PB03 : 1;
+ __IO uint32_t PB04 : 1;
+ __IO uint32_t PB05 : 1;
+ __IO uint32_t PB06 : 1;
+ __IO uint32_t PB07 : 1;
+ __IO uint32_t PB08 : 1;
+ __IO uint32_t PB09 : 1;
+ __IO uint32_t PB10 : 1;
+ __IO uint32_t PB11 : 1;
+ __IO uint32_t PB12 : 1;
+ __IO uint32_t PB13 : 1;
+ __IO uint32_t PB14 : 1;
+ __IO uint32_t PB15 : 1;
+} stc_gpio_pb_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pc_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t PC00 : 1;
+ __IO uint32_t PC01 : 1;
+ __IO uint32_t PC02 : 1;
+ __IO uint32_t PC03 : 1;
+ __IO uint32_t PC04 : 1;
+ __IO uint32_t PC05 : 1;
+ __IO uint32_t PC06 : 1;
+ __IO uint32_t PC07 : 1;
+ __IO uint32_t PC08 : 1;
+ __IO uint32_t PC09 : 1;
+ __IO uint32_t PC10 : 1;
+ __IO uint32_t PC11 : 1;
+ __IO uint32_t PC12 : 1;
+ __IO uint32_t PC13 : 1;
+ __IO uint32_t PC14 : 1;
+ __IO uint32_t PC15 : 1;
+} stc_gpio_pc_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pd_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t PD00 : 1;
+ __IO uint32_t PD01 : 1;
+ __IO uint32_t PD02 : 1;
+ __IO uint32_t PD03 : 1;
+ __IO uint32_t PD04 : 1;
+ __IO uint32_t PD05 : 1;
+ __IO uint32_t PD06 : 1;
+ __IO uint32_t PD07 : 1;
+} stc_gpio_pd_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t IESEL : 1;
+} stc_gpio_ctrl0_field_t;
+
+typedef struct
+{
+ __IO uint32_t EXT_CLK_SEL : 4;
+ __IO uint32_t SSN0_SEL : 4;
+ __IO uint32_t PCLK_SEL : 2;
+ __IO uint32_t HCLK_SEL : 2;
+ __IO uint32_t PCLK_EN : 1;
+ __IO uint32_t HCLK_EN : 1;
+ __IO uint32_t IR_POL : 1;
+} stc_gpio_ctrl1_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSN1_SEL : 4;
+ uint32_t RESERVED4 :11;
+ __IO uint32_t AHB_SEL : 1;
+} stc_gpio_ctrl2_field_t;
+
+typedef struct
+{
+ __IO uint32_t TIM0_G : 3;
+ __IO uint32_t TIM1_G : 3;
+ __IO uint32_t TIM2_G : 3;
+ __IO uint32_t TIM3_G : 3;
+ __IO uint32_t LPTIM_G : 3;
+} stc_gpio_timgs_field_t;
+
+typedef struct
+{
+ __IO uint32_t TIM0_E : 3;
+ __IO uint32_t TIM1_E : 3;
+ __IO uint32_t TIM2_E : 3;
+ __IO uint32_t TIM3_E : 3;
+ __IO uint32_t LPTIM_E : 3;
+} stc_gpio_times_field_t;
+
+typedef struct
+{
+ __IO uint32_t TIM0_CA : 3;
+ __IO uint32_t TIM1_CA : 3;
+ __IO uint32_t TIM2_CA : 3;
+ __IO uint32_t TIM3_CA : 3;
+ __IO uint32_t TIM3_CB : 3;
+} stc_gpio_timcps_field_t;
+
+typedef struct
+{
+ __IO uint32_t PCA_CH0 : 3;
+ __IO uint32_t PCA_ECI : 3;
+} stc_gpio_pcas_field_t;
+
+typedef struct
+{
+ __IO uint32_t DIVIDEND :32;
+} stc_hdiv_dividend_field_t;
+
+typedef struct
+{
+ __IO uint32_t DIVISOR :16;
+} stc_hdiv_divisor_field_t;
+
+typedef struct
+{
+ __IO uint32_t QUOTIENT :32;
+} stc_hdiv_quotient_field_t;
+
+typedef struct
+{
+ __IO uint32_t REMAINDER :32;
+} stc_hdiv_remainder_field_t;
+
+typedef struct
+{
+ __IO uint32_t SIGN : 1;
+} stc_hdiv_sign_field_t;
+
+typedef struct
+{
+ __IO uint32_t END : 1;
+ __IO uint32_t ZERO : 1;
+} stc_hdiv_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t TME : 1;
+} stc_i2c_tmrun_field_t;
+
+typedef struct
+{
+ __IO uint32_t TM : 8;
+} stc_i2c_tm_field_t;
+
+typedef struct
+{
+ __IO uint32_t H1M : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t AA : 1;
+ __IO uint32_t SI : 1;
+ __IO uint32_t STO : 1;
+ __IO uint32_t STA : 1;
+ __IO uint32_t ENS : 1;
+} stc_i2c_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DAT : 8;
+} stc_i2c_data_field_t;
+
+typedef struct
+{
+ __IO uint32_t GC : 1;
+ __IO uint32_t ADR : 7;
+} stc_i2c_addr_field_t;
+
+typedef struct
+{
+ __IO uint32_t STA : 8;
+} stc_i2c_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN : 1;
+ __IO uint32_t LCDCLK : 2;
+ __IO uint32_t CPCLK : 2;
+ __IO uint32_t BIAS : 1;
+ __IO uint32_t DUTY : 3;
+ __IO uint32_t BSEL : 3;
+ __IO uint32_t CONTRAST : 4;
+} stc_lcd_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t BLINKCNT : 6;
+ __IO uint32_t BLINKEN : 1;
+ __IO uint32_t CLKSRC : 1;
+ __IO uint32_t MODE : 1;
+ __IO uint32_t IE : 1;
+ __IO uint32_t DMAEN : 1;
+ __IO uint32_t INTF : 1;
+} stc_lcd_cr1_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 :10;
+ __IO uint32_t INTF : 1;
+} stc_lcd_intclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t S0 : 1;
+ __IO uint32_t S1 : 1;
+ __IO uint32_t S2 : 1;
+ __IO uint32_t S3 : 1;
+ __IO uint32_t S4 : 1;
+ __IO uint32_t S5 : 1;
+ __IO uint32_t S6 : 1;
+ __IO uint32_t S7 : 1;
+ __IO uint32_t S8 : 1;
+ __IO uint32_t S9 : 1;
+ __IO uint32_t S10 : 1;
+ __IO uint32_t S11 : 1;
+ __IO uint32_t S12 : 1;
+ __IO uint32_t S13 : 1;
+ __IO uint32_t S14 : 1;
+ __IO uint32_t S15 : 1;
+ __IO uint32_t S16 : 1;
+ __IO uint32_t S17 : 1;
+ __IO uint32_t S18 : 1;
+ __IO uint32_t S19 : 1;
+ __IO uint32_t S20 : 1;
+ __IO uint32_t S21 : 1;
+ __IO uint32_t S22 : 1;
+ __IO uint32_t S23 : 1;
+ __IO uint32_t S24 : 1;
+ __IO uint32_t S25 : 1;
+ __IO uint32_t S26 : 1;
+ __IO uint32_t S27 : 1;
+ __IO uint32_t S28 : 1;
+ __IO uint32_t S29 : 1;
+ __IO uint32_t S30 : 1;
+ __IO uint32_t S31 : 1;
+} stc_lcd_poen0_field_t;
+
+typedef struct
+{
+ __IO uint32_t S32 : 1;
+ __IO uint32_t S33 : 1;
+ __IO uint32_t S34 : 1;
+ __IO uint32_t S35 : 1;
+ __IO uint32_t S36C7 : 1;
+ __IO uint32_t S37C6 : 1;
+ __IO uint32_t S38C5 : 1;
+ __IO uint32_t S39C4 : 1;
+ __IO uint32_t C0 : 1;
+ __IO uint32_t C1 : 1;
+ __IO uint32_t C2 : 1;
+ __IO uint32_t C3 : 1;
+ __IO uint32_t MUX : 1;
+} stc_lcd_poen1_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram0_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram1_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram2_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram3_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram4_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram5_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram6_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+ __IO uint32_t D8 : 1;
+ __IO uint32_t D9 : 1;
+ __IO uint32_t D10 : 1;
+ __IO uint32_t D11 : 1;
+ __IO uint32_t D12 : 1;
+ __IO uint32_t D13 : 1;
+ __IO uint32_t D14 : 1;
+ __IO uint32_t D15 : 1;
+ __IO uint32_t D16 : 1;
+ __IO uint32_t D17 : 1;
+ __IO uint32_t D18 : 1;
+ __IO uint32_t D19 : 1;
+ __IO uint32_t D20 : 1;
+ __IO uint32_t D21 : 1;
+ __IO uint32_t D22 : 1;
+ __IO uint32_t D23 : 1;
+ __IO uint32_t D24 : 1;
+ __IO uint32_t D25 : 1;
+ __IO uint32_t D26 : 1;
+ __IO uint32_t D27 : 1;
+ __IO uint32_t D28 : 1;
+ __IO uint32_t D29 : 1;
+ __IO uint32_t D30 : 1;
+ __IO uint32_t D31 : 1;
+} stc_lcd_ram7_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_ram8_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_ram9_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_rama_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_ramb_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_ramc_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_ramd_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_rame_field_t;
+
+typedef struct
+{
+ __IO uint32_t D0 : 1;
+ __IO uint32_t D1 : 1;
+ __IO uint32_t D2 : 1;
+ __IO uint32_t D3 : 1;
+ __IO uint32_t D4 : 1;
+ __IO uint32_t D5 : 1;
+ __IO uint32_t D6 : 1;
+ __IO uint32_t D7 : 1;
+} stc_lcd_ramf_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_lptimer_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_lptimer_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t TR : 1;
+ __IO uint32_t MD : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t TOG_EN : 1;
+ __IO uint32_t TCK_SEL : 2;
+ uint32_t RESERVED6 : 1;
+ __IO uint32_t WT_FLAG : 1;
+ __IO uint32_t GATE : 1;
+ __IO uint32_t GATE_P : 1;
+ __IO uint32_t IE : 1;
+} stc_lptimer_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t TF : 1;
+} stc_lptimer_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t TFC : 1;
+} stc_lptimer_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA : 8;
+ __IO uint32_t DATA8 : 1;
+} stc_lpuart_sbuf_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCIE : 1;
+ __IO uint32_t TCIE : 1;
+ __IO uint32_t B8CONT : 2;
+ __IO uint32_t REN : 1;
+ __IO uint32_t ADRDET : 1;
+ __IO uint32_t SM : 2;
+ __IO uint32_t TXEIE : 1;
+ __IO uint32_t OVER : 2;
+ __IO uint32_t SCLKSEL : 2;
+ __IO uint32_t PEIE : 1;
+ __IO uint32_t STOPBIT : 2;
+ __IO uint32_t DMARXEN : 1;
+ __IO uint32_t DMATXEN : 1;
+ __IO uint32_t RTSEN : 1;
+ __IO uint32_t CTSEN : 1;
+ __IO uint32_t CTSIE : 1;
+ __IO uint32_t FEIE : 1;
+} stc_lpuart_scon_field_t;
+
+typedef struct
+{
+ __IO uint32_t SADDR : 8;
+} stc_lpuart_saddr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SADEN : 8;
+} stc_lpuart_saden_field_t;
+
+typedef struct
+{
+ __IO uint32_t RC : 1;
+ __IO uint32_t TC : 1;
+ __IO uint32_t FE : 1;
+ __IO uint32_t TXE : 1;
+ __IO uint32_t PE : 1;
+ __IO uint32_t CTSIF : 1;
+ __IO uint32_t CTS : 1;
+} stc_lpuart_isr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCCF : 1;
+ __IO uint32_t TCCF : 1;
+ __IO uint32_t FECF : 1;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t PECF : 1;
+ __IO uint32_t CTSIFCF : 1;
+} stc_lpuart_icr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCNT :16;
+} stc_lpuart_scnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t LVDEN : 1;
+ __IO uint32_t ACT : 1;
+ __IO uint32_t SOURCE_SEL : 2;
+ __IO uint32_t VTDS : 4;
+ __IO uint32_t FLTEN : 1;
+ __IO uint32_t DEBOUNCE_TIME : 3;
+ __IO uint32_t FTEN : 1;
+ __IO uint32_t RTEN : 1;
+ __IO uint32_t HTEN : 1;
+ __IO uint32_t IE : 1;
+} stc_lvd_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t INTF : 1;
+ __IO uint32_t FILTER : 1;
+} stc_lvd_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN : 1;
+ __IO uint32_t AZEN : 1;
+ __IO uint32_t MODE : 1;
+ __IO uint32_t UBUFSEL : 1;
+ __IO uint32_t RESSEL : 1;
+ __IO uint32_t BIASSEL : 3;
+ __IO uint32_t NEGSEL : 2;
+ __IO uint32_t POSSEL : 2;
+ __IO uint32_t PGAGAIN : 3;
+ __IO uint32_t POEN : 1;
+ __IO uint32_t RESINMUX : 2;
+} stc_opa_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN : 1;
+ __IO uint32_t AZEN : 1;
+ __IO uint32_t MODE : 1;
+ __IO uint32_t UBUFSEL : 1;
+ __IO uint32_t RESSEL : 1;
+ __IO uint32_t BIASSEL : 3;
+ __IO uint32_t NEGSEL : 2;
+ __IO uint32_t POSSEL : 2;
+ __IO uint32_t PGAGAIN : 3;
+ __IO uint32_t POEN : 1;
+ __IO uint32_t RESINMUX : 2;
+} stc_opa_cr1_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN : 1;
+ __IO uint32_t AZEN : 1;
+ __IO uint32_t MODE : 1;
+ __IO uint32_t UBUFSEL : 1;
+ __IO uint32_t RESSEL : 1;
+ __IO uint32_t BIASSEL : 3;
+ __IO uint32_t NEGSEL : 2;
+ __IO uint32_t POSSEL : 2;
+ __IO uint32_t PGAGAIN : 3;
+ __IO uint32_t POEN : 1;
+ __IO uint32_t RESINMUX : 2;
+} stc_opa_cr2_field_t;
+
+typedef struct
+{
+ __IO uint8_t ADCTR_EN : 1;
+ __IO uint8_t TRIGGER : 1;
+ __IO uint8_t AZ_PULSE : 1;
+ __IO uint8_t CLK_SW_SET : 1;
+ __IO uint8_t CLK_SEL : 4;
+} stc_opa_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCF0 : 1;
+ __IO uint32_t CCF1 : 1;
+ __IO uint32_t CCF2 : 1;
+ __IO uint32_t CCF3 : 1;
+ __IO uint32_t CCF4 : 1;
+ uint32_t RESERVED5 : 1;
+ __IO uint32_t CR : 1;
+ __IO uint32_t CF : 1;
+} stc_pca_ccon_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFIE : 1;
+ __IO uint32_t CPS : 3;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t WDTE : 1;
+ __IO uint32_t CIDL : 1;
+} stc_pca_cmod_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_pca_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCF0 : 1;
+ __IO uint32_t CCF1 : 1;
+ __IO uint32_t CCF2 : 1;
+ __IO uint32_t CCF3 : 1;
+ __IO uint32_t CCF4 : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t CF : 1;
+} stc_pca_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCIE : 1;
+ __IO uint32_t PWM : 1;
+ __IO uint32_t TOG : 1;
+ __IO uint32_t MAT : 1;
+ __IO uint32_t CAPN : 1;
+ __IO uint32_t CAPP : 1;
+ __IO uint32_t ECOM : 1;
+} stc_pca_ccapm0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCIE : 1;
+ __IO uint32_t PWM : 1;
+ __IO uint32_t TOG : 1;
+ __IO uint32_t MAT : 1;
+ __IO uint32_t CAPN : 1;
+ __IO uint32_t CAPP : 1;
+ __IO uint32_t ECOM : 1;
+} stc_pca_ccapm1_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCIE : 1;
+ __IO uint32_t PWM : 1;
+ __IO uint32_t TOG : 1;
+ __IO uint32_t MAT : 1;
+ __IO uint32_t CAPN : 1;
+ __IO uint32_t CAPP : 1;
+ __IO uint32_t ECOM : 1;
+} stc_pca_ccapm2_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCIE : 1;
+ __IO uint32_t PWM : 1;
+ __IO uint32_t TOG : 1;
+ __IO uint32_t MAT : 1;
+ __IO uint32_t CAPN : 1;
+ __IO uint32_t CAPP : 1;
+ __IO uint32_t ECOM : 1;
+} stc_pca_ccapm3_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCIE : 1;
+ __IO uint32_t PWM : 1;
+ __IO uint32_t TOG : 1;
+ __IO uint32_t MAT : 1;
+ __IO uint32_t CAPN : 1;
+ __IO uint32_t CAPP : 1;
+ __IO uint32_t ECOM : 1;
+} stc_pca_ccapm4_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP0 : 8;
+} stc_pca_ccap0h_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP0 : 8;
+} stc_pca_ccap0l_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP1 : 8;
+} stc_pca_ccap1h_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP1 : 8;
+} stc_pca_ccap1l_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP2 : 8;
+} stc_pca_ccap2h_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP2 : 8;
+} stc_pca_ccap2l_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP3 : 8;
+} stc_pca_ccap3h_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP3 : 8;
+} stc_pca_ccap3l_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP4 : 8;
+} stc_pca_ccap4h_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP4 : 8;
+} stc_pca_ccap4l_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAPO0 : 1;
+ __IO uint32_t CCAPO1 : 1;
+ __IO uint32_t CCAPO2 : 1;
+ __IO uint32_t CCAPO3 : 1;
+ __IO uint32_t CCAPO4 : 1;
+} stc_pca_ccapo_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP0 :16;
+} stc_pca_ccap0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP1 :16;
+} stc_pca_ccap1_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP2 :16;
+} stc_pca_ccap2_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP3 :16;
+} stc_pca_ccap3_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCAP4 :16;
+} stc_pca_ccap4_field_t;
+
+typedef struct
+{
+ __IO uint32_t CARR :16;
+} stc_pca_carr_field_t;
+
+typedef struct
+{
+ __IO uint32_t EPWM : 1;
+} stc_pca_epwm_field_t;
+
+typedef struct
+{
+ __IO uint8_t RUN : 1;
+} stc_pcnt_run_field_t;
+
+typedef struct
+{
+ __IO uint8_t MODE : 2;
+ __IO uint8_t CLKSEL : 2;
+ __IO uint8_t DIR : 1;
+ __IO uint8_t S0P : 1;
+ __IO uint8_t S1P : 1;
+} stc_pcnt_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CLKDIV :13;
+ __IO uint32_t DEBTOP : 3;
+ __IO uint32_t EN : 1;
+} stc_pcnt_flt_field_t;
+
+typedef struct
+{
+ __IO uint32_t TH :12;
+ uint32_t RESERVED12 : 4;
+ __IO uint32_t EN : 1;
+} stc_pcnt_tocr_field_t;
+
+typedef struct
+{
+ __IO uint8_t T2C : 1;
+ __IO uint8_t B2T : 1;
+ __IO uint8_t B2C : 1;
+} stc_pcnt_cmd_field_t;
+
+typedef struct
+{
+ __IO uint8_t DIR : 1;
+} stc_pcnt_sr1_field_t;
+
+typedef struct
+{
+ __IO uint16_t CNT :16;
+} stc_pcnt_cnt_field_t;
+
+typedef struct
+{
+ __IO uint16_t TOP :16;
+} stc_pcnt_top_field_t;
+
+typedef struct
+{
+ __IO uint16_t BUF :16;
+} stc_pcnt_buf_field_t;
+
+typedef struct
+{
+ __IO uint8_t UF : 1;
+ __IO uint8_t OV : 1;
+ __IO uint8_t TO : 1;
+ __IO uint8_t DIR : 1;
+ __IO uint8_t FE : 1;
+ __IO uint8_t BB : 1;
+ __IO uint8_t S0E : 1;
+ __IO uint8_t S1E : 1;
+} stc_pcnt_ifr_field_t;
+
+typedef struct
+{
+ __IO uint8_t UF : 1;
+ __IO uint8_t OV : 1;
+ __IO uint8_t TO : 1;
+ __IO uint8_t DIR : 1;
+ __IO uint8_t FE : 1;
+ __IO uint8_t BB : 1;
+ __IO uint8_t S0E : 1;
+ __IO uint8_t S1E : 1;
+} stc_pcnt_icr_field_t;
+
+typedef struct
+{
+ __IO uint8_t UF : 1;
+ __IO uint8_t OV : 1;
+ __IO uint8_t TO : 1;
+ __IO uint8_t DIR : 1;
+ __IO uint8_t FE : 1;
+ __IO uint8_t BB : 1;
+ __IO uint8_t S0E : 1;
+ __IO uint8_t S1E : 1;
+} stc_pcnt_ien_field_t;
+
+typedef struct
+{
+ __IO uint8_t T2C : 1;
+ __IO uint8_t B2T : 1;
+ __IO uint8_t B2C : 1;
+} stc_pcnt_sr2_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 1;
+ __IO uint32_t IE : 1;
+} stc_ram_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ERRADDR :13;
+} stc_ram_erraddr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ERR : 1;
+} stc_ram_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ERRCLR : 1;
+} stc_ram_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t POR5V : 1;
+ __IO uint32_t POR15V : 1;
+ __IO uint32_t LVD : 1;
+ __IO uint32_t WDT : 1;
+ __IO uint32_t PCA : 1;
+ __IO uint32_t LOCKUP : 1;
+ __IO uint32_t SYSREQ : 1;
+ __IO uint32_t RSTB : 1;
+} stc_reset_flag_field_t;
+
+typedef struct
+{
+ __IO uint32_t UART0 : 1;
+ __IO uint32_t UART1 : 1;
+ __IO uint32_t LPUART0 : 1;
+ __IO uint32_t LPUART1 : 1;
+ __IO uint32_t I2C0 : 1;
+ __IO uint32_t I2C1 : 1;
+ __IO uint32_t SPI0 : 1;
+ __IO uint32_t SPI1 : 1;
+ __IO uint32_t BASETIM : 1;
+ __IO uint32_t LPTIM : 1;
+ __IO uint32_t ADVTIM : 1;
+ __IO uint32_t TIM3 : 1;
+ uint32_t RESERVED12 : 1;
+ __IO uint32_t OPA : 1;
+ __IO uint32_t PCA : 1;
+ uint32_t RESERVED15 : 1;
+ __IO uint32_t ADC : 1;
+ __IO uint32_t VC : 1;
+ __IO uint32_t RNG : 1;
+ __IO uint32_t PCNT : 1;
+ __IO uint32_t RTC : 1;
+ __IO uint32_t TRIM : 1;
+ __IO uint32_t LCD : 1;
+ uint32_t RESERVED23 : 1;
+ __IO uint32_t TICK : 1;
+ __IO uint32_t SWD : 1;
+ __IO uint32_t CRC : 1;
+ __IO uint32_t AES : 1;
+ __IO uint32_t GPIO : 1;
+ __IO uint32_t DMA : 1;
+ __IO uint32_t DIV : 1;
+} stc_reset_prei_field_t;
+
+typedef struct
+{
+ __IO uint32_t RNGCIR_EN : 1;
+ __IO uint32_t RNG_RUN : 1;
+} stc_rng_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t LOAD : 1;
+ __IO uint32_t FDBK : 1;
+ __IO uint32_t CNT : 3;
+} stc_rng_mode_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA0 :32;
+} stc_rng_data0_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA1 :32;
+} stc_rng_data1_field_t;
+
+typedef struct
+{
+ __IO uint32_t PRDS : 3;
+ __IO uint32_t AMPM : 1;
+ uint32_t RESERVED4 : 1;
+ __IO uint32_t HZ1OE : 1;
+ __IO uint32_t HZ1SEL : 1;
+ __IO uint32_t START : 1;
+ __IO uint32_t PRDX : 6;
+ __IO uint32_t PRDSEL : 1;
+} stc_rtc_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t WAIT : 1;
+ __IO uint32_t WAITF : 1;
+ uint32_t RESERVED2 : 1;
+ __IO uint32_t PRDF : 1;
+ __IO uint32_t ALMF : 1;
+ uint32_t RESERVED5 : 1;
+ __IO uint32_t ALMIE : 1;
+ __IO uint32_t ALMEN : 1;
+ __IO uint32_t CKSEL : 3;
+} stc_rtc_cr1_field_t;
+
+typedef struct
+{
+ __IO uint32_t SECL : 4;
+ __IO uint32_t SECH : 3;
+} stc_rtc_sec_field_t;
+
+typedef struct
+{
+ __IO uint32_t MINL : 4;
+ __IO uint32_t MINH : 3;
+} stc_rtc_min_field_t;
+
+typedef struct
+{
+ __IO uint32_t HOURL : 4;
+ __IO uint32_t HOURH : 2;
+} stc_rtc_hour_field_t;
+
+typedef struct
+{
+ __IO uint32_t WEEK : 3;
+} stc_rtc_week_field_t;
+
+typedef struct
+{
+ __IO uint32_t DAYL : 4;
+ __IO uint32_t DAYH : 2;
+} stc_rtc_day_field_t;
+
+typedef struct
+{
+ __IO uint32_t MON : 5;
+} stc_rtc_mon_field_t;
+
+typedef struct
+{
+ __IO uint32_t YEARL : 4;
+ __IO uint32_t YEARH : 4;
+} stc_rtc_year_field_t;
+
+typedef struct
+{
+ __IO uint32_t ALMMINL : 4;
+ __IO uint32_t ALMMINH : 3;
+} stc_rtc_almmin_field_t;
+
+typedef struct
+{
+ __IO uint32_t ALMHOURL : 4;
+ __IO uint32_t ALMHOURH : 2;
+} stc_rtc_almhour_field_t;
+
+typedef struct
+{
+ __IO uint32_t ALMWEEK : 7;
+} stc_rtc_almweek_field_t;
+
+typedef struct
+{
+ __IO uint32_t CR : 9;
+ uint32_t RESERVED9 : 6;
+ __IO uint32_t EN : 1;
+} stc_rtc_compen_field_t;
+
+typedef struct
+{
+ __IO uint32_t SPR0 : 1;
+ __IO uint32_t SPR1 : 1;
+ __IO uint32_t CPHA : 1;
+ __IO uint32_t CPOL : 1;
+ __IO uint32_t MSTR : 1;
+ uint32_t RESERVED5 : 1;
+ __IO uint32_t SPEN : 1;
+ __IO uint32_t SPR2 : 1;
+} stc_spi_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSN : 1;
+} stc_spi_ssn_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 1;
+ __IO uint32_t RXNE : 1;
+ __IO uint32_t TXE : 1;
+ __IO uint32_t BUSY : 1;
+ __IO uint32_t MDF : 1;
+ __IO uint32_t SSERR : 1;
+ uint32_t RESERVED6 : 1;
+ __IO uint32_t SPIF : 1;
+} stc_spi_stat_field_t;
+
+typedef struct
+{
+ __IO uint32_t DAT : 8;
+} stc_spi_data_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 2;
+ __IO uint32_t INT_EN : 1;
+ __IO uint32_t HDMA_RX : 1;
+ __IO uint32_t HDMA_TX : 1;
+ __IO uint32_t TXEIE : 1;
+ __IO uint32_t RXNEIE : 1;
+} stc_spi_cr2_field_t;
+
+typedef struct
+{
+ __IO uint32_t INT_CLR : 1;
+} stc_spi_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCH_EN : 1;
+ __IO uint32_t XTH_EN : 1;
+ __IO uint32_t RCL_EN : 1;
+ __IO uint32_t XTL_EN : 1;
+ __IO uint32_t PLL_EN : 1;
+ __IO uint32_t CLK_SW5_SEL : 3;
+ __IO uint32_t HCLK_PRS : 3;
+ __IO uint32_t PCLK_PRS : 2;
+ uint32_t RESERVED13 : 2;
+ __IO uint32_t WAKEUP_BYRCH : 1;
+} stc_sysctrl_sysctrl0_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 1;
+ __IO uint32_t EXTH_EN : 1;
+ __IO uint32_t EXTL_EN : 1;
+ __IO uint32_t XTL_ALWAYS_ON : 1;
+ uint32_t RESERVED4 : 1;
+ __IO uint32_t RTC_LPW : 1;
+ __IO uint32_t LOCKUP_EN : 1;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t SWD_USE_IO : 1;
+ __IO uint32_t RTC_FREQ_ADJUST : 3;
+} stc_sysctrl_sysctrl1_field_t;
+
+typedef struct
+{
+ __IO uint32_t SYSCTRL2 :16;
+} stc_sysctrl_sysctrl2_field_t;
+
+typedef struct
+{
+ __IO uint32_t TRIM :11;
+ __IO uint32_t STABLE : 1;
+} stc_sysctrl_rch_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DRIVER : 2;
+ __IO uint32_t XTH_FSEL : 2;
+ __IO uint32_t STARTUP : 2;
+ __IO uint32_t STABLE : 1;
+} stc_sysctrl_xth_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t TRIM :10;
+ __IO uint32_t STARTUP : 2;
+ __IO uint32_t STABLE : 1;
+} stc_sysctrl_rcl_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DRIVER : 2;
+ __IO uint32_t AMP_SEL : 2;
+ __IO uint32_t STARTUP : 2;
+ __IO uint32_t STABLE : 1;
+} stc_sysctrl_xtl_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UART0 : 1;
+ __IO uint32_t UART1 : 1;
+ __IO uint32_t LPUART0 : 1;
+ __IO uint32_t LPUART1 : 1;
+ __IO uint32_t I2C0 : 1;
+ __IO uint32_t I2C1 : 1;
+ __IO uint32_t SPI0 : 1;
+ __IO uint32_t SPI1 : 1;
+ __IO uint32_t BASETIM : 1;
+ __IO uint32_t LPTIM : 1;
+ __IO uint32_t ADVTIM : 1;
+ __IO uint32_t TIM3 : 1;
+ uint32_t RESERVED12 : 1;
+ __IO uint32_t OPA : 1;
+ __IO uint32_t PCA : 1;
+ __IO uint32_t WDT : 1;
+ __IO uint32_t ADC : 1;
+ __IO uint32_t VC : 1;
+ __IO uint32_t RNG : 1;
+ __IO uint32_t PCNT : 1;
+ __IO uint32_t RTC : 1;
+ __IO uint32_t TRIM : 1;
+ __IO uint32_t LCD : 1;
+ uint32_t RESERVED23 : 1;
+ __IO uint32_t TICK : 1;
+ __IO uint32_t SWD : 1;
+ __IO uint32_t CRC : 1;
+ __IO uint32_t AES : 1;
+ __IO uint32_t GPIO : 1;
+ __IO uint32_t DMA : 1;
+ __IO uint32_t DIV : 1;
+ __IO uint32_t FLASH : 1;
+} stc_sysctrl_peri_clken_field_t;
+
+typedef struct
+{
+ __IO uint32_t REFSEL : 2;
+ __IO uint32_t FOSC : 3;
+ __IO uint32_t DIVN : 4;
+ __IO uint32_t IBSEL : 2;
+ __IO uint32_t LFSEL : 2;
+ __IO uint32_t FRSEL : 2;
+ __IO uint32_t STARTUP : 3;
+ __IO uint32_t STABLE : 1;
+} stc_sysctrl_pll_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim0_mode0_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim0_mode0_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT32 :32;
+} stc_tim0_mode0_cnt32_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t MD : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t TOGEN : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t GATE : 1;
+ __IO uint32_t GATEP : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+} stc_tim0_mode0_m0cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim0_mode0_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim0_mode0_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 :12;
+ __IO uint32_t MOE : 1;
+} stc_tim0_mode0_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim0_mode1_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CT : 1;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t EDG1ST : 1;
+ __IO uint32_t EDG2ND : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+} stc_tim0_mode1_m1cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim0_mode1_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim0_mode1_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 5;
+ __IO uint32_t TS : 3;
+ uint32_t RESERVED8 : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim0_mode1_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FLTA0 : 3;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t FLTB0 : 3;
+ uint32_t RESERVED7 :21;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim0_mode1_fltr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 8;
+ __IO uint32_t CIEA : 1;
+} stc_tim0_mode1_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim0_mode1_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim0_mode23_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim0_mode23_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t COMP : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t PWM2S : 1;
+ __IO uint32_t PRS : 3;
+ __IO uint32_t BUFPEN : 1;
+ __IO uint32_t CRG : 1;
+ __IO uint32_t CFG : 1;
+ __IO uint32_t UIE : 1;
+ __IO uint32_t UDE : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+ __IO uint32_t CSG : 1;
+ __IO uint32_t OCCS : 1;
+ __IO uint32_t URS : 1;
+ __IO uint32_t TDE : 1;
+ __IO uint32_t TIE : 1;
+ __IO uint32_t BIE : 1;
+ __IO uint32_t CIS : 2;
+ __IO uint32_t OCCE : 1;
+ __IO uint32_t TG : 1;
+ __IO uint32_t UG : 1;
+ __IO uint32_t BG : 1;
+ __IO uint32_t DIR : 1;
+} stc_tim0_mode23_m23cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ uint32_t RESERVED3 : 2;
+ __IO uint32_t CB0F : 1;
+ uint32_t RESERVED6 : 2;
+ __IO uint32_t CA0E : 1;
+ uint32_t RESERVED9 : 2;
+ __IO uint32_t CB0E : 1;
+ uint32_t RESERVED12 : 2;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim0_mode23_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ uint32_t RESERVED3 : 2;
+ __IO uint32_t CB0F : 1;
+ uint32_t RESERVED6 : 2;
+ __IO uint32_t CA0E : 1;
+ uint32_t RESERVED9 : 2;
+ __IO uint32_t CB0E : 1;
+ uint32_t RESERVED12 : 2;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim0_mode23_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t MMS : 3;
+ __IO uint32_t CCDS : 1;
+ __IO uint32_t MSM : 1;
+ __IO uint32_t TS : 3;
+ __IO uint32_t SMS : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim0_mode23_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t OCMA0_FLTA0 : 3;
+ __IO uint32_t CCPA0 : 1;
+ __IO uint32_t OCMB0_FLTB0 : 3;
+ __IO uint32_t CCPB0 : 1;
+ uint32_t RESERVED8 :16;
+ __IO uint32_t FLTBK : 3;
+ __IO uint32_t BKP : 1;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim0_mode23_fltr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UEVE : 1;
+ __IO uint32_t CMA0E : 1;
+ uint32_t RESERVED2 : 2;
+ __IO uint32_t CMB0E : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t ADTE : 1;
+} stc_tim0_mode23_adtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFA_CRA_BKSA : 2;
+ __IO uint32_t CFB_CRB_BKSB : 2;
+ __IO uint32_t CSA : 1;
+ __IO uint32_t CSB : 1;
+ __IO uint32_t BUFEA : 1;
+ __IO uint32_t BUFEB : 1;
+ __IO uint32_t CIEA : 1;
+ __IO uint32_t CIEB : 1;
+ __IO uint32_t CDEA : 1;
+ __IO uint32_t CDEB : 1;
+ __IO uint32_t CISB : 2;
+ __IO uint32_t CCGA : 1;
+ __IO uint32_t CCGB : 1;
+} stc_tim0_mode23_crch0_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTR : 8;
+ __IO uint32_t BKSEL : 1;
+ __IO uint32_t DTEN : 1;
+ __IO uint32_t BKE : 1;
+ __IO uint32_t AOE : 1;
+ __IO uint32_t MOE : 1;
+ __IO uint32_t SAFEEN : 1;
+ __IO uint32_t VC0E : 1;
+ __IO uint32_t VC1E : 1;
+} stc_tim0_mode23_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCR : 8;
+} stc_tim0_mode23_rcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARRDM :16;
+} stc_tim0_mode23_arrdm_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim0_mode23_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0B :16;
+} stc_tim0_mode23_ccr0b_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim1_mode0_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim1_mode0_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT32 :32;
+} stc_tim1_mode0_cnt32_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t MD : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t TOGEN : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t GATE : 1;
+ __IO uint32_t GATEP : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+} stc_tim1_mode0_m0cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim1_mode0_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim1_mode0_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 :12;
+ __IO uint32_t MOE : 1;
+} stc_tim1_mode0_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim1_mode1_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CT : 1;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t EDG1ST : 1;
+ __IO uint32_t EDG2ND : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+} stc_tim1_mode1_m1cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim1_mode1_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim1_mode1_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 5;
+ __IO uint32_t TS : 3;
+ uint32_t RESERVED8 : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim1_mode1_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FLTA0 : 3;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t FLTB0 : 3;
+ uint32_t RESERVED7 :21;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim1_mode1_fltr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 8;
+ __IO uint32_t CIEA : 1;
+} stc_tim1_mode1_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim1_mode1_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim1_mode23_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim1_mode23_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t COMP : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t PWM2S : 1;
+ __IO uint32_t PRS : 3;
+ __IO uint32_t BUFPEN : 1;
+ __IO uint32_t CRG : 1;
+ __IO uint32_t CFG : 1;
+ __IO uint32_t UIE : 1;
+ __IO uint32_t UDE : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+ __IO uint32_t CSG : 1;
+ __IO uint32_t OCCS : 1;
+ __IO uint32_t URS : 1;
+ __IO uint32_t TDE : 1;
+ __IO uint32_t TIE : 1;
+ __IO uint32_t BIE : 1;
+ __IO uint32_t CIS : 2;
+ __IO uint32_t OCCE : 1;
+ __IO uint32_t TG : 1;
+ __IO uint32_t UG : 1;
+ __IO uint32_t BG : 1;
+ __IO uint32_t DIR : 1;
+} stc_tim1_mode23_m23cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ uint32_t RESERVED3 : 2;
+ __IO uint32_t CB0F : 1;
+ uint32_t RESERVED6 : 2;
+ __IO uint32_t CA0E : 1;
+ uint32_t RESERVED9 : 2;
+ __IO uint32_t CB0E : 1;
+ uint32_t RESERVED12 : 2;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim1_mode23_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ uint32_t RESERVED3 : 2;
+ __IO uint32_t CB0F : 1;
+ uint32_t RESERVED6 : 2;
+ __IO uint32_t CA0E : 1;
+ uint32_t RESERVED9 : 2;
+ __IO uint32_t CB0E : 1;
+ uint32_t RESERVED12 : 2;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim1_mode23_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t MMS : 3;
+ __IO uint32_t CCDS : 1;
+ __IO uint32_t MSM : 1;
+ __IO uint32_t TS : 3;
+ __IO uint32_t SMS : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim1_mode23_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t OCMA0_FLTA0 : 3;
+ __IO uint32_t CCPA0 : 1;
+ __IO uint32_t OCMB0_FLTB0 : 3;
+ __IO uint32_t CCPB0 : 1;
+ uint32_t RESERVED8 :16;
+ __IO uint32_t FLTBK : 3;
+ __IO uint32_t BKP : 1;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim1_mode23_fltr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UEVE : 1;
+ __IO uint32_t CMA0E : 1;
+ uint32_t RESERVED2 : 2;
+ __IO uint32_t CMB0E : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t ADTE : 1;
+} stc_tim1_mode23_adtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFA_CRA_BKSA : 2;
+ __IO uint32_t CFB_CRB_BKSB : 2;
+ __IO uint32_t CSA : 1;
+ __IO uint32_t CSB : 1;
+ __IO uint32_t BUFEA : 1;
+ __IO uint32_t BUFEB : 1;
+ __IO uint32_t CIEA : 1;
+ __IO uint32_t CIEB : 1;
+ __IO uint32_t CDEA : 1;
+ __IO uint32_t CDEB : 1;
+ __IO uint32_t CISB : 2;
+ __IO uint32_t CCGA : 1;
+ __IO uint32_t CCGB : 1;
+} stc_tim1_mode23_crch0_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTR : 8;
+ __IO uint32_t BKSEL : 1;
+ __IO uint32_t DTEN : 1;
+ __IO uint32_t BKE : 1;
+ __IO uint32_t AOE : 1;
+ __IO uint32_t MOE : 1;
+ __IO uint32_t SAFEEN : 1;
+ __IO uint32_t VC0E : 1;
+ __IO uint32_t VC1E : 1;
+} stc_tim1_mode23_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCR : 8;
+} stc_tim1_mode23_rcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARRDM :16;
+} stc_tim1_mode23_arrdm_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim1_mode23_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0B :16;
+} stc_tim1_mode23_ccr0b_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim2_mode0_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim2_mode0_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT32 :32;
+} stc_tim2_mode0_cnt32_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t MD : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t TOGEN : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t GATE : 1;
+ __IO uint32_t GATEP : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+} stc_tim2_mode0_m0cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim2_mode0_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim2_mode0_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 :12;
+ __IO uint32_t MOE : 1;
+} stc_tim2_mode0_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim2_mode1_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CT : 1;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t EDG1ST : 1;
+ __IO uint32_t EDG2ND : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+} stc_tim2_mode1_m1cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim2_mode1_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim2_mode1_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 5;
+ __IO uint32_t TS : 3;
+ uint32_t RESERVED8 : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim2_mode1_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FLTA0 : 3;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t FLTB0 : 3;
+ uint32_t RESERVED7 :21;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim2_mode1_fltr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 8;
+ __IO uint32_t CIEA : 1;
+} stc_tim2_mode1_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim2_mode1_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim2_mode23_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim2_mode23_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t COMP : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t PWM2S : 1;
+ __IO uint32_t PRS : 3;
+ __IO uint32_t BUFPEN : 1;
+ __IO uint32_t CRG : 1;
+ __IO uint32_t CFG : 1;
+ __IO uint32_t UIE : 1;
+ __IO uint32_t UDE : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+ __IO uint32_t CSG : 1;
+ __IO uint32_t OCCS : 1;
+ __IO uint32_t URS : 1;
+ __IO uint32_t TDE : 1;
+ __IO uint32_t TIE : 1;
+ __IO uint32_t BIE : 1;
+ __IO uint32_t CIS : 2;
+ __IO uint32_t OCCE : 1;
+ __IO uint32_t TG : 1;
+ __IO uint32_t UG : 1;
+ __IO uint32_t BG : 1;
+ __IO uint32_t DIR : 1;
+} stc_tim2_mode23_m23cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ uint32_t RESERVED3 : 2;
+ __IO uint32_t CB0F : 1;
+ uint32_t RESERVED6 : 2;
+ __IO uint32_t CA0E : 1;
+ uint32_t RESERVED9 : 2;
+ __IO uint32_t CB0E : 1;
+ uint32_t RESERVED12 : 2;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim2_mode23_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ uint32_t RESERVED3 : 2;
+ __IO uint32_t CB0F : 1;
+ uint32_t RESERVED6 : 2;
+ __IO uint32_t CA0E : 1;
+ uint32_t RESERVED9 : 2;
+ __IO uint32_t CB0E : 1;
+ uint32_t RESERVED12 : 2;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim2_mode23_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t MMS : 3;
+ __IO uint32_t CCDS : 1;
+ __IO uint32_t MSM : 1;
+ __IO uint32_t TS : 3;
+ __IO uint32_t SMS : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim2_mode23_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t OCMA0_FLTA0 : 3;
+ __IO uint32_t CCPA0 : 1;
+ __IO uint32_t OCMB0_FLTB0 : 3;
+ __IO uint32_t CCPB0 : 1;
+ uint32_t RESERVED8 :16;
+ __IO uint32_t FLTBK : 3;
+ __IO uint32_t BKP : 1;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim2_mode23_fltr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UEVE : 1;
+ __IO uint32_t CMA0E : 1;
+ uint32_t RESERVED2 : 2;
+ __IO uint32_t CMB0E : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t ADTE : 1;
+} stc_tim2_mode23_adtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFA_CRA_BKSA : 2;
+ __IO uint32_t CFB_CRB_BKSB : 2;
+ __IO uint32_t CSA : 1;
+ __IO uint32_t CSB : 1;
+ __IO uint32_t BUFEA : 1;
+ __IO uint32_t BUFEB : 1;
+ __IO uint32_t CIEA : 1;
+ __IO uint32_t CIEB : 1;
+ __IO uint32_t CDEA : 1;
+ __IO uint32_t CDEB : 1;
+ __IO uint32_t CISB : 2;
+ __IO uint32_t CCGA : 1;
+ __IO uint32_t CCGB : 1;
+} stc_tim2_mode23_crch0_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTR : 8;
+ __IO uint32_t BKSEL : 1;
+ __IO uint32_t DTEN : 1;
+ __IO uint32_t BKE : 1;
+ __IO uint32_t AOE : 1;
+ __IO uint32_t MOE : 1;
+ __IO uint32_t SAFEEN : 1;
+ __IO uint32_t VC0E : 1;
+ __IO uint32_t VC1E : 1;
+} stc_tim2_mode23_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCR : 8;
+} stc_tim2_mode23_rcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARRDM :16;
+} stc_tim2_mode23_arrdm_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim2_mode23_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0B :16;
+} stc_tim2_mode23_ccr0b_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim3_mode0_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim3_mode0_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT32 :32;
+} stc_tim3_mode0_cnt32_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t MD : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t TOGEN : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t GATE : 1;
+ __IO uint32_t GATEP : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+} stc_tim3_mode0_m0cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim3_mode0_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+} stc_tim3_mode0_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 :12;
+ __IO uint32_t MOE : 1;
+} stc_tim3_mode0_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim3_mode1_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CT : 1;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t PRS : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t EDG1ST : 1;
+ __IO uint32_t EDG2ND : 1;
+ __IO uint32_t UIE : 1;
+ uint32_t RESERVED11 : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+} stc_tim3_mode1_m1cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim3_mode1_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+} stc_tim3_mode1_iclr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 5;
+ __IO uint32_t TS : 3;
+ uint32_t RESERVED8 : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim3_mode1_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FLTA0 : 3;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t FLTB0 : 3;
+ uint32_t RESERVED7 :21;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim3_mode1_fltr_field_t;
+
+typedef struct
+{
+ uint32_t RESERVED0 : 8;
+ __IO uint32_t CIEA : 1;
+} stc_tim3_mode1_cr0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim3_mode1_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARR :16;
+} stc_tim3_mode23_arr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim3_mode23_cnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t CTEN : 1;
+ __IO uint32_t COMP : 1;
+ __IO uint32_t CT : 1;
+ __IO uint32_t PWM2S : 1;
+ __IO uint32_t PRS : 3;
+ __IO uint32_t BUFPEN : 1;
+ __IO uint32_t CRG : 1;
+ __IO uint32_t CFG : 1;
+ __IO uint32_t UIE : 1;
+ __IO uint32_t UDE : 1;
+ __IO uint32_t MODE : 2;
+ __IO uint32_t ONESHOT : 1;
+ __IO uint32_t CSG : 1;
+ __IO uint32_t OCCS : 1;
+ __IO uint32_t URS : 1;
+ __IO uint32_t TDE : 1;
+ __IO uint32_t TIE : 1;
+ __IO uint32_t BIE : 1;
+ __IO uint32_t CIS : 2;
+ __IO uint32_t OCCE : 1;
+ __IO uint32_t TG : 1;
+ __IO uint32_t UG : 1;
+ __IO uint32_t BG : 1;
+ __IO uint32_t DIR : 1;
+} stc_tim3_mode23_m23cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ __IO uint32_t CA1F : 1;
+ __IO uint32_t CA2F : 1;
+ __IO uint32_t CB0F : 1;
+ __IO uint32_t CB1F : 1;
+ __IO uint32_t CB2F : 1;
+ __IO uint32_t CA0E : 1;
+ __IO uint32_t CA1E : 1;
+ __IO uint32_t CA2E : 1;
+ __IO uint32_t CB0E : 1;
+ __IO uint32_t CB1E : 1;
+ __IO uint32_t CB2E : 1;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim3_mode23_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UIF : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t CA0F : 1;
+ __IO uint32_t CA1F : 1;
+ __IO uint32_t CA2F : 1;
+ __IO uint32_t CB0F : 1;
+ __IO uint32_t CB1F : 1;
+ __IO uint32_t CB2F : 1;
+ __IO uint32_t CA0E : 1;
+ __IO uint32_t CA1E : 1;
+ __IO uint32_t CA2E : 1;
+ __IO uint32_t CB0E : 1;
+ __IO uint32_t CB1E : 1;
+ __IO uint32_t CB2E : 1;
+ __IO uint32_t BIF : 1;
+ __IO uint32_t TIF : 1;
+} stc_tim3_mode23_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t MMS : 3;
+ __IO uint32_t CCDS : 1;
+ __IO uint32_t MSM : 1;
+ __IO uint32_t TS : 3;
+ __IO uint32_t SMS : 3;
+ __IO uint32_t IA0S : 1;
+ __IO uint32_t IB0S : 1;
+} stc_tim3_mode23_mscr_field_t;
+
+typedef struct
+{
+ __IO uint32_t OCMA0_FLTA0 : 3;
+ __IO uint32_t CCPA0 : 1;
+ __IO uint32_t OCMB0_FLTB0 : 3;
+ __IO uint32_t CCPB0 : 1;
+ __IO uint32_t OCMA1_FLTA1 : 3;
+ __IO uint32_t CCPA1 : 1;
+ __IO uint32_t OCMB1_FLTB1 : 3;
+ __IO uint32_t CCPB1 : 1;
+ __IO uint32_t OCMA2_FLTA2 : 3;
+ __IO uint32_t CCPA2 : 1;
+ __IO uint32_t OCMB2_FLTB2 : 3;
+ __IO uint32_t CCPB2 : 1;
+ __IO uint32_t FLTBK : 3;
+ __IO uint32_t BKP : 1;
+ __IO uint32_t FLTET : 3;
+ __IO uint32_t ETP : 1;
+} stc_tim3_mode23_fltr_field_t;
+
+typedef struct
+{
+ __IO uint32_t UEVE : 1;
+ __IO uint32_t CMA0E : 1;
+ __IO uint32_t CMA1E : 1;
+ __IO uint32_t CMA2E : 1;
+ __IO uint32_t CMB0E : 1;
+ __IO uint32_t CMB1E : 1;
+ __IO uint32_t CMB2E : 1;
+ __IO uint32_t ADTE : 1;
+} stc_tim3_mode23_adtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFA_CRA_BKSA : 2;
+ __IO uint32_t CFB_CRB_BKSB : 2;
+ __IO uint32_t CSA : 1;
+ __IO uint32_t CSB : 1;
+ __IO uint32_t BUFEA : 1;
+ __IO uint32_t BUFEB : 1;
+ __IO uint32_t CIEA : 1;
+ __IO uint32_t CIEB : 1;
+ __IO uint32_t CDEA : 1;
+ __IO uint32_t CDEB : 1;
+ __IO uint32_t CISB : 2;
+ __IO uint32_t CCGA : 1;
+ __IO uint32_t CCGB : 1;
+} stc_tim3_mode23_crch0_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFA_CRA_BKSA : 2;
+ __IO uint32_t CFB_CRB_BKSB : 2;
+ __IO uint32_t CSA : 1;
+ __IO uint32_t CSB : 1;
+ __IO uint32_t BUFEA : 1;
+ __IO uint32_t BUFEB : 1;
+ __IO uint32_t CIEA : 1;
+ __IO uint32_t CIEB : 1;
+ __IO uint32_t CDEA : 1;
+ __IO uint32_t CDEB : 1;
+ __IO uint32_t CISB : 2;
+ __IO uint32_t CCGA : 1;
+ __IO uint32_t CCGB : 1;
+} stc_tim3_mode23_crch1_field_t;
+
+typedef struct
+{
+ __IO uint32_t CFA_CRA_BKSA : 2;
+ __IO uint32_t CFB_CRB_BKSB : 2;
+ __IO uint32_t CSA : 1;
+ __IO uint32_t CSB : 1;
+ __IO uint32_t BUFEA : 1;
+ __IO uint32_t BUFEB : 1;
+ __IO uint32_t CIEA : 1;
+ __IO uint32_t CIEB : 1;
+ __IO uint32_t CDEA : 1;
+ __IO uint32_t CDEB : 1;
+ __IO uint32_t CISB : 2;
+ __IO uint32_t CCGA : 1;
+ __IO uint32_t CCGB : 1;
+} stc_tim3_mode23_crch2_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTR : 8;
+ __IO uint32_t BKSEL : 1;
+ __IO uint32_t DTEN : 1;
+ __IO uint32_t BKE : 1;
+ __IO uint32_t AOE : 1;
+ __IO uint32_t MOE : 1;
+ __IO uint32_t SAFEEN : 1;
+ __IO uint32_t VC0E : 1;
+ __IO uint32_t VC1E : 1;
+} stc_tim3_mode23_dtr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCR : 8;
+} stc_tim3_mode23_rcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t ARRDM :16;
+} stc_tim3_mode23_arrdm_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0A :16;
+} stc_tim3_mode23_ccr0a_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR0B :16;
+} stc_tim3_mode23_ccr0b_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR1A :16;
+} stc_tim3_mode23_ccr1a_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR1B :16;
+} stc_tim3_mode23_ccr1b_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR2A :16;
+} stc_tim3_mode23_ccr2a_field_t;
+
+typedef struct
+{
+ __IO uint32_t CCR2B :16;
+} stc_tim3_mode23_ccr2b_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim4_cnter_field_t;
+
+typedef struct
+{
+ __IO uint32_t PERA :16;
+} stc_tim4_perar_field_t;
+
+typedef struct
+{
+ __IO uint32_t PERB :16;
+} stc_tim4_perbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMA :16;
+} stc_tim4_gcmar_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMB :16;
+} stc_tim4_gcmbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMC :16;
+} stc_tim4_gcmcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMD :16;
+} stc_tim4_gcmdr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCMA :16;
+} stc_tim4_scmar_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCMB :16;
+} stc_tim4_scmbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTUA :16;
+} stc_tim4_dtuar_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTDA :16;
+} stc_tim4_dtdar_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+ __IO uint32_t MODE : 3;
+ __IO uint32_t CKDIV : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t DIR : 1;
+ uint32_t RESERVED9 : 7;
+ __IO uint32_t ZMSKREV : 1;
+ __IO uint32_t ZMSKPOS : 1;
+ __IO uint32_t ZMSK : 2;
+} stc_tim4_gconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t INTENA : 1;
+ __IO uint32_t INTENB : 1;
+ __IO uint32_t INTENC : 1;
+ __IO uint32_t INTEND : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t INTENOVF : 1;
+ __IO uint32_t INTENUDF : 1;
+ __IO uint32_t INTENDE : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t INTENSAML : 1;
+ __IO uint32_t INTENSAMH : 1;
+ __IO uint32_t INTENSAU : 1;
+ __IO uint32_t INTENSAD : 1;
+ __IO uint32_t INTENSBU : 1;
+ __IO uint32_t INTENSBD : 1;
+} stc_tim4_iconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CAPCA : 1;
+ __IO uint32_t STACA : 1;
+ __IO uint32_t STPCA : 1;
+ __IO uint32_t STASTPSA : 1;
+ __IO uint32_t CMPCA : 2;
+ __IO uint32_t PERCA : 2;
+ __IO uint32_t OUTENA : 1;
+ __IO uint32_t DISSELA : 2;
+ __IO uint32_t DISVALA : 2;
+ uint32_t RESERVED13 : 3;
+ __IO uint32_t CAPCB : 1;
+ __IO uint32_t STACB : 1;
+ __IO uint32_t STPCB : 1;
+ __IO uint32_t STASTPSB : 1;
+ __IO uint32_t CMPCB : 2;
+ __IO uint32_t PERCB : 2;
+ __IO uint32_t OUTENB : 1;
+ __IO uint32_t DISSELB : 2;
+ __IO uint32_t DISVALB : 2;
+} stc_tim4_pconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t BENA : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t BENB : 1;
+ uint32_t RESERVED3 : 5;
+ __IO uint32_t BENP : 1;
+} stc_tim4_bconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTCEN : 1;
+ uint32_t RESERVED1 : 7;
+ __IO uint32_t SEPA : 1;
+} stc_tim4_dconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t NOFIENGA : 1;
+ __IO uint32_t NOFICKGA : 2;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t NOFIENGB : 1;
+ __IO uint32_t NOFICKGB : 2;
+ uint32_t RESERVED7 : 9;
+ __IO uint32_t NOFIENTA : 1;
+ __IO uint32_t NOFICKTA : 2;
+ uint32_t RESERVED19 : 1;
+ __IO uint32_t NOFIENTB : 1;
+ __IO uint32_t NOFICKTB : 2;
+ uint32_t RESERVED23 : 1;
+ __IO uint32_t NOFIENTC : 1;
+ __IO uint32_t NOFICKTC : 2;
+ uint32_t RESERVED27 : 1;
+ __IO uint32_t NOFIENTD : 1;
+ __IO uint32_t NOFICKTD : 2;
+} stc_tim4_fconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GEPERIA : 1;
+ __IO uint32_t GEPERIB : 1;
+ __IO uint32_t GEPERIC : 1;
+ __IO uint32_t GEPERID : 1;
+ uint32_t RESERVED4 :12;
+ __IO uint32_t PCNTE : 2;
+ __IO uint32_t PCNTS : 3;
+} stc_tim4_vperr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAF : 1;
+ __IO uint32_t CMBF : 1;
+ __IO uint32_t CMCF : 1;
+ __IO uint32_t CMDF : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFF : 1;
+ __IO uint32_t UDFF : 1;
+ __IO uint32_t DTEF : 1;
+ __IO uint32_t CMSAUF : 1;
+ __IO uint32_t CMSADF : 1;
+ __IO uint32_t CMSBUF : 1;
+ __IO uint32_t CMSBDF : 1;
+ uint32_t RESERVED13 : 8;
+ __IO uint32_t VPERNUM : 3;
+ uint32_t RESERVED24 : 7;
+ __IO uint32_t DIRF : 1;
+} stc_tim4_stflr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HSTA0 : 1;
+ __IO uint32_t HSTA1 : 1;
+ __IO uint32_t HSTA2 : 1;
+ __IO uint32_t HSTA3 : 1;
+ __IO uint32_t HSTA4 : 1;
+ __IO uint32_t HSTA5 : 1;
+ __IO uint32_t HSTA6 : 1;
+ __IO uint32_t HSTA7 : 1;
+ __IO uint32_t HSTA8 : 1;
+ __IO uint32_t HSTA9 : 1;
+ __IO uint32_t HSTA10 : 1;
+ __IO uint32_t HSTA11 : 1;
+ __IO uint32_t HSTA12 : 1;
+ __IO uint32_t HSTA13 : 1;
+ __IO uint32_t HSTA14 : 1;
+ __IO uint32_t HSTA15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STARTS : 1;
+} stc_tim4_hstar_field_t;
+
+typedef struct
+{
+ __IO uint32_t HSTP0 : 1;
+ __IO uint32_t HSTP1 : 1;
+ __IO uint32_t HSTP2 : 1;
+ __IO uint32_t HSTP3 : 1;
+ __IO uint32_t HSTP4 : 1;
+ __IO uint32_t HSTP5 : 1;
+ __IO uint32_t HSTP6 : 1;
+ __IO uint32_t HSTP7 : 1;
+ __IO uint32_t HSTP8 : 1;
+ __IO uint32_t HSTP9 : 1;
+ __IO uint32_t HSTP10 : 1;
+ __IO uint32_t HSTP11 : 1;
+ __IO uint32_t HSTP12 : 1;
+ __IO uint32_t HSTP13 : 1;
+ __IO uint32_t HSTP14 : 1;
+ __IO uint32_t HSTP15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STOPS : 1;
+} stc_tim4_hstpr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCEL0 : 1;
+ __IO uint32_t HCEL1 : 1;
+ __IO uint32_t HCEL2 : 1;
+ __IO uint32_t HCEL3 : 1;
+ __IO uint32_t HCEL4 : 1;
+ __IO uint32_t HCEL5 : 1;
+ __IO uint32_t HCEL6 : 1;
+ __IO uint32_t HCEL7 : 1;
+ __IO uint32_t HCEL8 : 1;
+ __IO uint32_t HCEL9 : 1;
+ __IO uint32_t HCEL10 : 1;
+ __IO uint32_t HCEL11 : 1;
+ __IO uint32_t HCEL12 : 1;
+ __IO uint32_t HCEL13 : 1;
+ __IO uint32_t HCEL14 : 1;
+ __IO uint32_t HCEL15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STARTS : 1;
+} stc_tim4_hcelr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCPA0 : 1;
+ __IO uint32_t HCPA1 : 1;
+ __IO uint32_t HCPA2 : 1;
+ __IO uint32_t HCPA3 : 1;
+ __IO uint32_t HCPA4 : 1;
+ __IO uint32_t HCPA5 : 1;
+ __IO uint32_t HCPA6 : 1;
+ __IO uint32_t HCPA7 : 1;
+ __IO uint32_t HCPA8 : 1;
+ __IO uint32_t HCPA9 : 1;
+ __IO uint32_t HCPA10 : 1;
+ __IO uint32_t HCPA11 : 1;
+ __IO uint32_t HCPA12 : 1;
+ __IO uint32_t HCPA13 : 1;
+ __IO uint32_t HCPA14 : 1;
+ __IO uint32_t HCPA15 : 1;
+} stc_tim4_hcpar_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCPB0 : 1;
+ __IO uint32_t HCPB1 : 1;
+ __IO uint32_t HCPB2 : 1;
+ __IO uint32_t HCPB3 : 1;
+ __IO uint32_t HCPB4 : 1;
+ __IO uint32_t HCPB5 : 1;
+ __IO uint32_t HCPB6 : 1;
+ __IO uint32_t HCPB7 : 1;
+ __IO uint32_t HCPB8 : 1;
+ __IO uint32_t HCPB9 : 1;
+ __IO uint32_t HCPB10 : 1;
+ __IO uint32_t HCPB11 : 1;
+ __IO uint32_t HCPB12 : 1;
+ __IO uint32_t HCPB13 : 1;
+ __IO uint32_t HCPB14 : 1;
+ __IO uint32_t HCPB15 : 1;
+} stc_tim4_hcpbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCUP0 : 1;
+ __IO uint32_t HCUP1 : 1;
+ __IO uint32_t HCUP2 : 1;
+ __IO uint32_t HCUP3 : 1;
+ __IO uint32_t HCUP4 : 1;
+ __IO uint32_t HCUP5 : 1;
+ __IO uint32_t HCUP6 : 1;
+ __IO uint32_t HCUP7 : 1;
+ __IO uint32_t HCUP8 : 1;
+ __IO uint32_t HCUP9 : 1;
+ __IO uint32_t HCUP10 : 1;
+ __IO uint32_t HCUP11 : 1;
+ __IO uint32_t HCUP12 : 1;
+ __IO uint32_t HCUP13 : 1;
+ __IO uint32_t HCUP14 : 1;
+ __IO uint32_t HCUP15 : 1;
+ __IO uint32_t HCUP16 : 1;
+ __IO uint32_t HCUP17 : 1;
+ __IO uint32_t HCUP18 : 1;
+ __IO uint32_t HCUP19 : 1;
+} stc_tim4_hcupr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCDO0 : 1;
+ __IO uint32_t HCDO1 : 1;
+ __IO uint32_t HCDO2 : 1;
+ __IO uint32_t HCDO3 : 1;
+ __IO uint32_t HCDO4 : 1;
+ __IO uint32_t HCDO5 : 1;
+ __IO uint32_t HCDO6 : 1;
+ __IO uint32_t HCDO7 : 1;
+ __IO uint32_t HCDO8 : 1;
+ __IO uint32_t HCDO9 : 1;
+ __IO uint32_t HCDO10 : 1;
+ __IO uint32_t HCDO11 : 1;
+ __IO uint32_t HCDO12 : 1;
+ __IO uint32_t HCDO13 : 1;
+ __IO uint32_t HCDO14 : 1;
+ __IO uint32_t HCDO15 : 1;
+ __IO uint32_t HCDO16 : 1;
+ __IO uint32_t HCDO17 : 1;
+ __IO uint32_t HCDO18 : 1;
+ __IO uint32_t HCDO19 : 1;
+} stc_tim4_hcdor_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAF : 1;
+ __IO uint32_t CMBF : 1;
+ __IO uint32_t CMCF : 1;
+ __IO uint32_t CMDF : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFF : 1;
+ __IO uint32_t UDFF : 1;
+ __IO uint32_t DTEF : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t SAMLF : 1;
+ __IO uint32_t SAMHF : 1;
+} stc_tim4_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAC : 1;
+ __IO uint32_t CMBC : 1;
+ __IO uint32_t CMCC : 1;
+ __IO uint32_t CMDC : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFC : 1;
+ __IO uint32_t UDFC : 1;
+ __IO uint32_t DTEC : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t SAMLC : 1;
+ __IO uint32_t SAMHC : 1;
+} stc_tim4_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAE : 1;
+ __IO uint32_t CMBE : 1;
+ __IO uint32_t CMCE : 1;
+ __IO uint32_t CMDE : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFE : 1;
+ __IO uint32_t UDFE : 1;
+ __IO uint32_t DITENA : 1;
+ __IO uint32_t DITENB : 1;
+ __IO uint32_t DITENS : 1;
+ __IO uint32_t CMSAE : 1;
+ __IO uint32_t CMSBE : 1;
+ __IO uint32_t DMA_G_CMA : 1;
+ __IO uint32_t DMA_G_CMB : 1;
+ __IO uint32_t DMA_G_CMC : 1;
+ __IO uint32_t DMA_G_CMD : 1;
+ uint32_t RESERVED17 : 2;
+ __IO uint32_t DMA_G_OVF : 1;
+ __IO uint32_t DMA_G_UDF : 1;
+ __IO uint32_t DMA_S_CMA : 1;
+ __IO uint32_t DMA_S_CMB : 1;
+} stc_tim4_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FBRAKE : 1;
+ __IO uint32_t FSAME : 1;
+ __IO uint32_t BFILTS : 2;
+ __IO uint32_t BFILTEN : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t SOFTBK : 1;
+ __IO uint32_t SML0 : 1;
+ __IO uint32_t SML1 : 1;
+ __IO uint32_t SML2 : 1;
+ __IO uint32_t SMH0 : 1;
+ __IO uint32_t SMH1 : 1;
+ __IO uint32_t SMH2 : 1;
+} stc_tim4_aossr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FBRAKE : 1;
+ __IO uint32_t FSAME : 1;
+} stc_tim4_aoscl_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN0 : 1;
+ __IO uint32_t EN1 : 1;
+ __IO uint32_t EN2 : 1;
+ __IO uint32_t EN3 : 1;
+ __IO uint32_t EN4 : 1;
+ __IO uint32_t EN5 : 1;
+ __IO uint32_t EN6 : 1;
+ __IO uint32_t EN7 : 1;
+ __IO uint32_t EN8 : 1;
+ __IO uint32_t EN9 : 1;
+ __IO uint32_t EN10 : 1;
+ __IO uint32_t EN11 : 1;
+ __IO uint32_t EN12 : 1;
+ __IO uint32_t EN13 : 1;
+ __IO uint32_t EN14 : 1;
+ __IO uint32_t EN15 : 1;
+} stc_tim4_ptbks_field_t;
+
+typedef struct
+{
+ __IO uint32_t TRIGAS : 4;
+ __IO uint32_t TRIGBS : 4;
+ __IO uint32_t TRIGCS : 4;
+ __IO uint32_t TRIGDS : 4;
+} stc_tim4_ttrig_field_t;
+
+typedef struct
+{
+ __IO uint32_t IAOS0S : 4;
+ __IO uint32_t IAOS1S : 4;
+ __IO uint32_t IAOS2S : 4;
+ __IO uint32_t IAOS3S : 4;
+} stc_tim4_itrig_field_t;
+
+typedef struct
+{
+ __IO uint32_t POL0 : 1;
+ __IO uint32_t POL1 : 1;
+ __IO uint32_t POL2 : 1;
+ __IO uint32_t POL3 : 1;
+ __IO uint32_t POL4 : 1;
+ __IO uint32_t POL5 : 1;
+ __IO uint32_t POL6 : 1;
+ __IO uint32_t POL7 : 1;
+ __IO uint32_t POL8 : 1;
+ __IO uint32_t POL9 : 1;
+ __IO uint32_t POL10 : 1;
+ __IO uint32_t POL11 : 1;
+ __IO uint32_t POL12 : 1;
+ __IO uint32_t POL13 : 1;
+ __IO uint32_t POL14 : 1;
+ __IO uint32_t POL15 : 1;
+} stc_tim4_ptbkp_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSTA0 : 1;
+ __IO uint32_t SSTA1 : 1;
+ __IO uint32_t SSTA2 : 1;
+} stc_tim4_sstar_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSTP0 : 1;
+ __IO uint32_t SSTP1 : 1;
+ __IO uint32_t SSTP2 : 1;
+} stc_tim4_sstpr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCLR0 : 1;
+ __IO uint32_t SCLR1 : 1;
+ __IO uint32_t SCLR2 : 1;
+} stc_tim4_sclrr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim5_cnter_field_t;
+
+typedef struct
+{
+ __IO uint32_t PERA :16;
+} stc_tim5_perar_field_t;
+
+typedef struct
+{
+ __IO uint32_t PERB :16;
+} stc_tim5_perbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMA :16;
+} stc_tim5_gcmar_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMB :16;
+} stc_tim5_gcmbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMC :16;
+} stc_tim5_gcmcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMD :16;
+} stc_tim5_gcmdr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCMA :16;
+} stc_tim5_scmar_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCMB :16;
+} stc_tim5_scmbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTUA :16;
+} stc_tim5_dtuar_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTDA :16;
+} stc_tim5_dtdar_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+ __IO uint32_t MODE : 3;
+ __IO uint32_t CKDIV : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t DIR : 1;
+ uint32_t RESERVED9 : 7;
+ __IO uint32_t ZMSKREV : 1;
+ __IO uint32_t ZMSKPOS : 1;
+ __IO uint32_t ZMSK : 2;
+} stc_tim5_gconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t INTENA : 1;
+ __IO uint32_t INTENB : 1;
+ __IO uint32_t INTENC : 1;
+ __IO uint32_t INTEND : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t INTENOVF : 1;
+ __IO uint32_t INTENUDF : 1;
+ __IO uint32_t INTENDE : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t INTENSAML : 1;
+ __IO uint32_t INTENSAMH : 1;
+ __IO uint32_t INTENSAU : 1;
+ __IO uint32_t INTENSAD : 1;
+ __IO uint32_t INTENSBU : 1;
+ __IO uint32_t INTENSBD : 1;
+} stc_tim5_iconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CAPCA : 1;
+ __IO uint32_t STACA : 1;
+ __IO uint32_t STPCA : 1;
+ __IO uint32_t STASTPSA : 1;
+ __IO uint32_t CMPCA : 2;
+ __IO uint32_t PERCA : 2;
+ __IO uint32_t OUTENA : 1;
+ __IO uint32_t DISSELA : 2;
+ __IO uint32_t DISVALA : 2;
+ uint32_t RESERVED13 : 3;
+ __IO uint32_t CAPCB : 1;
+ __IO uint32_t STACB : 1;
+ __IO uint32_t STPCB : 1;
+ __IO uint32_t STASTPSB : 1;
+ __IO uint32_t CMPCB : 2;
+ __IO uint32_t PERCB : 2;
+ __IO uint32_t OUTENB : 1;
+ __IO uint32_t DISSELB : 2;
+ __IO uint32_t DISVALB : 2;
+} stc_tim5_pconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t BENA : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t BENB : 1;
+ uint32_t RESERVED3 : 5;
+ __IO uint32_t BENP : 1;
+} stc_tim5_bconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTCEN : 1;
+ uint32_t RESERVED1 : 7;
+ __IO uint32_t SEPA : 1;
+} stc_tim5_dconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t NOFIENGA : 1;
+ __IO uint32_t NOFICKGA : 2;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t NOFIENGB : 1;
+ __IO uint32_t NOFICKGB : 2;
+ uint32_t RESERVED7 : 9;
+ __IO uint32_t NOFIENTA : 1;
+ __IO uint32_t NOFICKTA : 2;
+ uint32_t RESERVED19 : 1;
+ __IO uint32_t NOFIENTB : 1;
+ __IO uint32_t NOFICKTB : 2;
+ uint32_t RESERVED23 : 1;
+ __IO uint32_t NOFIENTC : 1;
+ __IO uint32_t NOFICKTC : 2;
+ uint32_t RESERVED27 : 1;
+ __IO uint32_t NOFIENTD : 1;
+ __IO uint32_t NOFICKTD : 2;
+} stc_tim5_fconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GEPERIA : 1;
+ __IO uint32_t GEPERIB : 1;
+ __IO uint32_t GEPERIC : 1;
+ __IO uint32_t GEPERID : 1;
+ uint32_t RESERVED4 :12;
+ __IO uint32_t PCNTE : 2;
+ __IO uint32_t PCNTS : 3;
+} stc_tim5_vperr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAF : 1;
+ __IO uint32_t CMBF : 1;
+ __IO uint32_t CMCF : 1;
+ __IO uint32_t CMDF : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFF : 1;
+ __IO uint32_t UDFF : 1;
+ __IO uint32_t DTEF : 1;
+ __IO uint32_t CMSAUF : 1;
+ __IO uint32_t CMSADF : 1;
+ __IO uint32_t CMSBUF : 1;
+ __IO uint32_t CMSBDF : 1;
+ uint32_t RESERVED13 : 8;
+ __IO uint32_t VPERNUM : 3;
+ uint32_t RESERVED24 : 7;
+ __IO uint32_t DIRF : 1;
+} stc_tim5_stflr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HSTA0 : 1;
+ __IO uint32_t HSTA1 : 1;
+ __IO uint32_t HSTA2 : 1;
+ __IO uint32_t HSTA3 : 1;
+ __IO uint32_t HSTA4 : 1;
+ __IO uint32_t HSTA5 : 1;
+ __IO uint32_t HSTA6 : 1;
+ __IO uint32_t HSTA7 : 1;
+ __IO uint32_t HSTA8 : 1;
+ __IO uint32_t HSTA9 : 1;
+ __IO uint32_t HSTA10 : 1;
+ __IO uint32_t HSTA11 : 1;
+ __IO uint32_t HSTA12 : 1;
+ __IO uint32_t HSTA13 : 1;
+ __IO uint32_t HSTA14 : 1;
+ __IO uint32_t HSTA15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STARTS : 1;
+} stc_tim5_hstar_field_t;
+
+typedef struct
+{
+ __IO uint32_t HSTP0 : 1;
+ __IO uint32_t HSTP1 : 1;
+ __IO uint32_t HSTP2 : 1;
+ __IO uint32_t HSTP3 : 1;
+ __IO uint32_t HSTP4 : 1;
+ __IO uint32_t HSTP5 : 1;
+ __IO uint32_t HSTP6 : 1;
+ __IO uint32_t HSTP7 : 1;
+ __IO uint32_t HSTP8 : 1;
+ __IO uint32_t HSTP9 : 1;
+ __IO uint32_t HSTP10 : 1;
+ __IO uint32_t HSTP11 : 1;
+ __IO uint32_t HSTP12 : 1;
+ __IO uint32_t HSTP13 : 1;
+ __IO uint32_t HSTP14 : 1;
+ __IO uint32_t HSTP15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STOPS : 1;
+} stc_tim5_hstpr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCEL0 : 1;
+ __IO uint32_t HCEL1 : 1;
+ __IO uint32_t HCEL2 : 1;
+ __IO uint32_t HCEL3 : 1;
+ __IO uint32_t HCEL4 : 1;
+ __IO uint32_t HCEL5 : 1;
+ __IO uint32_t HCEL6 : 1;
+ __IO uint32_t HCEL7 : 1;
+ __IO uint32_t HCEL8 : 1;
+ __IO uint32_t HCEL9 : 1;
+ __IO uint32_t HCEL10 : 1;
+ __IO uint32_t HCEL11 : 1;
+ __IO uint32_t HCEL12 : 1;
+ __IO uint32_t HCEL13 : 1;
+ __IO uint32_t HCEL14 : 1;
+ __IO uint32_t HCEL15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STARTS : 1;
+} stc_tim5_hcelr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCPA0 : 1;
+ __IO uint32_t HCPA1 : 1;
+ __IO uint32_t HCPA2 : 1;
+ __IO uint32_t HCPA3 : 1;
+ __IO uint32_t HCPA4 : 1;
+ __IO uint32_t HCPA5 : 1;
+ __IO uint32_t HCPA6 : 1;
+ __IO uint32_t HCPA7 : 1;
+ __IO uint32_t HCPA8 : 1;
+ __IO uint32_t HCPA9 : 1;
+ __IO uint32_t HCPA10 : 1;
+ __IO uint32_t HCPA11 : 1;
+ __IO uint32_t HCPA12 : 1;
+ __IO uint32_t HCPA13 : 1;
+ __IO uint32_t HCPA14 : 1;
+ __IO uint32_t HCPA15 : 1;
+} stc_tim5_hcpar_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCPB0 : 1;
+ __IO uint32_t HCPB1 : 1;
+ __IO uint32_t HCPB2 : 1;
+ __IO uint32_t HCPB3 : 1;
+ __IO uint32_t HCPB4 : 1;
+ __IO uint32_t HCPB5 : 1;
+ __IO uint32_t HCPB6 : 1;
+ __IO uint32_t HCPB7 : 1;
+ __IO uint32_t HCPB8 : 1;
+ __IO uint32_t HCPB9 : 1;
+ __IO uint32_t HCPB10 : 1;
+ __IO uint32_t HCPB11 : 1;
+ __IO uint32_t HCPB12 : 1;
+ __IO uint32_t HCPB13 : 1;
+ __IO uint32_t HCPB14 : 1;
+ __IO uint32_t HCPB15 : 1;
+} stc_tim5_hcpbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCUP0 : 1;
+ __IO uint32_t HCUP1 : 1;
+ __IO uint32_t HCUP2 : 1;
+ __IO uint32_t HCUP3 : 1;
+ __IO uint32_t HCUP4 : 1;
+ __IO uint32_t HCUP5 : 1;
+ __IO uint32_t HCUP6 : 1;
+ __IO uint32_t HCUP7 : 1;
+ __IO uint32_t HCUP8 : 1;
+ __IO uint32_t HCUP9 : 1;
+ __IO uint32_t HCUP10 : 1;
+ __IO uint32_t HCUP11 : 1;
+ __IO uint32_t HCUP12 : 1;
+ __IO uint32_t HCUP13 : 1;
+ __IO uint32_t HCUP14 : 1;
+ __IO uint32_t HCUP15 : 1;
+ __IO uint32_t HCUP16 : 1;
+ __IO uint32_t HCUP17 : 1;
+ __IO uint32_t HCUP18 : 1;
+ __IO uint32_t HCUP19 : 1;
+} stc_tim5_hcupr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCDO0 : 1;
+ __IO uint32_t HCDO1 : 1;
+ __IO uint32_t HCDO2 : 1;
+ __IO uint32_t HCDO3 : 1;
+ __IO uint32_t HCDO4 : 1;
+ __IO uint32_t HCDO5 : 1;
+ __IO uint32_t HCDO6 : 1;
+ __IO uint32_t HCDO7 : 1;
+ __IO uint32_t HCDO8 : 1;
+ __IO uint32_t HCDO9 : 1;
+ __IO uint32_t HCDO10 : 1;
+ __IO uint32_t HCDO11 : 1;
+ __IO uint32_t HCDO12 : 1;
+ __IO uint32_t HCDO13 : 1;
+ __IO uint32_t HCDO14 : 1;
+ __IO uint32_t HCDO15 : 1;
+ __IO uint32_t HCDO16 : 1;
+ __IO uint32_t HCDO17 : 1;
+ __IO uint32_t HCDO18 : 1;
+ __IO uint32_t HCDO19 : 1;
+} stc_tim5_hcdor_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAF : 1;
+ __IO uint32_t CMBF : 1;
+ __IO uint32_t CMCF : 1;
+ __IO uint32_t CMDF : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFF : 1;
+ __IO uint32_t UDFF : 1;
+ __IO uint32_t DTEF : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t SAMLF : 1;
+ __IO uint32_t SAMHF : 1;
+} stc_tim5_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAC : 1;
+ __IO uint32_t CMBC : 1;
+ __IO uint32_t CMCC : 1;
+ __IO uint32_t CMDC : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFC : 1;
+ __IO uint32_t UDFC : 1;
+ __IO uint32_t DTEC : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t SAMLC : 1;
+ __IO uint32_t SAMHC : 1;
+} stc_tim5_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAE : 1;
+ __IO uint32_t CMBE : 1;
+ __IO uint32_t CMCE : 1;
+ __IO uint32_t CMDE : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFE : 1;
+ __IO uint32_t UDFE : 1;
+ __IO uint32_t DITENA : 1;
+ __IO uint32_t DITENB : 1;
+ __IO uint32_t DITENS : 1;
+ __IO uint32_t CMSAE : 1;
+ __IO uint32_t CMSBE : 1;
+ __IO uint32_t DMA_G_CMA : 1;
+ __IO uint32_t DMA_G_CMB : 1;
+ __IO uint32_t DMA_G_CMC : 1;
+ __IO uint32_t DMA_G_CMD : 1;
+ uint32_t RESERVED17 : 2;
+ __IO uint32_t DMA_G_OVF : 1;
+ __IO uint32_t DMA_G_UDF : 1;
+ __IO uint32_t DMA_S_CMA : 1;
+ __IO uint32_t DMA_S_CMB : 1;
+} stc_tim5_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FBRAKE : 1;
+ __IO uint32_t FSAME : 1;
+ __IO uint32_t BFILTS : 2;
+ __IO uint32_t BFILTEN : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t SOFTBK : 1;
+ __IO uint32_t SML0 : 1;
+ __IO uint32_t SML1 : 1;
+ __IO uint32_t SML2 : 1;
+ __IO uint32_t SMH0 : 1;
+ __IO uint32_t SMH1 : 1;
+ __IO uint32_t SMH2 : 1;
+} stc_tim5_aossr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FBRAKE : 1;
+ __IO uint32_t FSAME : 1;
+} stc_tim5_aoscl_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN0 : 1;
+ __IO uint32_t EN1 : 1;
+ __IO uint32_t EN2 : 1;
+ __IO uint32_t EN3 : 1;
+ __IO uint32_t EN4 : 1;
+ __IO uint32_t EN5 : 1;
+ __IO uint32_t EN6 : 1;
+ __IO uint32_t EN7 : 1;
+ __IO uint32_t EN8 : 1;
+ __IO uint32_t EN9 : 1;
+ __IO uint32_t EN10 : 1;
+ __IO uint32_t EN11 : 1;
+ __IO uint32_t EN12 : 1;
+ __IO uint32_t EN13 : 1;
+ __IO uint32_t EN14 : 1;
+ __IO uint32_t EN15 : 1;
+} stc_tim5_ptbks_field_t;
+
+typedef struct
+{
+ __IO uint32_t TRIGAS : 4;
+ __IO uint32_t TRIGBS : 4;
+ __IO uint32_t TRIGCS : 4;
+ __IO uint32_t TRIGDS : 4;
+} stc_tim5_ttrig_field_t;
+
+typedef struct
+{
+ __IO uint32_t IAOS0S : 4;
+ __IO uint32_t IAOS1S : 4;
+ __IO uint32_t IAOS2S : 4;
+ __IO uint32_t IAOS3S : 4;
+} stc_tim5_itrig_field_t;
+
+typedef struct
+{
+ __IO uint32_t POL0 : 1;
+ __IO uint32_t POL1 : 1;
+ __IO uint32_t POL2 : 1;
+ __IO uint32_t POL3 : 1;
+ __IO uint32_t POL4 : 1;
+ __IO uint32_t POL5 : 1;
+ __IO uint32_t POL6 : 1;
+ __IO uint32_t POL7 : 1;
+ __IO uint32_t POL8 : 1;
+ __IO uint32_t POL9 : 1;
+ __IO uint32_t POL10 : 1;
+ __IO uint32_t POL11 : 1;
+ __IO uint32_t POL12 : 1;
+ __IO uint32_t POL13 : 1;
+ __IO uint32_t POL14 : 1;
+ __IO uint32_t POL15 : 1;
+} stc_tim5_ptbkp_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSTA0 : 1;
+ __IO uint32_t SSTA1 : 1;
+ __IO uint32_t SSTA2 : 1;
+} stc_tim5_sstar_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSTP0 : 1;
+ __IO uint32_t SSTP1 : 1;
+ __IO uint32_t SSTP2 : 1;
+} stc_tim5_sstpr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCLR0 : 1;
+ __IO uint32_t SCLR1 : 1;
+ __IO uint32_t SCLR2 : 1;
+} stc_tim5_sclrr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CNT :16;
+} stc_tim6_cnter_field_t;
+
+typedef struct
+{
+ __IO uint32_t PERA :16;
+} stc_tim6_perar_field_t;
+
+typedef struct
+{
+ __IO uint32_t PERB :16;
+} stc_tim6_perbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMA :16;
+} stc_tim6_gcmar_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMB :16;
+} stc_tim6_gcmbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMC :16;
+} stc_tim6_gcmcr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GCMD :16;
+} stc_tim6_gcmdr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCMA :16;
+} stc_tim6_scmar_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCMB :16;
+} stc_tim6_scmbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTUA :16;
+} stc_tim6_dtuar_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTDA :16;
+} stc_tim6_dtdar_field_t;
+
+typedef struct
+{
+ __IO uint32_t START : 1;
+ __IO uint32_t MODE : 3;
+ __IO uint32_t CKDIV : 3;
+ uint32_t RESERVED7 : 1;
+ __IO uint32_t DIR : 1;
+ uint32_t RESERVED9 : 7;
+ __IO uint32_t ZMSKREV : 1;
+ __IO uint32_t ZMSKPOS : 1;
+ __IO uint32_t ZMSK : 2;
+} stc_tim6_gconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t INTENA : 1;
+ __IO uint32_t INTENB : 1;
+ __IO uint32_t INTENC : 1;
+ __IO uint32_t INTEND : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t INTENOVF : 1;
+ __IO uint32_t INTENUDF : 1;
+ __IO uint32_t INTENDE : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t INTENSAML : 1;
+ __IO uint32_t INTENSAMH : 1;
+ __IO uint32_t INTENSAU : 1;
+ __IO uint32_t INTENSAD : 1;
+ __IO uint32_t INTENSBU : 1;
+ __IO uint32_t INTENSBD : 1;
+} stc_tim6_iconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CAPCA : 1;
+ __IO uint32_t STACA : 1;
+ __IO uint32_t STPCA : 1;
+ __IO uint32_t STASTPSA : 1;
+ __IO uint32_t CMPCA : 2;
+ __IO uint32_t PERCA : 2;
+ __IO uint32_t OUTENA : 1;
+ __IO uint32_t DISSELA : 2;
+ __IO uint32_t DISVALA : 2;
+ uint32_t RESERVED13 : 3;
+ __IO uint32_t CAPCB : 1;
+ __IO uint32_t STACB : 1;
+ __IO uint32_t STPCB : 1;
+ __IO uint32_t STASTPSB : 1;
+ __IO uint32_t CMPCB : 2;
+ __IO uint32_t PERCB : 2;
+ __IO uint32_t OUTENB : 1;
+ __IO uint32_t DISSELB : 2;
+ __IO uint32_t DISVALB : 2;
+} stc_tim6_pconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t BENA : 1;
+ uint32_t RESERVED1 : 1;
+ __IO uint32_t BENB : 1;
+ uint32_t RESERVED3 : 5;
+ __IO uint32_t BENP : 1;
+} stc_tim6_bconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DTCEN : 1;
+ uint32_t RESERVED1 : 7;
+ __IO uint32_t SEPA : 1;
+} stc_tim6_dconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t NOFIENGA : 1;
+ __IO uint32_t NOFICKGA : 2;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t NOFIENGB : 1;
+ __IO uint32_t NOFICKGB : 2;
+ uint32_t RESERVED7 : 9;
+ __IO uint32_t NOFIENTA : 1;
+ __IO uint32_t NOFICKTA : 2;
+ uint32_t RESERVED19 : 1;
+ __IO uint32_t NOFIENTB : 1;
+ __IO uint32_t NOFICKTB : 2;
+ uint32_t RESERVED23 : 1;
+ __IO uint32_t NOFIENTC : 1;
+ __IO uint32_t NOFICKTC : 2;
+ uint32_t RESERVED27 : 1;
+ __IO uint32_t NOFIENTD : 1;
+ __IO uint32_t NOFICKTD : 2;
+} stc_tim6_fconr_field_t;
+
+typedef struct
+{
+ __IO uint32_t GEPERIA : 1;
+ __IO uint32_t GEPERIB : 1;
+ __IO uint32_t GEPERIC : 1;
+ __IO uint32_t GEPERID : 1;
+ uint32_t RESERVED4 :12;
+ __IO uint32_t PCNTE : 2;
+ __IO uint32_t PCNTS : 3;
+} stc_tim6_vperr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAF : 1;
+ __IO uint32_t CMBF : 1;
+ __IO uint32_t CMCF : 1;
+ __IO uint32_t CMDF : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFF : 1;
+ __IO uint32_t UDFF : 1;
+ __IO uint32_t DTEF : 1;
+ __IO uint32_t CMSAUF : 1;
+ __IO uint32_t CMSADF : 1;
+ __IO uint32_t CMSBUF : 1;
+ __IO uint32_t CMSBDF : 1;
+ uint32_t RESERVED13 : 8;
+ __IO uint32_t VPERNUM : 3;
+ uint32_t RESERVED24 : 7;
+ __IO uint32_t DIRF : 1;
+} stc_tim6_stflr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HSTA0 : 1;
+ __IO uint32_t HSTA1 : 1;
+ __IO uint32_t HSTA2 : 1;
+ __IO uint32_t HSTA3 : 1;
+ __IO uint32_t HSTA4 : 1;
+ __IO uint32_t HSTA5 : 1;
+ __IO uint32_t HSTA6 : 1;
+ __IO uint32_t HSTA7 : 1;
+ __IO uint32_t HSTA8 : 1;
+ __IO uint32_t HSTA9 : 1;
+ __IO uint32_t HSTA10 : 1;
+ __IO uint32_t HSTA11 : 1;
+ __IO uint32_t HSTA12 : 1;
+ __IO uint32_t HSTA13 : 1;
+ __IO uint32_t HSTA14 : 1;
+ __IO uint32_t HSTA15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STARTS : 1;
+} stc_tim6_hstar_field_t;
+
+typedef struct
+{
+ __IO uint32_t HSTP0 : 1;
+ __IO uint32_t HSTP1 : 1;
+ __IO uint32_t HSTP2 : 1;
+ __IO uint32_t HSTP3 : 1;
+ __IO uint32_t HSTP4 : 1;
+ __IO uint32_t HSTP5 : 1;
+ __IO uint32_t HSTP6 : 1;
+ __IO uint32_t HSTP7 : 1;
+ __IO uint32_t HSTP8 : 1;
+ __IO uint32_t HSTP9 : 1;
+ __IO uint32_t HSTP10 : 1;
+ __IO uint32_t HSTP11 : 1;
+ __IO uint32_t HSTP12 : 1;
+ __IO uint32_t HSTP13 : 1;
+ __IO uint32_t HSTP14 : 1;
+ __IO uint32_t HSTP15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STOPS : 1;
+} stc_tim6_hstpr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCEL0 : 1;
+ __IO uint32_t HCEL1 : 1;
+ __IO uint32_t HCEL2 : 1;
+ __IO uint32_t HCEL3 : 1;
+ __IO uint32_t HCEL4 : 1;
+ __IO uint32_t HCEL5 : 1;
+ __IO uint32_t HCEL6 : 1;
+ __IO uint32_t HCEL7 : 1;
+ __IO uint32_t HCEL8 : 1;
+ __IO uint32_t HCEL9 : 1;
+ __IO uint32_t HCEL10 : 1;
+ __IO uint32_t HCEL11 : 1;
+ __IO uint32_t HCEL12 : 1;
+ __IO uint32_t HCEL13 : 1;
+ __IO uint32_t HCEL14 : 1;
+ __IO uint32_t HCEL15 : 1;
+ uint32_t RESERVED16 :15;
+ __IO uint32_t STARTS : 1;
+} stc_tim6_hcelr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCPA0 : 1;
+ __IO uint32_t HCPA1 : 1;
+ __IO uint32_t HCPA2 : 1;
+ __IO uint32_t HCPA3 : 1;
+ __IO uint32_t HCPA4 : 1;
+ __IO uint32_t HCPA5 : 1;
+ __IO uint32_t HCPA6 : 1;
+ __IO uint32_t HCPA7 : 1;
+ __IO uint32_t HCPA8 : 1;
+ __IO uint32_t HCPA9 : 1;
+ __IO uint32_t HCPA10 : 1;
+ __IO uint32_t HCPA11 : 1;
+ __IO uint32_t HCPA12 : 1;
+ __IO uint32_t HCPA13 : 1;
+ __IO uint32_t HCPA14 : 1;
+ __IO uint32_t HCPA15 : 1;
+} stc_tim6_hcpar_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCPB0 : 1;
+ __IO uint32_t HCPB1 : 1;
+ __IO uint32_t HCPB2 : 1;
+ __IO uint32_t HCPB3 : 1;
+ __IO uint32_t HCPB4 : 1;
+ __IO uint32_t HCPB5 : 1;
+ __IO uint32_t HCPB6 : 1;
+ __IO uint32_t HCPB7 : 1;
+ __IO uint32_t HCPB8 : 1;
+ __IO uint32_t HCPB9 : 1;
+ __IO uint32_t HCPB10 : 1;
+ __IO uint32_t HCPB11 : 1;
+ __IO uint32_t HCPB12 : 1;
+ __IO uint32_t HCPB13 : 1;
+ __IO uint32_t HCPB14 : 1;
+ __IO uint32_t HCPB15 : 1;
+} stc_tim6_hcpbr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCUP0 : 1;
+ __IO uint32_t HCUP1 : 1;
+ __IO uint32_t HCUP2 : 1;
+ __IO uint32_t HCUP3 : 1;
+ __IO uint32_t HCUP4 : 1;
+ __IO uint32_t HCUP5 : 1;
+ __IO uint32_t HCUP6 : 1;
+ __IO uint32_t HCUP7 : 1;
+ __IO uint32_t HCUP8 : 1;
+ __IO uint32_t HCUP9 : 1;
+ __IO uint32_t HCUP10 : 1;
+ __IO uint32_t HCUP11 : 1;
+ __IO uint32_t HCUP12 : 1;
+ __IO uint32_t HCUP13 : 1;
+ __IO uint32_t HCUP14 : 1;
+ __IO uint32_t HCUP15 : 1;
+ __IO uint32_t HCUP16 : 1;
+ __IO uint32_t HCUP17 : 1;
+ __IO uint32_t HCUP18 : 1;
+ __IO uint32_t HCUP19 : 1;
+} stc_tim6_hcupr_field_t;
+
+typedef struct
+{
+ __IO uint32_t HCDO0 : 1;
+ __IO uint32_t HCDO1 : 1;
+ __IO uint32_t HCDO2 : 1;
+ __IO uint32_t HCDO3 : 1;
+ __IO uint32_t HCDO4 : 1;
+ __IO uint32_t HCDO5 : 1;
+ __IO uint32_t HCDO6 : 1;
+ __IO uint32_t HCDO7 : 1;
+ __IO uint32_t HCDO8 : 1;
+ __IO uint32_t HCDO9 : 1;
+ __IO uint32_t HCDO10 : 1;
+ __IO uint32_t HCDO11 : 1;
+ __IO uint32_t HCDO12 : 1;
+ __IO uint32_t HCDO13 : 1;
+ __IO uint32_t HCDO14 : 1;
+ __IO uint32_t HCDO15 : 1;
+ __IO uint32_t HCDO16 : 1;
+ __IO uint32_t HCDO17 : 1;
+ __IO uint32_t HCDO18 : 1;
+ __IO uint32_t HCDO19 : 1;
+} stc_tim6_hcdor_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAF : 1;
+ __IO uint32_t CMBF : 1;
+ __IO uint32_t CMCF : 1;
+ __IO uint32_t CMDF : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFF : 1;
+ __IO uint32_t UDFF : 1;
+ __IO uint32_t DTEF : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t SAMLF : 1;
+ __IO uint32_t SAMHF : 1;
+} stc_tim6_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAC : 1;
+ __IO uint32_t CMBC : 1;
+ __IO uint32_t CMCC : 1;
+ __IO uint32_t CMDC : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFC : 1;
+ __IO uint32_t UDFC : 1;
+ __IO uint32_t DTEC : 1;
+ uint32_t RESERVED9 : 5;
+ __IO uint32_t SAMLC : 1;
+ __IO uint32_t SAMHC : 1;
+} stc_tim6_iclr_field_t;
+
+typedef struct
+{
+ __IO uint32_t CMAE : 1;
+ __IO uint32_t CMBE : 1;
+ __IO uint32_t CMCE : 1;
+ __IO uint32_t CMDE : 1;
+ uint32_t RESERVED4 : 2;
+ __IO uint32_t OVFE : 1;
+ __IO uint32_t UDFE : 1;
+ __IO uint32_t DITENA : 1;
+ __IO uint32_t DITENB : 1;
+ __IO uint32_t DITENS : 1;
+ __IO uint32_t CMSAE : 1;
+ __IO uint32_t CMSBE : 1;
+ __IO uint32_t DMA_G_CMA : 1;
+ __IO uint32_t DMA_G_CMB : 1;
+ __IO uint32_t DMA_G_CMC : 1;
+ __IO uint32_t DMA_G_CMD : 1;
+ uint32_t RESERVED17 : 2;
+ __IO uint32_t DMA_G_OVF : 1;
+ __IO uint32_t DMA_G_UDF : 1;
+ __IO uint32_t DMA_S_CMA : 1;
+ __IO uint32_t DMA_S_CMB : 1;
+} stc_tim6_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FBRAKE : 1;
+ __IO uint32_t FSAME : 1;
+ __IO uint32_t BFILTS : 2;
+ __IO uint32_t BFILTEN : 1;
+ uint32_t RESERVED5 : 2;
+ __IO uint32_t SOFTBK : 1;
+ __IO uint32_t SML0 : 1;
+ __IO uint32_t SML1 : 1;
+ __IO uint32_t SML2 : 1;
+ __IO uint32_t SMH0 : 1;
+ __IO uint32_t SMH1 : 1;
+ __IO uint32_t SMH2 : 1;
+} stc_tim6_aossr_field_t;
+
+typedef struct
+{
+ __IO uint32_t FBRAKE : 1;
+ __IO uint32_t FSAME : 1;
+} stc_tim6_aoscl_field_t;
+
+typedef struct
+{
+ __IO uint32_t EN0 : 1;
+ __IO uint32_t EN1 : 1;
+ __IO uint32_t EN2 : 1;
+ __IO uint32_t EN3 : 1;
+ __IO uint32_t EN4 : 1;
+ __IO uint32_t EN5 : 1;
+ __IO uint32_t EN6 : 1;
+ __IO uint32_t EN7 : 1;
+ __IO uint32_t EN8 : 1;
+ __IO uint32_t EN9 : 1;
+ __IO uint32_t EN10 : 1;
+ __IO uint32_t EN11 : 1;
+ __IO uint32_t EN12 : 1;
+ __IO uint32_t EN13 : 1;
+ __IO uint32_t EN14 : 1;
+ __IO uint32_t EN15 : 1;
+} stc_tim6_ptbks_field_t;
+
+typedef struct
+{
+ __IO uint32_t TRIGAS : 4;
+ __IO uint32_t TRIGBS : 4;
+ __IO uint32_t TRIGCS : 4;
+ __IO uint32_t TRIGDS : 4;
+} stc_tim6_ttrig_field_t;
+
+typedef struct
+{
+ __IO uint32_t IAOS0S : 4;
+ __IO uint32_t IAOS1S : 4;
+ __IO uint32_t IAOS2S : 4;
+ __IO uint32_t IAOS3S : 4;
+} stc_tim6_itrig_field_t;
+
+typedef struct
+{
+ __IO uint32_t POL0 : 1;
+ __IO uint32_t POL1 : 1;
+ __IO uint32_t POL2 : 1;
+ __IO uint32_t POL3 : 1;
+ __IO uint32_t POL4 : 1;
+ __IO uint32_t POL5 : 1;
+ __IO uint32_t POL6 : 1;
+ __IO uint32_t POL7 : 1;
+ __IO uint32_t POL8 : 1;
+ __IO uint32_t POL9 : 1;
+ __IO uint32_t POL10 : 1;
+ __IO uint32_t POL11 : 1;
+ __IO uint32_t POL12 : 1;
+ __IO uint32_t POL13 : 1;
+ __IO uint32_t POL14 : 1;
+ __IO uint32_t POL15 : 1;
+} stc_tim6_ptbkp_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSTA0 : 1;
+ __IO uint32_t SSTA1 : 1;
+ __IO uint32_t SSTA2 : 1;
+} stc_tim6_sstar_field_t;
+
+typedef struct
+{
+ __IO uint32_t SSTP0 : 1;
+ __IO uint32_t SSTP1 : 1;
+ __IO uint32_t SSTP2 : 1;
+} stc_tim6_sstpr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCLR0 : 1;
+ __IO uint32_t SCLR1 : 1;
+ __IO uint32_t SCLR2 : 1;
+} stc_tim6_sclrr_field_t;
+
+typedef struct
+{
+ __IO uint32_t DATA : 8;
+ __IO uint32_t DATA8 : 1;
+} stc_uart_sbuf_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCIE : 1;
+ __IO uint32_t TCIE : 1;
+ __IO uint32_t B8CONT : 2;
+ __IO uint32_t REN : 1;
+ __IO uint32_t ADRDET : 1;
+ __IO uint32_t SM : 2;
+ __IO uint32_t TXEIE : 1;
+ __IO uint32_t OVER : 1;
+ uint32_t RESERVED10 : 3;
+ __IO uint32_t PEIE : 1;
+ __IO uint32_t STOPBIT : 2;
+ __IO uint32_t DMARXEN : 1;
+ __IO uint32_t DMATXEN : 1;
+ __IO uint32_t RTSEN : 1;
+ __IO uint32_t CTSEN : 1;
+ __IO uint32_t CTSIE : 1;
+ __IO uint32_t FEIE : 1;
+} stc_uart_scon_field_t;
+
+typedef struct
+{
+ __IO uint32_t SADDR : 8;
+} stc_uart_saddr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SADEN : 8;
+} stc_uart_saden_field_t;
+
+typedef struct
+{
+ __IO uint32_t RC : 1;
+ __IO uint32_t TC : 1;
+ __IO uint32_t FE : 1;
+ __IO uint32_t TXE : 1;
+ __IO uint32_t PE : 1;
+ __IO uint32_t CTSIF : 1;
+ __IO uint32_t CTS : 1;
+} stc_uart_isr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RCCF : 1;
+ __IO uint32_t TCCF : 1;
+ __IO uint32_t FECF : 1;
+ uint32_t RESERVED3 : 1;
+ __IO uint32_t PECF : 1;
+ __IO uint32_t CTSIFCF : 1;
+} stc_uart_icr_field_t;
+
+typedef struct
+{
+ __IO uint32_t SCNT :16;
+} stc_uart_scnt_field_t;
+
+typedef struct
+{
+ __IO uint32_t DIV : 6;
+ __IO uint32_t DIV_EN : 1;
+ __IO uint32_t REF2P5_SEL : 1;
+ __IO uint32_t VC0_BIAS_SEL : 2;
+ __IO uint32_t VC0_HYS_SEL : 2;
+ __IO uint32_t VC1_BIAS_SEL : 2;
+ __IO uint32_t VC1_HYS_SEL : 2;
+} stc_vc_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t P_SEL : 4;
+ __IO uint32_t N_SEL : 4;
+ __IO uint32_t FLTEN : 1;
+ __IO uint32_t DEBOUNCE_TIME : 3;
+ __IO uint32_t FALLING : 1;
+ __IO uint32_t RISING : 1;
+ __IO uint32_t LEVEL : 1;
+ __IO uint32_t IE : 1;
+ __IO uint32_t EN : 1;
+} stc_vc_vc0_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t P_SEL : 4;
+ __IO uint32_t N_SEL : 4;
+ __IO uint32_t FLTEN : 1;
+ __IO uint32_t DEBOUNCE_TIME : 3;
+ __IO uint32_t FALLING : 1;
+ __IO uint32_t RISING : 1;
+ __IO uint32_t LEVEL : 1;
+ __IO uint32_t IE : 1;
+ __IO uint32_t EN : 1;
+} stc_vc_vc1_cr_field_t;
+
+typedef struct
+{
+ __IO uint32_t INV_TIMER : 1;
+ __IO uint32_t TIM0RCLR : 1;
+ __IO uint32_t TIM1RCLR : 1;
+ __IO uint32_t TIM2RCLR : 1;
+ __IO uint32_t TIM3RCLR : 1;
+ __IO uint32_t TIMBK : 1;
+ uint32_t RESERVED6 : 3;
+ __IO uint32_t INV_TIM4 : 1;
+ __IO uint32_t TIM4 : 1;
+ __IO uint32_t INV_TIM5 : 1;
+ __IO uint32_t TIM5 : 1;
+ __IO uint32_t INV_TIM6 : 1;
+ __IO uint32_t TIM6 : 1;
+ __IO uint32_t BRAKE : 1;
+} stc_vc_vc0_out_cfg_field_t;
+
+typedef struct
+{
+ __IO uint32_t INV_TIMER : 1;
+ __IO uint32_t TIM0RCLR : 1;
+ __IO uint32_t TIM1RCLR : 1;
+ __IO uint32_t TIM2RCLR : 1;
+ __IO uint32_t TIM3RCLR : 1;
+ __IO uint32_t TIMBK : 1;
+ uint32_t RESERVED6 : 3;
+ __IO uint32_t INV_TIM4 : 1;
+ __IO uint32_t TIM4 : 1;
+ __IO uint32_t INV_TIM5 : 1;
+ __IO uint32_t TIM5 : 1;
+ __IO uint32_t INV_TIM6 : 1;
+ __IO uint32_t TIM6 : 1;
+ __IO uint32_t BRAKE : 1;
+} stc_vc_vc1_out_cfg_field_t;
+
+typedef struct
+{
+ __IO uint32_t VC0_INTF : 1;
+ __IO uint32_t VC1_INTF : 1;
+ __IO uint32_t VC0_FILTER : 1;
+ __IO uint32_t VC1_FILTER : 1;
+} stc_vc_ifr_field_t;
+
+typedef struct
+{
+ __IO uint32_t RST : 8;
+} stc_wdt_rst_field_t;
+
+typedef struct
+{
+ __IO uint32_t WOV : 4;
+ __IO uint32_t WDTR : 1;
+ __IO uint32_t WINT_EN : 1;
+ uint32_t RESERVED6 : 1;
+ __IO uint32_t WDINT : 1;
+ __IO uint32_t WCNTL : 8;
+} stc_wdt_con_field_t;
+
+
+typedef struct
+{
+ uint8_t RESERVED0[4];
+ union
+ {
+ __IO uint32_t CR0;
+ stc_adc_cr0_field_t CR0_f;
+ };
+ union
+ {
+ __IO uint32_t CR1;
+ stc_adc_cr1_field_t CR1_f;
+ };
+ uint8_t RESERVED2[52];
+ union
+ {
+ __IO uint32_t SQR0;
+ stc_adc_sqr0_field_t SQR0_f;
+ };
+ union
+ {
+ __IO uint32_t SQR1;
+ stc_adc_sqr1_field_t SQR1_f;
+ };
+ union
+ {
+ __IO uint32_t SQR2;
+ stc_adc_sqr2_field_t SQR2_f;
+ };
+ union
+ {
+ __IO uint32_t JQR;
+ stc_adc_jqr_field_t JQR_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT0;
+ stc_adc_sqrresult0_field_t SQRRESULT0_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT1;
+ stc_adc_sqrresult1_field_t SQRRESULT1_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT2;
+ stc_adc_sqrresult2_field_t SQRRESULT2_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT3;
+ stc_adc_sqrresult3_field_t SQRRESULT3_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT4;
+ stc_adc_sqrresult4_field_t SQRRESULT4_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT5;
+ stc_adc_sqrresult5_field_t SQRRESULT5_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT6;
+ stc_adc_sqrresult6_field_t SQRRESULT6_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT7;
+ stc_adc_sqrresult7_field_t SQRRESULT7_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT8;
+ stc_adc_sqrresult8_field_t SQRRESULT8_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT9;
+ stc_adc_sqrresult9_field_t SQRRESULT9_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT10;
+ stc_adc_sqrresult10_field_t SQRRESULT10_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT11;
+ stc_adc_sqrresult11_field_t SQRRESULT11_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT12;
+ stc_adc_sqrresult12_field_t SQRRESULT12_f;
+ };
+ union
+ {
+ __IO uint32_t SQR_RESULT13;
+ stc_adc_sqr_result13_field_t SQR_RESULT13_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT14;
+ stc_adc_sqrresult14_field_t SQRRESULT14_f;
+ };
+ union
+ {
+ __IO uint32_t SQRRESULT15;
+ stc_adc_sqrresult15_field_t SQRRESULT15_f;
+ };
+ union
+ {
+ __IO uint32_t JQRRESULT0;
+ stc_adc_jqrresult0_field_t JQRRESULT0_f;
+ };
+ union
+ {
+ __IO uint32_t JQRRESULT1;
+ stc_adc_jqrresult1_field_t JQRRESULT1_f;
+ };
+ union
+ {
+ __IO uint32_t JQRRESULT2;
+ stc_adc_jqrresult2_field_t JQRRESULT2_f;
+ };
+ union
+ {
+ __IO uint32_t JQRRESULT3;
+ stc_adc_jqrresult3_field_t JQRRESULT3_f;
+ };
+ union
+ {
+ __IO uint32_t RESULT;
+ stc_adc_result_field_t RESULT_f;
+ };
+ union
+ {
+ __IO uint32_t RESULTACC;
+ stc_adc_resultacc_field_t RESULTACC_f;
+ };
+ union
+ {
+ __IO uint32_t HT;
+ stc_adc_ht_field_t HT_f;
+ };
+ union
+ {
+ __IO uint32_t LT;
+ stc_adc_lt_field_t LT_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_adc_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICR;
+ stc_adc_icr_field_t ICR_f;
+ };
+ union
+ {
+ __IO uint32_t EXTTRIGGER0;
+ stc_adc_exttrigger0_field_t EXTTRIGGER0_f;
+ };
+ union
+ {
+ __IO uint32_t EXTTRIGGER1;
+ stc_adc_exttrigger1_field_t EXTTRIGGER1_f;
+ };
+ union
+ {
+ __IO uint32_t SGLSTART;
+ stc_adc_sglstart_field_t SGLSTART_f;
+ };
+ union
+ {
+ __IO uint32_t SQRSTART;
+ stc_adc_sqrstart_field_t SQRSTART_f;
+ };
+ union
+ {
+ __IO uint32_t JQRSTART;
+ stc_adc_jqrstart_field_t JQRSTART_f;
+ };
+}M0P_ADC_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_aes_cr_field_t CR_f;
+ };
+ uint8_t RESERVED1[12];
+ union
+ {
+ __IO uint32_t DATA0;
+ stc_aes_data0_field_t DATA0_f;
+ };
+ union
+ {
+ __IO uint32_t DATA1;
+ stc_aes_data1_field_t DATA1_f;
+ };
+ union
+ {
+ __IO uint32_t DATA2;
+ stc_aes_data2_field_t DATA2_f;
+ };
+ union
+ {
+ __IO uint32_t DATA3;
+ stc_aes_data3_field_t DATA3_f;
+ };
+ union
+ {
+ __IO uint32_t KEY0;
+ stc_aes_key0_field_t KEY0_f;
+ };
+ union
+ {
+ __IO uint32_t KEY1;
+ stc_aes_key1_field_t KEY1_f;
+ };
+ union
+ {
+ __IO uint32_t KEY2;
+ stc_aes_key2_field_t KEY2_f;
+ };
+ union
+ {
+ __IO uint32_t KEY3;
+ stc_aes_key3_field_t KEY3_f;
+ };
+}M0P_AES_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_bgr_cr_field_t CR_f;
+ };
+}M0P_BGR_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_clk_trim_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t REFCON;
+ stc_clk_trim_refcon_field_t REFCON_f;
+ };
+ union
+ {
+ __IO uint32_t REFCNT;
+ stc_clk_trim_refcnt_field_t REFCNT_f;
+ };
+ union
+ {
+ __IO uint32_t CALCNT;
+ stc_clk_trim_calcnt_field_t CALCNT_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_clk_trim_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_clk_trim_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t CALCON;
+ stc_clk_trim_calcon_field_t CALCON_f;
+ };
+}M0P_CLK_TRIM_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_crc_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t RESULT;
+ stc_crc_result_field_t RESULT_f;
+ };
+ uint8_t RESERVED2[120];
+ union
+ {
+ __IO uint32_t DATA;
+ stc_crc_data_field_t DATA_f;
+ };
+}M0P_CRC_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t DEBUG_ACTIVE;
+ stc_debug_active_field_t DEBUG_ACTIVE_f;
+ };
+}M0P_DEBUG_ACTIVE_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CONF;
+ stc_dmac_conf_field_t CONF_f;
+ };
+ uint8_t RESERVED1[12];
+ union
+ {
+ __IO uint32_t CONFA0;
+ stc_dmac_confa0_field_t CONFA0_f;
+ };
+ union
+ {
+ __IO uint32_t CONFB0;
+ stc_dmac_confb0_field_t CONFB0_f;
+ };
+ union
+ {
+ __IO uint32_t SRCADR0;
+ stc_dmac_srcadr0_field_t SRCADR0_f;
+ };
+ union
+ {
+ __IO uint32_t DSTADR0;
+ stc_dmac_dstadr0_field_t DSTADR0_f;
+ };
+ union
+ {
+ __IO uint32_t CONFA1;
+ stc_dmac_confa1_field_t CONFA1_f;
+ };
+ union
+ {
+ __IO uint32_t CONFB1;
+ stc_dmac_confb1_field_t CONFB1_f;
+ };
+ union
+ {
+ __IO uint32_t SRCADR1;
+ stc_dmac_srcadr1_field_t SRCADR1_f;
+ };
+ union
+ {
+ __IO uint32_t DSTADR1;
+ stc_dmac_dstadr1_field_t DSTADR1_f;
+ };
+}M0P_DMAC_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t TNVS;
+ stc_flash_tnvs_field_t TNVS_f;
+ };
+ union
+ {
+ __IO uint32_t TPGS;
+ stc_flash_tpgs_field_t TPGS_f;
+ };
+ union
+ {
+ __IO uint32_t TPROG;
+ stc_flash_tprog_field_t TPROG_f;
+ };
+ union
+ {
+ __IO uint32_t TSERASE;
+ stc_flash_tserase_field_t TSERASE_f;
+ };
+ union
+ {
+ __IO uint32_t TMERASE;
+ stc_flash_tmerase_field_t TMERASE_f;
+ };
+ union
+ {
+ __IO uint32_t TPRCV;
+ stc_flash_tprcv_field_t TPRCV_f;
+ };
+ union
+ {
+ __IO uint32_t TSRCV;
+ stc_flash_tsrcv_field_t TSRCV_f;
+ };
+ union
+ {
+ __IO uint32_t TMRCV;
+ stc_flash_tmrcv_field_t TMRCV_f;
+ };
+ union
+ {
+ __IO uint32_t CR;
+ stc_flash_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_flash_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_flash_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t BYPASS;
+ stc_flash_bypass_field_t BYPASS_f;
+ };
+ union
+ {
+ __IO uint32_t SLOCK;
+ stc_flash_slock_field_t SLOCK_f;
+ };
+}M0P_FLASH_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t PA00_SEL;
+ stc_gpio_pa00_sel_field_t PA00_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA01_SEL;
+ stc_gpio_pa01_sel_field_t PA01_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA02_SEL;
+ stc_gpio_pa02_sel_field_t PA02_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA03_SEL;
+ stc_gpio_pa03_sel_field_t PA03_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA04_SEL;
+ stc_gpio_pa04_sel_field_t PA04_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA05_SEL;
+ stc_gpio_pa05_sel_field_t PA05_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA06_SEL;
+ stc_gpio_pa06_sel_field_t PA06_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA07_SEL;
+ stc_gpio_pa07_sel_field_t PA07_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA08_SEL;
+ stc_gpio_pa08_sel_field_t PA08_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA09_SEL;
+ stc_gpio_pa09_sel_field_t PA09_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA10_SEL;
+ stc_gpio_pa10_sel_field_t PA10_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA11_SEL;
+ stc_gpio_pa11_sel_field_t PA11_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA12_SEL;
+ stc_gpio_pa12_sel_field_t PA12_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA13_SEL;
+ stc_gpio_pa13_sel_field_t PA13_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA14_SEL;
+ stc_gpio_pa14_sel_field_t PA14_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PA15_SEL;
+ stc_gpio_pa15_sel_field_t PA15_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB00_SEL;
+ stc_gpio_pb00_sel_field_t PB00_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB01_SEL;
+ stc_gpio_pb01_sel_field_t PB01_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB02_SEL;
+ stc_gpio_pb02_sel_field_t PB02_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB03_SEL;
+ stc_gpio_pb03_sel_field_t PB03_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB04_SEL;
+ stc_gpio_pb04_sel_field_t PB04_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB05_SEL;
+ stc_gpio_pb05_sel_field_t PB05_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB06_SEL;
+ stc_gpio_pb06_sel_field_t PB06_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB07_SEL;
+ stc_gpio_pb07_sel_field_t PB07_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB08_SEL;
+ stc_gpio_pb08_sel_field_t PB08_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB09_SEL;
+ stc_gpio_pb09_sel_field_t PB09_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB10_SEL;
+ stc_gpio_pb10_sel_field_t PB10_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB11_SEL;
+ stc_gpio_pb11_sel_field_t PB11_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB12_SEL;
+ stc_gpio_pb12_sel_field_t PB12_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB13_SEL;
+ stc_gpio_pb13_sel_field_t PB13_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB14_SEL;
+ stc_gpio_pb14_sel_field_t PB14_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PB15_SEL;
+ stc_gpio_pb15_sel_field_t PB15_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC00_SEL;
+ stc_gpio_pc00_sel_field_t PC00_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC01_SEL;
+ stc_gpio_pc01_sel_field_t PC01_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC02_SEL;
+ stc_gpio_pc02_sel_field_t PC02_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC03_SEL;
+ stc_gpio_pc03_sel_field_t PC03_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC04_SEL;
+ stc_gpio_pc04_sel_field_t PC04_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC05_SEL;
+ stc_gpio_pc05_sel_field_t PC05_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC06_SEL;
+ stc_gpio_pc06_sel_field_t PC06_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC07_SEL;
+ stc_gpio_pc07_sel_field_t PC07_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC08_SEL;
+ stc_gpio_pc08_sel_field_t PC08_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC09_SEL;
+ stc_gpio_pc09_sel_field_t PC09_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC10_SEL;
+ stc_gpio_pc10_sel_field_t PC10_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC11_SEL;
+ stc_gpio_pc11_sel_field_t PC11_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC12_SEL;
+ stc_gpio_pc12_sel_field_t PC12_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC13_SEL;
+ stc_gpio_pc13_sel_field_t PC13_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC14_SEL;
+ stc_gpio_pc14_sel_field_t PC14_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PC15_SEL;
+ stc_gpio_pc15_sel_field_t PC15_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD00_SEL;
+ stc_gpio_pd00_sel_field_t PD00_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD01_SEL;
+ stc_gpio_pd01_sel_field_t PD01_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD02_SEL;
+ stc_gpio_pd02_sel_field_t PD02_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD03_SEL;
+ stc_gpio_pd03_sel_field_t PD03_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD04_SEL;
+ stc_gpio_pd04_sel_field_t PD04_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD05_SEL;
+ stc_gpio_pd05_sel_field_t PD05_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD06_SEL;
+ stc_gpio_pd06_sel_field_t PD06_SEL_f;
+ };
+ union
+ {
+ __IO uint32_t PD07_SEL;
+ stc_gpio_pd07_sel_field_t PD07_SEL_f;
+ };
+ uint8_t RESERVED56[32];
+ union
+ {
+ __IO uint32_t PADIR;
+ stc_gpio_padir_field_t PADIR_f;
+ };
+ union
+ {
+ __IO uint32_t PAIN;
+ stc_gpio_pain_field_t PAIN_f;
+ };
+ union
+ {
+ __IO uint32_t PAOUT;
+ stc_gpio_paout_field_t PAOUT_f;
+ };
+ union
+ {
+ __IO uint32_t PAADS;
+ stc_gpio_paads_field_t PAADS_f;
+ };
+ union
+ {
+ __IO uint32_t PABSET;
+ stc_gpio_pabset_field_t PABSET_f;
+ };
+ union
+ {
+ __IO uint32_t PABCLR;
+ stc_gpio_pabclr_field_t PABCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PABSETCLR;
+ stc_gpio_pabsetclr_field_t PABSETCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PADR;
+ stc_gpio_padr_field_t PADR_f;
+ };
+ union
+ {
+ __IO uint32_t PAPU;
+ stc_gpio_papu_field_t PAPU_f;
+ };
+ union
+ {
+ __IO uint32_t PAPD;
+ stc_gpio_papd_field_t PAPD_f;
+ };
+ uint8_t RESERVED66[4];
+ union
+ {
+ __IO uint32_t PAOD;
+ stc_gpio_paod_field_t PAOD_f;
+ };
+ union
+ {
+ __IO uint32_t PAHIE;
+ stc_gpio_pahie_field_t PAHIE_f;
+ };
+ union
+ {
+ __IO uint32_t PALIE;
+ stc_gpio_palie_field_t PALIE_f;
+ };
+ union
+ {
+ __IO uint32_t PARIE;
+ stc_gpio_parie_field_t PARIE_f;
+ };
+ union
+ {
+ __IO uint32_t PAFIE;
+ stc_gpio_pafie_field_t PAFIE_f;
+ };
+ union
+ {
+ __IO uint32_t PBDIR;
+ stc_gpio_pbdir_field_t PBDIR_f;
+ };
+ union
+ {
+ __IO uint32_t PBIN;
+ stc_gpio_pbin_field_t PBIN_f;
+ };
+ union
+ {
+ __IO uint32_t PBOUT;
+ stc_gpio_pbout_field_t PBOUT_f;
+ };
+ union
+ {
+ __IO uint32_t PBADS;
+ stc_gpio_pbads_field_t PBADS_f;
+ };
+ union
+ {
+ __IO uint32_t PBBSET;
+ stc_gpio_pbbset_field_t PBBSET_f;
+ };
+ union
+ {
+ __IO uint32_t PBBCLR;
+ stc_gpio_pbbclr_field_t PBBCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PBBSETCLR;
+ stc_gpio_pbbsetclr_field_t PBBSETCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PBDR;
+ stc_gpio_pbdr_field_t PBDR_f;
+ };
+ union
+ {
+ __IO uint32_t PBPU;
+ stc_gpio_pbpu_field_t PBPU_f;
+ };
+ union
+ {
+ __IO uint32_t PBPD;
+ stc_gpio_pbpd_field_t PBPD_f;
+ };
+ uint8_t RESERVED81[4];
+ union
+ {
+ __IO uint32_t PBOD;
+ stc_gpio_pbod_field_t PBOD_f;
+ };
+ union
+ {
+ __IO uint32_t PBHIE;
+ stc_gpio_pbhie_field_t PBHIE_f;
+ };
+ union
+ {
+ __IO uint32_t PBLIE;
+ stc_gpio_pblie_field_t PBLIE_f;
+ };
+ union
+ {
+ __IO uint32_t PBRIE;
+ stc_gpio_pbrie_field_t PBRIE_f;
+ };
+ union
+ {
+ __IO uint32_t PBFIE;
+ stc_gpio_pbfie_field_t PBFIE_f;
+ };
+ union
+ {
+ __IO uint32_t PCDIR;
+ stc_gpio_pcdir_field_t PCDIR_f;
+ };
+ union
+ {
+ __IO uint32_t PCIN;
+ stc_gpio_pcin_field_t PCIN_f;
+ };
+ union
+ {
+ __IO uint32_t PCOUT;
+ stc_gpio_pcout_field_t PCOUT_f;
+ };
+ union
+ {
+ __IO uint32_t PCADS;
+ stc_gpio_pcads_field_t PCADS_f;
+ };
+ union
+ {
+ __IO uint32_t PCBSET;
+ stc_gpio_pcbset_field_t PCBSET_f;
+ };
+ union
+ {
+ __IO uint32_t PCBCLR;
+ stc_gpio_pcbclr_field_t PCBCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PCBSETCLR;
+ stc_gpio_pcbsetclr_field_t PCBSETCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PCDR;
+ stc_gpio_pcdr_field_t PCDR_f;
+ };
+ union
+ {
+ __IO uint32_t PCPU;
+ stc_gpio_pcpu_field_t PCPU_f;
+ };
+ union
+ {
+ __IO uint32_t PCPD;
+ stc_gpio_pcpd_field_t PCPD_f;
+ };
+ uint8_t RESERVED96[4];
+ union
+ {
+ __IO uint32_t PCOD;
+ stc_gpio_pcod_field_t PCOD_f;
+ };
+ union
+ {
+ __IO uint32_t PCHIE;
+ stc_gpio_pchie_field_t PCHIE_f;
+ };
+ union
+ {
+ __IO uint32_t PCLIE;
+ stc_gpio_pclie_field_t PCLIE_f;
+ };
+ union
+ {
+ __IO uint32_t PCRIE;
+ stc_gpio_pcrie_field_t PCRIE_f;
+ };
+ union
+ {
+ __IO uint32_t PCFIE;
+ stc_gpio_pcfie_field_t PCFIE_f;
+ };
+ union
+ {
+ __IO uint32_t PDDIR;
+ stc_gpio_pddir_field_t PDDIR_f;
+ };
+ union
+ {
+ __IO uint32_t PDIN;
+ stc_gpio_pdin_field_t PDIN_f;
+ };
+ union
+ {
+ __IO uint32_t PDOUT;
+ stc_gpio_pdout_field_t PDOUT_f;
+ };
+ union
+ {
+ __IO uint32_t PDADS;
+ stc_gpio_pdads_field_t PDADS_f;
+ };
+ union
+ {
+ __IO uint32_t PDBSET;
+ stc_gpio_pdbset_field_t PDBSET_f;
+ };
+ union
+ {
+ __IO uint32_t PDBCLR;
+ stc_gpio_pdbclr_field_t PDBCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PDBSETCLR;
+ stc_gpio_pdbsetclr_field_t PDBSETCLR_f;
+ };
+ union
+ {
+ __IO uint32_t PDDR;
+ stc_gpio_pddr_field_t PDDR_f;
+ };
+ union
+ {
+ __IO uint32_t PDPU;
+ stc_gpio_pdpu_field_t PDPU_f;
+ };
+ union
+ {
+ __IO uint32_t PDPD;
+ stc_gpio_pdpd_field_t PDPD_f;
+ };
+ uint8_t RESERVED111[4];
+ union
+ {
+ __IO uint32_t PDOD;
+ stc_gpio_pdod_field_t PDOD_f;
+ };
+ union
+ {
+ __IO uint32_t PDHIE;
+ stc_gpio_pdhie_field_t PDHIE_f;
+ };
+ union
+ {
+ __IO uint32_t PDLIE;
+ stc_gpio_pdlie_field_t PDLIE_f;
+ };
+ union
+ {
+ __IO uint32_t PDRIE;
+ stc_gpio_pdrie_field_t PDRIE_f;
+ };
+ union
+ {
+ __IO uint32_t PDFIE;
+ stc_gpio_pdfie_field_t PDFIE_f;
+ };
+ union
+ {
+ __IO uint32_t PA_STAT;
+ stc_gpio_pa_stat_field_t PA_STAT_f;
+ };
+ uint8_t RESERVED117[12];
+ union
+ {
+ __IO uint32_t PA_ICLR;
+ stc_gpio_pa_iclr_field_t PA_ICLR_f;
+ };
+ uint8_t RESERVED118[44];
+ union
+ {
+ __IO uint32_t PB_STAT;
+ stc_gpio_pb_stat_field_t PB_STAT_f;
+ };
+ uint8_t RESERVED119[12];
+ union
+ {
+ __IO uint32_t PB_ICLR;
+ stc_gpio_pb_iclr_field_t PB_ICLR_f;
+ };
+ uint8_t RESERVED120[44];
+ union
+ {
+ __IO uint32_t PC_STAT;
+ stc_gpio_pc_stat_field_t PC_STAT_f;
+ };
+ uint8_t RESERVED121[12];
+ union
+ {
+ __IO uint32_t PC_ICLR;
+ stc_gpio_pc_iclr_field_t PC_ICLR_f;
+ };
+ uint8_t RESERVED122[44];
+ union
+ {
+ __IO uint32_t PD_STAT;
+ stc_gpio_pd_stat_field_t PD_STAT_f;
+ };
+ uint8_t RESERVED123[12];
+ union
+ {
+ __IO uint32_t PD_ICLR;
+ stc_gpio_pd_iclr_field_t PD_ICLR_f;
+ };
+ uint8_t RESERVED124[44];
+ union
+ {
+ __IO uint32_t CTRL0;
+ stc_gpio_ctrl0_field_t CTRL0_f;
+ };
+ union
+ {
+ __IO uint32_t CTRL1;
+ stc_gpio_ctrl1_field_t CTRL1_f;
+ };
+ union
+ {
+ __IO uint32_t CTRL2;
+ stc_gpio_ctrl2_field_t CTRL2_f;
+ };
+ union
+ {
+ __IO uint32_t TIMGS;
+ stc_gpio_timgs_field_t TIMGS_f;
+ };
+ union
+ {
+ __IO uint32_t TIMES;
+ stc_gpio_times_field_t TIMES_f;
+ };
+ union
+ {
+ __IO uint32_t TIMCPS;
+ stc_gpio_timcps_field_t TIMCPS_f;
+ };
+ union
+ {
+ __IO uint32_t PCAS;
+ stc_gpio_pcas_field_t PCAS_f;
+ };
+}M0P_GPIO_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t DIVIDEND;
+ stc_hdiv_dividend_field_t DIVIDEND_f;
+ };
+ union
+ {
+ __IO uint32_t DIVISOR;
+ stc_hdiv_divisor_field_t DIVISOR_f;
+ };
+ union
+ {
+ __IO uint32_t QUOTIENT;
+ stc_hdiv_quotient_field_t QUOTIENT_f;
+ };
+ union
+ {
+ __IO uint32_t REMAINDER;
+ stc_hdiv_remainder_field_t REMAINDER_f;
+ };
+ union
+ {
+ __IO uint32_t SIGN;
+ stc_hdiv_sign_field_t SIGN_f;
+ };
+ union
+ {
+ __IO uint32_t STAT;
+ stc_hdiv_stat_field_t STAT_f;
+ };
+}M0P_HDIV_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t TMRUN;
+ stc_i2c_tmrun_field_t TMRUN_f;
+ };
+ union
+ {
+ __IO uint32_t TM;
+ stc_i2c_tm_field_t TM_f;
+ };
+ union
+ {
+ __IO uint32_t CR;
+ stc_i2c_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t DATA;
+ stc_i2c_data_field_t DATA_f;
+ };
+ union
+ {
+ __IO uint32_t ADDR;
+ stc_i2c_addr_field_t ADDR_f;
+ };
+ union
+ {
+ __IO uint32_t STAT;
+ stc_i2c_stat_field_t STAT_f;
+ };
+}M0P_I2C_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR0;
+ stc_lcd_cr0_field_t CR0_f;
+ };
+ union
+ {
+ __IO uint32_t CR1;
+ stc_lcd_cr1_field_t CR1_f;
+ };
+ union
+ {
+ __IO uint32_t INTCLR;
+ stc_lcd_intclr_field_t INTCLR_f;
+ };
+ union
+ {
+ __IO uint32_t POEN0;
+ stc_lcd_poen0_field_t POEN0_f;
+ };
+ union
+ {
+ __IO uint32_t POEN1;
+ stc_lcd_poen1_field_t POEN1_f;
+ };
+ uint8_t RESERVED5[44];
+ union
+ {
+ __IO uint32_t RAM0;
+ stc_lcd_ram0_field_t RAM0_f;
+ };
+ union
+ {
+ __IO uint32_t RAM1;
+ stc_lcd_ram1_field_t RAM1_f;
+ };
+ union
+ {
+ __IO uint32_t RAM2;
+ stc_lcd_ram2_field_t RAM2_f;
+ };
+ union
+ {
+ __IO uint32_t RAM3;
+ stc_lcd_ram3_field_t RAM3_f;
+ };
+ union
+ {
+ __IO uint32_t RAM4;
+ stc_lcd_ram4_field_t RAM4_f;
+ };
+ union
+ {
+ __IO uint32_t RAM5;
+ stc_lcd_ram5_field_t RAM5_f;
+ };
+ union
+ {
+ __IO uint32_t RAM6;
+ stc_lcd_ram6_field_t RAM6_f;
+ };
+ union
+ {
+ __IO uint32_t RAM7;
+ stc_lcd_ram7_field_t RAM7_f;
+ };
+ union
+ {
+ __IO uint32_t RAM8;
+ stc_lcd_ram8_field_t RAM8_f;
+ };
+ union
+ {
+ __IO uint32_t RAM9;
+ stc_lcd_ram9_field_t RAM9_f;
+ };
+ union
+ {
+ __IO uint32_t RAMA;
+ stc_lcd_rama_field_t RAMA_f;
+ };
+ union
+ {
+ __IO uint32_t RAMB;
+ stc_lcd_ramb_field_t RAMB_f;
+ };
+ union
+ {
+ __IO uint32_t RAMC;
+ stc_lcd_ramc_field_t RAMC_f;
+ };
+ union
+ {
+ __IO uint32_t RAMD;
+ stc_lcd_ramd_field_t RAMD_f;
+ };
+ union
+ {
+ __IO uint32_t RAME;
+ stc_lcd_rame_field_t RAME_f;
+ };
+ union
+ {
+ __IO uint32_t RAMF;
+ stc_lcd_ramf_field_t RAMF_f;
+ };
+}M0P_LCD_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CNT;
+ stc_lptimer_cnt_field_t CNT_f;
+ };
+ union
+ {
+ __IO uint32_t ARR;
+ stc_lptimer_arr_field_t ARR_f;
+ };
+ uint8_t RESERVED2[4];
+ union
+ {
+ __IO uint32_t CR;
+ stc_lptimer_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_lptimer_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_lptimer_iclr_field_t ICLR_f;
+ };
+}M0P_LPTIMER_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t SBUF;
+ stc_lpuart_sbuf_field_t SBUF_f;
+ };
+ union
+ {
+ __IO uint32_t SCON;
+ stc_lpuart_scon_field_t SCON_f;
+ };
+ union
+ {
+ __IO uint32_t SADDR;
+ stc_lpuart_saddr_field_t SADDR_f;
+ };
+ union
+ {
+ __IO uint32_t SADEN;
+ stc_lpuart_saden_field_t SADEN_f;
+ };
+ union
+ {
+ __IO uint32_t ISR;
+ stc_lpuart_isr_field_t ISR_f;
+ };
+ union
+ {
+ __IO uint32_t ICR;
+ stc_lpuart_icr_field_t ICR_f;
+ };
+ union
+ {
+ __IO uint32_t SCNT;
+ stc_lpuart_scnt_field_t SCNT_f;
+ };
+}M0P_LPUART_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[40];
+ union
+ {
+ __IO uint32_t CR;
+ stc_lvd_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_lvd_ifr_field_t IFR_f;
+ };
+}M0P_LVD_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[48];
+ union
+ {
+ __IO uint32_t CR0;
+ stc_opa_cr0_field_t CR0_f;
+ };
+ union
+ {
+ __IO uint32_t CR1;
+ stc_opa_cr1_field_t CR1_f;
+ };
+ union
+ {
+ __IO uint32_t CR2;
+ stc_opa_cr2_field_t CR2_f;
+ };
+ union
+ {
+ __IO uint8_t CR;
+ stc_opa_cr_field_t CR_f;
+ };
+}M0P_OPA_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CCON;
+ stc_pca_ccon_field_t CCON_f;
+ };
+ union
+ {
+ __IO uint32_t CMOD;
+ stc_pca_cmod_field_t CMOD_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_pca_cnt_field_t CNT_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_pca_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t CCAPM0;
+ stc_pca_ccapm0_field_t CCAPM0_f;
+ };
+ union
+ {
+ __IO uint32_t CCAPM1;
+ stc_pca_ccapm1_field_t CCAPM1_f;
+ };
+ union
+ {
+ __IO uint32_t CCAPM2;
+ stc_pca_ccapm2_field_t CCAPM2_f;
+ };
+ union
+ {
+ __IO uint32_t CCAPM3;
+ stc_pca_ccapm3_field_t CCAPM3_f;
+ };
+ union
+ {
+ __IO uint32_t CCAPM4;
+ stc_pca_ccapm4_field_t CCAPM4_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP0H;
+ stc_pca_ccap0h_field_t CCAP0H_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP0L;
+ stc_pca_ccap0l_field_t CCAP0L_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP1H;
+ stc_pca_ccap1h_field_t CCAP1H_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP1L;
+ stc_pca_ccap1l_field_t CCAP1L_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP2H;
+ stc_pca_ccap2h_field_t CCAP2H_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP2L;
+ stc_pca_ccap2l_field_t CCAP2L_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP3H;
+ stc_pca_ccap3h_field_t CCAP3H_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP3L;
+ stc_pca_ccap3l_field_t CCAP3L_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP4H;
+ stc_pca_ccap4h_field_t CCAP4H_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP4L;
+ stc_pca_ccap4l_field_t CCAP4L_f;
+ };
+ union
+ {
+ __IO uint32_t CCAPO;
+ stc_pca_ccapo_field_t CCAPO_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP0;
+ stc_pca_ccap0_field_t CCAP0_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP1;
+ stc_pca_ccap1_field_t CCAP1_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP2;
+ stc_pca_ccap2_field_t CCAP2_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP3;
+ stc_pca_ccap3_field_t CCAP3_f;
+ };
+ union
+ {
+ __IO uint32_t CCAP4;
+ stc_pca_ccap4_field_t CCAP4_f;
+ };
+ union
+ {
+ __IO uint32_t CARR;
+ stc_pca_carr_field_t CARR_f;
+ };
+ union
+ {
+ __IO uint32_t EPWM;
+ stc_pca_epwm_field_t EPWM_f;
+ };
+}M0P_PCA_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint8_t RUN;
+ stc_pcnt_run_field_t RUN_f;
+ };
+ uint8_t RESERVED1[3];
+ union
+ {
+ __IO uint8_t CR;
+ stc_pcnt_cr_field_t CR_f;
+ };
+ uint8_t RESERVED2[3];
+ union
+ {
+ __IO uint32_t FLT;
+ stc_pcnt_flt_field_t FLT_f;
+ };
+ union
+ {
+ __IO uint32_t TOCR;
+ stc_pcnt_tocr_field_t TOCR_f;
+ };
+ union
+ {
+ __IO uint8_t CMD;
+ stc_pcnt_cmd_field_t CMD_f;
+ };
+ uint8_t RESERVED5[3];
+ union
+ {
+ __IO uint8_t SR1;
+ stc_pcnt_sr1_field_t SR1_f;
+ };
+ uint8_t RESERVED6[3];
+ union
+ {
+ __IO uint16_t CNT;
+ stc_pcnt_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED7[2];
+ union
+ {
+ __IO uint16_t TOP;
+ stc_pcnt_top_field_t TOP_f;
+ };
+ uint8_t RESERVED8[2];
+ union
+ {
+ __IO uint16_t BUF;
+ stc_pcnt_buf_field_t BUF_f;
+ };
+ uint8_t RESERVED9[2];
+ union
+ {
+ __IO uint8_t IFR;
+ stc_pcnt_ifr_field_t IFR_f;
+ };
+ uint8_t RESERVED10[3];
+ union
+ {
+ __IO uint8_t ICR;
+ stc_pcnt_icr_field_t ICR_f;
+ };
+ uint8_t RESERVED11[3];
+ union
+ {
+ __IO uint8_t IEN;
+ stc_pcnt_ien_field_t IEN_f;
+ };
+ uint8_t RESERVED12[3];
+ union
+ {
+ __IO uint8_t SR2;
+ stc_pcnt_sr2_field_t SR2_f;
+ };
+}M0P_PCNT_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_ram_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t ERRADDR;
+ stc_ram_erraddr_field_t ERRADDR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_ram_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_ram_iclr_field_t ICLR_f;
+ };
+}M0P_RAM_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t RESET_FLAG;
+ stc_reset_flag_field_t RESET_FLAG_f;
+ };
+ uint8_t RESERVED1[8];
+ union
+ {
+ __IO uint32_t PREI_RESET;
+ stc_reset_prei_field_t PREI_RESET_f;
+ };
+}M0P_RESET_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_rng_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t MODE;
+ stc_rng_mode_field_t MODE_f;
+ };
+ uint8_t RESERVED2[4];
+ union
+ {
+ __IO uint32_t DATA0;
+ stc_rng_data0_field_t DATA0_f;
+ };
+ union
+ {
+ __IO uint32_t DATA1;
+ stc_rng_data1_field_t DATA1_f;
+ };
+}M0P_RNG_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR0;
+ stc_rtc_cr0_field_t CR0_f;
+ };
+ union
+ {
+ __IO uint32_t CR1;
+ stc_rtc_cr1_field_t CR1_f;
+ };
+ union
+ {
+ __IO uint32_t SEC;
+ stc_rtc_sec_field_t SEC_f;
+ };
+ union
+ {
+ __IO uint32_t MIN;
+ stc_rtc_min_field_t MIN_f;
+ };
+ union
+ {
+ __IO uint32_t HOUR;
+ stc_rtc_hour_field_t HOUR_f;
+ };
+ union
+ {
+ __IO uint32_t WEEK;
+ stc_rtc_week_field_t WEEK_f;
+ };
+ union
+ {
+ __IO uint32_t DAY;
+ stc_rtc_day_field_t DAY_f;
+ };
+ union
+ {
+ __IO uint32_t MON;
+ stc_rtc_mon_field_t MON_f;
+ };
+ union
+ {
+ __IO uint32_t YEAR;
+ stc_rtc_year_field_t YEAR_f;
+ };
+ union
+ {
+ __IO uint32_t ALMMIN;
+ stc_rtc_almmin_field_t ALMMIN_f;
+ };
+ union
+ {
+ __IO uint32_t ALMHOUR;
+ stc_rtc_almhour_field_t ALMHOUR_f;
+ };
+ union
+ {
+ __IO uint32_t ALMWEEK;
+ stc_rtc_almweek_field_t ALMWEEK_f;
+ };
+ union
+ {
+ __IO uint32_t COMPEN;
+ stc_rtc_compen_field_t COMPEN_f;
+ };
+}M0P_RTC_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CR;
+ stc_spi_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t SSN;
+ stc_spi_ssn_field_t SSN_f;
+ };
+ union
+ {
+ __IO uint32_t STAT;
+ stc_spi_stat_field_t STAT_f;
+ };
+ union
+ {
+ __IO uint32_t DATA;
+ stc_spi_data_field_t DATA_f;
+ };
+ union
+ {
+ __IO uint32_t CR2;
+ stc_spi_cr2_field_t CR2_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_spi_iclr_field_t ICLR_f;
+ };
+}M0P_SPI_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t SYSCTRL0;
+ stc_sysctrl_sysctrl0_field_t SYSCTRL0_f;
+ };
+ union
+ {
+ __IO uint32_t SYSCTRL1;
+ stc_sysctrl_sysctrl1_field_t SYSCTRL1_f;
+ };
+ union
+ {
+ __IO uint32_t SYSCTRL2;
+ stc_sysctrl_sysctrl2_field_t SYSCTRL2_f;
+ };
+ union
+ {
+ __IO uint32_t RCH_CR;
+ stc_sysctrl_rch_cr_field_t RCH_CR_f;
+ };
+ union
+ {
+ __IO uint32_t XTH_CR;
+ stc_sysctrl_xth_cr_field_t XTH_CR_f;
+ };
+ union
+ {
+ __IO uint32_t RCL_CR;
+ stc_sysctrl_rcl_cr_field_t RCL_CR_f;
+ };
+ union
+ {
+ __IO uint32_t XTL_CR;
+ stc_sysctrl_xtl_cr_field_t XTL_CR_f;
+ };
+ uint8_t RESERVED7[4];
+ union
+ {
+ __IO uint32_t PERI_CLKEN;
+ stc_sysctrl_peri_clken_field_t PERI_CLKEN_f;
+ };
+ uint8_t RESERVED8[24];
+ union
+ {
+ __IO uint32_t PLL_CR;
+ stc_sysctrl_pll_cr_field_t PLL_CR_f;
+ };
+}M0P_SYSCTRL_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim0_mode0_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim0_mode0_cnt_field_t CNT_f;
+ };
+ union
+ {
+ __IO uint32_t CNT32;
+ stc_tim0_mode0_cnt32_field_t CNT32_f;
+ };
+ union
+ {
+ __IO uint32_t M0CR;
+ stc_tim0_mode0_m0cr_field_t M0CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim0_mode0_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim0_mode0_iclr_field_t ICLR_f;
+ };
+ uint8_t RESERVED6[24];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim0_mode0_dtr_field_t DTR_f;
+ };
+}M0P_TIM0_MODE0_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[4];
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim0_mode1_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED1[4];
+ union
+ {
+ __IO uint32_t M1CR;
+ stc_tim0_mode1_m1cr_field_t M1CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim0_mode1_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim0_mode1_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim0_mode1_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim0_mode1_fltr_field_t FLTR_f;
+ };
+ uint8_t RESERVED6[4];
+ union
+ {
+ __IO uint32_t CR0;
+ stc_tim0_mode1_cr0_field_t CR0_f;
+ };
+ uint8_t RESERVED7[20];
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim0_mode1_ccr0a_field_t CCR0A_f;
+ };
+}M0P_TIM0_MODE1_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim0_mode23_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim0_mode23_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED2[4];
+ union
+ {
+ __IO uint32_t M23CR;
+ stc_tim0_mode23_m23cr_field_t M23CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim0_mode23_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim0_mode23_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim0_mode23_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim0_mode23_fltr_field_t FLTR_f;
+ };
+ union
+ {
+ __IO uint32_t ADTR;
+ stc_tim0_mode23_adtr_field_t ADTR_f;
+ };
+ union
+ {
+ __IO uint32_t CRCH0;
+ stc_tim0_mode23_crch0_field_t CRCH0_f;
+ };
+ uint8_t RESERVED9[8];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim0_mode23_dtr_field_t DTR_f;
+ };
+ union
+ {
+ __IO uint32_t RCR;
+ stc_tim0_mode23_rcr_field_t RCR_f;
+ };
+ union
+ {
+ __IO uint32_t ARRDM;
+ stc_tim0_mode23_arrdm_field_t ARRDM_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim0_mode23_ccr0a_field_t CCR0A_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0B;
+ stc_tim0_mode23_ccr0b_field_t CCR0B_f;
+ };
+}M0P_TIM0_MODE23_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim1_mode0_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim1_mode0_cnt_field_t CNT_f;
+ };
+ union
+ {
+ __IO uint32_t CNT32;
+ stc_tim1_mode0_cnt32_field_t CNT32_f;
+ };
+ union
+ {
+ __IO uint32_t M0CR;
+ stc_tim1_mode0_m0cr_field_t M0CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim1_mode0_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim1_mode0_iclr_field_t ICLR_f;
+ };
+ uint8_t RESERVED6[24];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim1_mode0_dtr_field_t DTR_f;
+ };
+}M0P_TIM1_MODE0_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[4];
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim1_mode1_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED1[4];
+ union
+ {
+ __IO uint32_t M1CR;
+ stc_tim1_mode1_m1cr_field_t M1CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim1_mode1_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim1_mode1_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim1_mode1_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim1_mode1_fltr_field_t FLTR_f;
+ };
+ uint8_t RESERVED6[4];
+ union
+ {
+ __IO uint32_t CR0;
+ stc_tim1_mode1_cr0_field_t CR0_f;
+ };
+ uint8_t RESERVED7[20];
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim1_mode1_ccr0a_field_t CCR0A_f;
+ };
+}M0P_TIM1_MODE1_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim1_mode23_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim1_mode23_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED2[4];
+ union
+ {
+ __IO uint32_t M23CR;
+ stc_tim1_mode23_m23cr_field_t M23CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim1_mode23_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim1_mode23_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim1_mode23_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim1_mode23_fltr_field_t FLTR_f;
+ };
+ union
+ {
+ __IO uint32_t ADTR;
+ stc_tim1_mode23_adtr_field_t ADTR_f;
+ };
+ union
+ {
+ __IO uint32_t CRCH0;
+ stc_tim1_mode23_crch0_field_t CRCH0_f;
+ };
+ uint8_t RESERVED9[8];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim1_mode23_dtr_field_t DTR_f;
+ };
+ union
+ {
+ __IO uint32_t RCR;
+ stc_tim1_mode23_rcr_field_t RCR_f;
+ };
+ union
+ {
+ __IO uint32_t ARRDM;
+ stc_tim1_mode23_arrdm_field_t ARRDM_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim1_mode23_ccr0a_field_t CCR0A_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0B;
+ stc_tim1_mode23_ccr0b_field_t CCR0B_f;
+ };
+}M0P_TIM1_MODE23_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim2_mode0_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim2_mode0_cnt_field_t CNT_f;
+ };
+ union
+ {
+ __IO uint32_t CNT32;
+ stc_tim2_mode0_cnt32_field_t CNT32_f;
+ };
+ union
+ {
+ __IO uint32_t M0CR;
+ stc_tim2_mode0_m0cr_field_t M0CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim2_mode0_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim2_mode0_iclr_field_t ICLR_f;
+ };
+ uint8_t RESERVED6[24];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim2_mode0_dtr_field_t DTR_f;
+ };
+}M0P_TIM2_MODE0_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[4];
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim2_mode1_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED1[4];
+ union
+ {
+ __IO uint32_t M1CR;
+ stc_tim2_mode1_m1cr_field_t M1CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim2_mode1_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim2_mode1_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim2_mode1_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim2_mode1_fltr_field_t FLTR_f;
+ };
+ uint8_t RESERVED6[4];
+ union
+ {
+ __IO uint32_t CR0;
+ stc_tim2_mode1_cr0_field_t CR0_f;
+ };
+ uint8_t RESERVED7[20];
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim2_mode1_ccr0a_field_t CCR0A_f;
+ };
+}M0P_TIM2_MODE1_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim2_mode23_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim2_mode23_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED2[4];
+ union
+ {
+ __IO uint32_t M23CR;
+ stc_tim2_mode23_m23cr_field_t M23CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim2_mode23_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim2_mode23_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim2_mode23_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim2_mode23_fltr_field_t FLTR_f;
+ };
+ union
+ {
+ __IO uint32_t ADTR;
+ stc_tim2_mode23_adtr_field_t ADTR_f;
+ };
+ union
+ {
+ __IO uint32_t CRCH0;
+ stc_tim2_mode23_crch0_field_t CRCH0_f;
+ };
+ uint8_t RESERVED9[8];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim2_mode23_dtr_field_t DTR_f;
+ };
+ union
+ {
+ __IO uint32_t RCR;
+ stc_tim2_mode23_rcr_field_t RCR_f;
+ };
+ union
+ {
+ __IO uint32_t ARRDM;
+ stc_tim2_mode23_arrdm_field_t ARRDM_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim2_mode23_ccr0a_field_t CCR0A_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0B;
+ stc_tim2_mode23_ccr0b_field_t CCR0B_f;
+ };
+}M0P_TIM2_MODE23_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim3_mode0_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim3_mode0_cnt_field_t CNT_f;
+ };
+ union
+ {
+ __IO uint32_t CNT32;
+ stc_tim3_mode0_cnt32_field_t CNT32_f;
+ };
+ union
+ {
+ __IO uint32_t M0CR;
+ stc_tim3_mode0_m0cr_field_t M0CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim3_mode0_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim3_mode0_iclr_field_t ICLR_f;
+ };
+ uint8_t RESERVED6[24];
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim3_mode0_dtr_field_t DTR_f;
+ };
+}M0P_TIM3_MODE0_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[4];
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim3_mode1_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED1[4];
+ union
+ {
+ __IO uint32_t M1CR;
+ stc_tim3_mode1_m1cr_field_t M1CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim3_mode1_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim3_mode1_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim3_mode1_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim3_mode1_fltr_field_t FLTR_f;
+ };
+ uint8_t RESERVED6[4];
+ union
+ {
+ __IO uint32_t CR0;
+ stc_tim3_mode1_cr0_field_t CR0_f;
+ };
+ uint8_t RESERVED7[20];
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim3_mode1_ccr0a_field_t CCR0A_f;
+ };
+}M0P_TIM3_MODE1_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t ARR;
+ stc_tim3_mode23_arr_field_t ARR_f;
+ };
+ union
+ {
+ __IO uint32_t CNT;
+ stc_tim3_mode23_cnt_field_t CNT_f;
+ };
+ uint8_t RESERVED2[4];
+ union
+ {
+ __IO uint32_t M23CR;
+ stc_tim3_mode23_m23cr_field_t M23CR_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim3_mode23_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim3_mode23_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t MSCR;
+ stc_tim3_mode23_mscr_field_t MSCR_f;
+ };
+ union
+ {
+ __IO uint32_t FLTR;
+ stc_tim3_mode23_fltr_field_t FLTR_f;
+ };
+ union
+ {
+ __IO uint32_t ADTR;
+ stc_tim3_mode23_adtr_field_t ADTR_f;
+ };
+ union
+ {
+ __IO uint32_t CRCH0;
+ stc_tim3_mode23_crch0_field_t CRCH0_f;
+ };
+ union
+ {
+ __IO uint32_t CRCH1;
+ stc_tim3_mode23_crch1_field_t CRCH1_f;
+ };
+ union
+ {
+ __IO uint32_t CRCH2;
+ stc_tim3_mode23_crch2_field_t CRCH2_f;
+ };
+ union
+ {
+ __IO uint32_t DTR;
+ stc_tim3_mode23_dtr_field_t DTR_f;
+ };
+ union
+ {
+ __IO uint32_t RCR;
+ stc_tim3_mode23_rcr_field_t RCR_f;
+ };
+ union
+ {
+ __IO uint32_t ARRDM;
+ stc_tim3_mode23_arrdm_field_t ARRDM_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0A;
+ stc_tim3_mode23_ccr0a_field_t CCR0A_f;
+ };
+ union
+ {
+ __IO uint32_t CCR0B;
+ stc_tim3_mode23_ccr0b_field_t CCR0B_f;
+ };
+ union
+ {
+ __IO uint32_t CCR1A;
+ stc_tim3_mode23_ccr1a_field_t CCR1A_f;
+ };
+ union
+ {
+ __IO uint32_t CCR1B;
+ stc_tim3_mode23_ccr1b_field_t CCR1B_f;
+ };
+ union
+ {
+ __IO uint32_t CCR2A;
+ stc_tim3_mode23_ccr2a_field_t CCR2A_f;
+ };
+ union
+ {
+ __IO uint32_t CCR2B;
+ stc_tim3_mode23_ccr2b_field_t CCR2B_f;
+ };
+}M0P_TIM3_MODE23_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CNTER;
+ stc_tim4_cnter_field_t CNTER_f;
+ };
+ union
+ {
+ __IO uint32_t PERAR;
+ stc_tim4_perar_field_t PERAR_f;
+ };
+ union
+ {
+ __IO uint32_t PERBR;
+ stc_tim4_perbr_field_t PERBR_f;
+ };
+ uint8_t RESERVED3[4];
+ union
+ {
+ __IO uint32_t GCMAR;
+ stc_tim4_gcmar_field_t GCMAR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMBR;
+ stc_tim4_gcmbr_field_t GCMBR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMCR;
+ stc_tim4_gcmcr_field_t GCMCR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMDR;
+ stc_tim4_gcmdr_field_t GCMDR_f;
+ };
+ uint8_t RESERVED7[8];
+ union
+ {
+ __IO uint32_t SCMAR;
+ stc_tim4_scmar_field_t SCMAR_f;
+ };
+ union
+ {
+ __IO uint32_t SCMBR;
+ stc_tim4_scmbr_field_t SCMBR_f;
+ };
+ uint8_t RESERVED9[16];
+ union
+ {
+ __IO uint32_t DTUAR;
+ stc_tim4_dtuar_field_t DTUAR_f;
+ };
+ union
+ {
+ __IO uint32_t DTDAR;
+ stc_tim4_dtdar_field_t DTDAR_f;
+ };
+ uint8_t RESERVED11[8];
+ union
+ {
+ __IO uint32_t GCONR;
+ stc_tim4_gconr_field_t GCONR_f;
+ };
+ union
+ {
+ __IO uint32_t ICONR;
+ stc_tim4_iconr_field_t ICONR_f;
+ };
+ union
+ {
+ __IO uint32_t PCONR;
+ stc_tim4_pconr_field_t PCONR_f;
+ };
+ union
+ {
+ __IO uint32_t BCONR;
+ stc_tim4_bconr_field_t BCONR_f;
+ };
+ union
+ {
+ __IO uint32_t DCONR;
+ stc_tim4_dconr_field_t DCONR_f;
+ };
+ uint8_t RESERVED16[4];
+ union
+ {
+ __IO uint32_t FCONR;
+ stc_tim4_fconr_field_t FCONR_f;
+ };
+ union
+ {
+ __IO uint32_t VPERR;
+ stc_tim4_vperr_field_t VPERR_f;
+ };
+ union
+ {
+ __IO uint32_t STFLR;
+ stc_tim4_stflr_field_t STFLR_f;
+ };
+ union
+ {
+ __IO uint32_t HSTAR;
+ stc_tim4_hstar_field_t HSTAR_f;
+ };
+ union
+ {
+ __IO uint32_t HSTPR;
+ stc_tim4_hstpr_field_t HSTPR_f;
+ };
+ union
+ {
+ __IO uint32_t HCELR;
+ stc_tim4_hcelr_field_t HCELR_f;
+ };
+ union
+ {
+ __IO uint32_t HCPAR;
+ stc_tim4_hcpar_field_t HCPAR_f;
+ };
+ union
+ {
+ __IO uint32_t HCPBR;
+ stc_tim4_hcpbr_field_t HCPBR_f;
+ };
+ union
+ {
+ __IO uint32_t HCUPR;
+ stc_tim4_hcupr_field_t HCUPR_f;
+ };
+ union
+ {
+ __IO uint32_t HCDOR;
+ stc_tim4_hcdor_field_t HCDOR_f;
+ };
+ uint8_t RESERVED26[112];
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim4_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim4_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t CR;
+ stc_tim4_cr_field_t CR_f;
+ };
+ uint8_t RESERVED29[4];
+ union
+ {
+ __IO uint32_t AOSSR;
+ stc_tim4_aossr_field_t AOSSR_f;
+ };
+ union
+ {
+ __IO uint32_t AOSCL;
+ stc_tim4_aoscl_field_t AOSCL_f;
+ };
+ union
+ {
+ __IO uint32_t PTBKS;
+ stc_tim4_ptbks_field_t PTBKS_f;
+ };
+ union
+ {
+ __IO uint32_t TTRIG;
+ stc_tim4_ttrig_field_t TTRIG_f;
+ };
+ union
+ {
+ __IO uint32_t ITRIG;
+ stc_tim4_itrig_field_t ITRIG_f;
+ };
+ union
+ {
+ __IO uint32_t PTBKP;
+ stc_tim4_ptbkp_field_t PTBKP_f;
+ };
+ uint8_t RESERVED35[716];
+ union
+ {
+ __IO uint32_t SSTAR;
+ stc_tim4_sstar_field_t SSTAR_f;
+ };
+ union
+ {
+ __IO uint32_t SSTPR;
+ stc_tim4_sstpr_field_t SSTPR_f;
+ };
+ union
+ {
+ __IO uint32_t SCLRR;
+ stc_tim4_sclrr_field_t SCLRR_f;
+ };
+}M0P_TIM4_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CNTER;
+ stc_tim5_cnter_field_t CNTER_f;
+ };
+ union
+ {
+ __IO uint32_t PERAR;
+ stc_tim5_perar_field_t PERAR_f;
+ };
+ union
+ {
+ __IO uint32_t PERBR;
+ stc_tim5_perbr_field_t PERBR_f;
+ };
+ uint8_t RESERVED3[4];
+ union
+ {
+ __IO uint32_t GCMAR;
+ stc_tim5_gcmar_field_t GCMAR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMBR;
+ stc_tim5_gcmbr_field_t GCMBR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMCR;
+ stc_tim5_gcmcr_field_t GCMCR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMDR;
+ stc_tim5_gcmdr_field_t GCMDR_f;
+ };
+ uint8_t RESERVED7[8];
+ union
+ {
+ __IO uint32_t SCMAR;
+ stc_tim5_scmar_field_t SCMAR_f;
+ };
+ union
+ {
+ __IO uint32_t SCMBR;
+ stc_tim5_scmbr_field_t SCMBR_f;
+ };
+ uint8_t RESERVED9[16];
+ union
+ {
+ __IO uint32_t DTUAR;
+ stc_tim5_dtuar_field_t DTUAR_f;
+ };
+ union
+ {
+ __IO uint32_t DTDAR;
+ stc_tim5_dtdar_field_t DTDAR_f;
+ };
+ uint8_t RESERVED11[8];
+ union
+ {
+ __IO uint32_t GCONR;
+ stc_tim5_gconr_field_t GCONR_f;
+ };
+ union
+ {
+ __IO uint32_t ICONR;
+ stc_tim5_iconr_field_t ICONR_f;
+ };
+ union
+ {
+ __IO uint32_t PCONR;
+ stc_tim5_pconr_field_t PCONR_f;
+ };
+ union
+ {
+ __IO uint32_t BCONR;
+ stc_tim5_bconr_field_t BCONR_f;
+ };
+ union
+ {
+ __IO uint32_t DCONR;
+ stc_tim5_dconr_field_t DCONR_f;
+ };
+ uint8_t RESERVED16[4];
+ union
+ {
+ __IO uint32_t FCONR;
+ stc_tim5_fconr_field_t FCONR_f;
+ };
+ union
+ {
+ __IO uint32_t VPERR;
+ stc_tim5_vperr_field_t VPERR_f;
+ };
+ union
+ {
+ __IO uint32_t STFLR;
+ stc_tim5_stflr_field_t STFLR_f;
+ };
+ union
+ {
+ __IO uint32_t HSTAR;
+ stc_tim5_hstar_field_t HSTAR_f;
+ };
+ union
+ {
+ __IO uint32_t HSTPR;
+ stc_tim5_hstpr_field_t HSTPR_f;
+ };
+ union
+ {
+ __IO uint32_t HCELR;
+ stc_tim5_hcelr_field_t HCELR_f;
+ };
+ union
+ {
+ __IO uint32_t HCPAR;
+ stc_tim5_hcpar_field_t HCPAR_f;
+ };
+ union
+ {
+ __IO uint32_t HCPBR;
+ stc_tim5_hcpbr_field_t HCPBR_f;
+ };
+ union
+ {
+ __IO uint32_t HCUPR;
+ stc_tim5_hcupr_field_t HCUPR_f;
+ };
+ union
+ {
+ __IO uint32_t HCDOR;
+ stc_tim5_hcdor_field_t HCDOR_f;
+ };
+ uint8_t RESERVED26[112];
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim5_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim5_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t CR;
+ stc_tim5_cr_field_t CR_f;
+ };
+ uint8_t RESERVED29[4];
+ union
+ {
+ __IO uint32_t AOSSR;
+ stc_tim5_aossr_field_t AOSSR_f;
+ };
+ union
+ {
+ __IO uint32_t AOSCL;
+ stc_tim5_aoscl_field_t AOSCL_f;
+ };
+ union
+ {
+ __IO uint32_t PTBKS;
+ stc_tim5_ptbks_field_t PTBKS_f;
+ };
+ union
+ {
+ __IO uint32_t TTRIG;
+ stc_tim5_ttrig_field_t TTRIG_f;
+ };
+ union
+ {
+ __IO uint32_t ITRIG;
+ stc_tim5_itrig_field_t ITRIG_f;
+ };
+ union
+ {
+ __IO uint32_t PTBKP;
+ stc_tim5_ptbkp_field_t PTBKP_f;
+ };
+ uint8_t RESERVED35[716];
+ union
+ {
+ __IO uint32_t SSTAR;
+ stc_tim5_sstar_field_t SSTAR_f;
+ };
+ union
+ {
+ __IO uint32_t SSTPR;
+ stc_tim5_sstpr_field_t SSTPR_f;
+ };
+ union
+ {
+ __IO uint32_t SCLRR;
+ stc_tim5_sclrr_field_t SCLRR_f;
+ };
+}M0P_TIM5_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t CNTER;
+ stc_tim6_cnter_field_t CNTER_f;
+ };
+ union
+ {
+ __IO uint32_t PERAR;
+ stc_tim6_perar_field_t PERAR_f;
+ };
+ union
+ {
+ __IO uint32_t PERBR;
+ stc_tim6_perbr_field_t PERBR_f;
+ };
+ uint8_t RESERVED3[4];
+ union
+ {
+ __IO uint32_t GCMAR;
+ stc_tim6_gcmar_field_t GCMAR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMBR;
+ stc_tim6_gcmbr_field_t GCMBR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMCR;
+ stc_tim6_gcmcr_field_t GCMCR_f;
+ };
+ union
+ {
+ __IO uint32_t GCMDR;
+ stc_tim6_gcmdr_field_t GCMDR_f;
+ };
+ uint8_t RESERVED7[8];
+ union
+ {
+ __IO uint32_t SCMAR;
+ stc_tim6_scmar_field_t SCMAR_f;
+ };
+ union
+ {
+ __IO uint32_t SCMBR;
+ stc_tim6_scmbr_field_t SCMBR_f;
+ };
+ uint8_t RESERVED9[16];
+ union
+ {
+ __IO uint32_t DTUAR;
+ stc_tim6_dtuar_field_t DTUAR_f;
+ };
+ union
+ {
+ __IO uint32_t DTDAR;
+ stc_tim6_dtdar_field_t DTDAR_f;
+ };
+ uint8_t RESERVED11[8];
+ union
+ {
+ __IO uint32_t GCONR;
+ stc_tim6_gconr_field_t GCONR_f;
+ };
+ union
+ {
+ __IO uint32_t ICONR;
+ stc_tim6_iconr_field_t ICONR_f;
+ };
+ union
+ {
+ __IO uint32_t PCONR;
+ stc_tim6_pconr_field_t PCONR_f;
+ };
+ union
+ {
+ __IO uint32_t BCONR;
+ stc_tim6_bconr_field_t BCONR_f;
+ };
+ union
+ {
+ __IO uint32_t DCONR;
+ stc_tim6_dconr_field_t DCONR_f;
+ };
+ uint8_t RESERVED16[4];
+ union
+ {
+ __IO uint32_t FCONR;
+ stc_tim6_fconr_field_t FCONR_f;
+ };
+ union
+ {
+ __IO uint32_t VPERR;
+ stc_tim6_vperr_field_t VPERR_f;
+ };
+ union
+ {
+ __IO uint32_t STFLR;
+ stc_tim6_stflr_field_t STFLR_f;
+ };
+ union
+ {
+ __IO uint32_t HSTAR;
+ stc_tim6_hstar_field_t HSTAR_f;
+ };
+ union
+ {
+ __IO uint32_t HSTPR;
+ stc_tim6_hstpr_field_t HSTPR_f;
+ };
+ union
+ {
+ __IO uint32_t HCELR;
+ stc_tim6_hcelr_field_t HCELR_f;
+ };
+ union
+ {
+ __IO uint32_t HCPAR;
+ stc_tim6_hcpar_field_t HCPAR_f;
+ };
+ union
+ {
+ __IO uint32_t HCPBR;
+ stc_tim6_hcpbr_field_t HCPBR_f;
+ };
+ union
+ {
+ __IO uint32_t HCUPR;
+ stc_tim6_hcupr_field_t HCUPR_f;
+ };
+ union
+ {
+ __IO uint32_t HCDOR;
+ stc_tim6_hcdor_field_t HCDOR_f;
+ };
+ uint8_t RESERVED26[112];
+ union
+ {
+ __IO uint32_t IFR;
+ stc_tim6_ifr_field_t IFR_f;
+ };
+ union
+ {
+ __IO uint32_t ICLR;
+ stc_tim6_iclr_field_t ICLR_f;
+ };
+ union
+ {
+ __IO uint32_t CR;
+ stc_tim6_cr_field_t CR_f;
+ };
+ uint8_t RESERVED29[4];
+ union
+ {
+ __IO uint32_t AOSSR;
+ stc_tim6_aossr_field_t AOSSR_f;
+ };
+ union
+ {
+ __IO uint32_t AOSCL;
+ stc_tim6_aoscl_field_t AOSCL_f;
+ };
+ union
+ {
+ __IO uint32_t PTBKS;
+ stc_tim6_ptbks_field_t PTBKS_f;
+ };
+ union
+ {
+ __IO uint32_t TTRIG;
+ stc_tim6_ttrig_field_t TTRIG_f;
+ };
+ union
+ {
+ __IO uint32_t ITRIG;
+ stc_tim6_itrig_field_t ITRIG_f;
+ };
+ union
+ {
+ __IO uint32_t PTBKP;
+ stc_tim6_ptbkp_field_t PTBKP_f;
+ };
+ uint8_t RESERVED35[716];
+ union
+ {
+ __IO uint32_t SSTAR;
+ stc_tim6_sstar_field_t SSTAR_f;
+ };
+ union
+ {
+ __IO uint32_t SSTPR;
+ stc_tim6_sstpr_field_t SSTPR_f;
+ };
+ union
+ {
+ __IO uint32_t SCLRR;
+ stc_tim6_sclrr_field_t SCLRR_f;
+ };
+}M0P_TIM6_TypeDef;
+
+typedef struct
+{
+ union
+ {
+ __IO uint32_t SBUF;
+ stc_uart_sbuf_field_t SBUF_f;
+ };
+ union
+ {
+ __IO uint32_t SCON;
+ stc_uart_scon_field_t SCON_f;
+ };
+ union
+ {
+ __IO uint32_t SADDR;
+ stc_uart_saddr_field_t SADDR_f;
+ };
+ union
+ {
+ __IO uint32_t SADEN;
+ stc_uart_saden_field_t SADEN_f;
+ };
+ union
+ {
+ __IO uint32_t ISR;
+ stc_uart_isr_field_t ISR_f;
+ };
+ union
+ {
+ __IO uint32_t ICR;
+ stc_uart_icr_field_t ICR_f;
+ };
+ union
+ {
+ __IO uint32_t SCNT;
+ stc_uart_scnt_field_t SCNT_f;
+ };
+}M0P_UART_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[16];
+ union
+ {
+ __IO uint32_t CR;
+ stc_vc_cr_field_t CR_f;
+ };
+ union
+ {
+ __IO uint32_t VC0_CR;
+ stc_vc_vc0_cr_field_t VC0_CR_f;
+ };
+ union
+ {
+ __IO uint32_t VC1_CR;
+ stc_vc_vc1_cr_field_t VC1_CR_f;
+ };
+ union
+ {
+ __IO uint32_t VC0_OUT_CFG;
+ stc_vc_vc0_out_cfg_field_t VC0_OUT_CFG_f;
+ };
+ union
+ {
+ __IO uint32_t VC1_OUT_CFG;
+ stc_vc_vc1_out_cfg_field_t VC1_OUT_CFG_f;
+ };
+ union
+ {
+ __IO uint32_t IFR;
+ stc_vc_ifr_field_t IFR_f;
+ };
+}M0P_VC_TypeDef;
+
+typedef struct
+{
+ uint8_t RESERVED0[128];
+ union
+ {
+ __IO uint32_t RST;
+ stc_wdt_rst_field_t RST_f;
+ };
+ union
+ {
+ __IO uint32_t CON;
+ stc_wdt_con_field_t CON_f;
+ };
+}M0P_WDT_TypeDef;
+
+
+
+#define M0P_PERIPH_BASE (0x40000000UL)
+#define M0P_ADC_BASE (M0P_PERIPH_BASE + 0x00002400UL)
+#define M0P_AES_BASE (M0P_PERIPH_BASE + 0x00021400UL)
+#define M0P_BGR_BASE (M0P_PERIPH_BASE + 0x00002400UL)
+#define M0P_CLK_TRIM_BASE (M0P_PERIPH_BASE + 0x00001800UL)
+#define M0P_CRC_BASE (M0P_PERIPH_BASE + 0x00020900UL)
+#define M0P_DEBUG_ACTIVE_BASE (M0P_PERIPH_BASE + 0x00002438UL)
+#define M0P_DMAC_BASE (M0P_PERIPH_BASE + 0x00021000UL)
+#define M0P_FLASH_BASE (M0P_PERIPH_BASE + 0x00020000UL)
+#define M0P_GPIO_BASE (M0P_PERIPH_BASE + 0x00020C00UL)
+#define M0P_HDIV_BASE (M0P_PERIPH_BASE + 0x00021800UL)
+#define M0P_I2C0_BASE (M0P_PERIPH_BASE + 0x00000400UL)
+#define M0P_I2C1_BASE (M0P_PERIPH_BASE + 0x00004400UL)
+#define M0P_LCD_BASE (M0P_PERIPH_BASE + 0x00005C00UL)
+#define M0P_LPTIMER_BASE (M0P_PERIPH_BASE + 0x00000F00UL)
+#define M0P_LPUART0_BASE (M0P_PERIPH_BASE + 0x00000200UL)
+#define M0P_LPUART1_BASE (M0P_PERIPH_BASE + 0x00004000UL)
+#define M0P_LVD_BASE (M0P_PERIPH_BASE + 0x00002400UL)
+#define M0P_OPA_BASE (M0P_PERIPH_BASE + 0x00002400UL)
+#define M0P_PCA_BASE (M0P_PERIPH_BASE + 0x00001000UL)
+#define M0P_PCNT_BASE (M0P_PERIPH_BASE + 0x00005400UL)
+#define M0P_RAM_BASE (M0P_PERIPH_BASE + 0x00020400UL)
+#define M0P_RESET_BASE (M0P_PERIPH_BASE + 0x0000201CUL)
+#define M0P_RNG_BASE (M0P_PERIPH_BASE + 0x00004C00UL)
+#define M0P_RTC_BASE (M0P_PERIPH_BASE + 0x00001400UL)
+#define M0P_SPI0_BASE (M0P_PERIPH_BASE + 0x00000800UL)
+#define M0P_SPI1_BASE (M0P_PERIPH_BASE + 0x00004800UL)
+#define M0P_SYSCTRL_BASE (M0P_PERIPH_BASE + 0x00002000UL)
+#define M0P_TIM0_MODE0_BASE (M0P_PERIPH_BASE + 0x00000C00UL)
+#define M0P_TIM0_MODE1_BASE (M0P_PERIPH_BASE + 0x00000C00UL)
+#define M0P_TIM0_MODE23_BASE (M0P_PERIPH_BASE + 0x00000C00UL)
+#define M0P_TIM1_MODE0_BASE (M0P_PERIPH_BASE + 0x00000D00UL)
+#define M0P_TIM1_MODE1_BASE (M0P_PERIPH_BASE + 0x00000D00UL)
+#define M0P_TIM1_MODE23_BASE (M0P_PERIPH_BASE + 0x00000D00UL)
+#define M0P_TIM2_MODE0_BASE (M0P_PERIPH_BASE + 0x00000E00UL)
+#define M0P_TIM2_MODE1_BASE (M0P_PERIPH_BASE + 0x00000E00UL)
+#define M0P_TIM2_MODE23_BASE (M0P_PERIPH_BASE + 0x00000E00UL)
+#define M0P_TIM3_MODE0_BASE (M0P_PERIPH_BASE + 0x00005800UL)
+#define M0P_TIM3_MODE1_BASE (M0P_PERIPH_BASE + 0x00005800UL)
+#define M0P_TIM3_MODE23_BASE (M0P_PERIPH_BASE + 0x00005800UL)
+#define M0P_TIM4_BASE (M0P_PERIPH_BASE + 0x00003000UL)
+#define M0P_TIM5_BASE (M0P_PERIPH_BASE + 0x00003400UL)
+#define M0P_TIM6_BASE (M0P_PERIPH_BASE + 0x00003800UL)
+#define M0P_UART0_BASE (M0P_PERIPH_BASE + 0x00000000UL)
+#define M0P_UART1_BASE (M0P_PERIPH_BASE + 0x00000100UL)
+#define M0P_VC_BASE (M0P_PERIPH_BASE + 0x00002400UL)
+#define M0P_WDT_BASE (M0P_PERIPH_BASE + 0x00000F00UL)
+
+
+#define M0P_ADC ((M0P_ADC_TypeDef *)0x40002400UL)
+#define M0P_AES ((M0P_AES_TypeDef *)0x40021400UL)
+#define M0P_BGR ((M0P_BGR_TypeDef *)0x40002400UL)
+#define M0P_CLK_TRIM ((M0P_CLK_TRIM_TypeDef *)0x40001800UL)
+#define M0P_CRC ((M0P_CRC_TypeDef *)0x40020900UL)
+#define M0P_DEBUG_ACTIVE ((M0P_DEBUG_ACTIVE_TypeDef *)0x40002438UL)
+#define M0P_DMAC ((M0P_DMAC_TypeDef *)0x40021000UL)
+#define M0P_FLASH ((M0P_FLASH_TypeDef *)0x40020000UL)
+#define M0P_GPIO ((M0P_GPIO_TypeDef *)0x40020C00UL)
+#define M0P_HDIV ((M0P_HDIV_TypeDef *)0x40021800UL)
+#define M0P_I2C0 ((M0P_I2C_TypeDef *)0x40000400UL)
+#define M0P_I2C1 ((M0P_I2C_TypeDef *)0x40004400UL)
+#define M0P_LCD ((M0P_LCD_TypeDef *)0x40005C00UL)
+#define M0P_LPTIMER ((M0P_LPTIMER_TypeDef *)0x40000F00UL)
+#define M0P_LPUART0 ((M0P_LPUART_TypeDef *)0x40000200UL)
+#define M0P_LPUART1 ((M0P_LPUART_TypeDef *)0x40004000UL)
+#define M0P_LVD ((M0P_LVD_TypeDef *)0x40002400UL)
+#define M0P_OPA ((M0P_OPA_TypeDef *)0x40002400UL)
+#define M0P_PCA ((M0P_PCA_TypeDef *)0x40001000UL)
+#define M0P_PCNT ((M0P_PCNT_TypeDef *)0x40005400UL)
+#define M0P_RAM ((M0P_RAM_TypeDef *)0x40020400UL)
+#define M0P_RESET ((M0P_RESET_TypeDef *)0x4000201CUL)
+#define M0P_RNG ((M0P_RNG_TypeDef *)0x40004C00UL)
+#define M0P_RTC ((M0P_RTC_TypeDef *)0x40001400UL)
+#define M0P_SPI0 ((M0P_SPI_TypeDef *)0x40000800UL)
+#define M0P_SPI1 ((M0P_SPI_TypeDef *)0x40004800UL)
+#define M0P_SYSCTRL ((M0P_SYSCTRL_TypeDef *)0x40002000UL)
+#define M0P_TIM0_MODE0 ((M0P_TIM0_MODE0_TypeDef *)0x40000C00UL)
+#define M0P_TIM0_MODE1 ((M0P_TIM0_MODE1_TypeDef *)0x40000C00UL)
+#define M0P_TIM0_MODE23 ((M0P_TIM0_MODE23_TypeDef *)0x40000C00UL)
+#define M0P_TIM1_MODE0 ((M0P_TIM1_MODE0_TypeDef *)0x40000D00UL)
+#define M0P_TIM1_MODE1 ((M0P_TIM1_MODE1_TypeDef *)0x40000D00UL)
+#define M0P_TIM1_MODE23 ((M0P_TIM1_MODE23_TypeDef *)0x40000D00UL)
+#define M0P_TIM2_MODE0 ((M0P_TIM2_MODE0_TypeDef *)0x40000E00UL)
+#define M0P_TIM2_MODE1 ((M0P_TIM2_MODE1_TypeDef *)0x40000E00UL)
+#define M0P_TIM2_MODE23 ((M0P_TIM2_MODE23_TypeDef *)0x40000E00UL)
+#define M0P_TIM3_MODE0 ((M0P_TIM3_MODE0_TypeDef *)0x40005800UL)
+#define M0P_TIM3_MODE1 ((M0P_TIM3_MODE1_TypeDef *)0x40005800UL)
+#define M0P_TIM3_MODE23 ((M0P_TIM3_MODE23_TypeDef *)0x40005800UL)
+#define M0P_TIM4 ((M0P_TIM4_TypeDef *)0x40003000UL)
+#define M0P_TIM5 ((M0P_TIM5_TypeDef *)0x40003400UL)
+#define M0P_TIM6 ((M0P_TIM6_TypeDef *)0x40003800UL)
+#define M0P_UART0 ((M0P_UART_TypeDef *)0x40000000UL)
+#define M0P_UART1 ((M0P_UART_TypeDef *)0x40000100UL)
+#define M0P_VC ((M0P_VC_TypeDef *)0x40002400UL)
+#define M0P_WDT ((M0P_WDT_TypeDef *)0x40000F00UL)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HC32L136_H__ */
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l136.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l136.h
new file mode 100644
index 0000000000..708eee7dbd
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l136.h
@@ -0,0 +1,107 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file system_hc32l136.h
+ **
+ ** A detailed description is available at
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-03-09 1.0 Lux First version.
+ **
+ ******************************************************************************/
+
+#ifndef __SYSTEM_HC32L136_H__
+#define __SYSTEM_HC32L136_H__
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('define') */
+/******************************************************************************/
+#define HWWD_DISABLE (1)
+
+
+
+/**
+ ******************************************************************************
+ ** \brief Clock Setup macro definition
+ **
+ ** - 0: CLOCK_SETTING_NONE - User provides own clock setting in application
+ ** - 1: CLOCK_SETTING_CMSIS -
+ ******************************************************************************/
+#define CLOCK_SETTING_NONE 0u
+#define CLOCK_SETTING_CMSIS 1u
+
+
+/******************************************************************************/
+/* */
+/* START OF USER SETTINGS HERE */
+/* =========================== */
+/* */
+/* All lines with '<<<' can be set by user. */
+/* */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Global function prototypes ('extern', definition in C source) */
+/******************************************************************************/
+
+
+extern uint32_t SystemCoreClock; // System Clock Frequency (Core Clock)
+extern void SystemInit (void); // Initialize the system
+extern void SystemCoreClockUpdate (void); // Update SystemCoreClock variable
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYSTEM_HC32L136_H__ */
+
+
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l13x.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l13x.h
new file mode 100644
index 0000000000..53575aee59
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Include/system_hc32l13x.h
@@ -0,0 +1,111 @@
+/*******************************************************************************
+* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file system_hc32l13x.h
+ **
+ ** A detailed description is available at
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2019-03-01 1.0 Lux First version.
+ **
+ ******************************************************************************/
+
+#ifndef __SYSTEM_HC32L13X_H__
+#define __SYSTEM_HC32L13X_H__
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('define') */
+/******************************************************************************/
+#define HWWD_DISABLE (1)
+
+
+
+/**
+ ******************************************************************************
+ ** \brief Clock Setup macro definition
+ **
+ ** - 0: CLOCK_SETTING_NONE - User provides own clock setting in application
+ ** - 1: CLOCK_SETTING_CMSIS -
+ ******************************************************************************/
+#define CLOCK_SETTING_NONE 0u
+#define CLOCK_SETTING_CMSIS 1u
+
+
+/******************************************************************************/
+/* */
+/* START OF USER SETTINGS HERE */
+/* =========================== */
+/* */
+/* All lines with '<<<' can be set by user. */
+/* */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Global function prototypes ('extern', definition in C source) */
+/******************************************************************************/
+
+
+extern uint32_t SystemCoreClock; // System Clock Frequency (Core Clock)
+extern void SystemInit (void); // Initialize the system
+extern void SystemCoreClockUpdate (void); // Update SystemCoreClock variable
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYSTEM_HC32L13X_H__ */
+
+
+
+
+
+
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/ARM/startup_hc32l136.s b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/ARM/startup_hc32l136.s
new file mode 100644
index 0000000000..f066d81363
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/ARM/startup_hc32l136.s
@@ -0,0 +1,294 @@
+;/******************************************************************************
+;* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+;*
+;* This software is owned and published by:
+;* Huada Semiconductor Co.,Ltd ("HDSC").
+;*
+;* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+;* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+;*
+;* This software contains source code for use with HDSC
+;* components. This software is licensed by HDSC to be adapted only
+;* for use in systems utilizing HDSC components. HDSC shall not be
+;* responsible for misuse or illegal use of this software for devices not
+;* supported herein. HDSC is providing this software "AS IS" and will
+;* not be responsible for issues arising from incorrect user implementation
+;* of the software.
+;*
+;* Disclaimer:
+;* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+;* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+;* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+;* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+;* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+;* WARRANTY OF NONINFRINGEMENT.
+;* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+;* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+;* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+;* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+;* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+;* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+;* SAVINGS OR PROFITS,
+;* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+;* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+;* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+;* FROM, THE SOFTWARE.
+;*
+;* This software may be replicated in part or whole for the licensed use,
+;* with the restriction that this Disclaimer and Copyright notice must be
+;* included with each copy of this software, whether used in part or whole,
+;* at all times.
+;*/
+;/*****************************************************************************/
+
+;/*****************************************************************************/
+;/* Startup for ARM */
+;/* Version V1.0 */
+;/* Date 2018-04-15 */
+;/* Target-mcu {HC32L136} */
+;/*****************************************************************************/
+
+; Stack Configuration
+; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
+
+Stack_Size EQU 0x00000200
+
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+Stack_Mem SPACE Stack_Size
+__initial_sp
+
+
+; Heap Configuration
+; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
+
+Heap_Size EQU 0x00000200
+
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+__heap_base
+Heap_Mem SPACE Heap_Size
+__heap_limit
+
+
+ PRESERVE8
+ THUMB
+
+
+; Vector Table Mapped to Address 0 at Reset
+
+ AREA RESET, DATA, READONLY
+ EXPORT __Vectors
+ EXPORT __Vectors_End
+ EXPORT __Vectors_Size
+
+__Vectors DCD __initial_sp ; Top of Stack
+ DCD Reset_Handler ; Reset
+ DCD NMI_Handler ; NMI
+ DCD HardFault_Handler ; Hard Fault
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV
+ DCD SysTick_Handler ; SysTick
+
+ DCD IRQ000_Handler ;
+ DCD IRQ001_Handler ;
+ DCD IRQ002_Handler ;
+ DCD IRQ003_Handler ;
+ DCD IRQ004_Handler ;
+ DCD IRQ005_Handler ;
+ DCD IRQ006_Handler ;
+ DCD IRQ007_Handler ;
+ DCD IRQ008_Handler ;
+ DCD IRQ009_Handler ;
+ DCD IRQ010_Handler ;
+ DCD IRQ011_Handler ;
+ DCD IRQ012_Handler ;
+ DCD IRQ013_Handler ;
+ DCD IRQ014_Handler ;
+ DCD IRQ015_Handler ;
+ DCD IRQ016_Handler ;
+ DCD IRQ017_Handler ;
+ DCD IRQ018_Handler ;
+ DCD IRQ019_Handler ;
+ DCD IRQ020_Handler ;
+ DCD IRQ021_Handler ;
+ DCD IRQ022_Handler ;
+ DCD IRQ023_Handler ;
+ DCD IRQ024_Handler ;
+ DCD IRQ025_Handler ;
+ DCD IRQ026_Handler ;
+ DCD IRQ027_Handler ;
+ DCD IRQ028_Handler ;
+ DCD IRQ029_Handler ;
+ DCD IRQ030_Handler ;
+ DCD IRQ031_Handler ;
+
+__Vectors_End
+
+__Vectors_Size EQU __Vectors_End - __Vectors
+
+ AREA |.text|, CODE, READONLY
+
+
+; Reset Handler
+
+Reset_Handler PROC
+ EXPORT Reset_Handler [WEAK]
+ IMPORT SystemInit
+ IMPORT __main
+
+ ;reset NVIC if in rom debug
+ LDR R0, =0x20000000
+ LDR R2, =0x0
+ MOVS R1, #0 ; for warning,
+ ADD R1, PC,#0 ; for A1609W,
+ CMP R1, R0
+ BLS RAMCODE
+
+ ; ram code base address.
+ ADD R2, R0,R2
+RAMCODE
+ ; reset Vector table address.
+ LDR R0, =0xE000ED08
+ STR R2, [R0]
+
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__main
+ BX R0
+ ENDP
+
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+NMI_Handler PROC
+ EXPORT NMI_Handler [WEAK]
+ B .
+ ENDP
+HardFault_Handler\
+ PROC
+ EXPORT HardFault_Handler [WEAK]
+ B .
+ ENDP
+SVC_Handler PROC
+ EXPORT SVC_Handler [WEAK]
+ B .
+ ENDP
+PendSV_Handler PROC
+ EXPORT PendSV_Handler [WEAK]
+ B .
+ ENDP
+SysTick_Handler PROC
+ EXPORT SysTick_Handler [WEAK]
+ B .
+ ENDP
+
+Default_Handler PROC
+
+ EXPORT IRQ000_Handler [WEAK]
+ EXPORT IRQ001_Handler [WEAK]
+ EXPORT IRQ002_Handler [WEAK]
+ EXPORT IRQ003_Handler [WEAK]
+ EXPORT IRQ004_Handler [WEAK]
+ EXPORT IRQ005_Handler [WEAK]
+ EXPORT IRQ006_Handler [WEAK]
+ EXPORT IRQ007_Handler [WEAK]
+ EXPORT IRQ008_Handler [WEAK]
+ EXPORT IRQ009_Handler [WEAK]
+ EXPORT IRQ010_Handler [WEAK]
+ EXPORT IRQ011_Handler [WEAK]
+ EXPORT IRQ012_Handler [WEAK]
+ EXPORT IRQ013_Handler [WEAK]
+ EXPORT IRQ014_Handler [WEAK]
+ EXPORT IRQ015_Handler [WEAK]
+ EXPORT IRQ016_Handler [WEAK]
+ EXPORT IRQ017_Handler [WEAK]
+ EXPORT IRQ018_Handler [WEAK]
+ EXPORT IRQ019_Handler [WEAK]
+ EXPORT IRQ020_Handler [WEAK]
+ EXPORT IRQ021_Handler [WEAK]
+ EXPORT IRQ022_Handler [WEAK]
+ EXPORT IRQ023_Handler [WEAK]
+ EXPORT IRQ024_Handler [WEAK]
+ EXPORT IRQ025_Handler [WEAK]
+ EXPORT IRQ026_Handler [WEAK]
+ EXPORT IRQ027_Handler [WEAK]
+ EXPORT IRQ028_Handler [WEAK]
+ EXPORT IRQ029_Handler [WEAK]
+ EXPORT IRQ030_Handler [WEAK]
+ EXPORT IRQ031_Handler [WEAK]
+
+
+IRQ000_Handler
+IRQ001_Handler
+IRQ002_Handler
+IRQ003_Handler
+IRQ004_Handler
+IRQ005_Handler
+IRQ006_Handler
+IRQ007_Handler
+IRQ008_Handler
+IRQ009_Handler
+IRQ010_Handler
+IRQ011_Handler
+IRQ012_Handler
+IRQ013_Handler
+IRQ014_Handler
+IRQ015_Handler
+IRQ016_Handler
+IRQ017_Handler
+IRQ018_Handler
+IRQ019_Handler
+IRQ020_Handler
+IRQ021_Handler
+IRQ022_Handler
+IRQ023_Handler
+IRQ024_Handler
+IRQ025_Handler
+IRQ026_Handler
+IRQ027_Handler
+IRQ028_Handler
+IRQ029_Handler
+IRQ030_Handler
+IRQ031_Handler
+ B .
+
+ ENDP
+
+
+ ALIGN
+
+
+; User Initial Stack & Heap
+
+ IF :DEF:__MICROLIB
+
+ EXPORT __initial_sp
+ EXPORT __heap_base
+ EXPORT __heap_limit
+
+ ELSE
+
+ IMPORT __use_two_region_memory
+ EXPORT __user_initial_stackheap
+__user_initial_stackheap
+
+ LDR R0, = Heap_Mem
+ LDR R1, =(Stack_Mem + Stack_Size)
+ LDR R2, = (Heap_Mem + Heap_Size)
+ LDR R3, = Stack_Mem
+ BX LR
+
+ ALIGN
+
+ ENDIF
+
+
+ END
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/IAR/startup_hc32l136.s b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/IAR/startup_hc32l136.s
new file mode 100644
index 0000000000..14bc83d796
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/IAR/startup_hc32l136.s
@@ -0,0 +1,353 @@
+;*******************************************************************************
+; Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+;
+; This software is owned and published by:
+; Huada Semiconductor Co.,Ltd ("HDSC").
+;
+; BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+; BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+;
+; This software contains source code for use with HDSC
+; components. This software is licensed by HDSC to be adapted only
+; for use in systems utilizing HDSC components. HDSC shall not be
+; responsible for misuse or illegal use of this software for devices not
+; supported herein. HDSC is providing this software "AS IS" and will
+; not be responsible for issues arising from incorrect user implementation
+; of the software.
+;
+; Disclaimer:
+; HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+; REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+; ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+; WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+; WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+; WARRANTY OF NONINFRINGEMENT.
+; HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+; NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+; LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+; LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+; INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+; INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+; SAVINGS OR PROFITS,
+; EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+; YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+; INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+; FROM, THE SOFTWARE.
+;
+; This software may be replicated in part or whole for the licensed use,
+; with the restriction that this Disclaimer and Copyright notice must be
+; included with each copy of this software, whether used in part or whole,
+; at all times.
+;/
+;/*****************************************************************************/
+;/* Startup for IAR */
+;/* Version V1.0 */
+;/* Date 2018-04-15 */
+;/* Target-mcu M0+ Device */
+;/*****************************************************************************/
+ MODULE ?cstartup
+
+ ;; Forward declaration of sections.
+ SECTION CSTACK:DATA:NOROOT(3)
+
+ EXTERN __iar_program_start
+ EXTERN SystemInit
+ PUBLIC __vector_table
+
+ SECTION .intvec:CODE:ROOT(8)
+ DATA
+__vector_table DCD sfe(CSTACK)
+ DCD Reset_Handler
+ DCD NMI_Handler ; NMI
+ DCD HardFault_Handler ; Hard Fault
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD SVC_Handler ; SVCall
+ DCD 0 ; Debug Monitor
+ DCD 0 ; Reserved
+ DCD PendSV_Handler ; PendSV
+ DCD SysTick_Handler ; SysTick
+
+; Numbered IRQ handler vectors
+
+; Note: renaming to device dependent ISR function names are done in
+ DCD IRQ000_Handler
+ DCD IRQ001_Handler
+ DCD IRQ002_Handler
+ DCD IRQ003_Handler
+ DCD IRQ004_Handler
+ DCD IRQ005_Handler
+ DCD IRQ006_Handler
+ DCD IRQ007_Handler
+ DCD IRQ008_Handler
+ DCD IRQ009_Handler
+ DCD IRQ010_Handler
+ DCD IRQ011_Handler
+ DCD IRQ012_Handler
+ DCD IRQ013_Handler
+ DCD IRQ014_Handler
+ DCD IRQ015_Handler
+ DCD IRQ016_Handler
+ DCD IRQ017_Handler
+ DCD IRQ018_Handler
+ DCD IRQ019_Handler
+ DCD IRQ020_Handler
+ DCD IRQ021_Handler
+ DCD IRQ022_Handler
+ DCD IRQ023_Handler
+ DCD IRQ024_Handler
+ DCD IRQ025_Handler
+ DCD IRQ026_Handler
+ DCD IRQ027_Handler
+ DCD IRQ028_Handler
+ DCD IRQ029_Handler
+ DCD IRQ030_Handler
+ DCD IRQ031_Handler
+
+ THUMB
+
+ PUBWEAK Reset_Handler
+ SECTION .text:CODE:NOROOT:REORDER(2)
+Reset_Handler
+ ;reset NVIC if in rom debug
+ LDR R0, =0x20000000
+ LDR R2, =0x0 ; vector offset
+ cmp PC, R0
+ bls ROMCODE
+
+ ; ram code base address.
+ ADD R2, R0,R2
+ROMCODE
+ ; reset Vector table address.
+ LDR R0, =0xE000ED08
+ STR R2, [R0]
+
+ LDR R0, =SystemInit
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ PUBWEAK NMI_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+NMI_Handler
+ B NMI_Handler
+
+ PUBWEAK HardFault_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+HardFault_Handler
+ B HardFault_Handler
+
+
+ PUBWEAK SVC_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SVC_Handler
+ B SVC_Handler
+
+ PUBWEAK PendSV_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+PendSV_Handler
+ B PendSV_Handler
+
+ PUBWEAK SysTick_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+SysTick_Handler
+ B SysTick_Handler
+
+
+ PUBWEAK IRQ000_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ000_Handler
+ B IRQ000_Handler
+
+
+ PUBWEAK IRQ001_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ001_Handler
+ B IRQ001_Handler
+
+
+ PUBWEAK IRQ002_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ002_Handler
+ B IRQ002_Handler
+
+
+ PUBWEAK IRQ003_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ003_Handler
+ B IRQ003_Handler
+
+
+ PUBWEAK IRQ004_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ004_Handler
+ B IRQ004_Handler
+
+
+ PUBWEAK IRQ005_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ005_Handler
+ B IRQ005_Handler
+
+
+ PUBWEAK IRQ006_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ006_Handler
+ B IRQ006_Handler
+
+
+ PUBWEAK IRQ007_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ007_Handler
+ B IRQ007_Handler
+
+
+ PUBWEAK IRQ008_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ008_Handler
+ B IRQ008_Handler
+
+
+ PUBWEAK IRQ009_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ009_Handler
+ B IRQ009_Handler
+
+
+ PUBWEAK IRQ010_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ010_Handler
+ B IRQ010_Handler
+
+
+ PUBWEAK IRQ011_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ011_Handler
+ B IRQ011_Handler
+
+
+ PUBWEAK IRQ012_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ012_Handler
+ B IRQ012_Handler
+
+
+ PUBWEAK IRQ013_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ013_Handler
+ B IRQ013_Handler
+
+
+ PUBWEAK IRQ014_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ014_Handler
+ B IRQ014_Handler
+
+
+ PUBWEAK IRQ015_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ015_Handler
+ B IRQ015_Handler
+
+
+ PUBWEAK IRQ016_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ016_Handler
+ B IRQ016_Handler
+
+
+ PUBWEAK IRQ017_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ017_Handler
+ B IRQ017_Handler
+
+
+ PUBWEAK IRQ018_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ018_Handler
+ B IRQ018_Handler
+
+
+ PUBWEAK IRQ019_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ019_Handler
+ B IRQ019_Handler
+
+
+ PUBWEAK IRQ020_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ020_Handler
+ B IRQ020_Handler
+
+
+ PUBWEAK IRQ021_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ021_Handler
+ B IRQ021_Handler
+
+
+ PUBWEAK IRQ022_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ022_Handler
+ B IRQ022_Handler
+
+
+ PUBWEAK IRQ023_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ023_Handler
+ B IRQ023_Handler
+
+
+ PUBWEAK IRQ024_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ024_Handler
+ B IRQ024_Handler
+
+
+ PUBWEAK IRQ025_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ025_Handler
+ B IRQ025_Handler
+
+
+ PUBWEAK IRQ026_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ026_Handler
+ B IRQ026_Handler
+
+
+ PUBWEAK IRQ027_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ027_Handler
+ B IRQ027_Handler
+
+
+ PUBWEAK IRQ028_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ028_Handler
+ B IRQ028_Handler
+
+
+ PUBWEAK IRQ029_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ029_Handler
+ B IRQ029_Handler
+
+
+ PUBWEAK IRQ030_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ030_Handler
+ B IRQ030_Handler
+
+
+ PUBWEAK IRQ031_Handler
+ SECTION .text:CODE:NOROOT:REORDER(1)
+IRQ031_Handler
+ B IRQ031_Handler
+
+ END
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/interrupts_hc32l136.c b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/interrupts_hc32l136.c
new file mode 100644
index 0000000000..4086444a25
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/interrupts_hc32l136.c
@@ -0,0 +1,477 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file interrupts_hc32l136.c
+ **
+ ** Interrupt management
+ ** @link Driver Group Some description @endlink
+ **
+ ** - 2018-04-15 1.0 Lux First version.
+ **
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+void Gpio_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Dma_IRQHandler(uint8_t u8Param);
+void Uart_IRQHandler(uint8_t u8Param);
+__WEAKDEF void LpUart_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Spi_IRQHandler(uint8_t u8Param);
+__WEAKDEF void I2c_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Tim_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Tim3_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Adt_IRQHandler(uint8_t u8Param);
+__WEAKDEF void LpTim_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Pca_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Wdt_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Vc_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Rtc_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Adc_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Pcnt_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Lvd_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Lcd_IRQHandler(uint8_t u8Param);
+__WEAKDEF void EfRam_IRQHandler(uint8_t u8Param);
+__WEAKDEF void ClkTrim_IRQHandler(uint8_t u8Param);
+
+/**
+ *******************************************************************************
+ ** \brief NVIC 中断使能
+ **
+ ** \param [in] enIrq 中断号枚举类型
+ ** \param [in] enLevel 中断优先级枚举类型
+ ** \param [in] bEn 中断开关
+ ** \retval Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn)
+{
+ NVIC_ClearPendingIRQ(enIrq);
+ NVIC_SetPriority(enIrq, enLevel);
+ if (TRUE == bEn)
+ {
+ NVIC_EnableIRQ(enIrq);
+ }
+ else
+ {
+ NVIC_DisableIRQ(enIrq);
+ }
+}
+
+/**
+ *******************************************************************************
+ ** \brief NVIC hardware fault 中断实现
+ ** 用于单步调试功能
+ **
+ ** \retval
+ ******************************************************************************/
+//void HardFault_Handler(void)
+//{
+// volatile int a = 0;
+
+// while( 0 == a)
+// {
+// ;
+// }
+//}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortA 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTA_IRQHandler(void)
+{
+ Gpio_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortB 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTB_IRQHandler(void)
+{
+ Gpio_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTC_IRQHandler(void)
+{
+ Gpio_IRQHandler(2);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortD 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTD_IRQHandler(void)
+{
+ Gpio_IRQHandler(3);
+}
+
+/**
+ *******************************************************************************
+ ** \brief DMAC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void DMAC_IRQHandler(void)
+{
+ Dma_IRQHandler(0);
+}
+
+
+/**
+ *******************************************************************************
+ ** \brief UART0 串口0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void UART0_IRQHandler(void)
+{
+ Uart_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief UART1 串口1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void UART1_IRQHandler(void)
+{
+ Uart_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LPUART0 低功耗串口0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LPUART0_IRQHandler(void)
+{
+ LpUart_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LPUART1 低功耗串口1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LPUART1_IRQHandler(void)
+{
+ LpUart_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief SPI0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void SPI0_IRQHandler(void)
+{
+ Spi_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief SPI1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void SPI1_IRQHandler(void)
+{
+ Spi_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief I2C0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void I2C0_IRQHandler(void)
+{
+ I2c_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief I2C1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void I2C1_IRQHandler(void)
+{
+ I2c_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM0 基础时钟0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM0_IRQHandler(void)
+{
+ Tim_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM1 基础时钟1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM1_IRQHandler(void)
+{
+ Tim_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM2 基础时钟2 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM2_IRQHandler(void)
+{
+ Tim_IRQHandler(2);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM3 基础时钟3 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM3_IRQHandler(void)
+{
+ Tim3_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LPTIM 低功耗时钟 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LPTIM_IRQHandler(void)
+{
+ LpTim_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM4 高级时钟4 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM4_IRQHandler(void)
+{
+ Adt_IRQHandler(4);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM5 高级时钟5 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM5_IRQHandler(void)
+{
+ Adt_IRQHandler(5);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM6 高级时钟6 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM6_IRQHandler(void)
+{
+ Adt_IRQHandler(6);
+}
+
+/**
+ *******************************************************************************
+ ** \brief PCA 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PCA_IRQHandler(void)
+{
+ Pca_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief WDT 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void WDT_IRQHandler(void)
+{
+ Wdt_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief RTC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void RTC_IRQHandler(void)
+{
+ Rtc_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief ADC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void ADC_IRQHandler(void)
+{
+ Adc_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief PCNT 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PCNT_IRQHandler(void)
+{
+ Pcnt_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 电压比较0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void VC0_IRQHandler(void)
+{
+ Vc_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 电压比较1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void VC1_IRQHandler(void)
+{
+ Vc_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 低电压检测 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LVD_IRQHandler(void)
+{
+ Lvd_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LCD 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LCD_IRQHandler(void)
+{
+ Lcd_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief RAM 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void EF_RAM_IRQHandler(void)
+{
+ EfRam_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 时钟校准 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void CLKTRIM_IRQHandler(void)
+{
+ ClkTrim_IRQHandler(0);
+}
+
+
+
+/******************************************************************************/
+/* EOF (not truncated) */
+/******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l136.h b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l136.h
new file mode 100644
index 0000000000..708eee7dbd
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l136.h
@@ -0,0 +1,107 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file system_hc32l136.h
+ **
+ ** A detailed description is available at
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-03-09 1.0 Lux First version.
+ **
+ ******************************************************************************/
+
+#ifndef __SYSTEM_HC32L136_H__
+#define __SYSTEM_HC32L136_H__
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('define') */
+/******************************************************************************/
+#define HWWD_DISABLE (1)
+
+
+
+/**
+ ******************************************************************************
+ ** \brief Clock Setup macro definition
+ **
+ ** - 0: CLOCK_SETTING_NONE - User provides own clock setting in application
+ ** - 1: CLOCK_SETTING_CMSIS -
+ ******************************************************************************/
+#define CLOCK_SETTING_NONE 0u
+#define CLOCK_SETTING_CMSIS 1u
+
+
+/******************************************************************************/
+/* */
+/* START OF USER SETTINGS HERE */
+/* =========================== */
+/* */
+/* All lines with '<<<' can be set by user. */
+/* */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Global function prototypes ('extern', definition in C source) */
+/******************************************************************************/
+
+
+extern uint32_t SystemCoreClock; // System Clock Frequency (Core Clock)
+extern void SystemInit (void); // Initialize the system
+extern void SystemCoreClockUpdate (void); // Update SystemCoreClock variable
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYSTEM_HC32L136_H__ */
+
+
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l13x.c b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l13x.c
new file mode 100644
index 0000000000..603861ff37
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Device/HDSC/HC32L136/Source/system_hc32l13x.c
@@ -0,0 +1,91 @@
+/*******************************************************************************
+* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file system_hc32l13x.c
+ **
+ ** System clock initialization.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2019-03-01 1.0 Lux First version.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "base_types.h"
+#include "hc32l136.h"
+#include "system_hc32l13x.h"
+#include "sysctrl.h"
+
+/**
+ ******************************************************************************
+ ** System Clock Frequency (Core Clock) Variable according CMSIS
+ ******************************************************************************/
+uint32_t SystemCoreClock = 4000000;
+
+
+//add clock source.
+void SystemCoreClockUpdate (void) // Update SystemCoreClock variable
+{
+ SystemCoreClock = Sysctrl_GetHClkFreq();
+}
+
+/**
+ ******************************************************************************
+ ** \brief Setup the microcontroller system. Initialize the System and update
+ ** the SystemCoreClock variable.
+ **
+ ** \param none
+ ** \return none
+ ******************************************************************************/
+void SystemInit(void)
+{
+ SystemCoreClockUpdate();
+
+}
+
+
+
+
+
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armcc.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armcc.h
new file mode 100644
index 0000000000..59f173ac71
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armcc.h
@@ -0,0 +1,894 @@
+/**************************************************************************//**
+ * @file cmsis_armcc.h
+ * @brief CMSIS compiler ARMCC (Arm Compiler 5) header file
+ * @version V5.1.0
+ * @date 08. May 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 __CMSIS_ARMCC_H
+#define __CMSIS_ARMCC_H
+
+
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
+ #error "Please use Arm Compiler Toolchain V4.0.677 or later!"
+#endif
+
+/* CMSIS compiler control architecture macros */
+#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \
+ (defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) )
+ #define __ARM_ARCH_6M__ 1
+#endif
+
+#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1))
+ #define __ARM_ARCH_7M__ 1
+#endif
+
+#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1))
+ #define __ARM_ARCH_7EM__ 1
+#endif
+
+ /* __ARM_ARCH_8M_BASE__ not applicable */
+ /* __ARM_ARCH_8M_MAIN__ not applicable */
+
+/* CMSIS compiler control DSP macros */
+#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+ #define __ARM_FEATURE_DSP 1
+#endif
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE __inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static __inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE static __forceinline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __declspec(noreturn)
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT __packed struct
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION __packed union
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+#ifndef __COMPILER_BARRIER
+ #define __COMPILER_BARRIER() __memory_changed()
+#endif
+
+/* ######################### Startup and Lowlevel Init ######################## */
+
+#ifndef __PROGRAM_START
+#define __PROGRAM_START __main
+#endif
+
+#ifndef __INITIAL_SP
+#define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
+#endif
+
+#ifndef __STACK_LIMIT
+#define __STACK_LIMIT Image$$ARM_LIB_STACK$$ZI$$Base
+#endif
+
+#ifndef __VECTOR_TABLE
+#define __VECTOR_TABLE __Vectors
+#endif
+
+#ifndef __VECTOR_TABLE_ATTRIBUTE
+#define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section("RESET")))
+#endif
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __enable_irq(); */
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __disable_irq(); */
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_INLINE uint32_t __get_CONTROL(void)
+{
+ register uint32_t __regControl __ASM("control");
+ return(__regControl);
+}
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_INLINE void __set_CONTROL(uint32_t control)
+{
+ register uint32_t __regControl __ASM("control");
+ __regControl = control;
+}
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_IPSR(void)
+{
+ register uint32_t __regIPSR __ASM("ipsr");
+ return(__regIPSR);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_INLINE uint32_t __get_APSR(void)
+{
+ register uint32_t __regAPSR __ASM("apsr");
+ return(__regAPSR);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_xPSR(void)
+{
+ register uint32_t __regXPSR __ASM("xpsr");
+ return(__regXPSR);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_INLINE uint32_t __get_PSP(void)
+{
+ register uint32_t __regProcessStackPointer __ASM("psp");
+ return(__regProcessStackPointer);
+}
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ register uint32_t __regProcessStackPointer __ASM("psp");
+ __regProcessStackPointer = topOfProcStack;
+}
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_INLINE uint32_t __get_MSP(void)
+{
+ register uint32_t __regMainStackPointer __ASM("msp");
+ return(__regMainStackPointer);
+}
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ register uint32_t __regMainStackPointer __ASM("msp");
+ __regMainStackPointer = topOfMainStack;
+}
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_INLINE uint32_t __get_PRIMASK(void)
+{
+ register uint32_t __regPriMask __ASM("primask");
+ return(__regPriMask);
+}
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
+{
+ register uint32_t __regPriMask __ASM("primask");
+ __regPriMask = (priMask);
+}
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq __enable_fiq
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq __disable_fiq
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_INLINE uint32_t __get_BASEPRI(void)
+{
+ register uint32_t __regBasePri __ASM("basepri");
+ return(__regBasePri);
+}
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
+{
+ register uint32_t __regBasePri __ASM("basepri");
+ __regBasePri = (basePri & 0xFFU);
+}
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ register uint32_t __regBasePriMax __ASM("basepri_max");
+ __regBasePriMax = (basePri & 0xFFU);
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_INLINE uint32_t __get_FAULTMASK(void)
+{
+ register uint32_t __regFaultMask __ASM("faultmask");
+ return(__regFaultMask);
+}
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ register uint32_t __regFaultMask __ASM("faultmask");
+ __regFaultMask = (faultMask & (uint32_t)1U);
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+__STATIC_INLINE uint32_t __get_FPSCR(void)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+ register uint32_t __regfpscr __ASM("fpscr");
+ return(__regfpscr);
+#else
+ return(0U);
+#endif
+}
+
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+ register uint32_t __regfpscr __ASM("fpscr");
+ __regfpscr = (fpscr);
+#else
+ (void)fpscr;
+#endif
+}
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP __nop
+
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI __wfi
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE __wfe
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV __sev
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+#define __ISB() do {\
+ __schedule_barrier();\
+ __isb(0xF);\
+ __schedule_barrier();\
+ } while (0U)
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB() do {\
+ __schedule_barrier();\
+ __dsb(0xF);\
+ __schedule_barrier();\
+ } while (0U)
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+#define __DMB() do {\
+ __schedule_barrier();\
+ __dmb(0xF);\
+ __schedule_barrier();\
+ } while (0U)
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV __rev
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
+{
+ rev16 r0, r0
+ bx lr
+}
+#endif
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value)
+{
+ revsh r0, r0
+ bx lr
+}
+#endif
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+#define __ROR __ror
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __breakpoint(value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+ #define __RBIT __rbit
+#else
+__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
+{
+ uint32_t result;
+ uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
+
+ result = value; /* r will be reversed bits of v; first get LSB of v */
+ for (value >>= 1U; value != 0U; value >>= 1U)
+ {
+ result <<= 1U;
+ result |= value & 1U;
+ s--;
+ }
+ result <<= s; /* shift when v's highest bits are zero */
+ return result;
+}
+#endif
+
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+#define __CLZ __clz
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
+#else
+ #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
+#endif
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
+#else
+ #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
+#endif
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
+#else
+ #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
+#endif
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __STREXB(value, ptr) __strex(value, ptr)
+#else
+ #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
+#endif
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __STREXH(value, ptr) __strex(value, ptr)
+#else
+ #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
+#endif
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
+ #define __STREXW(value, ptr) __strex(value, ptr)
+#else
+ #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
+#endif
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+#define __CLREX __clrex
+
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT __ssat
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT __usat
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
+{
+ rrx r0, r0
+ bx lr
+}
+#endif
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+#define __STRBT(value, ptr) __strt(value, ptr)
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+#define __STRHT(value, ptr) __strt(value, ptr)
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+#define __STRT(value, ptr) __strt(value, ptr)
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
+
+#define __SADD8 __sadd8
+#define __QADD8 __qadd8
+#define __SHADD8 __shadd8
+#define __UADD8 __uadd8
+#define __UQADD8 __uqadd8
+#define __UHADD8 __uhadd8
+#define __SSUB8 __ssub8
+#define __QSUB8 __qsub8
+#define __SHSUB8 __shsub8
+#define __USUB8 __usub8
+#define __UQSUB8 __uqsub8
+#define __UHSUB8 __uhsub8
+#define __SADD16 __sadd16
+#define __QADD16 __qadd16
+#define __SHADD16 __shadd16
+#define __UADD16 __uadd16
+#define __UQADD16 __uqadd16
+#define __UHADD16 __uhadd16
+#define __SSUB16 __ssub16
+#define __QSUB16 __qsub16
+#define __SHSUB16 __shsub16
+#define __USUB16 __usub16
+#define __UQSUB16 __uqsub16
+#define __UHSUB16 __uhsub16
+#define __SASX __sasx
+#define __QASX __qasx
+#define __SHASX __shasx
+#define __UASX __uasx
+#define __UQASX __uqasx
+#define __UHASX __uhasx
+#define __SSAX __ssax
+#define __QSAX __qsax
+#define __SHSAX __shsax
+#define __USAX __usax
+#define __UQSAX __uqsax
+#define __UHSAX __uhsax
+#define __USAD8 __usad8
+#define __USADA8 __usada8
+#define __SSAT16 __ssat16
+#define __USAT16 __usat16
+#define __UXTB16 __uxtb16
+#define __UXTAB16 __uxtab16
+#define __SXTB16 __sxtb16
+#define __SXTAB16 __sxtab16
+#define __SMUAD __smuad
+#define __SMUADX __smuadx
+#define __SMLAD __smlad
+#define __SMLADX __smladx
+#define __SMLALD __smlald
+#define __SMLALDX __smlaldx
+#define __SMUSD __smusd
+#define __SMUSDX __smusdx
+#define __SMLSD __smlsd
+#define __SMLSDX __smlsdx
+#define __SMLSLD __smlsld
+#define __SMLSLDX __smlsldx
+#define __SEL __sel
+#define __QADD __qadd
+#define __QSUB __qsub
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
+ ((int64_t)(ARG3) << 32U) ) >> 32U))
+
+#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#endif /* __CMSIS_ARMCC_H */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang.h
new file mode 100644
index 0000000000..e917f357a3
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang.h
@@ -0,0 +1,1444 @@
+/**************************************************************************//**
+ * @file cmsis_armclang.h
+ * @brief CMSIS compiler armclang (Arm Compiler 6) header file
+ * @version V5.2.0
+ * @date 08. May 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+/*lint -esym(9058, IRQn)*/ /* disable MISRA 2012 Rule 2.4 for IRQn */
+
+#ifndef __CMSIS_ARMCLANG_H
+#define __CMSIS_ARMCLANG_H
+
+#pragma clang system_header /* treat file as system include file */
+
+#ifndef __ARM_COMPAT_H
+#include <arm_compat.h> /* Compatibility header for Arm Compiler 5 intrinsics */
+#endif
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE __inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static __inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __attribute__((always_inline)) static __inline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((__noreturn__))
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32 */
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT16_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_WRITE */
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT16_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_READ */
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_WRITE */
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_READ */
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+#ifndef __COMPILER_BARRIER
+ #define __COMPILER_BARRIER() __ASM volatile("":::"memory")
+#endif
+
+/* ######################### Startup and Lowlevel Init ######################## */
+
+#ifndef __PROGRAM_START
+#define __PROGRAM_START __main
+#endif
+
+#ifndef __INITIAL_SP
+#define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
+#endif
+
+#ifndef __STACK_LIMIT
+#define __STACK_LIMIT Image$$ARM_LIB_STACK$$ZI$$Base
+#endif
+
+#ifndef __VECTOR_TABLE
+#define __VECTOR_TABLE __Vectors
+#endif
+
+#ifndef __VECTOR_TABLE_ATTRIBUTE
+#define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section("RESET")))
+#endif
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __enable_irq(); see arm_compat.h */
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __disable_irq(); see arm_compat.h */
+
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Control Register (non-secure)
+ \details Returns the content of the non-secure Control Register when in secure mode.
+ \return non-secure Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Control Register (non-secure)
+ \details Writes the given value to the non-secure Control Register when in secure state.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
+{
+ __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
+}
+#endif
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_IPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_APSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_xPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSP(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, psp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSP(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, msp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );
+}
+#endif
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.
+ \return SP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Set Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.
+ \param [in] topOfStack Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
+{
+ __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Priority Mask (non-secure)
+ \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Priority Mask (non-secure)
+ \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
+}
+#endif
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq __enable_fiq /* see arm_compat.h */
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq __disable_fiq /* see arm_compat.h */
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Base Priority (non-secure)
+ \details Returns the current value of the non-secure Base Priority register when in secure state.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Base Priority (non-secure)
+ \details Assigns the given value to the non-secure Base Priority register when in secure state.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");
+}
+#endif
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Fault Mask (non-secure)
+ \details Returns the current value of the non-secure Fault Mask register when in secure state.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Fault Mask (non-secure)
+ \details Assigns the given value to the non-secure Fault Mask register when in secure state.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+/**
+ \brief Get Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, psplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
+#endif
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, msplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
+ \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
+ \param [in] MainStackPtrLimit Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#define __get_FPSCR (uint32_t)__builtin_arm_get_fpscr
+#else
+#define __get_FPSCR() ((uint32_t)0U)
+#endif
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#define __set_FPSCR __builtin_arm_set_fpscr
+#else
+#define __set_FPSCR(x) ((void)(x))
+#endif
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constraint "l"
+ * Otherwise, use general registers, specified by constraint "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_RW_REG(r) "+l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_RW_REG(r) "+r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP __builtin_arm_nop
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI __builtin_arm_wfi
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE __builtin_arm_wfe
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV __builtin_arm_sev
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+#define __ISB() __builtin_arm_isb(0xF)
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB() __builtin_arm_dsb(0xF)
+
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+#define __DMB() __builtin_arm_dmb(0xF)
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV(value) __builtin_bswap32(value)
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV16(value) __ROR(__REV(value), 16)
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REVSH(value) (int16_t)__builtin_bswap16(value)
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ op2 %= 32U;
+ if (op2 == 0U)
+ {
+ return op1;
+ }
+ return (op1 >> op2) | (op1 << (32U - op2));
+}
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __ASM volatile ("bkpt "#value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __RBIT __builtin_arm_rbit
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+__STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
+{
+ /* Even though __builtin_clz produces a CLZ instruction on ARM, formally
+ __builtin_clz(0) is undefined behaviour, so handle this case specially.
+ This guarantees ARM-compatible results if happening to compile on a non-ARM
+ target, and ensures the compiler doesn't decide to activate any
+ optimisations using the logic "value was passed to __builtin_clz, so it
+ is non-zero".
+ ARM Compiler 6.10 and possibly earlier will optimise this test away, leaving a
+ single CLZ instruction.
+ */
+ if (value == 0U)
+ {
+ return 32U;
+ }
+ return __builtin_clz(value);
+}
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDREXB (uint8_t)__builtin_arm_ldrex
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDREXH (uint16_t)__builtin_arm_ldrex
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDREXW (uint32_t)__builtin_arm_ldrex
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXB (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXH (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXW (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+#define __CLREX __builtin_arm_clrex
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT __builtin_arm_ssat
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT __builtin_arm_usat
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+}
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
+}
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief Load-Acquire (8 bit)
+ \details Executes a LDAB instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (16 bit)
+ \details Executes a LDAH instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (32 bit)
+ \details Executes a LDA instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release (8 bit)
+ \details Executes a STLB instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (16 bit)
+ \details Executes a STLH instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (32 bit)
+ \details Executes a STL instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (8 bit)
+ \details Executes a LDAB exclusive instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDAEXB (uint8_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Load-Acquire Exclusive (16 bit)
+ \details Executes a LDAH exclusive instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDAEXH (uint16_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Load-Acquire Exclusive (32 bit)
+ \details Executes a LDA exclusive instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDAEX (uint32_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Store-Release Exclusive (8 bit)
+ \details Executes a STLB exclusive instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEXB (uint32_t)__builtin_arm_stlex
+
+
+/**
+ \brief Store-Release Exclusive (16 bit)
+ \details Executes a STLH exclusive instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEXH (uint32_t)__builtin_arm_stlex
+
+
+/**
+ \brief Store-Release Exclusive (32 bit)
+ \details Executes a STL exclusive instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEX (uint32_t)__builtin_arm_stlex
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
+
+#define __SADD8 __builtin_arm_sadd8
+#define __QADD8 __builtin_arm_qadd8
+#define __SHADD8 __builtin_arm_shadd8
+#define __UADD8 __builtin_arm_uadd8
+#define __UQADD8 __builtin_arm_uqadd8
+#define __UHADD8 __builtin_arm_uhadd8
+#define __SSUB8 __builtin_arm_ssub8
+#define __QSUB8 __builtin_arm_qsub8
+#define __SHSUB8 __builtin_arm_shsub8
+#define __USUB8 __builtin_arm_usub8
+#define __UQSUB8 __builtin_arm_uqsub8
+#define __UHSUB8 __builtin_arm_uhsub8
+#define __SADD16 __builtin_arm_sadd16
+#define __QADD16 __builtin_arm_qadd16
+#define __SHADD16 __builtin_arm_shadd16
+#define __UADD16 __builtin_arm_uadd16
+#define __UQADD16 __builtin_arm_uqadd16
+#define __UHADD16 __builtin_arm_uhadd16
+#define __SSUB16 __builtin_arm_ssub16
+#define __QSUB16 __builtin_arm_qsub16
+#define __SHSUB16 __builtin_arm_shsub16
+#define __USUB16 __builtin_arm_usub16
+#define __UQSUB16 __builtin_arm_uqsub16
+#define __UHSUB16 __builtin_arm_uhsub16
+#define __SASX __builtin_arm_sasx
+#define __QASX __builtin_arm_qasx
+#define __SHASX __builtin_arm_shasx
+#define __UASX __builtin_arm_uasx
+#define __UQASX __builtin_arm_uqasx
+#define __UHASX __builtin_arm_uhasx
+#define __SSAX __builtin_arm_ssax
+#define __QSAX __builtin_arm_qsax
+#define __SHSAX __builtin_arm_shsax
+#define __USAX __builtin_arm_usax
+#define __UQSAX __builtin_arm_uqsax
+#define __UHSAX __builtin_arm_uhsax
+#define __USAD8 __builtin_arm_usad8
+#define __USADA8 __builtin_arm_usada8
+#define __SSAT16 __builtin_arm_ssat16
+#define __USAT16 __builtin_arm_usat16
+#define __UXTB16 __builtin_arm_uxtb16
+#define __UXTAB16 __builtin_arm_uxtab16
+#define __SXTB16 __builtin_arm_sxtb16
+#define __SXTAB16 __builtin_arm_sxtab16
+#define __SMUAD __builtin_arm_smuad
+#define __SMUADX __builtin_arm_smuadx
+#define __SMLAD __builtin_arm_smlad
+#define __SMLADX __builtin_arm_smladx
+#define __SMLALD __builtin_arm_smlald
+#define __SMLALDX __builtin_arm_smlaldx
+#define __SMUSD __builtin_arm_smusd
+#define __SMUSDX __builtin_arm_smusdx
+#define __SMLSD __builtin_arm_smlsd
+#define __SMLSDX __builtin_arm_smlsdx
+#define __SMLSLD __builtin_arm_smlsld
+#define __SMLSLDX __builtin_arm_smlsldx
+#define __SEL __builtin_arm_sel
+#define __QADD __builtin_arm_qadd
+#define __QSUB __builtin_arm_qsub
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
+{
+ int32_t result;
+
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#endif /* (__ARM_FEATURE_DSP == 1) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#endif /* __CMSIS_ARMCLANG_H */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang_ltm.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang_ltm.h
new file mode 100644
index 0000000000..feec324059
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_armclang_ltm.h
@@ -0,0 +1,1891 @@
+/**************************************************************************//**
+ * @file cmsis_armclang_ltm.h
+ * @brief CMSIS compiler armclang (Arm Compiler 6) header file
+ * @version V1.2.0
+ * @date 08. May 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2018-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+/*lint -esym(9058, IRQn)*/ /* disable MISRA 2012 Rule 2.4 for IRQn */
+
+#ifndef __CMSIS_ARMCLANG_H
+#define __CMSIS_ARMCLANG_H
+
+#pragma clang system_header /* treat file as system include file */
+
+#ifndef __ARM_COMPAT_H
+#include <arm_compat.h> /* Compatibility header for Arm Compiler 5 intrinsics */
+#endif
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE __inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static __inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __attribute__((always_inline)) static __inline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((__noreturn__))
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32 */
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT16_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_WRITE */
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT16_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_READ */
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_WRITE */
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wpacked"
+/*lint -esym(9058, T_UINT32_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_READ */
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #pragma clang diagnostic pop
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+#ifndef __COMPILER_BARRIER
+ #define __COMPILER_BARRIER() __ASM volatile("":::"memory")
+#endif
+
+/* ######################### Startup and Lowlevel Init ######################## */
+
+#ifndef __PROGRAM_START
+#define __PROGRAM_START __main
+#endif
+
+#ifndef __INITIAL_SP
+#define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
+#endif
+
+#ifndef __STACK_LIMIT
+#define __STACK_LIMIT Image$$ARM_LIB_STACK$$ZI$$Base
+#endif
+
+#ifndef __VECTOR_TABLE
+#define __VECTOR_TABLE __Vectors
+#endif
+
+#ifndef __VECTOR_TABLE_ATTRIBUTE
+#define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section("RESET")))
+#endif
+
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __enable_irq(); see arm_compat.h */
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+/* intrinsic void __disable_irq(); see arm_compat.h */
+
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Control Register (non-secure)
+ \details Returns the content of the non-secure Control Register when in secure mode.
+ \return non-secure Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Control Register (non-secure)
+ \details Writes the given value to the non-secure Control Register when in secure state.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
+{
+ __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
+}
+#endif
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_IPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_APSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_xPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSP(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, psp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSP(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, msp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );
+}
+#endif
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.
+ \return SP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Set Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.
+ \param [in] topOfStack Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
+{
+ __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Priority Mask (non-secure)
+ \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Priority Mask (non-secure)
+ \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
+}
+#endif
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq __enable_fiq /* see arm_compat.h */
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq __disable_fiq /* see arm_compat.h */
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Base Priority (non-secure)
+ \details Returns the current value of the non-secure Base Priority register when in secure state.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Base Priority (non-secure)
+ \details Assigns the given value to the non-secure Base Priority register when in secure state.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");
+}
+#endif
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Fault Mask (non-secure)
+ \details Returns the current value of the non-secure Fault Mask register when in secure state.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Fault Mask (non-secure)
+ \details Assigns the given value to the non-secure Fault Mask register when in secure state.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+/**
+ \brief Get Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, psplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
+#endif
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, msplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
+ \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
+ \param [in] MainStackPtrLimit Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#define __get_FPSCR (uint32_t)__builtin_arm_get_fpscr
+#else
+#define __get_FPSCR() ((uint32_t)0U)
+#endif
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#define __set_FPSCR __builtin_arm_set_fpscr
+#else
+#define __set_FPSCR(x) ((void)(x))
+#endif
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constraint "l"
+ * Otherwise, use general registers, specified by constraint "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP __builtin_arm_nop
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI __builtin_arm_wfi
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE __builtin_arm_wfe
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV __builtin_arm_sev
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+#define __ISB() __builtin_arm_isb(0xF)
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB() __builtin_arm_dsb(0xF)
+
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+#define __DMB() __builtin_arm_dmb(0xF)
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV(value) __builtin_bswap32(value)
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV16(value) __ROR(__REV(value), 16)
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REVSH(value) (int16_t)__builtin_bswap16(value)
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ op2 %= 32U;
+ if (op2 == 0U)
+ {
+ return op1;
+ }
+ return (op1 >> op2) | (op1 << (32U - op2));
+}
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __ASM volatile ("bkpt "#value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __RBIT __builtin_arm_rbit
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+__STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
+{
+ /* Even though __builtin_clz produces a CLZ instruction on ARM, formally
+ __builtin_clz(0) is undefined behaviour, so handle this case specially.
+ This guarantees ARM-compatible results if happening to compile on a non-ARM
+ target, and ensures the compiler doesn't decide to activate any
+ optimisations using the logic "value was passed to __builtin_clz, so it
+ is non-zero".
+ ARM Compiler 6.10 and possibly earlier will optimise this test away, leaving a
+ single CLZ instruction.
+ */
+ if (value == 0U)
+ {
+ return 32U;
+ }
+ return __builtin_clz(value);
+}
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDREXB (uint8_t)__builtin_arm_ldrex
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDREXH (uint16_t)__builtin_arm_ldrex
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDREXW (uint32_t)__builtin_arm_ldrex
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXB (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXH (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXW (uint32_t)__builtin_arm_strex
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+#define __CLREX __builtin_arm_clrex
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT __builtin_arm_ssat
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT __builtin_arm_usat
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+}
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
+}
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief Load-Acquire (8 bit)
+ \details Executes a LDAB instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (16 bit)
+ \details Executes a LDAH instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (32 bit)
+ \details Executes a LDA instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release (8 bit)
+ \details Executes a STLB instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (16 bit)
+ \details Executes a STLH instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (32 bit)
+ \details Executes a STL instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (8 bit)
+ \details Executes a LDAB exclusive instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDAEXB (uint8_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Load-Acquire Exclusive (16 bit)
+ \details Executes a LDAH exclusive instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDAEXH (uint16_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Load-Acquire Exclusive (32 bit)
+ \details Executes a LDA exclusive instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDAEX (uint32_t)__builtin_arm_ldaex
+
+
+/**
+ \brief Store-Release Exclusive (8 bit)
+ \details Executes a STLB exclusive instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEXB (uint32_t)__builtin_arm_stlex
+
+
+/**
+ \brief Store-Release Exclusive (16 bit)
+ \details Executes a STLH exclusive instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEXH (uint32_t)__builtin_arm_stlex
+
+
+/**
+ \brief Store-Release Exclusive (32 bit)
+ \details Executes a STL exclusive instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STLEX (uint32_t)__builtin_arm_stlex
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
+
+__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#define __SSAT16(ARG1,ARG2) \
+({ \
+ int32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+#define __USAT16(ARG1,ARG2) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
+{
+ int32_t result;
+
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#endif /* (__ARM_FEATURE_DSP == 1) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#endif /* __CMSIS_ARMCLANG_H */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_compiler.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_compiler.h
new file mode 100644
index 0000000000..adbf296f15
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_compiler.h
@@ -0,0 +1,283 @@
+/**************************************************************************//**
+ * @file cmsis_compiler.h
+ * @brief CMSIS compiler generic header file
+ * @version V5.1.0
+ * @date 09. October 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 __CMSIS_COMPILER_H
+#define __CMSIS_COMPILER_H
+
+#include <stdint.h>
+
+/*
+ * Arm Compiler 4/5
+ */
+#if defined ( __CC_ARM )
+ #include "cmsis_armcc.h"
+
+
+/*
+ * Arm Compiler 6.6 LTM (armclang)
+ */
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100)
+ #include "cmsis_armclang_ltm.h"
+
+ /*
+ * Arm Compiler above 6.10.1 (armclang)
+ */
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
+ #include "cmsis_armclang.h"
+
+
+/*
+ * GNU Compiler
+ */
+#elif defined ( __GNUC__ )
+ #include "cmsis_gcc.h"
+
+
+/*
+ * IAR Compiler
+ */
+#elif defined ( __ICCARM__ )
+ #include <cmsis_iccarm.h>
+
+
+/*
+ * TI Arm Compiler
+ */
+#elif defined ( __TI_ARM__ )
+ #include <cmsis_ccs.h>
+
+ #ifndef __ASM
+ #define __ASM __asm
+ #endif
+ #ifndef __INLINE
+ #define __INLINE inline
+ #endif
+ #ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+ #endif
+ #ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __STATIC_INLINE
+ #endif
+ #ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((noreturn))
+ #endif
+ #ifndef __USED
+ #define __USED __attribute__((used))
+ #endif
+ #ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+ #endif
+ #ifndef __PACKED
+ #define __PACKED __attribute__((packed))
+ #endif
+ #ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed))
+ #endif
+ #ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed))
+ #endif
+ #ifndef __UNALIGNED_UINT32 /* deprecated */
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT16_WRITE
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT16_READ
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT32_WRITE
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT32_READ
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+ #endif
+ #ifndef __RESTRICT
+ #define __RESTRICT __restrict
+ #endif
+ #ifndef __COMPILER_BARRIER
+ #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
+ #define __COMPILER_BARRIER() (void)0
+ #endif
+
+
+/*
+ * TASKING Compiler
+ */
+#elif defined ( __TASKING__ )
+ /*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all intrinsics,
+ * Including the CMSIS ones.
+ */
+
+ #ifndef __ASM
+ #define __ASM __asm
+ #endif
+ #ifndef __INLINE
+ #define __INLINE inline
+ #endif
+ #ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+ #endif
+ #ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __STATIC_INLINE
+ #endif
+ #ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((noreturn))
+ #endif
+ #ifndef __USED
+ #define __USED __attribute__((used))
+ #endif
+ #ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+ #endif
+ #ifndef __PACKED
+ #define __PACKED __packed__
+ #endif
+ #ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __packed__
+ #endif
+ #ifndef __PACKED_UNION
+ #define __PACKED_UNION union __packed__
+ #endif
+ #ifndef __UNALIGNED_UINT32 /* deprecated */
+ struct __packed__ T_UINT32 { uint32_t v; };
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT16_WRITE
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT16_READ
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT32_WRITE
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT32_READ
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __ALIGNED
+ #define __ALIGNED(x) __align(x)
+ #endif
+ #ifndef __RESTRICT
+ #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
+ #define __RESTRICT
+ #endif
+ #ifndef __COMPILER_BARRIER
+ #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
+ #define __COMPILER_BARRIER() (void)0
+ #endif
+
+
+/*
+ * COSMIC Compiler
+ */
+#elif defined ( __CSMC__ )
+ #include <cmsis_csm.h>
+
+ #ifndef __ASM
+ #define __ASM _asm
+ #endif
+ #ifndef __INLINE
+ #define __INLINE inline
+ #endif
+ #ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+ #endif
+ #ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __STATIC_INLINE
+ #endif
+ #ifndef __NO_RETURN
+ // NO RETURN is automatically detected hence no warning here
+ #define __NO_RETURN
+ #endif
+ #ifndef __USED
+ #warning No compiler specific solution for __USED. __USED is ignored.
+ #define __USED
+ #endif
+ #ifndef __WEAK
+ #define __WEAK __weak
+ #endif
+ #ifndef __PACKED
+ #define __PACKED @packed
+ #endif
+ #ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT @packed struct
+ #endif
+ #ifndef __PACKED_UNION
+ #define __PACKED_UNION @packed union
+ #endif
+ #ifndef __UNALIGNED_UINT32 /* deprecated */
+ @packed struct T_UINT32 { uint32_t v; };
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT16_WRITE
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT16_READ
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __UNALIGNED_UINT32_WRITE
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+ #endif
+ #ifndef __UNALIGNED_UINT32_READ
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+ #endif
+ #ifndef __ALIGNED
+ #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
+ #define __ALIGNED(x)
+ #endif
+ #ifndef __RESTRICT
+ #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
+ #define __RESTRICT
+ #endif
+ #ifndef __COMPILER_BARRIER
+ #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
+ #define __COMPILER_BARRIER() (void)0
+ #endif
+
+
+#else
+ #error Unknown compiler.
+#endif
+
+
+#endif /* __CMSIS_COMPILER_H */
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_gcc.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_gcc.h
new file mode 100644
index 0000000000..3ddcc58b69
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_gcc.h
@@ -0,0 +1,2168 @@
+/**************************************************************************//**
+ * @file cmsis_gcc.h
+ * @brief CMSIS compiler GCC header file
+ * @version V5.2.0
+ * @date 08. May 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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 __CMSIS_GCC_H
+#define __CMSIS_GCC_H
+
+/* ignore some GCC warnings */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
+/* Fallback for __has_builtin */
+#ifndef __has_builtin
+ #define __has_builtin(x) (0)
+#endif
+
+/* CMSIS compiler specific defines */
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+#ifndef __INLINE
+ #define __INLINE inline
+#endif
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+#endif
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline
+#endif
+#ifndef __NO_RETURN
+ #define __NO_RETURN __attribute__((__noreturn__))
+#endif
+#ifndef __USED
+ #define __USED __attribute__((used))
+#endif
+#ifndef __WEAK
+ #define __WEAK __attribute__((weak))
+#endif
+#ifndef __PACKED
+ #define __PACKED __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_STRUCT
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+#endif
+#ifndef __PACKED_UNION
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+#endif
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ struct __attribute__((packed)) T_UINT32 { uint32_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
+#endif
+#ifndef __UNALIGNED_UINT16_WRITE
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT16_READ
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __UNALIGNED_UINT32_WRITE
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
+#endif
+#ifndef __UNALIGNED_UINT32_READ
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpacked"
+ #pragma GCC diagnostic ignored "-Wattributes"
+ __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
+ #pragma GCC diagnostic pop
+ #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
+#endif
+#ifndef __ALIGNED
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+#endif
+#ifndef __RESTRICT
+ #define __RESTRICT __restrict
+#endif
+#ifndef __COMPILER_BARRIER
+ #define __COMPILER_BARRIER() __ASM volatile("":::"memory")
+#endif
+
+/* ######################### Startup and Lowlevel Init ######################## */
+
+#ifndef __PROGRAM_START
+
+/**
+ \brief Initializes data and bss sections
+ \details This default implementations initialized all data and additional bss
+ sections relying on .copy.table and .zero.table specified properly
+ in the used linker script.
+
+ */
+__STATIC_FORCEINLINE __NO_RETURN void __cmsis_start(void)
+{
+ extern void _start(void) __NO_RETURN;
+
+ typedef struct {
+ uint32_t const* src;
+ uint32_t* dest;
+ uint32_t wlen;
+ } __copy_table_t;
+
+ typedef struct {
+ uint32_t* dest;
+ uint32_t wlen;
+ } __zero_table_t;
+
+ extern const __copy_table_t __copy_table_start__;
+ extern const __copy_table_t __copy_table_end__;
+ extern const __zero_table_t __zero_table_start__;
+ extern const __zero_table_t __zero_table_end__;
+
+ for (__copy_table_t const* pTable = &__copy_table_start__; pTable < &__copy_table_end__; ++pTable) {
+ for(uint32_t i=0u; i<pTable->wlen; ++i) {
+ pTable->dest[i] = pTable->src[i];
+ }
+ }
+
+ for (__zero_table_t const* pTable = &__zero_table_start__; pTable < &__zero_table_end__; ++pTable) {
+ for(uint32_t i=0u; i<pTable->wlen; ++i) {
+ pTable->dest[i] = 0u;
+ }
+ }
+
+ _start();
+}
+
+#define __PROGRAM_START __cmsis_start
+#endif
+
+#ifndef __INITIAL_SP
+#define __INITIAL_SP __StackTop
+#endif
+
+#ifndef __STACK_LIMIT
+#define __STACK_LIMIT __StackLimit
+#endif
+
+#ifndef __VECTOR_TABLE
+#define __VECTOR_TABLE __Vectors
+#endif
+
+#ifndef __VECTOR_TABLE_ATTRIBUTE
+#define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section(".vectors")))
+#endif
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+/**
+ \brief Enable IRQ Interrupts
+ \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __enable_irq(void)
+{
+ __ASM volatile ("cpsie i" : : : "memory");
+}
+
+
+/**
+ \brief Disable IRQ Interrupts
+ \details Disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __disable_irq(void)
+{
+ __ASM volatile ("cpsid i" : : : "memory");
+}
+
+
+/**
+ \brief Get Control Register
+ \details Returns the content of the Control Register.
+ \return Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Control Register (non-secure)
+ \details Returns the content of the non-secure Control Register when in secure mode.
+ \return non-secure Control Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Control Register
+ \details Writes the given value to the Control Register.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Control Register (non-secure)
+ \details Writes the given value to the non-secure Control Register when in secure state.
+ \param [in] control Control Register value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
+{
+ __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
+}
+#endif
+
+
+/**
+ \brief Get IPSR Register
+ \details Returns the content of the IPSR Register.
+ \return IPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_IPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get APSR Register
+ \details Returns the content of the APSR Register.
+ \return APSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_APSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get xPSR Register
+ \details Returns the content of the xPSR Register.
+ \return xPSR Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_xPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Get Process Stack Pointer
+ \details Returns the current value of the Process Stack Pointer (PSP).
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSP(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, psp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
+ \return PSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer
+ \details Assigns the given value to the Process Stack Pointer (PSP).
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer
+ \details Returns the current value of the Main Stack Pointer (MSP).
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSP(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, msp" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
+ \return MSP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer
+ \details Assigns the given value to the Main Stack Pointer (MSP).
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );
+}
+#endif
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Stack Pointer (non-secure)
+ \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.
+ \return SP Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );
+ return(result);
+}
+
+
+/**
+ \brief Set Stack Pointer (non-secure)
+ \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.
+ \param [in] topOfStack Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
+{
+ __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );
+}
+#endif
+
+
+/**
+ \brief Get Priority Mask
+ \details Returns the current state of the priority mask bit from the Priority Mask Register.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) :: "memory");
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Priority Mask (non-secure)
+ \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
+ \return Priority Mask value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask_ns" : "=r" (result) :: "memory");
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Priority Mask
+ \details Assigns the given value to the Priority Mask Register.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Priority Mask (non-secure)
+ \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
+ \param [in] priMask Priority Mask
+ */
+__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
+}
+#endif
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Enable FIQ
+ \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __enable_fault_irq(void)
+{
+ __ASM volatile ("cpsie f" : : : "memory");
+}
+
+
+/**
+ \brief Disable FIQ
+ \details Disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__STATIC_FORCEINLINE void __disable_fault_irq(void)
+{
+ __ASM volatile ("cpsid f" : : : "memory");
+}
+
+
+/**
+ \brief Get Base Priority
+ \details Returns the current value of the Base Priority register.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Base Priority (non-secure)
+ \details Returns the current value of the non-secure Base Priority register when in secure state.
+ \return Base Priority register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Base Priority
+ \details Assigns the given value to the Base Priority register.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Base Priority (non-secure)
+ \details Assigns the given value to the non-secure Base Priority register when in secure state.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");
+}
+#endif
+
+
+/**
+ \brief Set Base Priority with condition
+ \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
+ or the new value increases the BASEPRI priority level.
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
+{
+ __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");
+}
+
+
+/**
+ \brief Get Fault Mask
+ \details Returns the current value of the Fault Mask register.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+ return(result);
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Fault Mask (non-secure)
+ \details Returns the current value of the non-secure Fault Mask register when in secure state.
+ \return Fault Mask register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
+ return(result);
+}
+#endif
+
+
+/**
+ \brief Set Fault Mask
+ \details Assigns the given value to the Fault Mask register.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Fault Mask (non-secure)
+ \details Assigns the given value to the non-secure Fault Mask register when in secure state.
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+/**
+ \brief Get Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, psplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Process Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \return PSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Process Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Process Stack Pointer (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
+ \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)ProcStackPtrLimit;
+#else
+ __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
+#endif
+}
+#endif
+
+
+/**
+ \brief Get Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always in non-secure
+ mode.
+
+ \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, msplim" : "=r" (result) );
+ return result;
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Get Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence zero is returned always.
+
+ \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
+ \return MSPLIM Register value
+ */
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ return 0U;
+#else
+ uint32_t result;
+ __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
+ return result;
+#endif
+}
+#endif
+
+
+/**
+ \brief Set Main Stack Pointer Limit
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored in non-secure
+ mode.
+
+ \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
+ \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
+ */
+__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+
+
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
+/**
+ \brief Set Main Stack Pointer Limit (non-secure)
+ Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
+ Stack Pointer Limit register hence the write is silently ignored.
+
+ \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
+ \param [in] MainStackPtrLimit Main Stack Pointer value to set
+ */
+__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
+{
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)MainStackPtrLimit;
+#else
+ __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
+#endif
+}
+#endif
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+/**
+ \brief Get FPSCR
+ \details Returns the current value of the Floating Point Status/Control register.
+ \return Floating Point Status/Control register value
+ */
+__STATIC_FORCEINLINE uint32_t __get_FPSCR(void)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#if __has_builtin(__builtin_arm_get_fpscr)
+// Re-enable using built-in when GCC has been fixed
+// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2)
+ /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */
+ return __builtin_arm_get_fpscr();
+#else
+ uint32_t result;
+
+ __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
+ return(result);
+#endif
+#else
+ return(0U);
+#endif
+}
+
+
+/**
+ \brief Set FPSCR
+ \details Assigns the given value to the Floating Point Status/Control register.
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+#if __has_builtin(__builtin_arm_set_fpscr)
+// Re-enable using built-in when GCC has been fixed
+// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2)
+ /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */
+ __builtin_arm_set_fpscr(fpscr);
+#else
+ __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory");
+#endif
+#else
+ (void)fpscr;
+#endif
+}
+
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constraint "l"
+ * Otherwise, use general registers, specified by constraint "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_RW_REG(r) "+l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_RW_REG(r) "+r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/**
+ \brief No Operation
+ \details No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP() __ASM volatile ("nop")
+
+/**
+ \brief Wait For Interrupt
+ \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
+ */
+#define __WFI() __ASM volatile ("wfi")
+
+
+/**
+ \brief Wait For Event
+ \details Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE() __ASM volatile ("wfe")
+
+
+/**
+ \brief Send Event
+ \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV() __ASM volatile ("sev")
+
+
+/**
+ \brief Instruction Synchronization Barrier
+ \details Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or memory,
+ after the instruction has been completed.
+ */
+__STATIC_FORCEINLINE void __ISB(void)
+{
+ __ASM volatile ("isb 0xF":::"memory");
+}
+
+
+/**
+ \brief Data Synchronization Barrier
+ \details Acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+__STATIC_FORCEINLINE void __DSB(void)
+{
+ __ASM volatile ("dsb 0xF":::"memory");
+}
+
+
+/**
+ \brief Data Memory Barrier
+ \details Ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+__STATIC_FORCEINLINE void __DMB(void)
+{
+ __ASM volatile ("dmb 0xF":::"memory");
+}
+
+
+/**
+ \brief Reverse byte order (32 bit)
+ \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE uint32_t __REV(uint32_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+ return __builtin_bswap32(value);
+#else
+ uint32_t result;
+
+ __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return result;
+#endif
+}
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return result;
+}
+
+
+/**
+ \brief Reverse byte order (16 bit)
+ \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE int16_t __REVSH(int16_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ return (int16_t)__builtin_bswap16(value);
+#else
+ int16_t result;
+
+ __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return result;
+#endif
+}
+
+
+/**
+ \brief Rotate Right in unsigned value (32 bit)
+ \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+ \param [in] op1 Value to rotate
+ \param [in] op2 Number of Bits to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ op2 %= 32U;
+ if (op2 == 0U)
+ {
+ return op1;
+ }
+ return (op1 >> op2) | (op1 << (32U - op2));
+}
+
+
+/**
+ \brief Breakpoint
+ \details Causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __ASM volatile ("bkpt "#value)
+
+
+/**
+ \brief Reverse bit order of value
+ \details Reverses the bit order of the given value.
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value)
+{
+ uint32_t result;
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+ __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
+#else
+ uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
+
+ result = value; /* r will be reversed bits of v; first get LSB of v */
+ for (value >>= 1U; value != 0U; value >>= 1U)
+ {
+ result <<= 1U;
+ result |= value & 1U;
+ s--;
+ }
+ result <<= s; /* shift when v's highest bits are zero */
+#endif
+ return result;
+}
+
+
+/**
+ \brief Count leading zeros
+ \details Counts the number of leading zeros of a data value.
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+__STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
+{
+ /* Even though __builtin_clz produces a CLZ instruction on ARM, formally
+ __builtin_clz(0) is undefined behaviour, so handle this case specially.
+ This guarantees ARM-compatible results if happening to compile on a non-ARM
+ target, and ensures the compiler doesn't decide to activate any
+ optimisations using the logic "value was passed to __builtin_clz, so it
+ is non-zero".
+ ARM GCC 7.3 and possibly earlier will optimise this test away, leaving a
+ single CLZ instruction.
+ */
+ if (value == 0U)
+ {
+ return 32U;
+ }
+ return __builtin_clz(value);
+}
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief LDR Exclusive (8 bit)
+ \details Executes a exclusive LDR instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDR Exclusive (16 bit)
+ \details Executes a exclusive LDR instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDR Exclusive (32 bit)
+ \details Executes a exclusive LDR instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
+ return(result);
+}
+
+
+/**
+ \brief STR Exclusive (8 bit)
+ \details Executes a exclusive STR instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief STR Exclusive (16 bit)
+ \details Executes a exclusive STR instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief STR Exclusive (32 bit)
+ \details Executes a exclusive STR instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+ return(result);
+}
+
+
+/**
+ \brief Remove the exclusive lock
+ \details Removes the exclusive lock which is created by LDREX.
+ */
+__STATIC_FORCEINLINE void __CLREX(void)
+{
+ __ASM volatile ("clrex" ::: "memory");
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] ARG1 Value to be saturated
+ \param [in] ARG2 Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT(ARG1,ARG2) \
+__extension__ \
+({ \
+ int32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] ARG1 Value to be saturated
+ \param [in] ARG2 Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT(ARG1,ARG2) \
+ __extension__ \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+
+/**
+ \brief Rotate Right with Extend (32 bit)
+ \details Moves each bit of a bitstring right by one bit.
+ The carry input is shifted in at the left end of the bitstring.
+ \param [in] value Value to rotate
+ \return Rotated value
+ */
+__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+}
+
+
+/**
+ \brief LDRT Unprivileged (8 bit)
+ \details Executes a Unprivileged LDRT instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" );
+#endif
+ return ((uint8_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (16 bit)
+ \details Executes a Unprivileged LDRT instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" );
+#endif
+ return ((uint16_t) result); /* Add explicit type cast here */
+}
+
+
+/**
+ \brief LDRT Unprivileged (32 bit)
+ \details Executes a Unprivileged LDRT instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief STRT Unprivileged (8 bit)
+ \details Executes a Unprivileged STRT instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (16 bit)
+ \details Executes a Unprivileged STRT instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief STRT Unprivileged (32 bit)
+ \details Executes a Unprivileged STRT instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
+}
+
+#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+/**
+ \brief Signed Saturate
+ \details Saturates a signed value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
+{
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+}
+
+/**
+ \brief Unsigned Saturate
+ \details Saturates an unsigned value.
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
+{
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+}
+
+#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
+ (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
+ (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
+
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+/**
+ \brief Load-Acquire (8 bit)
+ \details Executes a LDAB instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (16 bit)
+ \details Executes a LDAH instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire (32 bit)
+ \details Executes a LDA instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release (8 bit)
+ \details Executes a STLB instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
+{
+ __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (16 bit)
+ \details Executes a STLH instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
+{
+ __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Store-Release (32 bit)
+ \details Executes a STL instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ */
+__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
+{
+ __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (8 bit)
+ \details Executes a LDAB exclusive instruction for 8 bit value.
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint8_t) result);
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (16 bit)
+ \details Executes a LDAH exclusive instruction for 16 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return ((uint16_t) result);
+}
+
+
+/**
+ \brief Load-Acquire Exclusive (32 bit)
+ \details Executes a LDA exclusive instruction for 32 bit values.
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release Exclusive (8 bit)
+ \details Executes a STLB exclusive instruction for 8 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release Exclusive (16 bit)
+ \details Executes a STLH exclusive instruction for 16 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+
+/**
+ \brief Store-Release Exclusive (32 bit)
+ \details Executes a STL exclusive instruction for 32 bit values.
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)
+{
+ uint32_t result;
+
+ __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );
+ return(result);
+}
+
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+
+/* ################### Compiler specific Intrinsics ########################### */
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
+ Access to dedicated SIMD instructions
+ @{
+*/
+
+#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
+
+__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+
+__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#define __SSAT16(ARG1,ARG2) \
+({ \
+ int32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+#define __USAT16(ARG1,ARG2) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
+{
+ uint32_t result;
+
+ __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
+{
+ union llreg_u{
+ uint32_t w32[2];
+ uint64_t w64;
+ } llr;
+ llr.w64 = acc;
+
+#ifndef __ARMEB__ /* Little endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
+#else /* Big endian */
+ __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
+#endif
+
+ return(llr.w64);
+}
+
+__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
+{
+ uint32_t result;
+
+ __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2)
+{
+ int32_t result;
+
+ __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
+ return(result);
+}
+
+#if 0
+#define __PKHBT(ARG1,ARG2,ARG3) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+ __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
+ __RES; \
+ })
+
+#define __PKHTB(ARG1,ARG2,ARG3) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
+ if (ARG3 == 0) \
+ __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
+ else \
+ __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
+ __RES; \
+ })
+#endif
+
+#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
+ ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
+
+#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
+ ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
+
+__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
+{
+ int32_t result;
+
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
+ return(result);
+}
+
+#endif /* (__ARM_FEATURE_DSP == 1) */
+/*@} end of group CMSIS_SIMD_intrinsics */
+
+
+#pragma GCC diagnostic pop
+
+#endif /* __CMSIS_GCC_H */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_iccarm.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_iccarm.h
new file mode 100644
index 0000000000..12d68fd9a6
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_iccarm.h
@@ -0,0 +1,964 @@
+/**************************************************************************//**
+ * @file cmsis_iccarm.h
+ * @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file
+ * @version V5.1.0
+ * @date 08. May 2019
+ ******************************************************************************/
+
+//------------------------------------------------------------------------------
+//
+// Copyright (c) 2017-2019 IAR Systems
+// Copyright (c) 2017-2019 Arm Limited. All rights reserved.
+//
+// Licensed 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 __CMSIS_ICCARM_H__
+#define __CMSIS_ICCARM_H__
+
+#ifndef __ICCARM__
+ #error This file should only be compiled by ICCARM
+#endif
+
+#pragma system_include
+
+#define __IAR_FT _Pragma("inline=forced") __intrinsic
+
+#if (__VER__ >= 8000000)
+ #define __ICCARM_V8 1
+#else
+ #define __ICCARM_V8 0
+#endif
+
+#ifndef __ALIGNED
+ #if __ICCARM_V8
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+ #elif (__VER__ >= 7080000)
+ /* Needs IAR language extensions */
+ #define __ALIGNED(x) __attribute__((aligned(x)))
+ #else
+ #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored.
+ #define __ALIGNED(x)
+ #endif
+#endif
+
+
+/* Define compiler macros for CPU architecture, used in CMSIS 5.
+ */
+#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__ || __ARM_ARCH_8M_BASE__ || __ARM_ARCH_8M_MAIN__
+/* Macros already defined */
+#else
+ #if defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__)
+ #define __ARM_ARCH_8M_MAIN__ 1
+ #elif defined(__ARM8M_BASELINE__)
+ #define __ARM_ARCH_8M_BASE__ 1
+ #elif defined(__ARM_ARCH_PROFILE) && __ARM_ARCH_PROFILE == 'M'
+ #if __ARM_ARCH == 6
+ #define __ARM_ARCH_6M__ 1
+ #elif __ARM_ARCH == 7
+ #if __ARM_FEATURE_DSP
+ #define __ARM_ARCH_7EM__ 1
+ #else
+ #define __ARM_ARCH_7M__ 1
+ #endif
+ #endif /* __ARM_ARCH */
+ #endif /* __ARM_ARCH_PROFILE == 'M' */
+#endif
+
+/* Alternativ core deduction for older ICCARM's */
+#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__) && \
+ !defined(__ARM_ARCH_8M_BASE__) && !defined(__ARM_ARCH_8M_MAIN__)
+ #if defined(__ARM6M__) && (__CORE__ == __ARM6M__)
+ #define __ARM_ARCH_6M__ 1
+ #elif defined(__ARM7M__) && (__CORE__ == __ARM7M__)
+ #define __ARM_ARCH_7M__ 1
+ #elif defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)
+ #define __ARM_ARCH_7EM__ 1
+ #elif defined(__ARM8M_BASELINE__) && (__CORE == __ARM8M_BASELINE__)
+ #define __ARM_ARCH_8M_BASE__ 1
+ #elif defined(__ARM8M_MAINLINE__) && (__CORE == __ARM8M_MAINLINE__)
+ #define __ARM_ARCH_8M_MAIN__ 1
+ #elif defined(__ARM8EM_MAINLINE__) && (__CORE == __ARM8EM_MAINLINE__)
+ #define __ARM_ARCH_8M_MAIN__ 1
+ #else
+ #error "Unknown target."
+ #endif
+#endif
+
+
+
+#if defined(__ARM_ARCH_6M__) && __ARM_ARCH_6M__==1
+ #define __IAR_M0_FAMILY 1
+#elif defined(__ARM_ARCH_8M_BASE__) && __ARM_ARCH_8M_BASE__==1
+ #define __IAR_M0_FAMILY 1
+#else
+ #define __IAR_M0_FAMILY 0
+#endif
+
+
+#ifndef __ASM
+ #define __ASM __asm
+#endif
+
+#ifndef __COMPILER_BARRIER
+ #define __COMPILER_BARRIER() __ASM volatile("":::"memory")
+#endif
+
+#ifndef __INLINE
+ #define __INLINE inline
+#endif
+
+#ifndef __NO_RETURN
+ #if __ICCARM_V8
+ #define __NO_RETURN __attribute__((__noreturn__))
+ #else
+ #define __NO_RETURN _Pragma("object_attribute=__noreturn")
+ #endif
+#endif
+
+#ifndef __PACKED
+ #if __ICCARM_V8
+ #define __PACKED __attribute__((packed, aligned(1)))
+ #else
+ /* Needs IAR language extensions */
+ #define __PACKED __packed
+ #endif
+#endif
+
+#ifndef __PACKED_STRUCT
+ #if __ICCARM_V8
+ #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
+ #else
+ /* Needs IAR language extensions */
+ #define __PACKED_STRUCT __packed struct
+ #endif
+#endif
+
+#ifndef __PACKED_UNION
+ #if __ICCARM_V8
+ #define __PACKED_UNION union __attribute__((packed, aligned(1)))
+ #else
+ /* Needs IAR language extensions */
+ #define __PACKED_UNION __packed union
+ #endif
+#endif
+
+#ifndef __RESTRICT
+ #if __ICCARM_V8
+ #define __RESTRICT __restrict
+ #else
+ /* Needs IAR language extensions */
+ #define __RESTRICT restrict
+ #endif
+#endif
+
+#ifndef __STATIC_INLINE
+ #define __STATIC_INLINE static inline
+#endif
+
+#ifndef __FORCEINLINE
+ #define __FORCEINLINE _Pragma("inline=forced")
+#endif
+
+#ifndef __STATIC_FORCEINLINE
+ #define __STATIC_FORCEINLINE __FORCEINLINE __STATIC_INLINE
+#endif
+
+#ifndef __UNALIGNED_UINT16_READ
+#pragma language=save
+#pragma language=extended
+__IAR_FT uint16_t __iar_uint16_read(void const *ptr)
+{
+ return *(__packed uint16_t*)(ptr);
+}
+#pragma language=restore
+#define __UNALIGNED_UINT16_READ(PTR) __iar_uint16_read(PTR)
+#endif
+
+
+#ifndef __UNALIGNED_UINT16_WRITE
+#pragma language=save
+#pragma language=extended
+__IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val)
+{
+ *(__packed uint16_t*)(ptr) = val;;
+}
+#pragma language=restore
+#define __UNALIGNED_UINT16_WRITE(PTR,VAL) __iar_uint16_write(PTR,VAL)
+#endif
+
+#ifndef __UNALIGNED_UINT32_READ
+#pragma language=save
+#pragma language=extended
+__IAR_FT uint32_t __iar_uint32_read(void const *ptr)
+{
+ return *(__packed uint32_t*)(ptr);
+}
+#pragma language=restore
+#define __UNALIGNED_UINT32_READ(PTR) __iar_uint32_read(PTR)
+#endif
+
+#ifndef __UNALIGNED_UINT32_WRITE
+#pragma language=save
+#pragma language=extended
+__IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val)
+{
+ *(__packed uint32_t*)(ptr) = val;;
+}
+#pragma language=restore
+#define __UNALIGNED_UINT32_WRITE(PTR,VAL) __iar_uint32_write(PTR,VAL)
+#endif
+
+#ifndef __UNALIGNED_UINT32 /* deprecated */
+#pragma language=save
+#pragma language=extended
+__packed struct __iar_u32 { uint32_t v; };
+#pragma language=restore
+#define __UNALIGNED_UINT32(PTR) (((struct __iar_u32 *)(PTR))->v)
+#endif
+
+#ifndef __USED
+ #if __ICCARM_V8
+ #define __USED __attribute__((used))
+ #else
+ #define __USED _Pragma("__root")
+ #endif
+#endif
+
+#ifndef __WEAK
+ #if __ICCARM_V8
+ #define __WEAK __attribute__((weak))
+ #else
+ #define __WEAK _Pragma("__weak")
+ #endif
+#endif
+
+#ifndef __PROGRAM_START
+#define __PROGRAM_START __iar_program_start
+#endif
+
+#ifndef __INITIAL_SP
+#define __INITIAL_SP CSTACK$$Limit
+#endif
+
+#ifndef __STACK_LIMIT
+#define __STACK_LIMIT CSTACK$$Base
+#endif
+
+#ifndef __VECTOR_TABLE
+#define __VECTOR_TABLE __vector_table
+#endif
+
+#ifndef __VECTOR_TABLE_ATTRIBUTE
+#define __VECTOR_TABLE_ATTRIBUTE @".intvec"
+#endif
+
+#ifndef __ICCARM_INTRINSICS_VERSION__
+ #define __ICCARM_INTRINSICS_VERSION__ 0
+#endif
+
+#if __ICCARM_INTRINSICS_VERSION__ == 2
+
+ #if defined(__CLZ)
+ #undef __CLZ
+ #endif
+ #if defined(__REVSH)
+ #undef __REVSH
+ #endif
+ #if defined(__RBIT)
+ #undef __RBIT
+ #endif
+ #if defined(__SSAT)
+ #undef __SSAT
+ #endif
+ #if defined(__USAT)
+ #undef __USAT
+ #endif
+
+ #include "iccarm_builtin.h"
+
+ #define __disable_fault_irq __iar_builtin_disable_fiq
+ #define __disable_irq __iar_builtin_disable_interrupt
+ #define __enable_fault_irq __iar_builtin_enable_fiq
+ #define __enable_irq __iar_builtin_enable_interrupt
+ #define __arm_rsr __iar_builtin_rsr
+ #define __arm_wsr __iar_builtin_wsr
+
+
+ #define __get_APSR() (__arm_rsr("APSR"))
+ #define __get_BASEPRI() (__arm_rsr("BASEPRI"))
+ #define __get_CONTROL() (__arm_rsr("CONTROL"))
+ #define __get_FAULTMASK() (__arm_rsr("FAULTMASK"))
+
+ #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
+ #define __get_FPSCR() (__arm_rsr("FPSCR"))
+ #define __set_FPSCR(VALUE) (__arm_wsr("FPSCR", (VALUE)))
+ #else
+ #define __get_FPSCR() ( 0 )
+ #define __set_FPSCR(VALUE) ((void)VALUE)
+ #endif
+
+ #define __get_IPSR() (__arm_rsr("IPSR"))
+ #define __get_MSP() (__arm_rsr("MSP"))
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ #define __get_MSPLIM() (0U)
+ #else
+ #define __get_MSPLIM() (__arm_rsr("MSPLIM"))
+ #endif
+ #define __get_PRIMASK() (__arm_rsr("PRIMASK"))
+ #define __get_PSP() (__arm_rsr("PSP"))
+
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ #define __get_PSPLIM() (0U)
+ #else
+ #define __get_PSPLIM() (__arm_rsr("PSPLIM"))
+ #endif
+
+ #define __get_xPSR() (__arm_rsr("xPSR"))
+
+ #define __set_BASEPRI(VALUE) (__arm_wsr("BASEPRI", (VALUE)))
+ #define __set_BASEPRI_MAX(VALUE) (__arm_wsr("BASEPRI_MAX", (VALUE)))
+ #define __set_CONTROL(VALUE) (__arm_wsr("CONTROL", (VALUE)))
+ #define __set_FAULTMASK(VALUE) (__arm_wsr("FAULTMASK", (VALUE)))
+ #define __set_MSP(VALUE) (__arm_wsr("MSP", (VALUE)))
+
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ #define __set_MSPLIM(VALUE) ((void)(VALUE))
+ #else
+ #define __set_MSPLIM(VALUE) (__arm_wsr("MSPLIM", (VALUE)))
+ #endif
+ #define __set_PRIMASK(VALUE) (__arm_wsr("PRIMASK", (VALUE)))
+ #define __set_PSP(VALUE) (__arm_wsr("PSP", (VALUE)))
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ #define __set_PSPLIM(VALUE) ((void)(VALUE))
+ #else
+ #define __set_PSPLIM(VALUE) (__arm_wsr("PSPLIM", (VALUE)))
+ #endif
+
+ #define __TZ_get_CONTROL_NS() (__arm_rsr("CONTROL_NS"))
+ #define __TZ_set_CONTROL_NS(VALUE) (__arm_wsr("CONTROL_NS", (VALUE)))
+ #define __TZ_get_PSP_NS() (__arm_rsr("PSP_NS"))
+ #define __TZ_set_PSP_NS(VALUE) (__arm_wsr("PSP_NS", (VALUE)))
+ #define __TZ_get_MSP_NS() (__arm_rsr("MSP_NS"))
+ #define __TZ_set_MSP_NS(VALUE) (__arm_wsr("MSP_NS", (VALUE)))
+ #define __TZ_get_SP_NS() (__arm_rsr("SP_NS"))
+ #define __TZ_set_SP_NS(VALUE) (__arm_wsr("SP_NS", (VALUE)))
+ #define __TZ_get_PRIMASK_NS() (__arm_rsr("PRIMASK_NS"))
+ #define __TZ_set_PRIMASK_NS(VALUE) (__arm_wsr("PRIMASK_NS", (VALUE)))
+ #define __TZ_get_BASEPRI_NS() (__arm_rsr("BASEPRI_NS"))
+ #define __TZ_set_BASEPRI_NS(VALUE) (__arm_wsr("BASEPRI_NS", (VALUE)))
+ #define __TZ_get_FAULTMASK_NS() (__arm_rsr("FAULTMASK_NS"))
+ #define __TZ_set_FAULTMASK_NS(VALUE)(__arm_wsr("FAULTMASK_NS", (VALUE)))
+
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ #define __TZ_get_PSPLIM_NS() (0U)
+ #define __TZ_set_PSPLIM_NS(VALUE) ((void)(VALUE))
+ #else
+ #define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS"))
+ #define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE)))
+ #endif
+
+ #define __TZ_get_MSPLIM_NS() (__arm_rsr("MSPLIM_NS"))
+ #define __TZ_set_MSPLIM_NS(VALUE) (__arm_wsr("MSPLIM_NS", (VALUE)))
+
+ #define __NOP __iar_builtin_no_operation
+
+ #define __CLZ __iar_builtin_CLZ
+ #define __CLREX __iar_builtin_CLREX
+
+ #define __DMB __iar_builtin_DMB
+ #define __DSB __iar_builtin_DSB
+ #define __ISB __iar_builtin_ISB
+
+ #define __LDREXB __iar_builtin_LDREXB
+ #define __LDREXH __iar_builtin_LDREXH
+ #define __LDREXW __iar_builtin_LDREX
+
+ #define __RBIT __iar_builtin_RBIT
+ #define __REV __iar_builtin_REV
+ #define __REV16 __iar_builtin_REV16
+
+ __IAR_FT int16_t __REVSH(int16_t val)
+ {
+ return (int16_t) __iar_builtin_REVSH(val);
+ }
+
+ #define __ROR __iar_builtin_ROR
+ #define __RRX __iar_builtin_RRX
+
+ #define __SEV __iar_builtin_SEV
+
+ #if !__IAR_M0_FAMILY
+ #define __SSAT __iar_builtin_SSAT
+ #endif
+
+ #define __STREXB __iar_builtin_STREXB
+ #define __STREXH __iar_builtin_STREXH
+ #define __STREXW __iar_builtin_STREX
+
+ #if !__IAR_M0_FAMILY
+ #define __USAT __iar_builtin_USAT
+ #endif
+
+ #define __WFE __iar_builtin_WFE
+ #define __WFI __iar_builtin_WFI
+
+ #if __ARM_MEDIA__
+ #define __SADD8 __iar_builtin_SADD8
+ #define __QADD8 __iar_builtin_QADD8
+ #define __SHADD8 __iar_builtin_SHADD8
+ #define __UADD8 __iar_builtin_UADD8
+ #define __UQADD8 __iar_builtin_UQADD8
+ #define __UHADD8 __iar_builtin_UHADD8
+ #define __SSUB8 __iar_builtin_SSUB8
+ #define __QSUB8 __iar_builtin_QSUB8
+ #define __SHSUB8 __iar_builtin_SHSUB8
+ #define __USUB8 __iar_builtin_USUB8
+ #define __UQSUB8 __iar_builtin_UQSUB8
+ #define __UHSUB8 __iar_builtin_UHSUB8
+ #define __SADD16 __iar_builtin_SADD16
+ #define __QADD16 __iar_builtin_QADD16
+ #define __SHADD16 __iar_builtin_SHADD16
+ #define __UADD16 __iar_builtin_UADD16
+ #define __UQADD16 __iar_builtin_UQADD16
+ #define __UHADD16 __iar_builtin_UHADD16
+ #define __SSUB16 __iar_builtin_SSUB16
+ #define __QSUB16 __iar_builtin_QSUB16
+ #define __SHSUB16 __iar_builtin_SHSUB16
+ #define __USUB16 __iar_builtin_USUB16
+ #define __UQSUB16 __iar_builtin_UQSUB16
+ #define __UHSUB16 __iar_builtin_UHSUB16
+ #define __SASX __iar_builtin_SASX
+ #define __QASX __iar_builtin_QASX
+ #define __SHASX __iar_builtin_SHASX
+ #define __UASX __iar_builtin_UASX
+ #define __UQASX __iar_builtin_UQASX
+ #define __UHASX __iar_builtin_UHASX
+ #define __SSAX __iar_builtin_SSAX
+ #define __QSAX __iar_builtin_QSAX
+ #define __SHSAX __iar_builtin_SHSAX
+ #define __USAX __iar_builtin_USAX
+ #define __UQSAX __iar_builtin_UQSAX
+ #define __UHSAX __iar_builtin_UHSAX
+ #define __USAD8 __iar_builtin_USAD8
+ #define __USADA8 __iar_builtin_USADA8
+ #define __SSAT16 __iar_builtin_SSAT16
+ #define __USAT16 __iar_builtin_USAT16
+ #define __UXTB16 __iar_builtin_UXTB16
+ #define __UXTAB16 __iar_builtin_UXTAB16
+ #define __SXTB16 __iar_builtin_SXTB16
+ #define __SXTAB16 __iar_builtin_SXTAB16
+ #define __SMUAD __iar_builtin_SMUAD
+ #define __SMUADX __iar_builtin_SMUADX
+ #define __SMMLA __iar_builtin_SMMLA
+ #define __SMLAD __iar_builtin_SMLAD
+ #define __SMLADX __iar_builtin_SMLADX
+ #define __SMLALD __iar_builtin_SMLALD
+ #define __SMLALDX __iar_builtin_SMLALDX
+ #define __SMUSD __iar_builtin_SMUSD
+ #define __SMUSDX __iar_builtin_SMUSDX
+ #define __SMLSD __iar_builtin_SMLSD
+ #define __SMLSDX __iar_builtin_SMLSDX
+ #define __SMLSLD __iar_builtin_SMLSLD
+ #define __SMLSLDX __iar_builtin_SMLSLDX
+ #define __SEL __iar_builtin_SEL
+ #define __QADD __iar_builtin_QADD
+ #define __QSUB __iar_builtin_QSUB
+ #define __PKHBT __iar_builtin_PKHBT
+ #define __PKHTB __iar_builtin_PKHTB
+ #endif
+
+#else /* __ICCARM_INTRINSICS_VERSION__ == 2 */
+
+ #if __IAR_M0_FAMILY
+ /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
+ #define __CLZ __cmsis_iar_clz_not_active
+ #define __SSAT __cmsis_iar_ssat_not_active
+ #define __USAT __cmsis_iar_usat_not_active
+ #define __RBIT __cmsis_iar_rbit_not_active
+ #define __get_APSR __cmsis_iar_get_APSR_not_active
+ #endif
+
+
+ #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
+ #define __get_FPSCR __cmsis_iar_get_FPSR_not_active
+ #define __set_FPSCR __cmsis_iar_set_FPSR_not_active
+ #endif
+
+ #ifdef __INTRINSICS_INCLUDED
+ #error intrinsics.h is already included previously!
+ #endif
+
+ #include <intrinsics.h>
+
+ #if __IAR_M0_FAMILY
+ /* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
+ #undef __CLZ
+ #undef __SSAT
+ #undef __USAT
+ #undef __RBIT
+ #undef __get_APSR
+
+ __STATIC_INLINE uint8_t __CLZ(uint32_t data)
+ {
+ if (data == 0U) { return 32U; }
+
+ uint32_t count = 0U;
+ uint32_t mask = 0x80000000U;
+
+ while ((data & mask) == 0U)
+ {
+ count += 1U;
+ mask = mask >> 1U;
+ }
+ return count;
+ }
+
+ __STATIC_INLINE uint32_t __RBIT(uint32_t v)
+ {
+ uint8_t sc = 31U;
+ uint32_t r = v;
+ for (v >>= 1U; v; v >>= 1U)
+ {
+ r <<= 1U;
+ r |= v & 1U;
+ sc--;
+ }
+ return (r << sc);
+ }
+
+ __STATIC_INLINE uint32_t __get_APSR(void)
+ {
+ uint32_t res;
+ __asm("MRS %0,APSR" : "=r" (res));
+ return res;
+ }
+
+ #endif
+
+ #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
+ (defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
+ #undef __get_FPSCR
+ #undef __set_FPSCR
+ #define __get_FPSCR() (0)
+ #define __set_FPSCR(VALUE) ((void)VALUE)
+ #endif
+
+ #pragma diag_suppress=Pe940
+ #pragma diag_suppress=Pe177
+
+ #define __enable_irq __enable_interrupt
+ #define __disable_irq __disable_interrupt
+ #define __NOP __no_operation
+
+ #define __get_xPSR __get_PSR
+
+ #if (!defined(__ARM_ARCH_6M__) || __ARM_ARCH_6M__==0)
+
+ __IAR_FT uint32_t __LDREXW(uint32_t volatile *ptr)
+ {
+ return __LDREX((unsigned long *)ptr);
+ }
+
+ __IAR_FT uint32_t __STREXW(uint32_t value, uint32_t volatile *ptr)
+ {
+ return __STREX(value, (unsigned long *)ptr);
+ }
+ #endif
+
+
+ /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+ #if (__CORTEX_M >= 0x03)
+
+ __IAR_FT uint32_t __RRX(uint32_t value)
+ {
+ uint32_t result;
+ __ASM("RRX %0, %1" : "=r"(result) : "r" (value) : "cc");
+ return(result);
+ }
+
+ __IAR_FT void __set_BASEPRI_MAX(uint32_t value)
+ {
+ __asm volatile("MSR BASEPRI_MAX,%0"::"r" (value));
+ }
+
+
+ #define __enable_fault_irq __enable_fiq
+ #define __disable_fault_irq __disable_fiq
+
+
+ #endif /* (__CORTEX_M >= 0x03) */
+
+ __IAR_FT uint32_t __ROR(uint32_t op1, uint32_t op2)
+ {
+ return (op1 >> op2) | (op1 << ((sizeof(op1)*8)-op2));
+ }
+
+ #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+ __IAR_FT uint32_t __get_MSPLIM(void)
+ {
+ uint32_t res;
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ res = 0U;
+ #else
+ __asm volatile("MRS %0,MSPLIM" : "=r" (res));
+ #endif
+ return res;
+ }
+
+ __IAR_FT void __set_MSPLIM(uint32_t value)
+ {
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure MSPLIM is RAZ/WI
+ (void)value;
+ #else
+ __asm volatile("MSR MSPLIM,%0" :: "r" (value));
+ #endif
+ }
+
+ __IAR_FT uint32_t __get_PSPLIM(void)
+ {
+ uint32_t res;
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ res = 0U;
+ #else
+ __asm volatile("MRS %0,PSPLIM" : "=r" (res));
+ #endif
+ return res;
+ }
+
+ __IAR_FT void __set_PSPLIM(uint32_t value)
+ {
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)value;
+ #else
+ __asm volatile("MSR PSPLIM,%0" :: "r" (value));
+ #endif
+ }
+
+ __IAR_FT uint32_t __TZ_get_CONTROL_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,CONTROL_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_CONTROL_NS(uint32_t value)
+ {
+ __asm volatile("MSR CONTROL_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_PSP_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,PSP_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_PSP_NS(uint32_t value)
+ {
+ __asm volatile("MSR PSP_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_MSP_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,MSP_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_MSP_NS(uint32_t value)
+ {
+ __asm volatile("MSR MSP_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_SP_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,SP_NS" : "=r" (res));
+ return res;
+ }
+ __IAR_FT void __TZ_set_SP_NS(uint32_t value)
+ {
+ __asm volatile("MSR SP_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_PRIMASK_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,PRIMASK_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_PRIMASK_NS(uint32_t value)
+ {
+ __asm volatile("MSR PRIMASK_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_BASEPRI_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,BASEPRI_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_BASEPRI_NS(uint32_t value)
+ {
+ __asm volatile("MSR BASEPRI_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_FAULTMASK_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,FAULTMASK_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_FAULTMASK_NS(uint32_t value)
+ {
+ __asm volatile("MSR FAULTMASK_NS,%0" :: "r" (value));
+ }
+
+ __IAR_FT uint32_t __TZ_get_PSPLIM_NS(void)
+ {
+ uint32_t res;
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ res = 0U;
+ #else
+ __asm volatile("MRS %0,PSPLIM_NS" : "=r" (res));
+ #endif
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_PSPLIM_NS(uint32_t value)
+ {
+ #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
+ (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
+ // without main extensions, the non-secure PSPLIM is RAZ/WI
+ (void)value;
+ #else
+ __asm volatile("MSR PSPLIM_NS,%0" :: "r" (value));
+ #endif
+ }
+
+ __IAR_FT uint32_t __TZ_get_MSPLIM_NS(void)
+ {
+ uint32_t res;
+ __asm volatile("MRS %0,MSPLIM_NS" : "=r" (res));
+ return res;
+ }
+
+ __IAR_FT void __TZ_set_MSPLIM_NS(uint32_t value)
+ {
+ __asm volatile("MSR MSPLIM_NS,%0" :: "r" (value));
+ }
+
+ #endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */
+
+#endif /* __ICCARM_INTRINSICS_VERSION__ == 2 */
+
+#define __BKPT(value) __asm volatile ("BKPT %0" : : "i"(value))
+
+#if __IAR_M0_FAMILY
+ __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
+ {
+ if ((sat >= 1U) && (sat <= 32U))
+ {
+ const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
+ const int32_t min = -1 - max ;
+ if (val > max)
+ {
+ return max;
+ }
+ else if (val < min)
+ {
+ return min;
+ }
+ }
+ return val;
+ }
+
+ __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
+ {
+ if (sat <= 31U)
+ {
+ const uint32_t max = ((1U << sat) - 1U);
+ if (val > (int32_t)max)
+ {
+ return max;
+ }
+ else if (val < 0)
+ {
+ return 0U;
+ }
+ }
+ return (uint32_t)val;
+ }
+#endif
+
+#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
+
+ __IAR_FT uint8_t __LDRBT(volatile uint8_t *addr)
+ {
+ uint32_t res;
+ __ASM("LDRBT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
+ return ((uint8_t)res);
+ }
+
+ __IAR_FT uint16_t __LDRHT(volatile uint16_t *addr)
+ {
+ uint32_t res;
+ __ASM("LDRHT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
+ return ((uint16_t)res);
+ }
+
+ __IAR_FT uint32_t __LDRT(volatile uint32_t *addr)
+ {
+ uint32_t res;
+ __ASM("LDRT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
+ return res;
+ }
+
+ __IAR_FT void __STRBT(uint8_t value, volatile uint8_t *addr)
+ {
+ __ASM("STRBT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory");
+ }
+
+ __IAR_FT void __STRHT(uint16_t value, volatile uint16_t *addr)
+ {
+ __ASM("STRHT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory");
+ }
+
+ __IAR_FT void __STRT(uint32_t value, volatile uint32_t *addr)
+ {
+ __ASM("STRT %1, [%0]" : : "r" (addr), "r" (value) : "memory");
+ }
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
+ (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
+
+
+ __IAR_FT uint8_t __LDAB(volatile uint8_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
+ return ((uint8_t)res);
+ }
+
+ __IAR_FT uint16_t __LDAH(volatile uint16_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
+ return ((uint16_t)res);
+ }
+
+ __IAR_FT uint32_t __LDA(volatile uint32_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDA %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
+ return res;
+ }
+
+ __IAR_FT void __STLB(uint8_t value, volatile uint8_t *ptr)
+ {
+ __ASM volatile ("STLB %1, [%0]" :: "r" (ptr), "r" (value) : "memory");
+ }
+
+ __IAR_FT void __STLH(uint16_t value, volatile uint16_t *ptr)
+ {
+ __ASM volatile ("STLH %1, [%0]" :: "r" (ptr), "r" (value) : "memory");
+ }
+
+ __IAR_FT void __STL(uint32_t value, volatile uint32_t *ptr)
+ {
+ __ASM volatile ("STL %1, [%0]" :: "r" (ptr), "r" (value) : "memory");
+ }
+
+ __IAR_FT uint8_t __LDAEXB(volatile uint8_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAEXB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
+ return ((uint8_t)res);
+ }
+
+ __IAR_FT uint16_t __LDAEXH(volatile uint16_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAEXH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
+ return ((uint16_t)res);
+ }
+
+ __IAR_FT uint32_t __LDAEX(volatile uint32_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("LDAEX %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
+ return res;
+ }
+
+ __IAR_FT uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("STLEXB %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory");
+ return res;
+ }
+
+ __IAR_FT uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("STLEXH %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory");
+ return res;
+ }
+
+ __IAR_FT uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)
+ {
+ uint32_t res;
+ __ASM volatile ("STLEX %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory");
+ return res;
+ }
+
+#endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */
+
+#undef __IAR_FT
+#undef __IAR_M0_FAMILY
+#undef __ICCARM_V8
+
+#pragma diag_default=Pe940
+#pragma diag_default=Pe177
+
+#endif /* __CMSIS_ICCARM_H__ */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_version.h b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_version.h
new file mode 100644
index 0000000000..f2e2746626
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/cmsis_version.h
@@ -0,0 +1,39 @@
+/**************************************************************************//**
+ * @file cmsis_version.h
+ * @brief CMSIS Core(M) Version definitions
+ * @version V5.0.3
+ * @date 24. June 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CMSIS_VERSION_H
+#define __CMSIS_VERSION_H
+
+/* CMSIS Version definitions */
+#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
+#define __CM_CMSIS_VERSION_SUB ( 3U) /*!< [15:0] CMSIS Core(M) sub version */
+#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
+ __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
+#endif
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_armv81mml.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_armv81mml.h
new file mode 100644
index 0000000000..8441e57fb1
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_armv81mml.h
@@ -0,0 +1,2968 @@
+/**************************************************************************//**
+ * @file core_armv81mml.h
+ * @brief CMSIS Armv8.1-M Mainline Core Peripheral Access Layer Header File
+ * @version V1.0.0
+ * @date 15. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2018-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_ARMV81MML_H_GENERIC
+#define __CORE_ARMV81MML_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_ARMV81MML
+ @{
+ */
+
+#include "cmsis_version.h"
+
+#define __ARM_ARCH_8M_MAIN__ 1 // patching for now
+/* CMSIS ARMV81MML definitions */
+#define __ARMv81MML_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __ARMv81MML_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __ARMv81MML_CMSIS_VERSION ((__ARMv81MML_CMSIS_VERSION_MAIN << 16U) | \
+ __ARMv81MML_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (81U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV81MML_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_ARMV81MML_H_DEPENDANT
+#define __CORE_ARMV81MML_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __ARMv81MML_REV
+ #define __ARMv81MML_REV 0x0000U
+ #warning "__ARMv81MML_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DSP_PRESENT
+ #define __DSP_PRESENT 0U
+ #warning "__DSP_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group ARMv81MML */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
+#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */
+ uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */
+ uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */
+#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */
+
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED6[580U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */
+ uint32_t RESERVED3[92U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+ uint32_t RESERVED7[6U];
+ __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */
+ __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */
+ __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */
+ __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */
+ __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
+#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */
+#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */
+#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */
+
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */
+#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */
+#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Non-Secure Access Control Register Definitions */
+#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */
+#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */
+
+#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */
+#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */
+
+#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */
+#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/* Instruction Tightly-Coupled Memory Control Register Definitions */
+#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */
+#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */
+
+#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */
+#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */
+
+#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */
+#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */
+
+#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */
+#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */
+
+/* Data Tightly-Coupled Memory Control Register Definitions */
+#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */
+#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */
+
+#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */
+#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */
+
+#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */
+#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */
+
+#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */
+#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */
+
+/* AHBP Control Register Definitions */
+#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */
+#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */
+
+#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */
+#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */
+
+/* L1 Cache Control Register Definitions */
+#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */
+#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */
+
+#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */
+#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */
+
+#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */
+#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */
+
+/* AHBS Control Register Definitions */
+#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */
+#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */
+
+#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */
+#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */
+
+#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/
+#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */
+
+/* Auxiliary Bus Fault Status Register Definitions */
+#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/
+#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */
+
+#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/
+#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */
+
+#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/
+#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */
+
+#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/
+#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */
+
+#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/
+#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */
+
+#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/
+#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+ __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[29U];
+ __OM uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */
+ __IM uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */
+ __IOM uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */
+ uint32_t RESERVED6[4U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Stimulus Port Register Definitions */
+#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */
+#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */
+
+#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */
+#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */
+#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */
+
+#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */
+#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Integration Write Register Definitions */
+#define ITM_IWR_ATVALIDM_Pos 0U /*!< ITM IWR: ATVALIDM Position */
+#define ITM_IWR_ATVALIDM_Msk (1UL /*<< ITM_IWR_ATVALIDM_Pos*/) /*!< ITM IWR: ATVALIDM Mask */
+
+/* ITM Integration Read Register Definitions */
+#define ITM_IRR_ATREADYM_Pos 0U /*!< ITM IRR: ATREADYM Position */
+#define ITM_IRR_ATREADYM_Msk (1UL /*<< ITM_IRR_ATREADYM_Pos*/) /*!< ITM IRR: ATREADYM Mask */
+
+/* ITM Integration Mode Control Register Definitions */
+#define ITM_IMCR_INTEGRATION_Pos 0U /*!< ITM IMCR: INTEGRATION Position */
+#define ITM_IMCR_INTEGRATION_Msk (1UL /*<< ITM_IMCR_INTEGRATION_Pos*/) /*!< ITM IMCR: INTEGRATION Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+ uint32_t RESERVED32[934U];
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+ uint32_t RESERVED33[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */
+#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY_Pos 0U /*!< TPI ITATBCTR2: ATREADY Position */
+#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/) /*!< TPI ITATBCTR2: ATREADY Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY_Pos 0U /*!< TPI ITATBCTR0: ATREADY Position */
+#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/) /*!< TPI ITATBCTR0: ATREADY Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_MajorType_Pos 4U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+#define TPI_DEVTYPE_SubType_Pos 0U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */
+ __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */
+ __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */
+ __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */
+ uint32_t RESERVED0[1];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_PXN_Pos 4U /*!< MPU RLAR: PXN Position */
+#define MPU_RLAR_PXN_Msk (0x1UL << MPU_RLAR_PXN_Pos) /*!< MPU RLAR: PXN Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#else
+ uint32_t RESERVED0[3];
+#endif
+ __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */
+ __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/* Secure Fault Status Register Definitions */
+#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */
+#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */
+
+#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */
+#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */
+
+#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */
+#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */
+
+#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */
+#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */
+
+#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */
+#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */
+
+#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */
+#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */
+
+#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */
+#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */
+
+#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */
+#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */
+#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */
+
+#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */
+#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */
+
+#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */
+#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */
+
+#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */
+#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */
+
+#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */
+#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */
+
+#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */
+#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */
+#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */
+#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+ #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+ #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+ #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+ #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */
+ #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Set Priority Grouping (non-secure)
+ \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB_NS->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << 8U) ); /* Insert write key and priorty group */
+ SCB_NS->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping (non-secure)
+ \details Reads the priority grouping field from the non-secure NVIC when in secure state.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void)
+{
+ return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV81MML_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mbl.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mbl.h
new file mode 100644
index 0000000000..344dca5148
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mbl.h
@@ -0,0 +1,1921 @@
+/**************************************************************************//**
+ * @file core_armv8mbl.h
+ * @brief CMSIS Armv8-M Baseline Core Peripheral Access Layer Header File
+ * @version V5.0.8
+ * @date 12. November 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_ARMV8MBL_H_GENERIC
+#define __CORE_ARMV8MBL_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_ARMv8MBL
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS definitions */
+#define __ARMv8MBL_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __ARMv8MBL_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __ARMv8MBL_CMSIS_VERSION ((__ARMv8MBL_CMSIS_VERSION_MAIN << 16U) | \
+ __ARMv8MBL_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M ( 2U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MBL_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_ARMV8MBL_H_DEPENDANT
+#define __CORE_ARMV8MBL_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __ARMv8MBL_REV
+ #define __ARMv8MBL_REV 0x0000U
+ #warning "__ARMv8MBL_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __VTOR_PRESENT
+ #define __VTOR_PRESENT 0U
+ #warning "__VTOR_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+
+ #ifndef __ETM_PRESENT
+ #define __ETM_PRESENT 0U
+ #warning "__ETM_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MTB_PRESENT
+ #define __MTB_PRESENT 0U
+ #warning "__MTB_PRESENT not defined in device header file; using default!"
+ #endif
+
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group ARMv8MBL */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+#else
+ uint32_t RESERVED0;
+#endif
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
+#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t RESERVED0[6U];
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */
+ uint32_t RESERVED3[809U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */
+ uint32_t RESERVED4[4U];
+ __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */
+#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI Periodic Synchronization Control Register Definitions */
+#define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */
+#define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */
+
+/* TPI Software Lock Status Register Definitions */
+#define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */
+#define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */
+
+#define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */
+#define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */
+
+#define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */
+#define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */
+#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ uint32_t RESERVED0[7U];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 1U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#endif
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */
+#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Special LR values for Secure/Non-Secure call handling and exception handling */
+
+/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */
+#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */
+
+/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */
+#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */
+#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */
+#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */
+#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */
+#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */
+#define EXC_RETURN_SPSEL (0x00000004UL) /* bit [2] stack pointer used to restore context: 0=MSP 1=PSP */
+#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */
+
+/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */
+#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */
+#else
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */
+#endif
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+#define __NVIC_SetPriorityGrouping(X) (void)(X)
+#define __NVIC_GetPriorityGrouping() (0U)
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ If VTOR is not present address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MBL_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mml.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mml.h
new file mode 100644
index 0000000000..5ddb8aeda7
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_armv8mml.h
@@ -0,0 +1,2835 @@
+/**************************************************************************//**
+ * @file core_armv8mml.h
+ * @brief CMSIS Armv8-M Mainline Core Peripheral Access Layer Header File
+ * @version V5.1.0
+ * @date 12. September 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_ARMV8MML_H_GENERIC
+#define __CORE_ARMV8MML_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_ARMv8MML
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS Armv8MML definitions */
+#define __ARMv8MML_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __ARMv8MML_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __ARMv8MML_CMSIS_VERSION ((__ARMv8MML_CMSIS_VERSION_MAIN << 16U) | \
+ __ARMv8MML_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (81U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined(__ARM_FEATURE_DSP)
+ #if defined(__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MML_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_ARMV8MML_H_DEPENDANT
+#define __CORE_ARMV8MML_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __ARMv8MML_REV
+ #define __ARMv8MML_REV 0x0000U
+ #warning "__ARMv8MML_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DSP_PRESENT
+ #define __DSP_PRESENT 0U
+ #warning "__DSP_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group ARMv8MML */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
+#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */
+ uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */
+ uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */
+#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */
+
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED6[580U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */
+ uint32_t RESERVED3[92U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
+#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */
+#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */
+#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */
+
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */
+#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */
+#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Non-Secure Access Control Register Definitions */
+#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */
+#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */
+
+#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */
+#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */
+
+#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */
+#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+ __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */
+ uint32_t RESERVED6[4U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Stimulus Port Register Definitions */
+#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */
+#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */
+
+#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */
+#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */
+#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */
+
+#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */
+#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+ uint32_t RESERVED32[934U];
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+ uint32_t RESERVED33[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */
+#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Sizes Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Sizes Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */
+ uint32_t RESERVED3[809U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) Software Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) Software Lock Status Register */
+ uint32_t RESERVED4[4U];
+ __IM uint32_t TYPE; /*!< Offset: 0xFC8 (R/ ) Device Identifier Register */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Register */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_SWOSCALER_Pos 0U /*!< TPI ACPR: SWOSCALER Position */
+#define TPI_ACPR_SWOSCALER_Msk (0xFFFFUL /*<< TPI_ACPR_SWOSCALER_Pos*/) /*!< TPI ACPR: SWOSCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */
+#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI Periodic Synchronization Control Register Definitions */
+#define TPI_PSCR_PSCount_Pos 0U /*!< TPI PSCR: PSCount Position */
+#define TPI_PSCR_PSCount_Msk (0x1FUL /*<< TPI_PSCR_PSCount_Pos*/) /*!< TPI PSCR: TPSCount Mask */
+
+/* TPI Software Lock Status Register Definitions */
+#define TPI_LSR_nTT_Pos 1U /*!< TPI LSR: Not thirty-two bit. Position */
+#define TPI_LSR_nTT_Msk (0x1UL << TPI_LSR_nTT_Pos) /*!< TPI LSR: Not thirty-two bit. Mask */
+
+#define TPI_LSR_SLK_Pos 1U /*!< TPI LSR: Software Lock status Position */
+#define TPI_LSR_SLK_Msk (0x1UL << TPI_LSR_SLK_Pos) /*!< TPI LSR: Software Lock status Mask */
+
+#define TPI_LSR_SLI_Pos 0U /*!< TPI LSR: Software Lock implemented Position */
+#define TPI_LSR_SLI_Msk (0x1UL /*<< TPI_LSR_SLI_Pos*/) /*!< TPI LSR: Software Lock implemented Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFO depth Position */
+#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFO depth Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */
+ __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */
+ __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */
+ __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */
+ uint32_t RESERVED0[1];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#else
+ uint32_t RESERVED0[3];
+#endif
+ __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */
+ __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/* Secure Fault Status Register Definitions */
+#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */
+#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */
+
+#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */
+#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */
+
+#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */
+#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */
+
+#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */
+#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */
+
+#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */
+#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */
+
+#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */
+#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */
+
+#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */
+#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */
+
+#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */
+#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */
+#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */
+
+#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */
+#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */
+
+#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */
+#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */
+
+#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */
+#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */
+
+#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */
+#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */
+
+#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */
+#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */
+#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */
+#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+ #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+ #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+ #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+ #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */
+ #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Special LR values for Secure/Non-Secure call handling and exception handling */
+
+/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */
+#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */
+
+/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */
+#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */
+#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */
+#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */
+#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */
+#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */
+#define EXC_RETURN_SPSEL (0x00000004UL) /* bit [2] stack pointer used to restore context: 0=MSP 1=PSP */
+#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */
+
+/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */
+#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */
+#else
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */
+#endif
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Set Priority Grouping (non-secure)
+ \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB_NS->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB_NS->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping (non-secure)
+ \details Reads the priority grouping field from the non-secure NVIC when in secure state.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void)
+{
+ return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_ARMV8MML_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm0.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm0.h
new file mode 100644
index 0000000000..cafae5a0a7
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm0.h
@@ -0,0 +1,952 @@
+/**************************************************************************//**
+ * @file core_cm0.h
+ * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File
+ * @version V5.0.6
+ * @date 13. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM0_H_GENERIC
+#define __CORE_CM0_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M0
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM0 definitions */
+#define __CM0_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM0_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
+ __CM0_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (0U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM0_H_DEPENDANT
+#define __CORE_CM0_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM0_REV
+ #define __CM0_REV 0x0000U
+ #warning "__CM0_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M0 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:1; /*!< bit: 0 Reserved */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RESERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ uint32_t RESERVED0;
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the Cortex-M0 header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+#define __NVIC_SetPriorityGrouping(X) (void)(X)
+#define __NVIC_GetPriorityGrouping() (0U)
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ Address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t vectors = 0x0U;
+ (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
+ /* ARM Application Note 321 states that the M0 does not require the architectural barrier */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t vectors = 0x0U;
+ return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm0plus.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm0plus.h
new file mode 100644
index 0000000000..d104965db5
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm0plus.h
@@ -0,0 +1,1085 @@
+/**************************************************************************//**
+ * @file core_cm0plus.h
+ * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File
+ * @version V5.0.7
+ * @date 13. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM0PLUS_H_GENERIC
+#define __CORE_CM0PLUS_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex-M0+
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM0+ definitions */
+#define __CM0PLUS_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM0PLUS_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \
+ __CM0PLUS_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (0U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0PLUS_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM0PLUS_H_DEPENDANT
+#define __CORE_CM0PLUS_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM0PLUS_REV
+ #define __CM0PLUS_REV 0x0000U
+ #warning "__CM0PLUS_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __VTOR_PRESENT
+ #define __VTOR_PRESENT 0U
+ #warning "__VTOR_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex-M0+ */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core MPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RESERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+#else
+ uint32_t RESERVED0;
+#endif
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 1U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the Cortex-M0+ header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+#define __NVIC_SetPriorityGrouping(X) (void)(X)
+#define __NVIC_GetPriorityGrouping() (0U)
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ If VTOR is not present address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t vectors = SCB->VTOR;
+#else
+ uint32_t vectors = 0x0U;
+#endif
+ (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
+ /* ARM Application Note 321 states that the M0+ does not require the architectural barrier */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t vectors = SCB->VTOR;
+#else
+ uint32_t vectors = 0x0U;
+#endif
+ return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM0PLUS_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm1.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm1.h
new file mode 100644
index 0000000000..76b4569743
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm1.h
@@ -0,0 +1,979 @@
+/**************************************************************************//**
+ * @file core_cm1.h
+ * @brief CMSIS Cortex-M1 Core Peripheral Access Layer Header File
+ * @version V1.0.1
+ * @date 12. November 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM1_H_GENERIC
+#define __CORE_CM1_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M1
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM1 definitions */
+#define __CM1_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM1_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM1_CMSIS_VERSION ((__CM1_CMSIS_VERSION_MAIN << 16U) | \
+ __CM1_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (1U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM1_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM1_H_DEPENDANT
+#define __CORE_CM1_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM1_REV
+ #define __CM1_REV 0x0100U
+ #warning "__CM1_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M1 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:1; /*!< bit: 0 Reserved */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ uint32_t RESERVED0;
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_ITCMUAEN_Pos 4U /*!< ACTLR: Instruction TCM Upper Alias Enable Position */
+#define SCnSCB_ACTLR_ITCMUAEN_Msk (1UL << SCnSCB_ACTLR_ITCMUAEN_Pos) /*!< ACTLR: Instruction TCM Upper Alias Enable Mask */
+
+#define SCnSCB_ACTLR_ITCMLAEN_Pos 3U /*!< ACTLR: Instruction TCM Lower Alias Enable Position */
+#define SCnSCB_ACTLR_ITCMLAEN_Msk (1UL << SCnSCB_ACTLR_ITCMLAEN_Pos) /*!< ACTLR: Instruction TCM Lower Alias Enable Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Cortex-M1 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the Cortex-M1 header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M1 */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+#define __NVIC_SetPriorityGrouping(X) (void)(X)
+#define __NVIC_GetPriorityGrouping() (0U)
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ Address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)0x0U;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ /* ARM Application Note 321 states that the M1 does not require the architectural barrier */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)0x0U;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM1_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm23.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm23.h
new file mode 100644
index 0000000000..b79c6af0b1
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm23.h
@@ -0,0 +1,1996 @@
+/**************************************************************************//**
+ * @file core_cm23.h
+ * @brief CMSIS Cortex-M23 Core Peripheral Access Layer Header File
+ * @version V5.0.8
+ * @date 12. November 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM23_H_GENERIC
+#define __CORE_CM23_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M23
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS definitions */
+#define __CM23_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM23_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM23_CMSIS_VERSION ((__CM23_CMSIS_VERSION_MAIN << 16U) | \
+ __CM23_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (23U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM23_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM23_H_DEPENDANT
+#define __CORE_CM23_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM23_REV
+ #define __CM23_REV 0x0000U
+ #warning "__CM23_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __VTOR_PRESENT
+ #define __VTOR_PRESENT 0U
+ #warning "__VTOR_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+
+ #ifndef __ETM_PRESENT
+ #define __ETM_PRESENT 0U
+ #warning "__ETM_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MTB_PRESENT
+ #define __MTB_PRESENT 0U
+ #warning "__MTB_PRESENT not defined in device header file; using default!"
+ #endif
+
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M23 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint32_t IPR[124U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+#else
+ uint32_t RESERVED0;
+#endif
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED1;
+ __IOM uint32_t SHPR[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
+#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ uint32_t RESERVED0[6U];
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x3UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */
+ __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */
+ __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */
+#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration Test FIFO Test Data 0 Register Definitions */
+#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */
+#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */
+
+#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */
+#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */
+#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */
+#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */
+#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */
+#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */
+#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */
+
+/* TPI Integration Test ATB Control Register 2 Register Definitions */
+#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */
+#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */
+
+#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */
+#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */
+
+#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */
+#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */
+
+#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */
+#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */
+
+/* TPI Integration Test FIFO Test Data 1 Register Definitions */
+#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */
+#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */
+#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */
+
+#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */
+#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */
+
+#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */
+#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */
+#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */
+#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */
+#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */
+
+/* TPI Integration Test ATB Control Register 0 Definitions */
+#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */
+#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */
+
+#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */
+#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */
+
+#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */
+#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */
+
+#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */
+#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */
+#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ uint32_t RESERVED0[7U];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 1U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: EN Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: EN Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#endif
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register */
+#define CoreDebug_DEMCR_DWTENA_Pos 24U /*!< CoreDebug DEMCR: DWTENA Position */
+#define CoreDebug_DEMCR_DWTENA_Msk (1UL << CoreDebug_DEMCR_DWTENA_Pos) /*!< CoreDebug DEMCR: DWTENA Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M23 */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M23 */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Special LR values for Secure/Non-Secure call handling and exception handling */
+
+/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */
+#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */
+
+/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */
+#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */
+#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */
+#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */
+#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */
+#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */
+#define EXC_RETURN_SPSEL (0x00000004UL) /* bit [2] stack pointer used to restore context: 0=MSP 1=PSP */
+#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */
+
+/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */
+#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */
+#else
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */
+#endif
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+#define __NVIC_SetPriorityGrouping(X) (void)(X)
+#define __NVIC_GetPriorityGrouping() (0U)
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ If VTOR is not present address 0 must be mapped to SRAM.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+#else
+ uint32_t *vectors = (uint32_t *)0x0U;
+#endif
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[_IP_IDX(IRQn)] = ((uint32_t)(NVIC_NS->IPR[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB_NS->SHPR[_SHP_IDX(IRQn)] = ((uint32_t)(SCB_NS->SHPR[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IPR[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB_NS->SHPR[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM23_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm3.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm3.h
new file mode 100644
index 0000000000..8157ca782d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm3.h
@@ -0,0 +1,1937 @@
+/**************************************************************************//**
+ * @file core_cm3.h
+ * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File
+ * @version V5.1.0
+ * @date 13. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM3_H_GENERIC
+#define __CORE_CM3_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M3
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM3 definitions */
+#define __CM3_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM3_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16U) | \
+ __CM3_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (3U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM3_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM3_H_DEPENDANT
+#define __CORE_CM3_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM3_REV
+ #define __CM3_REV 0x0200U
+ #warning "__CM3_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M3 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
+ uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[24U];
+ __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RESERVED1[24U];
+ __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[24U];
+ __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[24U];
+ __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[56U];
+ __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED5[644U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ uint32_t RESERVED0[5U];
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#if defined (__CM3_REV) && (__CM3_REV < 0x0201U) /* core r2p1 */
+#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */
+#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
+
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#else
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+#endif
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+#if defined (__CM3_REV) && (__CM3_REV >= 0x200U)
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+#else
+ uint32_t RESERVED1[1U];
+#endif
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+#if defined (__CM3_REV) && (__CM3_REV >= 0x200U)
+#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */
+#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */
+
+#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */
+#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */
+
+#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */
+#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+#endif
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[6U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x1UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x1UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */
+#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */
+
+#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */
+#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x1UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x1UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */
+#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */
+
+#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */
+#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
+ __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
+ __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
+ __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
+ /* ARM Application Note 321 states that the M3 does not require the architectural barrier */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM3_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm33.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm33.h
new file mode 100644
index 0000000000..7fed59a88e
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm33.h
@@ -0,0 +1,2910 @@
+/**************************************************************************//**
+ * @file core_cm33.h
+ * @brief CMSIS Cortex-M33 Core Peripheral Access Layer Header File
+ * @version V5.1.0
+ * @date 12. November 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM33_H_GENERIC
+#define __CORE_CM33_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M33
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM33 definitions */
+#define __CM33_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM33_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM33_CMSIS_VERSION ((__CM33_CMSIS_VERSION_MAIN << 16U) | \
+ __CM33_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (33U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined (__TARGET_FPU_VFP)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined (__ARM_FP)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined (__ARMVFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined (__TI_VFP_SUPPORT__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined (__FPU_VFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM33_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM33_H_DEPENDANT
+#define __CORE_CM33_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM33_REV
+ #define __CM33_REV 0x0000U
+ #warning "__CM33_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DSP_PRESENT
+ #define __DSP_PRESENT 0U
+ #warning "__DSP_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M33 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
+#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */
+ uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */
+ uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */
+#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */
+
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED6[580U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */
+ uint32_t RESERVED3[92U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
+#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */
+#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */
+#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */
+
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */
+#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */
+#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Non-Secure Access Control Register Definitions */
+#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */
+#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */
+
+#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */
+#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */
+
+#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */
+#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+ __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */
+ uint32_t RESERVED6[4U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Stimulus Port Register Definitions */
+#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */
+#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */
+
+#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */
+#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */
+#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */
+
+#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */
+#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+ uint32_t RESERVED32[934U];
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+ uint32_t RESERVED33[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */
+#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */
+ __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */
+ __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */
+#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration Test FIFO Test Data 0 Register Definitions */
+#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */
+#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */
+
+#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */
+#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */
+#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */
+#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */
+#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */
+#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */
+#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */
+
+/* TPI Integration Test ATB Control Register 2 Register Definitions */
+#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */
+#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */
+
+#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */
+#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */
+
+#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */
+#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */
+
+#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */
+#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */
+
+/* TPI Integration Test FIFO Test Data 1 Register Definitions */
+#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */
+#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */
+#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */
+
+#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */
+#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */
+
+#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */
+#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */
+#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */
+#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */
+#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */
+
+/* TPI Integration Test ATB Control Register 0 Definitions */
+#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */
+#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */
+
+#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */
+#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */
+
+#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */
+#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */
+
+#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */
+#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */
+#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */
+ __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */
+ __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */
+ __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */
+ uint32_t RESERVED0[1];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#else
+ uint32_t RESERVED0[3];
+#endif
+ __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */
+ __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/* Secure Fault Status Register Definitions */
+#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */
+#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */
+
+#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */
+#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */
+
+#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */
+#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */
+
+#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */
+#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */
+
+#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */
+#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */
+
+#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */
+#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */
+
+#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */
+#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */
+
+#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */
+#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */
+#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */
+
+#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */
+#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */
+
+#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */
+#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */
+
+#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */
+#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */
+
+#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */
+#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */
+
+#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */
+#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */
+#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */
+#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+ #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+ #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+ #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+ #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */
+ #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Special LR values for Secure/Non-Secure call handling and exception handling */
+
+/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */
+#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */
+
+/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */
+#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */
+#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */
+#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */
+#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */
+#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */
+#define EXC_RETURN_SPSEL (0x00000004UL) /* bit [2] stack pointer used to restore context: 0=MSP 1=PSP */
+#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */
+
+/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */
+#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */
+#else
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */
+#endif
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Set Priority Grouping (non-secure)
+ \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB_NS->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB_NS->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping (non-secure)
+ \details Reads the priority grouping field from the non-secure NVIC when in secure state.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void)
+{
+ return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM33_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm35p.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm35p.h
new file mode 100644
index 0000000000..5579c82306
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm35p.h
@@ -0,0 +1,2910 @@
+/**************************************************************************//**
+ * @file core_cm35p.h
+ * @brief CMSIS Cortex-M35P Core Peripheral Access Layer Header File
+ * @version V1.0.0
+ * @date 12. November 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM35P_H_GENERIC
+#define __CORE_CM35P_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M35P
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM35P definitions */
+#define __CM35P_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM35P_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM35P_CMSIS_VERSION ((__CM35P_CMSIS_VERSION_MAIN << 16U) | \
+ __CM35P_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (35U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined (__TARGET_FPU_VFP)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined (__ARM_FP)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined (__ARMVFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+ #if defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1U)
+ #if defined (__DSP_PRESENT) && (__DSP_PRESENT == 1U)
+ #define __DSP_USED 1U
+ #else
+ #error "Compiler generates DSP (SIMD) instructions for a devices without DSP extensions (check __DSP_PRESENT)"
+ #define __DSP_USED 0U
+ #endif
+ #else
+ #define __DSP_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined (__TI_VFP_SUPPORT__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined (__FPU_VFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM35P_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM35P_H_DEPENDANT
+#define __CORE_CM35P_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM35P_REV
+ #define __CM35P_REV 0x0000U
+ #warning "__CM35P_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __SAUREGION_PRESENT
+ #define __SAUREGION_PRESENT 0U
+ #warning "__SAUREGION_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DSP_PRESENT
+ #define __DSP_PRESENT 0U
+ #warning "__DSP_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M35P */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core SAU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_IT_Pos 25U /*!< xPSR: IT Position */
+#define xPSR_IT_Msk (3UL << xPSR_IT_Pos) /*!< xPSR: IT Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack-pointer select */
+ uint32_t FPCA:1; /*!< bit: 2 Floating-point context active */
+ uint32_t SFPA:1; /*!< bit: 3 Secure floating-point active */
+ uint32_t _reserved1:28; /*!< bit: 4..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SFPA_Pos 3U /*!< CONTROL: SFPA Position */
+#define CONTROL_SFPA_Msk (1UL << CONTROL_SFPA_Pos) /*!< CONTROL: SFPA Mask */
+
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[16U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[16U];
+ __IOM uint32_t ICER[16U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[16U];
+ __IOM uint32_t ISPR[16U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[16U];
+ __IOM uint32_t ICPR[16U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[16U];
+ __IOM uint32_t IABR[16U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[16U];
+ __IOM uint32_t ITNS[16U]; /*!< Offset: 0x280 (R/W) Interrupt Non-Secure State Register */
+ uint32_t RESERVED5[16U];
+ __IOM uint8_t IPR[496U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED6[580U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[6U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ __IOM uint32_t NSACR; /*!< Offset: 0x08C (R/W) Non-Secure Access Control Register */
+ uint32_t RESERVED3[92U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_PENDNMISET_Pos 31U /*!< SCB ICSR: PENDNMISET Position */
+#define SCB_ICSR_PENDNMISET_Msk (1UL << SCB_ICSR_PENDNMISET_Pos) /*!< SCB ICSR: PENDNMISET Mask */
+
+#define SCB_ICSR_NMIPENDSET_Pos SCB_ICSR_PENDNMISET_Pos /*!< SCB ICSR: NMIPENDSET Position, backward compatibility */
+#define SCB_ICSR_NMIPENDSET_Msk SCB_ICSR_PENDNMISET_Msk /*!< SCB ICSR: NMIPENDSET Mask, backward compatibility */
+
+#define SCB_ICSR_PENDNMICLR_Pos 30U /*!< SCB ICSR: PENDNMICLR Position */
+#define SCB_ICSR_PENDNMICLR_Msk (1UL << SCB_ICSR_PENDNMICLR_Pos) /*!< SCB ICSR: PENDNMICLR Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_STTNS_Pos 24U /*!< SCB ICSR: STTNS Position (Security Extension) */
+#define SCB_ICSR_STTNS_Msk (1UL << SCB_ICSR_STTNS_Pos) /*!< SCB ICSR: STTNS Mask (Security Extension) */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIS_Pos 14U /*!< SCB AIRCR: PRIS Position */
+#define SCB_AIRCR_PRIS_Msk (1UL << SCB_AIRCR_PRIS_Pos) /*!< SCB AIRCR: PRIS Mask */
+
+#define SCB_AIRCR_BFHFNMINS_Pos 13U /*!< SCB AIRCR: BFHFNMINS Position */
+#define SCB_AIRCR_BFHFNMINS_Msk (1UL << SCB_AIRCR_BFHFNMINS_Pos) /*!< SCB AIRCR: BFHFNMINS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQS_Pos 3U /*!< SCB AIRCR: SYSRESETREQS Position */
+#define SCB_AIRCR_SYSRESETREQS_Msk (1UL << SCB_AIRCR_SYSRESETREQS_Pos) /*!< SCB AIRCR: SYSRESETREQS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEPS_Pos 3U /*!< SCB SCR: SLEEPDEEPS Position */
+#define SCB_SCR_SLEEPDEEPS_Msk (1UL << SCB_SCR_SLEEPDEEPS_Pos) /*!< SCB SCR: SLEEPDEEPS Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: BP Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: BP Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: IC Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: IC Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: DC Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: DC Mask */
+
+#define SCB_CCR_STKOFHFNMIGN_Pos 10U /*!< SCB CCR: STKOFHFNMIGN Position */
+#define SCB_CCR_STKOFHFNMIGN_Msk (1UL << SCB_CCR_STKOFHFNMIGN_Pos) /*!< SCB CCR: STKOFHFNMIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_HARDFAULTPENDED_Pos 21U /*!< SCB SHCSR: HARDFAULTPENDED Position */
+#define SCB_SHCSR_HARDFAULTPENDED_Msk (1UL << SCB_SHCSR_HARDFAULTPENDED_Pos) /*!< SCB SHCSR: HARDFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTPENDED_Pos 20U /*!< SCB SHCSR: SECUREFAULTPENDED Position */
+#define SCB_SHCSR_SECUREFAULTPENDED_Msk (1UL << SCB_SHCSR_SECUREFAULTPENDED_Pos) /*!< SCB SHCSR: SECUREFAULTPENDED Mask */
+
+#define SCB_SHCSR_SECUREFAULTENA_Pos 19U /*!< SCB SHCSR: SECUREFAULTENA Position */
+#define SCB_SHCSR_SECUREFAULTENA_Msk (1UL << SCB_SHCSR_SECUREFAULTENA_Pos) /*!< SCB SHCSR: SECUREFAULTENA Mask */
+
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_NMIACT_Pos 5U /*!< SCB SHCSR: NMIACT Position */
+#define SCB_SHCSR_NMIACT_Msk (1UL << SCB_SHCSR_NMIACT_Pos) /*!< SCB SHCSR: NMIACT Mask */
+
+#define SCB_SHCSR_SECUREFAULTACT_Pos 4U /*!< SCB SHCSR: SECUREFAULTACT Position */
+#define SCB_SHCSR_SECUREFAULTACT_Msk (1UL << SCB_SHCSR_SECUREFAULTACT_Pos) /*!< SCB SHCSR: SECUREFAULTACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_HARDFAULTACT_Pos 2U /*!< SCB SHCSR: HARDFAULTACT Position */
+#define SCB_SHCSR_HARDFAULTACT_Msk (1UL << SCB_SHCSR_HARDFAULTACT_Pos) /*!< SCB SHCSR: HARDFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_STKOF_Pos (SCB_CFSR_USGFAULTSR_Pos + 4U) /*!< SCB CFSR (UFSR): STKOF Position */
+#define SCB_CFSR_STKOF_Msk (1UL << SCB_CFSR_STKOF_Pos) /*!< SCB CFSR (UFSR): STKOF Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Non-Secure Access Control Register Definitions */
+#define SCB_NSACR_CP11_Pos 11U /*!< SCB NSACR: CP11 Position */
+#define SCB_NSACR_CP11_Msk (1UL << SCB_NSACR_CP11_Pos) /*!< SCB NSACR: CP11 Mask */
+
+#define SCB_NSACR_CP10_Pos 10U /*!< SCB NSACR: CP10 Position */
+#define SCB_NSACR_CP10_Msk (1UL << SCB_NSACR_CP10_Pos) /*!< SCB NSACR: CP10 Mask */
+
+#define SCB_NSACR_CPn_Pos 0U /*!< SCB NSACR: CPn Position */
+#define SCB_NSACR_CPn_Msk (1UL /*<< SCB_NSACR_CPn_Pos*/) /*!< SCB NSACR: CPn Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+ __IOM uint32_t CPPWR; /*!< Offset: 0x00C (R/W) Coprocessor Power Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) ITM Device Architecture Register */
+ uint32_t RESERVED6[4U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Stimulus Port Register Definitions */
+#define ITM_STIM_DISABLED_Pos 1U /*!< ITM STIM: DISABLED Position */
+#define ITM_STIM_DISABLED_Msk (0x1UL << ITM_STIM_DISABLED_Pos) /*!< ITM STIM: DISABLED Mask */
+
+#define ITM_STIM_FIFOREADY_Pos 0U /*!< ITM STIM: FIFOREADY Position */
+#define ITM_STIM_FIFOREADY_Msk (0x1UL /*<< ITM_STIM_FIFOREADY_Pos*/) /*!< ITM STIM: FIFOREADY Mask */
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TRACEBUSID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TRACEBUSID_Msk (0x7FUL << ITM_TCR_TRACEBUSID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPRESCALE_Pos 8U /*!< ITM TCR: TSPRESCALE Position */
+#define ITM_TCR_TSPRESCALE_Msk (3UL << ITM_TCR_TSPRESCALE_Pos) /*!< ITM TCR: TSPRESCALE Mask */
+
+#define ITM_TCR_STALLENA_Pos 5U /*!< ITM TCR: STALLENA Position */
+#define ITM_TCR_STALLENA_Msk (1UL << ITM_TCR_STALLENA_Pos) /*!< ITM TCR: STALLENA Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ uint32_t RESERVED3[1U];
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ uint32_t RESERVED5[1U];
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED6[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ uint32_t RESERVED7[1U];
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t COMP4; /*!< Offset: 0x060 (R/W) Comparator Register 4 */
+ uint32_t RESERVED9[1U];
+ __IOM uint32_t FUNCTION4; /*!< Offset: 0x068 (R/W) Function Register 4 */
+ uint32_t RESERVED10[1U];
+ __IOM uint32_t COMP5; /*!< Offset: 0x070 (R/W) Comparator Register 5 */
+ uint32_t RESERVED11[1U];
+ __IOM uint32_t FUNCTION5; /*!< Offset: 0x078 (R/W) Function Register 5 */
+ uint32_t RESERVED12[1U];
+ __IOM uint32_t COMP6; /*!< Offset: 0x080 (R/W) Comparator Register 6 */
+ uint32_t RESERVED13[1U];
+ __IOM uint32_t FUNCTION6; /*!< Offset: 0x088 (R/W) Function Register 6 */
+ uint32_t RESERVED14[1U];
+ __IOM uint32_t COMP7; /*!< Offset: 0x090 (R/W) Comparator Register 7 */
+ uint32_t RESERVED15[1U];
+ __IOM uint32_t FUNCTION7; /*!< Offset: 0x098 (R/W) Function Register 7 */
+ uint32_t RESERVED16[1U];
+ __IOM uint32_t COMP8; /*!< Offset: 0x0A0 (R/W) Comparator Register 8 */
+ uint32_t RESERVED17[1U];
+ __IOM uint32_t FUNCTION8; /*!< Offset: 0x0A8 (R/W) Function Register 8 */
+ uint32_t RESERVED18[1U];
+ __IOM uint32_t COMP9; /*!< Offset: 0x0B0 (R/W) Comparator Register 9 */
+ uint32_t RESERVED19[1U];
+ __IOM uint32_t FUNCTION9; /*!< Offset: 0x0B8 (R/W) Function Register 9 */
+ uint32_t RESERVED20[1U];
+ __IOM uint32_t COMP10; /*!< Offset: 0x0C0 (R/W) Comparator Register 10 */
+ uint32_t RESERVED21[1U];
+ __IOM uint32_t FUNCTION10; /*!< Offset: 0x0C8 (R/W) Function Register 10 */
+ uint32_t RESERVED22[1U];
+ __IOM uint32_t COMP11; /*!< Offset: 0x0D0 (R/W) Comparator Register 11 */
+ uint32_t RESERVED23[1U];
+ __IOM uint32_t FUNCTION11; /*!< Offset: 0x0D8 (R/W) Function Register 11 */
+ uint32_t RESERVED24[1U];
+ __IOM uint32_t COMP12; /*!< Offset: 0x0E0 (R/W) Comparator Register 12 */
+ uint32_t RESERVED25[1U];
+ __IOM uint32_t FUNCTION12; /*!< Offset: 0x0E8 (R/W) Function Register 12 */
+ uint32_t RESERVED26[1U];
+ __IOM uint32_t COMP13; /*!< Offset: 0x0F0 (R/W) Comparator Register 13 */
+ uint32_t RESERVED27[1U];
+ __IOM uint32_t FUNCTION13; /*!< Offset: 0x0F8 (R/W) Function Register 13 */
+ uint32_t RESERVED28[1U];
+ __IOM uint32_t COMP14; /*!< Offset: 0x100 (R/W) Comparator Register 14 */
+ uint32_t RESERVED29[1U];
+ __IOM uint32_t FUNCTION14; /*!< Offset: 0x108 (R/W) Function Register 14 */
+ uint32_t RESERVED30[1U];
+ __IOM uint32_t COMP15; /*!< Offset: 0x110 (R/W) Comparator Register 15 */
+ uint32_t RESERVED31[1U];
+ __IOM uint32_t FUNCTION15; /*!< Offset: 0x118 (R/W) Function Register 15 */
+ uint32_t RESERVED32[934U];
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+ uint32_t RESERVED33[1U];
+ __IM uint32_t DEVARCH; /*!< Offset: 0xFBC (R/ ) Device Architecture Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCDISS_Pos 23U /*!< DWT CTRL: CYCDISS Position */
+#define DWT_CTRL_CYCDISS_Msk (0x1UL << DWT_CTRL_CYCDISS_Pos) /*!< DWT CTRL: CYCDISS Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_ID_Pos 27U /*!< DWT FUNCTION: ID Position */
+#define DWT_FUNCTION_ID_Msk (0x1FUL << DWT_FUNCTION_ID_Pos) /*!< DWT FUNCTION: ID Mask */
+
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_ACTION_Pos 4U /*!< DWT FUNCTION: ACTION Position */
+#define DWT_FUNCTION_ACTION_Msk (0x1UL << DWT_FUNCTION_ACTION_Pos) /*!< DWT FUNCTION: ACTION Mask */
+
+#define DWT_FUNCTION_MATCH_Pos 0U /*!< DWT FUNCTION: MATCH Position */
+#define DWT_FUNCTION_MATCH_Msk (0xFUL /*<< DWT_FUNCTION_MATCH_Pos*/) /*!< DWT FUNCTION: MATCH Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IOM uint32_t PSCR; /*!< Offset: 0x308 (R/W) Periodic Synchronization Control Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t ITFTTD0; /*!< Offset: 0xEEC (R/ ) Integration Test FIFO Test Data 0 Register */
+ __IOM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/W) Integration Test ATB Control Register 2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) Integration Test ATB Control Register 0 */
+ __IM uint32_t ITFTTD1; /*!< Offset: 0xEFC (R/ ) Integration Test FIFO Test Data 1 Register */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) Device Configuration Register */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) Device Type Identifier Register */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_FOnMan_Pos 6U /*!< TPI FFCR: FOnMan Position */
+#define TPI_FFCR_FOnMan_Msk (0x1UL << TPI_FFCR_FOnMan_Pos) /*!< TPI FFCR: FOnMan Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration Test FIFO Test Data 0 Register Definitions */
+#define TPI_ITFTTD0_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD0: ATB Interface 2 ATVALIDPosition */
+#define TPI_ITFTTD0_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 2 ATVALID Mask */
+
+#define TPI_ITFTTD0_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD0: ATB Interface 2 byte count Position */
+#define TPI_ITFTTD0_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 2 byte count Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Position */
+#define TPI_ITFTTD0_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD0: ATB Interface 1 ATVALID Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD0: ATB Interface 1 byte count Position */
+#define TPI_ITFTTD0_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD0_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD0: ATB Interface 1 byte countt Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data2_Pos 16U /*!< TPI ITFTTD0: ATB Interface 1 data2 Position */
+#define TPI_ITFTTD0_ATB_IF1_data2_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data2 Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data1_Pos 8U /*!< TPI ITFTTD0: ATB Interface 1 data1 Position */
+#define TPI_ITFTTD0_ATB_IF1_data1_Msk (0xFFUL << TPI_ITFTTD0_ATB_IF1_data1_Pos) /*!< TPI ITFTTD0: ATB Interface 1 data1 Mask */
+
+#define TPI_ITFTTD0_ATB_IF1_data0_Pos 0U /*!< TPI ITFTTD0: ATB Interface 1 data0 Position */
+#define TPI_ITFTTD0_ATB_IF1_data0_Msk (0xFFUL /*<< TPI_ITFTTD0_ATB_IF1_data0_Pos*/) /*!< TPI ITFTTD0: ATB Interface 1 data0 Mask */
+
+/* TPI Integration Test ATB Control Register 2 Register Definitions */
+#define TPI_ITATBCTR2_AFVALID2S_Pos 1U /*!< TPI ITATBCTR2: AFVALID2S Position */
+#define TPI_ITATBCTR2_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID2S_Pos) /*!< TPI ITATBCTR2: AFVALID2SS Mask */
+
+#define TPI_ITATBCTR2_AFVALID1S_Pos 1U /*!< TPI ITATBCTR2: AFVALID1S Position */
+#define TPI_ITATBCTR2_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR2_AFVALID1S_Pos) /*!< TPI ITATBCTR2: AFVALID1SS Mask */
+
+#define TPI_ITATBCTR2_ATREADY2S_Pos 0U /*!< TPI ITATBCTR2: ATREADY2S Position */
+#define TPI_ITATBCTR2_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2S_Pos*/) /*!< TPI ITATBCTR2: ATREADY2S Mask */
+
+#define TPI_ITATBCTR2_ATREADY1S_Pos 0U /*!< TPI ITATBCTR2: ATREADY1S Position */
+#define TPI_ITATBCTR2_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1S_Pos*/) /*!< TPI ITATBCTR2: ATREADY1S Mask */
+
+/* TPI Integration Test FIFO Test Data 1 Register Definitions */
+#define TPI_ITFTTD1_ATB_IF2_ATVALID_Pos 29U /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Position */
+#define TPI_ITFTTD1_ATB_IF2_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 2 ATVALID Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_bytecount_Pos 27U /*!< TPI ITFTTD1: ATB Interface 2 byte count Position */
+#define TPI_ITFTTD1_ATB_IF2_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF2_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 2 byte count Mask */
+
+#define TPI_ITFTTD1_ATB_IF1_ATVALID_Pos 26U /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Position */
+#define TPI_ITFTTD1_ATB_IF1_ATVALID_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_ATVALID_Pos) /*!< TPI ITFTTD1: ATB Interface 1 ATVALID Mask */
+
+#define TPI_ITFTTD1_ATB_IF1_bytecount_Pos 24U /*!< TPI ITFTTD1: ATB Interface 1 byte count Position */
+#define TPI_ITFTTD1_ATB_IF1_bytecount_Msk (0x3UL << TPI_ITFTTD1_ATB_IF1_bytecount_Pos) /*!< TPI ITFTTD1: ATB Interface 1 byte countt Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data2_Pos 16U /*!< TPI ITFTTD1: ATB Interface 2 data2 Position */
+#define TPI_ITFTTD1_ATB_IF2_data2_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data2 Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data1_Pos 8U /*!< TPI ITFTTD1: ATB Interface 2 data1 Position */
+#define TPI_ITFTTD1_ATB_IF2_data1_Msk (0xFFUL << TPI_ITFTTD1_ATB_IF2_data1_Pos) /*!< TPI ITFTTD1: ATB Interface 2 data1 Mask */
+
+#define TPI_ITFTTD1_ATB_IF2_data0_Pos 0U /*!< TPI ITFTTD1: ATB Interface 2 data0 Position */
+#define TPI_ITFTTD1_ATB_IF2_data0_Msk (0xFFUL /*<< TPI_ITFTTD1_ATB_IF2_data0_Pos*/) /*!< TPI ITFTTD1: ATB Interface 2 data0 Mask */
+
+/* TPI Integration Test ATB Control Register 0 Definitions */
+#define TPI_ITATBCTR0_AFVALID2S_Pos 1U /*!< TPI ITATBCTR0: AFVALID2S Position */
+#define TPI_ITATBCTR0_AFVALID2S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID2S_Pos) /*!< TPI ITATBCTR0: AFVALID2SS Mask */
+
+#define TPI_ITATBCTR0_AFVALID1S_Pos 1U /*!< TPI ITATBCTR0: AFVALID1S Position */
+#define TPI_ITATBCTR0_AFVALID1S_Msk (0x1UL << TPI_ITATBCTR0_AFVALID1S_Pos) /*!< TPI ITATBCTR0: AFVALID1SS Mask */
+
+#define TPI_ITATBCTR0_ATREADY2S_Pos 0U /*!< TPI ITATBCTR0: ATREADY2S Position */
+#define TPI_ITATBCTR0_ATREADY2S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2S_Pos*/) /*!< TPI ITATBCTR0: ATREADY2S Mask */
+
+#define TPI_ITATBCTR0_ATREADY1S_Pos 0U /*!< TPI ITATBCTR0: ATREADY1S Position */
+#define TPI_ITATBCTR0_ATREADY1S_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1S_Pos*/) /*!< TPI ITATBCTR0: ATREADY1S Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_FIFOSZ_Pos 6U /*!< TPI DEVID: FIFOSZ Position */
+#define TPI_DEVID_FIFOSZ_Msk (0x7UL << TPI_DEVID_FIFOSZ_Pos) /*!< TPI DEVID: FIFOSZ Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x3FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) MPU Region Limit Address Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Region Base Address Register Alias 1 */
+ __IOM uint32_t RLAR_A1; /*!< Offset: 0x018 (R/W) MPU Region Limit Address Register Alias 1 */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Region Base Address Register Alias 2 */
+ __IOM uint32_t RLAR_A2; /*!< Offset: 0x020 (R/W) MPU Region Limit Address Register Alias 2 */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Region Base Address Register Alias 3 */
+ __IOM uint32_t RLAR_A3; /*!< Offset: 0x028 (R/W) MPU Region Limit Address Register Alias 3 */
+ uint32_t RESERVED0[1];
+ union {
+ __IOM uint32_t MAIR[2];
+ struct {
+ __IOM uint32_t MAIR0; /*!< Offset: 0x030 (R/W) MPU Memory Attribute Indirection Register 0 */
+ __IOM uint32_t MAIR1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
+ };
+ };
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_BASE_Pos 5U /*!< MPU RBAR: BASE Position */
+#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_Pos) /*!< MPU RBAR: BASE Mask */
+
+#define MPU_RBAR_SH_Pos 3U /*!< MPU RBAR: SH Position */
+#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos) /*!< MPU RBAR: SH Mask */
+
+#define MPU_RBAR_AP_Pos 1U /*!< MPU RBAR: AP Position */
+#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos) /*!< MPU RBAR: AP Mask */
+
+#define MPU_RBAR_XN_Pos 0U /*!< MPU RBAR: XN Position */
+#define MPU_RBAR_XN_Msk (01UL /*<< MPU_RBAR_XN_Pos*/) /*!< MPU RBAR: XN Mask */
+
+/* MPU Region Limit Address Register Definitions */
+#define MPU_RLAR_LIMIT_Pos 5U /*!< MPU RLAR: LIMIT Position */
+#define MPU_RLAR_LIMIT_Msk (0x7FFFFFFUL << MPU_RLAR_LIMIT_Pos) /*!< MPU RLAR: LIMIT Mask */
+
+#define MPU_RLAR_AttrIndx_Pos 1U /*!< MPU RLAR: AttrIndx Position */
+#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos) /*!< MPU RLAR: AttrIndx Mask */
+
+#define MPU_RLAR_EN_Pos 0U /*!< MPU RLAR: Region enable bit Position */
+#define MPU_RLAR_EN_Msk (1UL /*<< MPU_RLAR_EN_Pos*/) /*!< MPU RLAR: Region enable bit Disable Mask */
+
+/* MPU Memory Attribute Indirection Register 0 Definitions */
+#define MPU_MAIR0_Attr3_Pos 24U /*!< MPU MAIR0: Attr3 Position */
+#define MPU_MAIR0_Attr3_Msk (0xFFUL << MPU_MAIR0_Attr3_Pos) /*!< MPU MAIR0: Attr3 Mask */
+
+#define MPU_MAIR0_Attr2_Pos 16U /*!< MPU MAIR0: Attr2 Position */
+#define MPU_MAIR0_Attr2_Msk (0xFFUL << MPU_MAIR0_Attr2_Pos) /*!< MPU MAIR0: Attr2 Mask */
+
+#define MPU_MAIR0_Attr1_Pos 8U /*!< MPU MAIR0: Attr1 Position */
+#define MPU_MAIR0_Attr1_Msk (0xFFUL << MPU_MAIR0_Attr1_Pos) /*!< MPU MAIR0: Attr1 Mask */
+
+#define MPU_MAIR0_Attr0_Pos 0U /*!< MPU MAIR0: Attr0 Position */
+#define MPU_MAIR0_Attr0_Msk (0xFFUL /*<< MPU_MAIR0_Attr0_Pos*/) /*!< MPU MAIR0: Attr0 Mask */
+
+/* MPU Memory Attribute Indirection Register 1 Definitions */
+#define MPU_MAIR1_Attr7_Pos 24U /*!< MPU MAIR1: Attr7 Position */
+#define MPU_MAIR1_Attr7_Msk (0xFFUL << MPU_MAIR1_Attr7_Pos) /*!< MPU MAIR1: Attr7 Mask */
+
+#define MPU_MAIR1_Attr6_Pos 16U /*!< MPU MAIR1: Attr6 Position */
+#define MPU_MAIR1_Attr6_Msk (0xFFUL << MPU_MAIR1_Attr6_Pos) /*!< MPU MAIR1: Attr6 Mask */
+
+#define MPU_MAIR1_Attr5_Pos 8U /*!< MPU MAIR1: Attr5 Position */
+#define MPU_MAIR1_Attr5_Msk (0xFFUL << MPU_MAIR1_Attr5_Pos) /*!< MPU MAIR1: Attr5 Mask */
+
+#define MPU_MAIR1_Attr4_Pos 0U /*!< MPU MAIR1: Attr4 Position */
+#define MPU_MAIR1_Attr4_Msk (0xFFUL /*<< MPU_MAIR1_Attr4_Pos*/) /*!< MPU MAIR1: Attr4 Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SAU Security Attribution Unit (SAU)
+ \brief Type definitions for the Security Attribution Unit (SAU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Security Attribution Unit (SAU).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SAU Control Register */
+ __IM uint32_t TYPE; /*!< Offset: 0x004 (R/ ) SAU Type Register */
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) SAU Region Number Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) SAU Region Base Address Register */
+ __IOM uint32_t RLAR; /*!< Offset: 0x010 (R/W) SAU Region Limit Address Register */
+#else
+ uint32_t RESERVED0[3];
+#endif
+ __IOM uint32_t SFSR; /*!< Offset: 0x014 (R/W) Secure Fault Status Register */
+ __IOM uint32_t SFAR; /*!< Offset: 0x018 (R/W) Secure Fault Address Register */
+} SAU_Type;
+
+/* SAU Control Register Definitions */
+#define SAU_CTRL_ALLNS_Pos 1U /*!< SAU CTRL: ALLNS Position */
+#define SAU_CTRL_ALLNS_Msk (1UL << SAU_CTRL_ALLNS_Pos) /*!< SAU CTRL: ALLNS Mask */
+
+#define SAU_CTRL_ENABLE_Pos 0U /*!< SAU CTRL: ENABLE Position */
+#define SAU_CTRL_ENABLE_Msk (1UL /*<< SAU_CTRL_ENABLE_Pos*/) /*!< SAU CTRL: ENABLE Mask */
+
+/* SAU Type Register Definitions */
+#define SAU_TYPE_SREGION_Pos 0U /*!< SAU TYPE: SREGION Position */
+#define SAU_TYPE_SREGION_Msk (0xFFUL /*<< SAU_TYPE_SREGION_Pos*/) /*!< SAU TYPE: SREGION Mask */
+
+#if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
+/* SAU Region Number Register Definitions */
+#define SAU_RNR_REGION_Pos 0U /*!< SAU RNR: REGION Position */
+#define SAU_RNR_REGION_Msk (0xFFUL /*<< SAU_RNR_REGION_Pos*/) /*!< SAU RNR: REGION Mask */
+
+/* SAU Region Base Address Register Definitions */
+#define SAU_RBAR_BADDR_Pos 5U /*!< SAU RBAR: BADDR Position */
+#define SAU_RBAR_BADDR_Msk (0x7FFFFFFUL << SAU_RBAR_BADDR_Pos) /*!< SAU RBAR: BADDR Mask */
+
+/* SAU Region Limit Address Register Definitions */
+#define SAU_RLAR_LADDR_Pos 5U /*!< SAU RLAR: LADDR Position */
+#define SAU_RLAR_LADDR_Msk (0x7FFFFFFUL << SAU_RLAR_LADDR_Pos) /*!< SAU RLAR: LADDR Mask */
+
+#define SAU_RLAR_NSC_Pos 1U /*!< SAU RLAR: NSC Position */
+#define SAU_RLAR_NSC_Msk (1UL << SAU_RLAR_NSC_Pos) /*!< SAU RLAR: NSC Mask */
+
+#define SAU_RLAR_ENABLE_Pos 0U /*!< SAU RLAR: ENABLE Position */
+#define SAU_RLAR_ENABLE_Msk (1UL /*<< SAU_RLAR_ENABLE_Pos*/) /*!< SAU RLAR: ENABLE Mask */
+
+#endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
+
+/* Secure Fault Status Register Definitions */
+#define SAU_SFSR_LSERR_Pos 7U /*!< SAU SFSR: LSERR Position */
+#define SAU_SFSR_LSERR_Msk (1UL << SAU_SFSR_LSERR_Pos) /*!< SAU SFSR: LSERR Mask */
+
+#define SAU_SFSR_SFARVALID_Pos 6U /*!< SAU SFSR: SFARVALID Position */
+#define SAU_SFSR_SFARVALID_Msk (1UL << SAU_SFSR_SFARVALID_Pos) /*!< SAU SFSR: SFARVALID Mask */
+
+#define SAU_SFSR_LSPERR_Pos 5U /*!< SAU SFSR: LSPERR Position */
+#define SAU_SFSR_LSPERR_Msk (1UL << SAU_SFSR_LSPERR_Pos) /*!< SAU SFSR: LSPERR Mask */
+
+#define SAU_SFSR_INVTRAN_Pos 4U /*!< SAU SFSR: INVTRAN Position */
+#define SAU_SFSR_INVTRAN_Msk (1UL << SAU_SFSR_INVTRAN_Pos) /*!< SAU SFSR: INVTRAN Mask */
+
+#define SAU_SFSR_AUVIOL_Pos 3U /*!< SAU SFSR: AUVIOL Position */
+#define SAU_SFSR_AUVIOL_Msk (1UL << SAU_SFSR_AUVIOL_Pos) /*!< SAU SFSR: AUVIOL Mask */
+
+#define SAU_SFSR_INVER_Pos 2U /*!< SAU SFSR: INVER Position */
+#define SAU_SFSR_INVER_Msk (1UL << SAU_SFSR_INVER_Pos) /*!< SAU SFSR: INVER Mask */
+
+#define SAU_SFSR_INVIS_Pos 1U /*!< SAU SFSR: INVIS Position */
+#define SAU_SFSR_INVIS_Msk (1UL << SAU_SFSR_INVIS_Pos) /*!< SAU SFSR: INVIS Mask */
+
+#define SAU_SFSR_INVEP_Pos 0U /*!< SAU SFSR: INVEP Position */
+#define SAU_SFSR_INVEP_Msk (1UL /*<< SAU_SFSR_INVEP_Pos*/) /*!< SAU SFSR: INVEP Mask */
+
+/*@} end of group CMSIS_SAU */
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_LSPENS_Pos 29U /*!< FPCCR: LSPENS Position */
+#define FPU_FPCCR_LSPENS_Msk (1UL << FPU_FPCCR_LSPENS_Pos) /*!< FPCCR: LSPENS bit Mask */
+
+#define FPU_FPCCR_CLRONRET_Pos 28U /*!< FPCCR: CLRONRET Position */
+#define FPU_FPCCR_CLRONRET_Msk (1UL << FPU_FPCCR_CLRONRET_Pos) /*!< FPCCR: CLRONRET bit Mask */
+
+#define FPU_FPCCR_CLRONRETS_Pos 27U /*!< FPCCR: CLRONRETS Position */
+#define FPU_FPCCR_CLRONRETS_Msk (1UL << FPU_FPCCR_CLRONRETS_Pos) /*!< FPCCR: CLRONRETS bit Mask */
+
+#define FPU_FPCCR_TS_Pos 26U /*!< FPCCR: TS Position */
+#define FPU_FPCCR_TS_Msk (1UL << FPU_FPCCR_TS_Pos) /*!< FPCCR: TS bit Mask */
+
+#define FPU_FPCCR_UFRDY_Pos 10U /*!< FPCCR: UFRDY Position */
+#define FPU_FPCCR_UFRDY_Msk (1UL << FPU_FPCCR_UFRDY_Pos) /*!< FPCCR: UFRDY bit Mask */
+
+#define FPU_FPCCR_SPLIMVIOL_Pos 9U /*!< FPCCR: SPLIMVIOL Position */
+#define FPU_FPCCR_SPLIMVIOL_Msk (1UL << FPU_FPCCR_SPLIMVIOL_Pos) /*!< FPCCR: SPLIMVIOL bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_SFRDY_Pos 7U /*!< FPCCR: SFRDY Position */
+#define FPU_FPCCR_SFRDY_Msk (1UL << FPU_FPCCR_SFRDY_Pos) /*!< FPCCR: SFRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_S_Pos 2U /*!< FPCCR: Security status of the FP context bit Position */
+#define FPU_FPCCR_S_Msk (1UL << FPU_FPCCR_S_Pos) /*!< FPCCR: Security status of the FP context bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+ uint32_t RESERVED4[1U];
+ __IOM uint32_t DAUTHCTRL; /*!< Offset: 0x014 (R/W) Debug Authentication Control Register */
+ __IOM uint32_t DSCSR; /*!< Offset: 0x018 (R/W) Debug Security Control and Status Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESTART_ST_Pos 26U /*!< CoreDebug DHCSR: S_RESTART_ST Position */
+#define CoreDebug_DHCSR_S_RESTART_ST_Msk (1UL << CoreDebug_DHCSR_S_RESTART_ST_Pos) /*!< CoreDebug DHCSR: S_RESTART_ST Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/* Debug Authentication Control Register Definitions */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos 3U /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Position */
+#define CoreDebug_DAUTHCTRL_INTSPNIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPNIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPNIDEN, Mask */
+
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos 2U /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPNIDENSEL_Msk (1UL << CoreDebug_DAUTHCTRL_SPNIDENSEL_Pos) /*!< CoreDebug DAUTHCTRL: SPNIDENSEL Mask */
+
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Pos 1U /*!< CoreDebug DAUTHCTRL: INTSPIDEN Position */
+#define CoreDebug_DAUTHCTRL_INTSPIDEN_Msk (1UL << CoreDebug_DAUTHCTRL_INTSPIDEN_Pos) /*!< CoreDebug DAUTHCTRL: INTSPIDEN Mask */
+
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Pos 0U /*!< CoreDebug DAUTHCTRL: SPIDENSEL Position */
+#define CoreDebug_DAUTHCTRL_SPIDENSEL_Msk (1UL /*<< CoreDebug_DAUTHCTRL_SPIDENSEL_Pos*/) /*!< CoreDebug DAUTHCTRL: SPIDENSEL Mask */
+
+/* Debug Security Control and Status Register Definitions */
+#define CoreDebug_DSCSR_CDS_Pos 16U /*!< CoreDebug DSCSR: CDS Position */
+#define CoreDebug_DSCSR_CDS_Msk (1UL << CoreDebug_DSCSR_CDS_Pos) /*!< CoreDebug DSCSR: CDS Mask */
+
+#define CoreDebug_DSCSR_SBRSEL_Pos 1U /*!< CoreDebug DSCSR: SBRSEL Position */
+#define CoreDebug_DSCSR_SBRSEL_Msk (1UL << CoreDebug_DSCSR_SBRSEL_Pos) /*!< CoreDebug DSCSR: SBRSEL Mask */
+
+#define CoreDebug_DSCSR_SBRSELEN_Pos 0U /*!< CoreDebug DSCSR: SBRSELEN Position */
+#define CoreDebug_DSCSR_SBRSELEN_Msk (1UL /*<< CoreDebug_DSCSR_SBRSELEN_Pos*/) /*!< CoreDebug DSCSR: SBRSELEN Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+ #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+ #define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+ #define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+ #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+ #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+ #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+ #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+ #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+ #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+ #define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+ #define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+ #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE ) /*!< Core Debug configuration struct */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+ #endif
+
+ #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SAU_BASE (SCS_BASE + 0x0DD0UL) /*!< Security Attribution Unit */
+ #define SAU ((SAU_Type *) SAU_BASE ) /*!< Security Attribution Unit */
+ #endif
+
+ #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+ #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+ #define SCS_BASE_NS (0xE002E000UL) /*!< System Control Space Base Address (non-secure address space) */
+ #define CoreDebug_BASE_NS (0xE002EDF0UL) /*!< Core Debug Base Address (non-secure address space) */
+ #define SysTick_BASE_NS (SCS_BASE_NS + 0x0010UL) /*!< SysTick Base Address (non-secure address space) */
+ #define NVIC_BASE_NS (SCS_BASE_NS + 0x0100UL) /*!< NVIC Base Address (non-secure address space) */
+ #define SCB_BASE_NS (SCS_BASE_NS + 0x0D00UL) /*!< System Control Block Base Address (non-secure address space) */
+
+ #define SCnSCB_NS ((SCnSCB_Type *) SCS_BASE_NS ) /*!< System control Register not in SCB(non-secure address space) */
+ #define SCB_NS ((SCB_Type *) SCB_BASE_NS ) /*!< SCB configuration struct (non-secure address space) */
+ #define SysTick_NS ((SysTick_Type *) SysTick_BASE_NS ) /*!< SysTick configuration struct (non-secure address space) */
+ #define NVIC_NS ((NVIC_Type *) NVIC_BASE_NS ) /*!< NVIC configuration struct (non-secure address space) */
+ #define CoreDebug_NS ((CoreDebug_Type *) CoreDebug_BASE_NS) /*!< Core Debug configuration struct (non-secure address space) */
+
+ #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE_NS (SCS_BASE_NS + 0x0D90UL) /*!< Memory Protection Unit (non-secure address space) */
+ #define MPU_NS ((MPU_Type *) MPU_BASE_NS ) /*!< Memory Protection Unit (non-secure address space) */
+ #endif
+
+ #define FPU_BASE_NS (SCS_BASE_NS + 0x0F30UL) /*!< Floating Point Unit (non-secure address space) */
+ #define FPU_NS ((FPU_Type *) FPU_BASE_NS ) /*!< Floating Point Unit (non-secure address space) */
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* Special LR values for Secure/Non-Secure call handling and exception handling */
+
+/* Function Return Payload (from ARMv8-M Architecture Reference Manual) LR value on entry from Secure BLXNS */
+#define FNC_RETURN (0xFEFFFFFFUL) /* bit [0] ignored when processing a branch */
+
+/* The following EXC_RETURN mask values are used to evaluate the LR on exception entry */
+#define EXC_RETURN_PREFIX (0xFF000000UL) /* bits [31:24] set to indicate an EXC_RETURN value */
+#define EXC_RETURN_S (0x00000040UL) /* bit [6] stack used to push registers: 0=Non-secure 1=Secure */
+#define EXC_RETURN_DCRS (0x00000020UL) /* bit [5] stacking rules for called registers: 0=skipped 1=saved */
+#define EXC_RETURN_FTYPE (0x00000010UL) /* bit [4] allocate stack for floating-point context: 0=done 1=skipped */
+#define EXC_RETURN_MODE (0x00000008UL) /* bit [3] processor mode for return: 0=Handler mode 1=Thread mode */
+#define EXC_RETURN_SPSEL (0x00000004UL) /* bit [2] stack pointer used to restore context: 0=MSP 1=PSP */
+#define EXC_RETURN_ES (0x00000001UL) /* bit [0] security state exception was taken to: 0=Non-secure 1=Secure */
+
+/* Integrity Signature (from ARMv8-M Architecture Reference Manual) for exception context stacking */
+#if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) /* Value for processors with floating-point extension: */
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125AUL) /* bit [0] SFTC must match LR bit[4] EXC_RETURN_FTYPE */
+#else
+#define EXC_INTEGRITY_SIGNATURE (0xFEFA125BUL) /* Value for processors without floating-point extension */
+#endif
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Get Interrupt Target State
+ \details Reads the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ \return 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_GetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Target State
+ \details Sets the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_SetTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] |= ((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Clear Interrupt Target State
+ \details Clears the interrupt target field in the NVIC and returns the interrupt target bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 if interrupt is assigned to Secure
+ 1 if interrupt is assigned to Non Secure
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t NVIC_ClearTargetState(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] &= ~((uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)));
+ return((uint32_t)(((NVIC->ITNS[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief Set Priority Grouping (non-secure)
+ \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB_NS->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB_NS->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping (non-secure)
+ \details Reads the priority grouping field from the non-secure NVIC when in secure state.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriorityGrouping_NS(void)
+{
+ return ((uint32_t)((SCB_NS->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt (non-secure)
+ \details Enables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status (non-secure)
+ \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt (non-secure)
+ \details Disables a device specific interrupt in the non-secure NVIC interrupt controller when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt (non-secure)
+ \details Reads the NVIC pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt (non-secure)
+ \details Sets the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt (non-secure)
+ \details Clears the pending bit of a device specific interrupt in the non-secure NVIC pending register when in secure state.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt (non-secure)
+ \details Reads the active register in non-secure NVIC when in secure state and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC_NS->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority (non-secure)
+ \details Sets the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every non-secure processor exception.
+ */
+__STATIC_INLINE void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC_NS->IPR[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority (non-secure)
+ \details Reads the priority of a non-secure device specific interrupt or a non-secure processor exception when in secure state.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC_NS->IPR[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB_NS->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+#endif /* defined (__ARM_FEATURE_CMSE) &&(__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv8.h"
+
+#endif
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## SAU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SAUFunctions SAU Functions
+ \brief Functions that configure the SAU.
+ @{
+ */
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+
+/**
+ \brief Enable SAU
+ \details Enables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Enable(void)
+{
+ SAU->CTRL |= (SAU_CTRL_ENABLE_Msk);
+}
+
+
+
+/**
+ \brief Disable SAU
+ \details Disables the Security Attribution Unit (SAU).
+ */
+__STATIC_INLINE void TZ_SAU_Disable(void)
+{
+ SAU->CTRL &= ~(SAU_CTRL_ENABLE_Msk);
+}
+
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+/*@} end of CMSIS_Core_SAUFunctions */
+
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
+/**
+ \brief System Tick Configuration (non-secure)
+ \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+
+ */
+__STATIC_INLINE uint32_t TZ_SysTick_Config_NS(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick_NS->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ TZ_NVIC_SetPriority_NS (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick_NS->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick_NS->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+#endif /* defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM35P_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm4.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm4.h
new file mode 100644
index 0000000000..12c023b801
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm4.h
@@ -0,0 +1,2124 @@
+/**************************************************************************//**
+ * @file core_cm4.h
+ * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File
+ * @version V5.1.0
+ * @date 13. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM4_H_GENERIC
+#define __CORE_CM4_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M4
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM4 definitions */
+#define __CM4_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM4_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
+ __CM4_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (4U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM4_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM4_H_DEPENDANT
+#define __CORE_CM4_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM4_REV
+ #define __CM4_REV 0x0000U
+ #warning "__CM4_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M4 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */
+ uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[24U];
+ __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RESERVED1[24U];
+ __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[24U];
+ __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[24U];
+ __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[56U];
+ __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED5[644U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ uint32_t RESERVED0[5U];
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */
+#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */
+
+#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */
+#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */
+
+#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */
+#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[6U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x1UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x1UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */
+#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */
+
+#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */
+#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x1UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x1UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */
+#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */
+
+#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */
+#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
+ __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
+ __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
+ __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/* Media and FP Feature Register 2 Definitions */
+
+#define FPU_MVFR2_VFP_Misc_Pos 4U /*!< MVFR2: VFP Misc bits Position */
+#define FPU_MVFR2_VFP_Misc_Msk (0xFUL << FPU_MVFR2_VFP_Misc_Pos) /*!< MVFR2: VFP Misc bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */
+#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */
+#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
+ /* ARM Application Note 321 states that the M4 does not require the architectural barrier */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = FPU->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM4_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_cm7.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm7.h
new file mode 100644
index 0000000000..c4515d8fa3
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_cm7.h
@@ -0,0 +1,2725 @@
+/**************************************************************************//**
+ * @file core_cm7.h
+ * @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File
+ * @version V5.1.1
+ * @date 28. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_CM7_H_GENERIC
+#define __CORE_CM7_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup Cortex_M7
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS CM7 definitions */
+#define __CM7_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __CM7_CMSIS_VERSION_SUB ( __CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __CM7_CMSIS_VERSION ((__CM7_CMSIS_VERSION_MAIN << 16U) | \
+ __CM7_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_M (7U) /*!< Cortex-M Core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
+*/
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
+ #define __FPU_USED 1U
+ #else
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #define __FPU_USED 0U
+ #endif
+ #else
+ #define __FPU_USED 0U
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM7_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_CM7_H_DEPENDANT
+#define __CORE_CM7_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __CM7_REV
+ #define __CM7_REV 0x0000U
+ #warning "__CM7_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __FPU_PRESENT
+ #define __FPU_PRESENT 0U
+ #warning "__FPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __ICACHE_PRESENT
+ #define __ICACHE_PRESENT 0U
+ #warning "__ICACHE_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DCACHE_PRESENT
+ #define __DCACHE_PRESENT 0U
+ #warning "__DCACHE_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __DTCM_PRESENT
+ #define __DTCM_PRESENT 0U
+ #warning "__DTCM_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group Cortex_M7 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ - Core FPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+#define APSR_GE_Pos 16U /*!< APSR: GE Position */
+#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
+ uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
+ uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */
+#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */
+
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */
+ uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */
+#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */
+
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[24U];
+ __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RESERVED1[24U];
+ __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[24U];
+ __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[24U];
+ __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[56U];
+ __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED5[644U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHPR[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t ID_PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t ID_DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ID_AFR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t ID_MFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ID_ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ uint32_t RESERVED0[1U];
+ __IM uint32_t CLIDR; /*!< Offset: 0x078 (R/ ) Cache Level ID register */
+ __IM uint32_t CTR; /*!< Offset: 0x07C (R/ ) Cache Type register */
+ __IM uint32_t CCSIDR; /*!< Offset: 0x080 (R/ ) Cache Size ID Register */
+ __IOM uint32_t CSSELR; /*!< Offset: 0x084 (R/W) Cache Size Selection Register */
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ uint32_t RESERVED3[93U];
+ __OM uint32_t STIR; /*!< Offset: 0x200 ( /W) Software Triggered Interrupt Register */
+ uint32_t RESERVED4[15U];
+ __IM uint32_t MVFR0; /*!< Offset: 0x240 (R/ ) Media and VFP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x244 (R/ ) Media and VFP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x248 (R/ ) Media and VFP Feature Register 2 */
+ uint32_t RESERVED5[1U];
+ __OM uint32_t ICIALLU; /*!< Offset: 0x250 ( /W) I-Cache Invalidate All to PoU */
+ uint32_t RESERVED6[1U];
+ __OM uint32_t ICIMVAU; /*!< Offset: 0x258 ( /W) I-Cache Invalidate by MVA to PoU */
+ __OM uint32_t DCIMVAC; /*!< Offset: 0x25C ( /W) D-Cache Invalidate by MVA to PoC */
+ __OM uint32_t DCISW; /*!< Offset: 0x260 ( /W) D-Cache Invalidate by Set-way */
+ __OM uint32_t DCCMVAU; /*!< Offset: 0x264 ( /W) D-Cache Clean by MVA to PoU */
+ __OM uint32_t DCCMVAC; /*!< Offset: 0x268 ( /W) D-Cache Clean by MVA to PoC */
+ __OM uint32_t DCCSW; /*!< Offset: 0x26C ( /W) D-Cache Clean by Set-way */
+ __OM uint32_t DCCIMVAC; /*!< Offset: 0x270 ( /W) D-Cache Clean and Invalidate by MVA to PoC */
+ __OM uint32_t DCCISW; /*!< Offset: 0x274 ( /W) D-Cache Clean and Invalidate by Set-way */
+ uint32_t RESERVED7[6U];
+ __IOM uint32_t ITCMCR; /*!< Offset: 0x290 (R/W) Instruction Tightly-Coupled Memory Control Register */
+ __IOM uint32_t DTCMCR; /*!< Offset: 0x294 (R/W) Data Tightly-Coupled Memory Control Registers */
+ __IOM uint32_t AHBPCR; /*!< Offset: 0x298 (R/W) AHBP Control Register */
+ __IOM uint32_t CACR; /*!< Offset: 0x29C (R/W) L1 Cache Control Register */
+ __IOM uint32_t AHBSCR; /*!< Offset: 0x2A0 (R/W) AHB Slave Control Register */
+ uint32_t RESERVED8[1U];
+ __IOM uint32_t ABFSR; /*!< Offset: 0x2A8 (R/W) Auxiliary Bus Fault Status Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_BP_Pos 18U /*!< SCB CCR: Branch prediction enable bit Position */
+#define SCB_CCR_BP_Msk (1UL << SCB_CCR_BP_Pos) /*!< SCB CCR: Branch prediction enable bit Mask */
+
+#define SCB_CCR_IC_Pos 17U /*!< SCB CCR: Instruction cache enable bit Position */
+#define SCB_CCR_IC_Msk (1UL << SCB_CCR_IC_Pos) /*!< SCB CCR: Instruction cache enable bit Mask */
+
+#define SCB_CCR_DC_Pos 16U /*!< SCB CCR: Cache enable bit Position */
+#define SCB_CCR_DC_Msk (1UL << SCB_CCR_DC_Pos) /*!< SCB CCR: Cache enable bit Mask */
+
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MLSPERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */
+#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */
+#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/* SCB Cache Level ID Register Definitions */
+#define SCB_CLIDR_LOUU_Pos 27U /*!< SCB CLIDR: LoUU Position */
+#define SCB_CLIDR_LOUU_Msk (7UL << SCB_CLIDR_LOUU_Pos) /*!< SCB CLIDR: LoUU Mask */
+
+#define SCB_CLIDR_LOC_Pos 24U /*!< SCB CLIDR: LoC Position */
+#define SCB_CLIDR_LOC_Msk (7UL << SCB_CLIDR_LOC_Pos) /*!< SCB CLIDR: LoC Mask */
+
+/* SCB Cache Type Register Definitions */
+#define SCB_CTR_FORMAT_Pos 29U /*!< SCB CTR: Format Position */
+#define SCB_CTR_FORMAT_Msk (7UL << SCB_CTR_FORMAT_Pos) /*!< SCB CTR: Format Mask */
+
+#define SCB_CTR_CWG_Pos 24U /*!< SCB CTR: CWG Position */
+#define SCB_CTR_CWG_Msk (0xFUL << SCB_CTR_CWG_Pos) /*!< SCB CTR: CWG Mask */
+
+#define SCB_CTR_ERG_Pos 20U /*!< SCB CTR: ERG Position */
+#define SCB_CTR_ERG_Msk (0xFUL << SCB_CTR_ERG_Pos) /*!< SCB CTR: ERG Mask */
+
+#define SCB_CTR_DMINLINE_Pos 16U /*!< SCB CTR: DminLine Position */
+#define SCB_CTR_DMINLINE_Msk (0xFUL << SCB_CTR_DMINLINE_Pos) /*!< SCB CTR: DminLine Mask */
+
+#define SCB_CTR_IMINLINE_Pos 0U /*!< SCB CTR: ImInLine Position */
+#define SCB_CTR_IMINLINE_Msk (0xFUL /*<< SCB_CTR_IMINLINE_Pos*/) /*!< SCB CTR: ImInLine Mask */
+
+/* SCB Cache Size ID Register Definitions */
+#define SCB_CCSIDR_WT_Pos 31U /*!< SCB CCSIDR: WT Position */
+#define SCB_CCSIDR_WT_Msk (1UL << SCB_CCSIDR_WT_Pos) /*!< SCB CCSIDR: WT Mask */
+
+#define SCB_CCSIDR_WB_Pos 30U /*!< SCB CCSIDR: WB Position */
+#define SCB_CCSIDR_WB_Msk (1UL << SCB_CCSIDR_WB_Pos) /*!< SCB CCSIDR: WB Mask */
+
+#define SCB_CCSIDR_RA_Pos 29U /*!< SCB CCSIDR: RA Position */
+#define SCB_CCSIDR_RA_Msk (1UL << SCB_CCSIDR_RA_Pos) /*!< SCB CCSIDR: RA Mask */
+
+#define SCB_CCSIDR_WA_Pos 28U /*!< SCB CCSIDR: WA Position */
+#define SCB_CCSIDR_WA_Msk (1UL << SCB_CCSIDR_WA_Pos) /*!< SCB CCSIDR: WA Mask */
+
+#define SCB_CCSIDR_NUMSETS_Pos 13U /*!< SCB CCSIDR: NumSets Position */
+#define SCB_CCSIDR_NUMSETS_Msk (0x7FFFUL << SCB_CCSIDR_NUMSETS_Pos) /*!< SCB CCSIDR: NumSets Mask */
+
+#define SCB_CCSIDR_ASSOCIATIVITY_Pos 3U /*!< SCB CCSIDR: Associativity Position */
+#define SCB_CCSIDR_ASSOCIATIVITY_Msk (0x3FFUL << SCB_CCSIDR_ASSOCIATIVITY_Pos) /*!< SCB CCSIDR: Associativity Mask */
+
+#define SCB_CCSIDR_LINESIZE_Pos 0U /*!< SCB CCSIDR: LineSize Position */
+#define SCB_CCSIDR_LINESIZE_Msk (7UL /*<< SCB_CCSIDR_LINESIZE_Pos*/) /*!< SCB CCSIDR: LineSize Mask */
+
+/* SCB Cache Size Selection Register Definitions */
+#define SCB_CSSELR_LEVEL_Pos 1U /*!< SCB CSSELR: Level Position */
+#define SCB_CSSELR_LEVEL_Msk (7UL << SCB_CSSELR_LEVEL_Pos) /*!< SCB CSSELR: Level Mask */
+
+#define SCB_CSSELR_IND_Pos 0U /*!< SCB CSSELR: InD Position */
+#define SCB_CSSELR_IND_Msk (1UL /*<< SCB_CSSELR_IND_Pos*/) /*!< SCB CSSELR: InD Mask */
+
+/* SCB Software Triggered Interrupt Register Definitions */
+#define SCB_STIR_INTID_Pos 0U /*!< SCB STIR: INTID Position */
+#define SCB_STIR_INTID_Msk (0x1FFUL /*<< SCB_STIR_INTID_Pos*/) /*!< SCB STIR: INTID Mask */
+
+/* SCB D-Cache Invalidate by Set-way Register Definitions */
+#define SCB_DCISW_WAY_Pos 30U /*!< SCB DCISW: Way Position */
+#define SCB_DCISW_WAY_Msk (3UL << SCB_DCISW_WAY_Pos) /*!< SCB DCISW: Way Mask */
+
+#define SCB_DCISW_SET_Pos 5U /*!< SCB DCISW: Set Position */
+#define SCB_DCISW_SET_Msk (0x1FFUL << SCB_DCISW_SET_Pos) /*!< SCB DCISW: Set Mask */
+
+/* SCB D-Cache Clean by Set-way Register Definitions */
+#define SCB_DCCSW_WAY_Pos 30U /*!< SCB DCCSW: Way Position */
+#define SCB_DCCSW_WAY_Msk (3UL << SCB_DCCSW_WAY_Pos) /*!< SCB DCCSW: Way Mask */
+
+#define SCB_DCCSW_SET_Pos 5U /*!< SCB DCCSW: Set Position */
+#define SCB_DCCSW_SET_Msk (0x1FFUL << SCB_DCCSW_SET_Pos) /*!< SCB DCCSW: Set Mask */
+
+/* SCB D-Cache Clean and Invalidate by Set-way Register Definitions */
+#define SCB_DCCISW_WAY_Pos 30U /*!< SCB DCCISW: Way Position */
+#define SCB_DCCISW_WAY_Msk (3UL << SCB_DCCISW_WAY_Pos) /*!< SCB DCCISW: Way Mask */
+
+#define SCB_DCCISW_SET_Pos 5U /*!< SCB DCCISW: Set Position */
+#define SCB_DCCISW_SET_Msk (0x1FFUL << SCB_DCCISW_SET_Pos) /*!< SCB DCCISW: Set Mask */
+
+/* Instruction Tightly-Coupled Memory Control Register Definitions */
+#define SCB_ITCMCR_SZ_Pos 3U /*!< SCB ITCMCR: SZ Position */
+#define SCB_ITCMCR_SZ_Msk (0xFUL << SCB_ITCMCR_SZ_Pos) /*!< SCB ITCMCR: SZ Mask */
+
+#define SCB_ITCMCR_RETEN_Pos 2U /*!< SCB ITCMCR: RETEN Position */
+#define SCB_ITCMCR_RETEN_Msk (1UL << SCB_ITCMCR_RETEN_Pos) /*!< SCB ITCMCR: RETEN Mask */
+
+#define SCB_ITCMCR_RMW_Pos 1U /*!< SCB ITCMCR: RMW Position */
+#define SCB_ITCMCR_RMW_Msk (1UL << SCB_ITCMCR_RMW_Pos) /*!< SCB ITCMCR: RMW Mask */
+
+#define SCB_ITCMCR_EN_Pos 0U /*!< SCB ITCMCR: EN Position */
+#define SCB_ITCMCR_EN_Msk (1UL /*<< SCB_ITCMCR_EN_Pos*/) /*!< SCB ITCMCR: EN Mask */
+
+/* Data Tightly-Coupled Memory Control Register Definitions */
+#define SCB_DTCMCR_SZ_Pos 3U /*!< SCB DTCMCR: SZ Position */
+#define SCB_DTCMCR_SZ_Msk (0xFUL << SCB_DTCMCR_SZ_Pos) /*!< SCB DTCMCR: SZ Mask */
+
+#define SCB_DTCMCR_RETEN_Pos 2U /*!< SCB DTCMCR: RETEN Position */
+#define SCB_DTCMCR_RETEN_Msk (1UL << SCB_DTCMCR_RETEN_Pos) /*!< SCB DTCMCR: RETEN Mask */
+
+#define SCB_DTCMCR_RMW_Pos 1U /*!< SCB DTCMCR: RMW Position */
+#define SCB_DTCMCR_RMW_Msk (1UL << SCB_DTCMCR_RMW_Pos) /*!< SCB DTCMCR: RMW Mask */
+
+#define SCB_DTCMCR_EN_Pos 0U /*!< SCB DTCMCR: EN Position */
+#define SCB_DTCMCR_EN_Msk (1UL /*<< SCB_DTCMCR_EN_Pos*/) /*!< SCB DTCMCR: EN Mask */
+
+/* AHBP Control Register Definitions */
+#define SCB_AHBPCR_SZ_Pos 1U /*!< SCB AHBPCR: SZ Position */
+#define SCB_AHBPCR_SZ_Msk (7UL << SCB_AHBPCR_SZ_Pos) /*!< SCB AHBPCR: SZ Mask */
+
+#define SCB_AHBPCR_EN_Pos 0U /*!< SCB AHBPCR: EN Position */
+#define SCB_AHBPCR_EN_Msk (1UL /*<< SCB_AHBPCR_EN_Pos*/) /*!< SCB AHBPCR: EN Mask */
+
+/* L1 Cache Control Register Definitions */
+#define SCB_CACR_FORCEWT_Pos 2U /*!< SCB CACR: FORCEWT Position */
+#define SCB_CACR_FORCEWT_Msk (1UL << SCB_CACR_FORCEWT_Pos) /*!< SCB CACR: FORCEWT Mask */
+
+#define SCB_CACR_ECCEN_Pos 1U /*!< SCB CACR: ECCEN Position */
+#define SCB_CACR_ECCEN_Msk (1UL << SCB_CACR_ECCEN_Pos) /*!< SCB CACR: ECCEN Mask */
+
+#define SCB_CACR_SIWT_Pos 0U /*!< SCB CACR: SIWT Position */
+#define SCB_CACR_SIWT_Msk (1UL /*<< SCB_CACR_SIWT_Pos*/) /*!< SCB CACR: SIWT Mask */
+
+/* AHBS Control Register Definitions */
+#define SCB_AHBSCR_INITCOUNT_Pos 11U /*!< SCB AHBSCR: INITCOUNT Position */
+#define SCB_AHBSCR_INITCOUNT_Msk (0x1FUL << SCB_AHBPCR_INITCOUNT_Pos) /*!< SCB AHBSCR: INITCOUNT Mask */
+
+#define SCB_AHBSCR_TPRI_Pos 2U /*!< SCB AHBSCR: TPRI Position */
+#define SCB_AHBSCR_TPRI_Msk (0x1FFUL << SCB_AHBPCR_TPRI_Pos) /*!< SCB AHBSCR: TPRI Mask */
+
+#define SCB_AHBSCR_CTL_Pos 0U /*!< SCB AHBSCR: CTL Position*/
+#define SCB_AHBSCR_CTL_Msk (3UL /*<< SCB_AHBPCR_CTL_Pos*/) /*!< SCB AHBSCR: CTL Mask */
+
+/* Auxiliary Bus Fault Status Register Definitions */
+#define SCB_ABFSR_AXIMTYPE_Pos 8U /*!< SCB ABFSR: AXIMTYPE Position*/
+#define SCB_ABFSR_AXIMTYPE_Msk (3UL << SCB_ABFSR_AXIMTYPE_Pos) /*!< SCB ABFSR: AXIMTYPE Mask */
+
+#define SCB_ABFSR_EPPB_Pos 4U /*!< SCB ABFSR: EPPB Position*/
+#define SCB_ABFSR_EPPB_Msk (1UL << SCB_ABFSR_EPPB_Pos) /*!< SCB ABFSR: EPPB Mask */
+
+#define SCB_ABFSR_AXIM_Pos 3U /*!< SCB ABFSR: AXIM Position*/
+#define SCB_ABFSR_AXIM_Msk (1UL << SCB_ABFSR_AXIM_Pos) /*!< SCB ABFSR: AXIM Mask */
+
+#define SCB_ABFSR_AHBP_Pos 2U /*!< SCB ABFSR: AHBP Position*/
+#define SCB_ABFSR_AHBP_Msk (1UL << SCB_ABFSR_AHBP_Pos) /*!< SCB ABFSR: AHBP Mask */
+
+#define SCB_ABFSR_DTCM_Pos 1U /*!< SCB ABFSR: DTCM Position*/
+#define SCB_ABFSR_DTCM_Msk (1UL << SCB_ABFSR_DTCM_Pos) /*!< SCB ABFSR: DTCM Mask */
+
+#define SCB_ABFSR_ITCM_Pos 0U /*!< SCB ABFSR: ITCM Position*/
+#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISDYNADD_Pos 26U /*!< ACTLR: DISDYNADD Position */
+#define SCnSCB_ACTLR_DISDYNADD_Msk (1UL << SCnSCB_ACTLR_DISDYNADD_Pos) /*!< ACTLR: DISDYNADD Mask */
+
+#define SCnSCB_ACTLR_DISISSCH1_Pos 21U /*!< ACTLR: DISISSCH1 Position */
+#define SCnSCB_ACTLR_DISISSCH1_Msk (0x1FUL << SCnSCB_ACTLR_DISISSCH1_Pos) /*!< ACTLR: DISISSCH1 Mask */
+
+#define SCnSCB_ACTLR_DISDI_Pos 16U /*!< ACTLR: DISDI Position */
+#define SCnSCB_ACTLR_DISDI_Msk (0x1FUL << SCnSCB_ACTLR_DISDI_Pos) /*!< ACTLR: DISDI Mask */
+
+#define SCnSCB_ACTLR_DISCRITAXIRUR_Pos 15U /*!< ACTLR: DISCRITAXIRUR Position */
+#define SCnSCB_ACTLR_DISCRITAXIRUR_Msk (1UL << SCnSCB_ACTLR_DISCRITAXIRUR_Pos) /*!< ACTLR: DISCRITAXIRUR Mask */
+
+#define SCnSCB_ACTLR_DISBTACALLOC_Pos 14U /*!< ACTLR: DISBTACALLOC Position */
+#define SCnSCB_ACTLR_DISBTACALLOC_Msk (1UL << SCnSCB_ACTLR_DISBTACALLOC_Pos) /*!< ACTLR: DISBTACALLOC Mask */
+
+#define SCnSCB_ACTLR_DISBTACREAD_Pos 13U /*!< ACTLR: DISBTACREAD Position */
+#define SCnSCB_ACTLR_DISBTACREAD_Msk (1UL << SCnSCB_ACTLR_DISBTACREAD_Pos) /*!< ACTLR: DISBTACREAD Mask */
+
+#define SCnSCB_ACTLR_DISITMATBFLUSH_Pos 12U /*!< ACTLR: DISITMATBFLUSH Position */
+#define SCnSCB_ACTLR_DISITMATBFLUSH_Msk (1UL << SCnSCB_ACTLR_DISITMATBFLUSH_Pos) /*!< ACTLR: DISITMATBFLUSH Mask */
+
+#define SCnSCB_ACTLR_DISRAMODE_Pos 11U /*!< ACTLR: DISRAMODE Position */
+#define SCnSCB_ACTLR_DISRAMODE_Msk (1UL << SCnSCB_ACTLR_DISRAMODE_Pos) /*!< ACTLR: DISRAMODE Mask */
+
+#define SCnSCB_ACTLR_FPEXCODIS_Pos 10U /*!< ACTLR: FPEXCODIS Position */
+#define SCnSCB_ACTLR_FPEXCODIS_Msk (1UL << SCnSCB_ACTLR_FPEXCODIS_Pos) /*!< ACTLR: FPEXCODIS Mask */
+
+#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[6U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+ uint32_t RESERVED3[981U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( W) Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R ) Lock Status Register */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x1UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x1UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */
+#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */
+
+#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */
+#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x1UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x1UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */
+#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */
+
+#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */
+#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
+ __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
+ __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
+ __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+#define MPU_TYPE_RALIASES 4U
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_FPU Floating Point Unit (FPU)
+ \brief Type definitions for the Floating Point Unit (FPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Floating Point Unit (FPU).
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */
+ __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */
+ __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */
+ __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */
+ __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */
+ __IM uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */
+} FPU_Type;
+
+/* Floating-Point Context Control Register Definitions */
+#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */
+#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */
+
+#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */
+#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */
+
+#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */
+#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */
+
+#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */
+#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */
+
+#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */
+#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */
+
+#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */
+#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */
+
+#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */
+#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */
+
+#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */
+#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */
+
+#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */
+#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */
+
+/* Floating-Point Context Address Register Definitions */
+#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */
+#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */
+
+/* Floating-Point Default Status Control Register Definitions */
+#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */
+#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */
+
+#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */
+#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */
+
+#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */
+#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */
+
+#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */
+#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */
+
+/* Media and FP Feature Register 0 Definitions */
+#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */
+#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */
+
+#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */
+#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */
+
+#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */
+#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */
+
+#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */
+#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */
+
+#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */
+#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */
+
+#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */
+#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */
+
+#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */
+#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */
+
+#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */
+#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */
+
+/* Media and FP Feature Register 1 Definitions */
+#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */
+#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */
+
+#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */
+#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */
+
+#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */
+#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */
+
+#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */
+#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */
+
+/* Media and FP Feature Register 2 Definitions */
+
+#define FPU_MVFR2_VFP_Misc_Pos 4U /*!< MVFR2: VFP Misc bits Position */
+#define FPU_MVFR2_VFP_Misc_Msk (0xFUL << FPU_MVFR2_VFP_Misc_Pos) /*!< MVFR2: VFP Misc bits Mask */
+
+/*@} end of group CMSIS_FPU */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */
+#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */
+#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */
+#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
+ __DSB();
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## MPU functions #################################### */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+
+#include "mpu_armv7.h"
+
+#endif
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ uint32_t mvfr0;
+
+ mvfr0 = SCB->MVFR0;
+ if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
+ {
+ return 2U; /* Double + Single precision FPU */
+ }
+ else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
+ {
+ return 1U; /* Single precision FPU */
+ }
+ else
+ {
+ return 0U; /* No FPU */
+ }
+}
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ########################## Cache functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_CacheFunctions Cache Functions
+ \brief Functions that configure Instruction and Data cache.
+ @{
+ */
+
+/* Cache Size ID Register Macros */
+#define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos)
+#define CCSIDR_SETS(x) (((x) & SCB_CCSIDR_NUMSETS_Msk ) >> SCB_CCSIDR_NUMSETS_Pos )
+
+#define __SCB_DCACHE_LINE_SIZE 32U /*!< Cortex-M7 cache line size is fixed to 32 bytes (8 words). See also register SCB_CCSIDR */
+#define __SCB_ICACHE_LINE_SIZE 32U /*!< Cortex-M7 cache line size is fixed to 32 bytes (8 words). See also register SCB_CCSIDR */
+
+/**
+ \brief Enable I-Cache
+ \details Turns on I-Cache
+ */
+__STATIC_FORCEINLINE void SCB_EnableICache (void)
+{
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
+ if (SCB->CCR & SCB_CCR_IC_Msk) return; /* return if ICache is already enabled */
+
+ __DSB();
+ __ISB();
+ SCB->ICIALLU = 0UL; /* invalidate I-Cache */
+ __DSB();
+ __ISB();
+ SCB->CCR |= (uint32_t)SCB_CCR_IC_Msk; /* enable I-Cache */
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief Disable I-Cache
+ \details Turns off I-Cache
+ */
+__STATIC_FORCEINLINE void SCB_DisableICache (void)
+{
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
+ __DSB();
+ __ISB();
+ SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk; /* disable I-Cache */
+ SCB->ICIALLU = 0UL; /* invalidate I-Cache */
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief Invalidate I-Cache
+ \details Invalidates I-Cache
+ */
+__STATIC_FORCEINLINE void SCB_InvalidateICache (void)
+{
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
+ __DSB();
+ __ISB();
+ SCB->ICIALLU = 0UL;
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief I-Cache Invalidate by address
+ \details Invalidates I-Cache for the given address.
+ I-Cache is invalidated starting from a 32 byte aligned address in 32 byte granularity.
+ I-Cache memory blocks which are part of given address + given size are invalidated.
+ \param[in] addr address
+ \param[in] isize size of memory block (in number of bytes)
+*/
+__STATIC_FORCEINLINE void SCB_InvalidateICache_by_Addr (void *addr, int32_t isize)
+{
+ #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
+ if ( isize > 0 ) {
+ int32_t op_size = isize + (((uint32_t)addr) & (__SCB_ICACHE_LINE_SIZE - 1U));
+ uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_ICACHE_LINE_SIZE - 1U) */;
+
+ __DSB();
+
+ do {
+ SCB->ICIMVAU = op_addr; /* register accepts only 32byte aligned values, only bits 31..5 are valid */
+ op_addr += __SCB_ICACHE_LINE_SIZE;
+ op_size -= __SCB_ICACHE_LINE_SIZE;
+ } while ( op_size > 0 );
+
+ __DSB();
+ __ISB();
+ }
+ #endif
+}
+
+
+/**
+ \brief Enable D-Cache
+ \details Turns on D-Cache
+ */
+__STATIC_FORCEINLINE void SCB_EnableDCache (void)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ uint32_t ccsidr;
+ uint32_t sets;
+ uint32_t ways;
+
+ if (SCB->CCR & SCB_CCR_DC_Msk) return; /* return if DCache is already enabled */
+
+ SCB->CSSELR = 0U; /* select Level 1 data cache */
+ __DSB();
+
+ ccsidr = SCB->CCSIDR;
+
+ /* invalidate D-Cache */
+ sets = (uint32_t)(CCSIDR_SETS(ccsidr));
+ do {
+ ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
+ do {
+ SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
+ ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) );
+ #if defined ( __CC_ARM )
+ __schedule_barrier();
+ #endif
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
+ __DSB();
+
+ SCB->CCR |= (uint32_t)SCB_CCR_DC_Msk; /* enable D-Cache */
+
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief Disable D-Cache
+ \details Turns off D-Cache
+ */
+__STATIC_FORCEINLINE void SCB_DisableDCache (void)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ uint32_t ccsidr;
+ uint32_t sets;
+ uint32_t ways;
+
+ SCB->CSSELR = 0U; /* select Level 1 data cache */
+ __DSB();
+
+ SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk; /* disable D-Cache */
+ __DSB();
+
+ ccsidr = SCB->CCSIDR;
+
+ /* clean & invalidate D-Cache */
+ sets = (uint32_t)(CCSIDR_SETS(ccsidr));
+ do {
+ ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
+ do {
+ SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
+ ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) );
+ #if defined ( __CC_ARM )
+ __schedule_barrier();
+ #endif
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
+
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief Invalidate D-Cache
+ \details Invalidates D-Cache
+ */
+__STATIC_FORCEINLINE void SCB_InvalidateDCache (void)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ uint32_t ccsidr;
+ uint32_t sets;
+ uint32_t ways;
+
+ SCB->CSSELR = 0U; /* select Level 1 data cache */
+ __DSB();
+
+ ccsidr = SCB->CCSIDR;
+
+ /* invalidate D-Cache */
+ sets = (uint32_t)(CCSIDR_SETS(ccsidr));
+ do {
+ ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
+ do {
+ SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
+ ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk) );
+ #if defined ( __CC_ARM )
+ __schedule_barrier();
+ #endif
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
+
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief Clean D-Cache
+ \details Cleans D-Cache
+ */
+__STATIC_FORCEINLINE void SCB_CleanDCache (void)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ uint32_t ccsidr;
+ uint32_t sets;
+ uint32_t ways;
+
+ SCB->CSSELR = 0U; /* select Level 1 data cache */
+ __DSB();
+
+ ccsidr = SCB->CCSIDR;
+
+ /* clean D-Cache */
+ sets = (uint32_t)(CCSIDR_SETS(ccsidr));
+ do {
+ ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
+ do {
+ SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) |
+ ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk) );
+ #if defined ( __CC_ARM )
+ __schedule_barrier();
+ #endif
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
+
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief Clean & Invalidate D-Cache
+ \details Cleans and Invalidates D-Cache
+ */
+__STATIC_FORCEINLINE void SCB_CleanInvalidateDCache (void)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ uint32_t ccsidr;
+ uint32_t sets;
+ uint32_t ways;
+
+ SCB->CSSELR = 0U; /* select Level 1 data cache */
+ __DSB();
+
+ ccsidr = SCB->CCSIDR;
+
+ /* clean & invalidate D-Cache */
+ sets = (uint32_t)(CCSIDR_SETS(ccsidr));
+ do {
+ ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
+ do {
+ SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
+ ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk) );
+ #if defined ( __CC_ARM )
+ __schedule_barrier();
+ #endif
+ } while (ways-- != 0U);
+ } while(sets-- != 0U);
+
+ __DSB();
+ __ISB();
+ #endif
+}
+
+
+/**
+ \brief D-Cache Invalidate by address
+ \details Invalidates D-Cache for the given address.
+ D-Cache is invalidated starting from a 32 byte aligned address in 32 byte granularity.
+ D-Cache memory blocks which are part of given address + given size are invalidated.
+ \param[in] addr address
+ \param[in] dsize size of memory block (in number of bytes)
+*/
+__STATIC_FORCEINLINE void SCB_InvalidateDCache_by_Addr (void *addr, int32_t dsize)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ if ( dsize > 0 ) {
+ int32_t op_size = dsize + (((uint32_t)addr) & (__SCB_DCACHE_LINE_SIZE - 1U));
+ uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_DCACHE_LINE_SIZE - 1U) */;
+
+ __DSB();
+
+ do {
+ SCB->DCIMVAC = op_addr; /* register accepts only 32byte aligned values, only bits 31..5 are valid */
+ op_addr += __SCB_DCACHE_LINE_SIZE;
+ op_size -= __SCB_DCACHE_LINE_SIZE;
+ } while ( op_size > 0 );
+
+ __DSB();
+ __ISB();
+ }
+ #endif
+}
+
+
+/**
+ \brief D-Cache Clean by address
+ \details Cleans D-Cache for the given address
+ D-Cache is cleaned starting from a 32 byte aligned address in 32 byte granularity.
+ D-Cache memory blocks which are part of given address + given size are cleaned.
+ \param[in] addr address
+ \param[in] dsize size of memory block (in number of bytes)
+*/
+__STATIC_FORCEINLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ if ( dsize > 0 ) {
+ int32_t op_size = dsize + (((uint32_t)addr) & (__SCB_DCACHE_LINE_SIZE - 1U));
+ uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_DCACHE_LINE_SIZE - 1U) */;
+
+ __DSB();
+
+ do {
+ SCB->DCCMVAC = op_addr; /* register accepts only 32byte aligned values, only bits 31..5 are valid */
+ op_addr += __SCB_DCACHE_LINE_SIZE;
+ op_size -= __SCB_DCACHE_LINE_SIZE;
+ } while ( op_size > 0 );
+
+ __DSB();
+ __ISB();
+ }
+ #endif
+}
+
+
+/**
+ \brief D-Cache Clean and Invalidate by address
+ \details Cleans and invalidates D_Cache for the given address
+ D-Cache is cleaned and invalidated starting from a 32 byte aligned address in 32 byte granularity.
+ D-Cache memory blocks which are part of given address + given size are cleaned and invalidated.
+ \param[in] addr address (aligned to 32-byte boundary)
+ \param[in] dsize size of memory block (in number of bytes)
+*/
+__STATIC_FORCEINLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
+{
+ #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+ if ( dsize > 0 ) {
+ int32_t op_size = dsize + (((uint32_t)addr) & (__SCB_DCACHE_LINE_SIZE - 1U));
+ uint32_t op_addr = (uint32_t)addr /* & ~(__SCB_DCACHE_LINE_SIZE - 1U) */;
+
+ __DSB();
+
+ do {
+ SCB->DCCIMVAC = op_addr; /* register accepts only 32byte aligned values, only bits 31..5 are valid */
+ op_addr += __SCB_DCACHE_LINE_SIZE;
+ op_size -= __SCB_DCACHE_LINE_SIZE;
+ } while ( op_size > 0 );
+
+ __DSB();
+ __ISB();
+ }
+ #endif
+}
+
+/*@} end of CMSIS_Core_CacheFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_CM7_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_sc000.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_sc000.h
new file mode 100644
index 0000000000..cf92577b63
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_sc000.h
@@ -0,0 +1,1025 @@
+/**************************************************************************//**
+ * @file core_sc000.h
+ * @brief CMSIS SC000 Core Peripheral Access Layer Header File
+ * @version V5.0.6
+ * @date 12. November 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_SC000_H_GENERIC
+#define __CORE_SC000_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup SC000
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS SC000 definitions */
+#define __SC000_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __SC000_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
+ __SC000_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_SC (000U) /*!< Cortex secure core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_SC000_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_SC000_H_DEPENDANT
+#define __CORE_SC000_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __SC000_REV
+ #define __SC000_REV 0x0000U
+ #warning "__SC000_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 2U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group SC000 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core MPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
+ uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:1; /*!< bit: 0 Reserved */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[31U];
+ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RSERVED1[31U];
+ __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[31U];
+ __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[31U];
+ uint32_t RESERVED4[64U];
+ __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
+} NVIC_Type;
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ uint32_t RESERVED1[154U];
+ __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+} MPU_Type;
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
+ Therefore they are not covered by the SC000 header file.
+ @{
+ */
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */
+/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+/*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+
+
+/* Interrupt Priorities are WORD accessible only under Armv6-M */
+/* The following MACROS handle generation of the register offset and byte masks */
+#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
+#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
+#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
+ /* ARM Application Note 321 states that the M0 and M0+ do not require the architectural barrier - assume SC000 is the same */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t *vectors = (uint32_t *)SCB->VTOR;
+ return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ SCB_AIRCR_SYSRESETREQ_Msk);
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_SC000_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/core_sc300.h b/bsp/hc32l136/Libraries/CMSIS/Include/core_sc300.h
new file mode 100644
index 0000000000..40f3af81be
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/core_sc300.h
@@ -0,0 +1,1912 @@
+/**************************************************************************//**
+ * @file core_sc300.h
+ * @brief CMSIS SC300 Core Peripheral Access Layer Header File
+ * @version V5.0.8
+ * @date 31. May 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef __CORE_SC300_H_GENERIC
+#define __CORE_SC300_H_GENERIC
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
+ CMSIS violates the following MISRA-C:2004 rules:
+
+ \li Required Rule 8.5, object/function definition in header file.<br>
+ Function definitions in header files are used to allow 'inlining'.
+
+ \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
+ Unions are used for effective representation of core registers.
+
+ \li Advisory Rule 19.7, Function-like macro defined.<br>
+ Function-like macros are used to allow more efficient code.
+ */
+
+
+/*******************************************************************************
+ * CMSIS definitions
+ ******************************************************************************/
+/**
+ \ingroup SC3000
+ @{
+ */
+
+#include "cmsis_version.h"
+
+/* CMSIS SC300 definitions */
+#define __SC300_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
+#define __SC300_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
+#define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \
+ __SC300_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
+
+#define __CORTEX_SC (300U) /*!< Cortex secure core */
+
+/** __FPU_USED indicates whether an FPU is used or not.
+ This core does not support an FPU at all
+*/
+#define __FPU_USED 0U
+
+#if defined ( __CC_ARM )
+ #if defined __TARGET_FPU_VFP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+ #if defined __ARM_FP
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __GNUC__ )
+ #if defined (__VFP_FP__) && !defined(__SOFTFP__)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __ICCARM__ )
+ #if defined __ARMVFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TI_ARM__ )
+ #if defined __TI_VFP_SUPPORT__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __TASKING__ )
+ #if defined __FPU_VFP__
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#elif defined ( __CSMC__ )
+ #if ( __CSMC__ & 0x400U)
+ #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
+ #endif
+
+#endif
+
+#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_SC300_H_GENERIC */
+
+#ifndef __CMSIS_GENERIC
+
+#ifndef __CORE_SC300_H_DEPENDANT
+#define __CORE_SC300_H_DEPENDANT
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* check device defines and use defaults */
+#if defined __CHECK_DEVICE_DEFINES
+ #ifndef __SC300_REV
+ #define __SC300_REV 0x0000U
+ #warning "__SC300_REV not defined in device header file; using default!"
+ #endif
+
+ #ifndef __MPU_PRESENT
+ #define __MPU_PRESENT 0U
+ #warning "__MPU_PRESENT not defined in device header file; using default!"
+ #endif
+
+ #ifndef __NVIC_PRIO_BITS
+ #define __NVIC_PRIO_BITS 3U
+ #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
+ #endif
+
+ #ifndef __Vendor_SysTickConfig
+ #define __Vendor_SysTickConfig 0U
+ #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
+ #endif
+#endif
+
+/* IO definitions (access restrictions to peripheral registers) */
+/**
+ \defgroup CMSIS_glob_defs CMSIS Global Defines
+
+ <strong>IO Type Qualifiers</strong> are used
+ \li to specify the access to peripheral variables.
+ \li for automatic generation of peripheral register debug information.
+*/
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+/* following defines should be used for structure members */
+#define __IM volatile const /*! Defines 'read only' structure member permissions */
+#define __OM volatile /*! Defines 'write only' structure member permissions */
+#define __IOM volatile /*! Defines 'read / write' structure member permissions */
+
+/*@} end of group SC300 */
+
+
+
+/*******************************************************************************
+ * Register Abstraction
+ Core Register contain:
+ - Core Register
+ - Core NVIC Register
+ - Core SCB Register
+ - Core SysTick Register
+ - Core Debug Register
+ - Core MPU Register
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_core_register Defines and Type Definitions
+ \brief Type definitions and defines for Cortex-M processor based devices.
+*/
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CORE Status and Control Registers
+ \brief Core Register type definitions.
+ @{
+ */
+
+/**
+ \brief Union type to access the Application Program Status Register (APSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} APSR_Type;
+
+/* APSR Register Definitions */
+#define APSR_N_Pos 31U /*!< APSR: N Position */
+#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
+
+#define APSR_Z_Pos 30U /*!< APSR: Z Position */
+#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
+
+#define APSR_C_Pos 29U /*!< APSR: C Position */
+#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
+
+#define APSR_V_Pos 28U /*!< APSR: V Position */
+#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
+
+#define APSR_Q_Pos 27U /*!< APSR: Q Position */
+#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */
+
+
+/**
+ \brief Union type to access the Interrupt Program Status Register (IPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} IPSR_Type;
+
+/* IPSR Register Definitions */
+#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
+#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
+ uint32_t _reserved0:1; /*!< bit: 9 Reserved */
+ uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */
+ uint32_t _reserved1:8; /*!< bit: 16..23 Reserved */
+ uint32_t T:1; /*!< bit: 24 Thumb bit */
+ uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */
+ uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
+ uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
+ uint32_t C:1; /*!< bit: 29 Carry condition code flag */
+ uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
+ uint32_t N:1; /*!< bit: 31 Negative condition code flag */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} xPSR_Type;
+
+/* xPSR Register Definitions */
+#define xPSR_N_Pos 31U /*!< xPSR: N Position */
+#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
+
+#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
+#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
+
+#define xPSR_C_Pos 29U /*!< xPSR: C Position */
+#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
+
+#define xPSR_V_Pos 28U /*!< xPSR: V Position */
+#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
+
+#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */
+#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */
+
+#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */
+#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */
+
+#define xPSR_T_Pos 24U /*!< xPSR: T Position */
+#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
+
+#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */
+#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */
+
+#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
+#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
+
+
+/**
+ \brief Union type to access the Control Registers (CONTROL).
+ */
+typedef union
+{
+ struct
+ {
+ uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
+ uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
+ uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
+ } b; /*!< Structure used for bit access */
+ uint32_t w; /*!< Type used for word access */
+} CONTROL_Type;
+
+/* CONTROL Register Definitions */
+#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
+#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
+
+#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
+#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
+
+/*@} end of group CMSIS_CORE */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
+ \brief Type definitions for the NVIC Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
+ */
+typedef struct
+{
+ __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
+ uint32_t RESERVED0[24U];
+ __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
+ uint32_t RESERVED1[24U];
+ __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
+ uint32_t RESERVED2[24U];
+ __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
+ uint32_t RESERVED3[24U];
+ __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */
+ uint32_t RESERVED4[56U];
+ __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */
+ uint32_t RESERVED5[644U];
+ __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */
+} NVIC_Type;
+
+/* Software Triggered Interrupt Register Definitions */
+#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */
+#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */
+
+/*@} end of group CMSIS_NVIC */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCB System Control Block (SCB)
+ \brief Type definitions for the System Control Block Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control Block (SCB).
+ */
+typedef struct
+{
+ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
+ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
+ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
+ __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
+ __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
+ __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
+ __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */
+ __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
+ __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */
+ __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */
+ __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */
+ __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */
+ __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */
+ __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */
+ __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */
+ __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */
+ __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */
+ __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */
+ __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */
+ uint32_t RESERVED0[5U];
+ __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */
+ uint32_t RESERVED1[129U];
+ __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
+} SCB_Type;
+
+/* SCB CPUID Register Definitions */
+#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
+#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
+
+#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
+#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
+
+#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
+#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
+
+#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
+#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
+
+#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
+#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
+
+/* SCB Interrupt Control State Register Definitions */
+#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
+#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
+
+#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
+#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
+
+#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
+#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
+
+#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
+#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
+
+#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
+#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
+
+#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
+#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
+
+#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
+#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
+
+#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
+#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
+
+#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */
+#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
+
+#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
+#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
+
+/* SCB Vector Table Offset Register Definitions */
+#define SCB_VTOR_TBLBASE_Pos 29U /*!< SCB VTOR: TBLBASE Position */
+#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
+
+#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
+#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
+
+/* SCB Application Interrupt and Reset Control Register Definitions */
+#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
+#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
+
+#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
+#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
+
+#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
+#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
+
+#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */
+#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
+
+#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
+#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
+
+#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
+#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
+
+#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */
+#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */
+
+/* SCB System Control Register Definitions */
+#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
+#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
+
+#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
+#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
+
+#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
+#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
+
+/* SCB Configuration Control Register Definitions */
+#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
+#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
+
+#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */
+#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
+
+#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */
+#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
+
+#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
+#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
+
+#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */
+#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
+
+#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */
+#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */
+
+/* SCB System Handler Control and State Register Definitions */
+#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */
+#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
+
+#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */
+#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
+
+#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */
+#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
+
+#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
+#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
+
+#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */
+#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
+
+#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */
+#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
+
+#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */
+#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
+
+#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */
+#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
+
+#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */
+#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
+
+#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */
+#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
+
+#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */
+#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
+
+#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */
+#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
+
+#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */
+#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
+
+#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */
+#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */
+
+/* SCB Configurable Fault Status Register Definitions */
+#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */
+#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
+
+#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */
+#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
+
+#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */
+#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
+
+/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_MMARVALID_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */
+#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */
+
+#define SCB_CFSR_MSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */
+#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */
+
+#define SCB_CFSR_MUNSTKERR_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
+#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
+
+#define SCB_CFSR_DACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */
+#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
+
+#define SCB_CFSR_IACCVIOL_Pos (SCB_SHCSR_MEMFAULTACT_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */
+#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
+
+/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */
+#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */
+
+#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */
+#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */
+
+#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */
+#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */
+
+#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */
+#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
+
+#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */
+#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */
+
+#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */
+#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */
+
+/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
+#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */
+#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
+
+#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */
+#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */
+
+#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */
+#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */
+
+#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */
+#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */
+
+#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */
+#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */
+
+#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
+#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
+
+/* SCB Hard Fault Status Register Definitions */
+#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */
+#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
+
+#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */
+#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
+
+#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */
+#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
+
+/* SCB Debug Fault Status Register Definitions */
+#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */
+#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
+
+#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */
+#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
+
+#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */
+#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
+
+#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */
+#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
+
+#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */
+#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */
+
+/*@} end of group CMSIS_SCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
+ \brief Type definitions for the System Control and ID Register not in the SCB
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Control and ID Register not in the SCB.
+ */
+typedef struct
+{
+ uint32_t RESERVED0[1U];
+ __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */
+ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
+} SCnSCB_Type;
+
+/* Interrupt Controller Type Register Definitions */
+#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */
+#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */
+
+/* Auxiliary Control Register Definitions */
+#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */
+#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */
+
+#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */
+#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */
+
+#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
+#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
+
+/*@} end of group CMSIS_SCnotSCB */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_SysTick System Tick Timer (SysTick)
+ \brief Type definitions for the System Timer Registers.
+ @{
+ */
+
+/**
+ \brief Structure type to access the System Timer (SysTick).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
+ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
+ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
+ __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
+} SysTick_Type;
+
+/* SysTick Control / Status Register Definitions */
+#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
+#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
+
+#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
+#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
+
+#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
+#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
+
+#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
+#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
+
+/* SysTick Reload Register Definitions */
+#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
+#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
+
+/* SysTick Current Register Definitions */
+#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
+#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
+
+/* SysTick Calibration Register Definitions */
+#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
+#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
+
+#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
+#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
+
+#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
+#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
+
+/*@} end of group CMSIS_SysTick */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
+ \brief Type definitions for the Instrumentation Trace Macrocell (ITM)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).
+ */
+typedef struct
+{
+ __OM union
+ {
+ __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */
+ __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */
+ __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */
+ } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */
+ uint32_t RESERVED0[864U];
+ __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */
+ uint32_t RESERVED1[15U];
+ __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */
+ uint32_t RESERVED2[15U];
+ __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */
+ uint32_t RESERVED3[32U];
+ uint32_t RESERVED4[43U];
+ __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */
+ __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */
+ uint32_t RESERVED5[6U];
+ __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */
+ __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */
+ __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */
+ __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */
+ __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */
+ __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */
+ __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */
+ __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */
+ __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */
+ __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */
+ __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */
+ __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */
+} ITM_Type;
+
+/* ITM Trace Privilege Register Definitions */
+#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */
+#define ITM_TPR_PRIVMASK_Msk (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */
+
+/* ITM Trace Control Register Definitions */
+#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */
+#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
+
+#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */
+#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */
+
+#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */
+#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */
+
+#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */
+#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
+
+#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */
+#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
+
+#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */
+#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
+
+#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */
+#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
+
+#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */
+#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
+
+#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */
+#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */
+
+/* ITM Lock Status Register Definitions */
+#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */
+#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
+
+#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */
+#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
+
+#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */
+#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */
+
+/*@}*/ /* end of group CMSIS_ITM */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
+ \brief Type definitions for the Data Watchpoint and Trace (DWT)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Data Watchpoint and Trace Register (DWT).
+ */
+typedef struct
+{
+ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
+ __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
+ __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */
+ __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */
+ __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */
+ __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */
+ __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */
+ __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */
+ __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */
+ __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */
+ __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */
+ uint32_t RESERVED0[1U];
+ __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */
+ __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */
+ __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */
+ uint32_t RESERVED1[1U];
+ __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */
+ __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */
+ __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */
+ uint32_t RESERVED2[1U];
+ __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */
+ __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */
+ __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */
+} DWT_Type;
+
+/* DWT Control Register Definitions */
+#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */
+#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */
+
+#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */
+#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */
+
+#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */
+#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */
+
+#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */
+#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */
+
+#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */
+#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */
+
+#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */
+#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */
+
+#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */
+#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */
+
+#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */
+#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */
+
+#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */
+#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */
+
+#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */
+#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */
+
+#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */
+#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */
+
+#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */
+#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */
+
+#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */
+#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */
+
+#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */
+#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */
+
+#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */
+#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */
+
+#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */
+#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */
+
+#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */
+#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */
+
+#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */
+#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */
+
+/* DWT CPI Count Register Definitions */
+#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */
+#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */
+
+/* DWT Exception Overhead Count Register Definitions */
+#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */
+#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */
+
+/* DWT Sleep Count Register Definitions */
+#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */
+#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */
+
+/* DWT LSU Count Register Definitions */
+#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */
+#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */
+
+/* DWT Folded-instruction Count Register Definitions */
+#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */
+#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */
+
+/* DWT Comparator Mask Register Definitions */
+#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */
+#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */
+
+/* DWT Comparator Function Register Definitions */
+#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */
+#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */
+
+#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */
+#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */
+
+#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */
+#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */
+
+#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */
+#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */
+
+#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */
+#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */
+
+#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */
+#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */
+
+#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */
+#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */
+
+#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */
+#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */
+
+#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */
+#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */
+
+/*@}*/ /* end of group CMSIS_DWT */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_TPI Trace Port Interface (TPI)
+ \brief Type definitions for the Trace Port Interface (TPI)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Trace Port Interface Register (TPI).
+ */
+typedef struct
+{
+ __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */
+ __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */
+ uint32_t RESERVED0[2U];
+ __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */
+ uint32_t RESERVED1[55U];
+ __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */
+ uint32_t RESERVED2[131U];
+ __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */
+ __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */
+ __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */
+ uint32_t RESERVED3[759U];
+ __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */
+ __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */
+ __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */
+ uint32_t RESERVED4[1U];
+ __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */
+ __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */
+ __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */
+ uint32_t RESERVED5[39U];
+ __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */
+ __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */
+ uint32_t RESERVED7[8U];
+ __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */
+ __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */
+} TPI_Type;
+
+/* TPI Asynchronous Clock Prescaler Register Definitions */
+#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */
+#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */
+
+/* TPI Selected Pin Protocol Register Definitions */
+#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */
+#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */
+
+/* TPI Formatter and Flush Status Register Definitions */
+#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */
+#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */
+
+#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */
+#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */
+
+#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */
+#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */
+
+#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */
+#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */
+
+/* TPI Formatter and Flush Control Register Definitions */
+#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */
+#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */
+
+#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */
+#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */
+
+/* TPI TRIGGER Register Definitions */
+#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */
+#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */
+
+/* TPI Integration ETM Data Register Definitions (FIFO0) */
+#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */
+#define TPI_FIFO0_ITM_ATVALID_Msk (0x1UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */
+
+#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */
+#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */
+
+#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */
+#define TPI_FIFO0_ETM_ATVALID_Msk (0x1UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */
+
+#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */
+#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */
+
+#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */
+#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */
+
+#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */
+#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */
+
+#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */
+#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */
+
+/* TPI ITATBCTR2 Register Definitions */
+#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */
+#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */
+
+#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */
+#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */
+
+/* TPI Integration ITM Data Register Definitions (FIFO1) */
+#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */
+#define TPI_FIFO1_ITM_ATVALID_Msk (0x1UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */
+
+#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */
+#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */
+
+#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */
+#define TPI_FIFO1_ETM_ATVALID_Msk (0x1UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */
+
+#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */
+#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */
+
+#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */
+#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */
+
+#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */
+#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */
+
+#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */
+#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */
+
+/* TPI ITATBCTR0 Register Definitions */
+#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */
+#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */
+
+#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */
+#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */
+
+/* TPI Integration Mode Control Register Definitions */
+#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */
+#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */
+
+/* TPI DEVID Register Definitions */
+#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */
+#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */
+
+#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */
+#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */
+
+#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */
+#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */
+
+#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */
+#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */
+
+#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */
+#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */
+
+#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */
+#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */
+
+/* TPI DEVTYPE Register Definitions */
+#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */
+#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */
+
+#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */
+#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */
+
+/*@}*/ /* end of group CMSIS_TPI */
+
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_MPU Memory Protection Unit (MPU)
+ \brief Type definitions for the Memory Protection Unit (MPU)
+ @{
+ */
+
+/**
+ \brief Structure type to access the Memory Protection Unit (MPU).
+ */
+typedef struct
+{
+ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
+ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
+ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
+ __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
+ __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */
+ __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */
+ __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */
+ __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */
+ __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */
+} MPU_Type;
+
+/* MPU Type Register Definitions */
+#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
+#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
+
+#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
+#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
+
+#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
+#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
+
+/* MPU Control Register Definitions */
+#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
+#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
+
+#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
+#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
+
+#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
+#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
+
+/* MPU Region Number Register Definitions */
+#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
+#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
+
+/* MPU Region Base Address Register Definitions */
+#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */
+#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
+
+#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
+#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
+
+#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
+#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
+
+/* MPU Region Attribute and Size Register Definitions */
+#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
+#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
+
+#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
+#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
+
+#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
+#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
+
+#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
+#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
+
+#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
+#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
+
+#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
+#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
+
+#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
+#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
+
+#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
+#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
+
+#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
+#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
+
+#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
+#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
+
+/*@} end of group CMSIS_MPU */
+#endif
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
+ \brief Type definitions for the Core Debug Registers
+ @{
+ */
+
+/**
+ \brief Structure type to access the Core Debug Register (CoreDebug).
+ */
+typedef struct
+{
+ __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */
+ __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */
+ __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */
+ __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */
+} CoreDebug_Type;
+
+/* Debug Halting Control and Status Register Definitions */
+#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */
+#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
+
+#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */
+#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
+
+#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
+#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
+
+#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */
+#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
+
+#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */
+#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
+
+#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */
+#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
+
+#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */
+#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
+
+#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
+#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
+
+#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */
+#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
+
+#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */
+#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
+
+#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */
+#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
+
+#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */
+#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
+
+/* Debug Core Register Selector Register Definitions */
+#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */
+#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
+
+#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */
+#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */
+
+/* Debug Exception and Monitor Control Register Definitions */
+#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */
+#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
+
+#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */
+#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
+
+#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */
+#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
+
+#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */
+#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
+
+#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */
+#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
+
+#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */
+#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
+
+#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */
+#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
+
+#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */
+#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
+
+#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */
+#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
+
+#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */
+#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
+
+#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */
+#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
+
+#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */
+#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
+
+#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */
+#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
+
+/*@} end of group CMSIS_CoreDebug */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_bitfield Core register bit field macros
+ \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
+ @{
+ */
+
+/**
+ \brief Mask and shift a bit field value for use in a register bit range.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted value.
+*/
+#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
+
+/**
+ \brief Mask and shift a register value to extract a bit filed value.
+ \param[in] field Name of the register bit field.
+ \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
+ \return Masked and shifted bit field value.
+*/
+#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
+
+/*@} end of group CMSIS_core_bitfield */
+
+
+/**
+ \ingroup CMSIS_core_register
+ \defgroup CMSIS_core_base Core Definitions
+ \brief Definitions for base addresses, unions, and structures.
+ @{
+ */
+
+/* Memory mapping of Core Hardware */
+#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
+#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */
+#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */
+#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */
+#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */
+#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
+#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
+#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
+
+#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
+#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
+#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
+#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
+#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */
+#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */
+#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */
+#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
+
+#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
+ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
+ #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
+#endif
+
+/*@} */
+
+
+
+/*******************************************************************************
+ * Hardware Abstraction Layer
+ Core Function Interface contains:
+ - Core NVIC Functions
+ - Core SysTick Functions
+ - Core Debug Functions
+ - Core Register Access Functions
+ ******************************************************************************/
+/**
+ \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
+*/
+
+
+
+/* ########################## NVIC functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_NVICFunctions NVIC Functions
+ \brief Functions that manage interrupts and exceptions via the NVIC.
+ @{
+ */
+
+#ifdef CMSIS_NVIC_VIRTUAL
+ #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
+ #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
+ #endif
+ #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
+ #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
+ #define NVIC_EnableIRQ __NVIC_EnableIRQ
+ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
+ #define NVIC_DisableIRQ __NVIC_DisableIRQ
+ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
+ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
+ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
+ #define NVIC_GetActive __NVIC_GetActive
+ #define NVIC_SetPriority __NVIC_SetPriority
+ #define NVIC_GetPriority __NVIC_GetPriority
+ #define NVIC_SystemReset __NVIC_SystemReset
+#endif /* CMSIS_NVIC_VIRTUAL */
+
+#ifdef CMSIS_VECTAB_VIRTUAL
+ #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+ #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
+ #endif
+ #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
+#else
+ #define NVIC_SetVector __NVIC_SetVector
+ #define NVIC_GetVector __NVIC_GetVector
+#endif /* (CMSIS_VECTAB_VIRTUAL) */
+
+#define NVIC_USER_IRQ_OFFSET 16
+
+
+/* The following EXC_RETURN values are saved the LR on exception entry */
+#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
+#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
+#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
+
+
+/**
+ \brief Set Priority Grouping
+ \details Sets the priority grouping field using the required unlock sequence.
+ The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
+ Only values from 0..7 are used.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Priority grouping field.
+ */
+__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
+{
+ uint32_t reg_value;
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+
+ reg_value = SCB->AIRCR; /* read old register configuration */
+ reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */
+ reg_value = (reg_value |
+ ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */
+ SCB->AIRCR = reg_value;
+}
+
+
+/**
+ \brief Get Priority Grouping
+ \details Reads the priority grouping field from the NVIC Interrupt Controller.
+ \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
+{
+ return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
+}
+
+
+/**
+ \brief Enable Interrupt
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ __COMPILER_BARRIER();
+ NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __COMPILER_BARRIER();
+ }
+}
+
+
+/**
+ \brief Get Interrupt Enable status
+ \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt is not enabled.
+ \return 1 Interrupt is enabled.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Disable Interrupt
+ \details Disables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ __DSB();
+ __ISB();
+ }
+}
+
+
+/**
+ \brief Get Pending Interrupt
+ \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not pending.
+ \return 1 Interrupt status is pending.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Pending Interrupt
+ \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Clear Pending Interrupt
+ \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ }
+}
+
+
+/**
+ \brief Get Active Interrupt
+ \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
+ \param [in] IRQn Device specific interrupt number.
+ \return 0 Interrupt status is not active.
+ \return 1 Interrupt status is active.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
+ }
+ else
+ {
+ return(0U);
+ }
+}
+
+
+/**
+ \brief Set Interrupt Priority
+ \details Sets the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ if ((int32_t)(IRQn) >= 0)
+ {
+ NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+ else
+ {
+ SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
+ }
+}
+
+
+/**
+ \brief Get Interrupt Priority
+ \details Reads the priority of a device specific interrupt or a processor exception.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Interrupt Priority.
+ Value is aligned automatically to the implemented priority bits of the microcontroller.
+ */
+__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
+{
+
+ if ((int32_t)(IRQn) >= 0)
+ {
+ return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS)));
+ }
+ else
+ {
+ return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
+ }
+}
+
+
+/**
+ \brief Encode Priority
+ \details Encodes the priority for an interrupt with the given priority group,
+ preemptive priority value, and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
+ \param [in] PriorityGroup Used priority group.
+ \param [in] PreemptPriority Preemptive priority value (starting from 0).
+ \param [in] SubPriority Subpriority value (starting from 0).
+ \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
+ */
+__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ return (
+ ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
+ ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
+ );
+}
+
+
+/**
+ \brief Decode Priority
+ \details Decodes an interrupt priority value with a given priority group to
+ preemptive priority value and subpriority value.
+ In case of a conflict between priority grouping and available
+ priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
+ \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
+ \param [in] PriorityGroup Used priority group.
+ \param [out] pPreemptPriority Preemptive priority value (starting from 0).
+ \param [out] pSubPriority Subpriority value (starting from 0).
+ */
+__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
+{
+ uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
+ uint32_t PreemptPriorityBits;
+ uint32_t SubPriorityBits;
+
+ PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
+ SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
+
+ *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
+ *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
+}
+
+
+/**
+ \brief Set Interrupt Vector
+ \details Sets an interrupt vector in SRAM based interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ VTOR must been relocated to SRAM before.
+ \param [in] IRQn Interrupt number
+ \param [in] vector Address of interrupt handler function
+ */
+__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
+ /* ARM Application Note 321 states that the M3 does not require the architectural barrier */
+}
+
+
+/**
+ \brief Get Interrupt Vector
+ \details Reads an interrupt vector from interrupt vector table.
+ The interrupt number can be positive to specify a device specific interrupt,
+ or negative to specify a processor exception.
+ \param [in] IRQn Interrupt number.
+ \return Address of interrupt handler function
+ */
+__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
+{
+ uint32_t vectors = (uint32_t )SCB->VTOR;
+ return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
+}
+
+
+/**
+ \brief System Reset
+ \details Initiates a system reset request to reset the MCU.
+ */
+__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
+{
+ __DSB(); /* Ensure all outstanding memory accesses included
+ buffered write are completed before reset */
+ SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
+ (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
+ SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
+ __DSB(); /* Ensure completion of memory access */
+
+ for(;;) /* wait until reset */
+ {
+ __NOP();
+ }
+}
+
+/*@} end of CMSIS_Core_NVICFunctions */
+
+
+/* ########################## FPU functions #################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_FpuFunctions FPU Functions
+ \brief Function that provides FPU type.
+ @{
+ */
+
+/**
+ \brief get FPU type
+ \details returns the FPU type
+ \returns
+ - \b 0: No FPU
+ - \b 1: Single precision FPU
+ - \b 2: Double + Single precision FPU
+ */
+__STATIC_INLINE uint32_t SCB_GetFPUType(void)
+{
+ return 0U; /* No FPU */
+}
+
+
+/*@} end of CMSIS_Core_FpuFunctions */
+
+
+
+/* ################################## SysTick function ############################################ */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
+ \brief Functions that configure the System.
+ @{
+ */
+
+#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
+
+/**
+ \brief System Tick Configuration
+ \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
+ Counter is in free running mode to generate periodic interrupts.
+ \param [in] ticks Number of ticks between two interrupts.
+ \return 0 Function succeeded.
+ \return 1 Function failed.
+ \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
+ function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
+ must contain a vendor-specific implementation of this function.
+ */
+__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
+{
+ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
+ {
+ return (1UL); /* Reload value impossible */
+ }
+
+ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
+ NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
+ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
+ SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
+ SysTick_CTRL_TICKINT_Msk |
+ SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
+ return (0UL); /* Function successful */
+}
+
+#endif
+
+/*@} end of CMSIS_Core_SysTickFunctions */
+
+
+
+/* ##################################### Debug In/Output function ########################################### */
+/**
+ \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_core_DebugFunctions ITM Functions
+ \brief Functions that access the ITM debug interface.
+ @{
+ */
+
+extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
+#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
+
+
+/**
+ \brief ITM Send Character
+ \details Transmits a character via the ITM channel 0, and
+ \li Just returns when no debugger is connected that has booked the output.
+ \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
+ \param [in] ch Character to transmit.
+ \returns Character to transmit.
+ */
+__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
+{
+ if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
+ ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */
+ {
+ while (ITM->PORT[0U].u32 == 0UL)
+ {
+ __NOP();
+ }
+ ITM->PORT[0U].u8 = (uint8_t)ch;
+ }
+ return (ch);
+}
+
+
+/**
+ \brief ITM Receive Character
+ \details Inputs a character via the external variable \ref ITM_RxBuffer.
+ \return Received character.
+ \return -1 No character pending.
+ */
+__STATIC_INLINE int32_t ITM_ReceiveChar (void)
+{
+ int32_t ch = -1; /* no character available */
+
+ if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY)
+ {
+ ch = ITM_RxBuffer;
+ ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
+ }
+
+ return (ch);
+}
+
+
+/**
+ \brief ITM Check Character
+ \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
+ \return 0 No character available.
+ \return 1 Character available.
+ */
+__STATIC_INLINE int32_t ITM_CheckChar (void)
+{
+
+ if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY)
+ {
+ return (0); /* no character available */
+ }
+ else
+ {
+ return (1); /* character available */
+ }
+}
+
+/*@} end of CMSIS_core_DebugFunctions */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CORE_SC300_H_DEPENDANT */
+
+#endif /* __CMSIS_GENERIC */
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv7.h b/bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv7.h
new file mode 100644
index 0000000000..66ef59b4a0
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv7.h
@@ -0,0 +1,272 @@
+/******************************************************************************
+ * @file mpu_armv7.h
+ * @brief CMSIS MPU API for Armv7-M MPU
+ * @version V5.1.0
+ * @date 08. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2017-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef ARM_MPU_ARMV7_H
+#define ARM_MPU_ARMV7_H
+
+#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) ///!< MPU Region Size 32 Bytes
+#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) ///!< MPU Region Size 64 Bytes
+#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) ///!< MPU Region Size 128 Bytes
+#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) ///!< MPU Region Size 256 Bytes
+#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) ///!< MPU Region Size 512 Bytes
+#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) ///!< MPU Region Size 1 KByte
+#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) ///!< MPU Region Size 2 KBytes
+#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) ///!< MPU Region Size 4 KBytes
+#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) ///!< MPU Region Size 8 KBytes
+#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) ///!< MPU Region Size 16 KBytes
+#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) ///!< MPU Region Size 32 KBytes
+#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) ///!< MPU Region Size 64 KBytes
+#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) ///!< MPU Region Size 128 KBytes
+#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) ///!< MPU Region Size 256 KBytes
+#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) ///!< MPU Region Size 512 KBytes
+#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) ///!< MPU Region Size 1 MByte
+#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) ///!< MPU Region Size 2 MBytes
+#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) ///!< MPU Region Size 4 MBytes
+#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) ///!< MPU Region Size 8 MBytes
+#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) ///!< MPU Region Size 16 MBytes
+#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) ///!< MPU Region Size 32 MBytes
+#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) ///!< MPU Region Size 64 MBytes
+#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) ///!< MPU Region Size 128 MBytes
+#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) ///!< MPU Region Size 256 MBytes
+#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) ///!< MPU Region Size 512 MBytes
+#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) ///!< MPU Region Size 1 GByte
+#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) ///!< MPU Region Size 2 GBytes
+#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) ///!< MPU Region Size 4 GBytes
+
+#define ARM_MPU_AP_NONE 0U ///!< MPU Access Permission no access
+#define ARM_MPU_AP_PRIV 1U ///!< MPU Access Permission privileged access only
+#define ARM_MPU_AP_URO 2U ///!< MPU Access Permission unprivileged access read-only
+#define ARM_MPU_AP_FULL 3U ///!< MPU Access Permission full access
+#define ARM_MPU_AP_PRO 5U ///!< MPU Access Permission privileged access read-only
+#define ARM_MPU_AP_RO 6U ///!< MPU Access Permission read-only access
+
+/** MPU Region Base Address Register Value
+*
+* \param Region The region to be configured, number 0 to 15.
+* \param BaseAddress The base address for the region.
+*/
+#define ARM_MPU_RBAR(Region, BaseAddress) \
+ (((BaseAddress) & MPU_RBAR_ADDR_Msk) | \
+ ((Region) & MPU_RBAR_REGION_Msk) | \
+ (MPU_RBAR_VALID_Msk))
+
+/**
+* MPU Memory Access Attributes
+*
+* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
+* \param IsShareable Region is shareable between multiple bus masters.
+* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
+* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
+*/
+#define ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable) \
+ ((((TypeExtField) << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \
+ (((IsShareable) << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \
+ (((IsCacheable) << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \
+ (((IsBufferable) << MPU_RASR_B_Pos) & MPU_RASR_B_Msk))
+
+/**
+* MPU Region Attribute and Size Register Value
+*
+* \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
+* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
+* \param AccessAttributes Memory access attribution, see \ref ARM_MPU_ACCESS_.
+* \param SubRegionDisable Sub-region disable field.
+* \param Size Region size of the region to be configured, for example 4K, 8K.
+*/
+#define ARM_MPU_RASR_EX(DisableExec, AccessPermission, AccessAttributes, SubRegionDisable, Size) \
+ ((((DisableExec) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \
+ (((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \
+ (((AccessAttributes) & (MPU_RASR_TEX_Msk | MPU_RASR_S_Msk | MPU_RASR_C_Msk | MPU_RASR_B_Msk))) | \
+ (((SubRegionDisable) << MPU_RASR_SRD_Pos) & MPU_RASR_SRD_Msk) | \
+ (((Size) << MPU_RASR_SIZE_Pos) & MPU_RASR_SIZE_Msk) | \
+ (((MPU_RASR_ENABLE_Msk))))
+
+/**
+* MPU Region Attribute and Size Register Value
+*
+* \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
+* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
+* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
+* \param IsShareable Region is shareable between multiple bus masters.
+* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
+* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
+* \param SubRegionDisable Sub-region disable field.
+* \param Size Region size of the region to be configured, for example 4K, 8K.
+*/
+#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
+ ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size)
+
+/**
+* MPU Memory Access Attribute for strongly ordered memory.
+* - TEX: 000b
+* - Shareable
+* - Non-cacheable
+* - Non-bufferable
+*/
+#define ARM_MPU_ACCESS_ORDERED ARM_MPU_ACCESS_(0U, 1U, 0U, 0U)
+
+/**
+* MPU Memory Access Attribute for device memory.
+* - TEX: 000b (if shareable) or 010b (if non-shareable)
+* - Shareable or non-shareable
+* - Non-cacheable
+* - Bufferable (if shareable) or non-bufferable (if non-shareable)
+*
+* \param IsShareable Configures the device memory as shareable or non-shareable.
+*/
+#define ARM_MPU_ACCESS_DEVICE(IsShareable) ((IsShareable) ? ARM_MPU_ACCESS_(0U, 1U, 0U, 1U) : ARM_MPU_ACCESS_(2U, 0U, 0U, 0U))
+
+/**
+* MPU Memory Access Attribute for normal memory.
+* - TEX: 1BBb (reflecting outer cacheability rules)
+* - Shareable or non-shareable
+* - Cacheable or non-cacheable (reflecting inner cacheability rules)
+* - Bufferable or non-bufferable (reflecting inner cacheability rules)
+*
+* \param OuterCp Configures the outer cache policy.
+* \param InnerCp Configures the inner cache policy.
+* \param IsShareable Configures the memory as shareable or non-shareable.
+*/
+#define ARM_MPU_ACCESS_NORMAL(OuterCp, InnerCp, IsShareable) ARM_MPU_ACCESS_((4U | (OuterCp)), IsShareable, ((InnerCp) & 2U), ((InnerCp) & 1U))
+
+/**
+* MPU Memory Access Attribute non-cacheable policy.
+*/
+#define ARM_MPU_CACHEP_NOCACHE 0U
+
+/**
+* MPU Memory Access Attribute write-back, write and read allocate policy.
+*/
+#define ARM_MPU_CACHEP_WB_WRA 1U
+
+/**
+* MPU Memory Access Attribute write-through, no write allocate policy.
+*/
+#define ARM_MPU_CACHEP_WT_NWA 2U
+
+/**
+* MPU Memory Access Attribute write-back, no write allocate policy.
+*/
+#define ARM_MPU_CACHEP_WB_NWA 3U
+
+
+/**
+* Struct for a single MPU Region
+*/
+typedef struct {
+ uint32_t RBAR; //!< The region base address register value (RBAR)
+ uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR
+} ARM_MPU_Region_t;
+
+/** Enable the MPU.
+* \param MPU_Control Default access permissions for unconfigured regions.
+*/
+__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
+{
+ MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
+#ifdef SCB_SHCSR_MEMFAULTENA_Msk
+ SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
+#endif
+ __DSB();
+ __ISB();
+}
+
+/** Disable the MPU.
+*/
+__STATIC_INLINE void ARM_MPU_Disable(void)
+{
+ __DMB();
+#ifdef SCB_SHCSR_MEMFAULTENA_Msk
+ SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
+#endif
+ MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
+}
+
+/** Clear and disable the given MPU region.
+* \param rnr Region number to be cleared.
+*/
+__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
+{
+ MPU->RNR = rnr;
+ MPU->RASR = 0U;
+}
+
+/** Configure an MPU region.
+* \param rbar Value for RBAR register.
+* \param rsar Value for RSAR register.
+*/
+__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr)
+{
+ MPU->RBAR = rbar;
+ MPU->RASR = rasr;
+}
+
+/** Configure the given MPU region.
+* \param rnr Region number to be configured.
+* \param rbar Value for RBAR register.
+* \param rsar Value for RSAR register.
+*/
+__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr)
+{
+ MPU->RNR = rnr;
+ MPU->RBAR = rbar;
+ MPU->RASR = rasr;
+}
+
+/** Memcopy with strictly ordered memory access, e.g. for register targets.
+* \param dst Destination data is copied to.
+* \param src Source data is copied from.
+* \param len Amount of data words to be copied.
+*/
+__STATIC_INLINE void ARM_MPU_OrderedMemcpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
+{
+ uint32_t i;
+ for (i = 0U; i < len; ++i)
+ {
+ dst[i] = src[i];
+ }
+}
+
+/** Load the given number of MPU regions from a table.
+* \param table Pointer to the MPU configuration table.
+* \param cnt Amount of regions to be configured.
+*/
+__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt)
+{
+ const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U;
+ while (cnt > MPU_TYPE_RALIASES) {
+ ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize);
+ table += MPU_TYPE_RALIASES;
+ cnt -= MPU_TYPE_RALIASES;
+ }
+ ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize);
+}
+
+#endif
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv8.h b/bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv8.h
new file mode 100644
index 0000000000..0041d4dc6f
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/mpu_armv8.h
@@ -0,0 +1,346 @@
+/******************************************************************************
+ * @file mpu_armv8.h
+ * @brief CMSIS MPU API for Armv8-M and Armv8.1-M MPU
+ * @version V5.1.0
+ * @date 08. March 2019
+ ******************************************************************************/
+/*
+ * Copyright (c) 2017-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef ARM_MPU_ARMV8_H
+#define ARM_MPU_ARMV8_H
+
+/** \brief Attribute for device memory (outer only) */
+#define ARM_MPU_ATTR_DEVICE ( 0U )
+
+/** \brief Attribute for non-cacheable, normal memory */
+#define ARM_MPU_ATTR_NON_CACHEABLE ( 4U )
+
+/** \brief Attribute for normal memory (outer and inner)
+* \param NT Non-Transient: Set to 1 for non-transient data.
+* \param WB Write-Back: Set to 1 to use write-back update policy.
+* \param RA Read Allocation: Set to 1 to use cache allocation on read miss.
+* \param WA Write Allocation: Set to 1 to use cache allocation on write miss.
+*/
+#define ARM_MPU_ATTR_MEMORY_(NT, WB, RA, WA) \
+ (((NT & 1U) << 3U) | ((WB & 1U) << 2U) | ((RA & 1U) << 1U) | (WA & 1U))
+
+/** \brief Device memory type non Gathering, non Re-ordering, non Early Write Acknowledgement */
+#define ARM_MPU_ATTR_DEVICE_nGnRnE (0U)
+
+/** \brief Device memory type non Gathering, non Re-ordering, Early Write Acknowledgement */
+#define ARM_MPU_ATTR_DEVICE_nGnRE (1U)
+
+/** \brief Device memory type non Gathering, Re-ordering, Early Write Acknowledgement */
+#define ARM_MPU_ATTR_DEVICE_nGRE (2U)
+
+/** \brief Device memory type Gathering, Re-ordering, Early Write Acknowledgement */
+#define ARM_MPU_ATTR_DEVICE_GRE (3U)
+
+/** \brief Memory Attribute
+* \param O Outer memory attributes
+* \param I O == ARM_MPU_ATTR_DEVICE: Device memory attributes, else: Inner memory attributes
+*/
+#define ARM_MPU_ATTR(O, I) (((O & 0xFU) << 4U) | (((O & 0xFU) != 0U) ? (I & 0xFU) : ((I & 0x3U) << 2U)))
+
+/** \brief Normal memory non-shareable */
+#define ARM_MPU_SH_NON (0U)
+
+/** \brief Normal memory outer shareable */
+#define ARM_MPU_SH_OUTER (2U)
+
+/** \brief Normal memory inner shareable */
+#define ARM_MPU_SH_INNER (3U)
+
+/** \brief Memory access permissions
+* \param RO Read-Only: Set to 1 for read-only memory.
+* \param NP Non-Privileged: Set to 1 for non-privileged memory.
+*/
+#define ARM_MPU_AP_(RO, NP) (((RO & 1U) << 1U) | (NP & 1U))
+
+/** \brief Region Base Address Register value
+* \param BASE The base address bits [31:5] of a memory region. The value is zero extended. Effective address gets 32 byte aligned.
+* \param SH Defines the Shareability domain for this memory region.
+* \param RO Read-Only: Set to 1 for a read-only memory region.
+* \param NP Non-Privileged: Set to 1 for a non-privileged memory region.
+* \oaram XN eXecute Never: Set to 1 for a non-executable memory region.
+*/
+#define ARM_MPU_RBAR(BASE, SH, RO, NP, XN) \
+ ((BASE & MPU_RBAR_BASE_Msk) | \
+ ((SH << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk) | \
+ ((ARM_MPU_AP_(RO, NP) << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk) | \
+ ((XN << MPU_RBAR_XN_Pos) & MPU_RBAR_XN_Msk))
+
+/** \brief Region Limit Address Register value
+* \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended.
+* \param IDX The attribute index to be associated with this memory region.
+*/
+#define ARM_MPU_RLAR(LIMIT, IDX) \
+ ((LIMIT & MPU_RLAR_LIMIT_Msk) | \
+ ((IDX << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \
+ (MPU_RLAR_EN_Msk))
+
+#if defined(MPU_RLAR_PXN_Pos)
+
+/** \brief Region Limit Address Register with PXN value
+* \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended.
+* \param PXN Privileged execute never. Defines whether code can be executed from this privileged region.
+* \param IDX The attribute index to be associated with this memory region.
+*/
+#define ARM_MPU_RLAR_PXN(LIMIT, PXN, IDX) \
+ ((LIMIT & MPU_RLAR_LIMIT_Msk) | \
+ ((PXN << MPU_RLAR_PXN_Pos) & MPU_RLAR_PXN_Msk) | \
+ ((IDX << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \
+ (MPU_RLAR_EN_Msk))
+
+#endif
+
+/**
+* Struct for a single MPU Region
+*/
+typedef struct {
+ uint32_t RBAR; /*!< Region Base Address Register value */
+ uint32_t RLAR; /*!< Region Limit Address Register value */
+} ARM_MPU_Region_t;
+
+/** Enable the MPU.
+* \param MPU_Control Default access permissions for unconfigured regions.
+*/
+__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
+{
+ MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
+#ifdef SCB_SHCSR_MEMFAULTENA_Msk
+ SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
+#endif
+ __DSB();
+ __ISB();
+}
+
+/** Disable the MPU.
+*/
+__STATIC_INLINE void ARM_MPU_Disable(void)
+{
+ __DMB();
+#ifdef SCB_SHCSR_MEMFAULTENA_Msk
+ SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
+#endif
+ MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
+}
+
+#ifdef MPU_NS
+/** Enable the Non-secure MPU.
+* \param MPU_Control Default access permissions for unconfigured regions.
+*/
+__STATIC_INLINE void ARM_MPU_Enable_NS(uint32_t MPU_Control)
+{
+ MPU_NS->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
+#ifdef SCB_SHCSR_MEMFAULTENA_Msk
+ SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
+#endif
+ __DSB();
+ __ISB();
+}
+
+/** Disable the Non-secure MPU.
+*/
+__STATIC_INLINE void ARM_MPU_Disable_NS(void)
+{
+ __DMB();
+#ifdef SCB_SHCSR_MEMFAULTENA_Msk
+ SCB_NS->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
+#endif
+ MPU_NS->CTRL &= ~MPU_CTRL_ENABLE_Msk;
+}
+#endif
+
+/** Set the memory attribute encoding to the given MPU.
+* \param mpu Pointer to the MPU to be configured.
+* \param idx The attribute index to be set [0-7]
+* \param attr The attribute value to be set.
+*/
+__STATIC_INLINE void ARM_MPU_SetMemAttrEx(MPU_Type* mpu, uint8_t idx, uint8_t attr)
+{
+ const uint8_t reg = idx / 4U;
+ const uint32_t pos = ((idx % 4U) * 8U);
+ const uint32_t mask = 0xFFU << pos;
+
+ if (reg >= (sizeof(mpu->MAIR) / sizeof(mpu->MAIR[0]))) {
+ return; // invalid index
+ }
+
+ mpu->MAIR[reg] = ((mpu->MAIR[reg] & ~mask) | ((attr << pos) & mask));
+}
+
+/** Set the memory attribute encoding.
+* \param idx The attribute index to be set [0-7]
+* \param attr The attribute value to be set.
+*/
+__STATIC_INLINE void ARM_MPU_SetMemAttr(uint8_t idx, uint8_t attr)
+{
+ ARM_MPU_SetMemAttrEx(MPU, idx, attr);
+}
+
+#ifdef MPU_NS
+/** Set the memory attribute encoding to the Non-secure MPU.
+* \param idx The attribute index to be set [0-7]
+* \param attr The attribute value to be set.
+*/
+__STATIC_INLINE void ARM_MPU_SetMemAttr_NS(uint8_t idx, uint8_t attr)
+{
+ ARM_MPU_SetMemAttrEx(MPU_NS, idx, attr);
+}
+#endif
+
+/** Clear and disable the given MPU region of the given MPU.
+* \param mpu Pointer to MPU to be used.
+* \param rnr Region number to be cleared.
+*/
+__STATIC_INLINE void ARM_MPU_ClrRegionEx(MPU_Type* mpu, uint32_t rnr)
+{
+ mpu->RNR = rnr;
+ mpu->RLAR = 0U;
+}
+
+/** Clear and disable the given MPU region.
+* \param rnr Region number to be cleared.
+*/
+__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
+{
+ ARM_MPU_ClrRegionEx(MPU, rnr);
+}
+
+#ifdef MPU_NS
+/** Clear and disable the given Non-secure MPU region.
+* \param rnr Region number to be cleared.
+*/
+__STATIC_INLINE void ARM_MPU_ClrRegion_NS(uint32_t rnr)
+{
+ ARM_MPU_ClrRegionEx(MPU_NS, rnr);
+}
+#endif
+
+/** Configure the given MPU region of the given MPU.
+* \param mpu Pointer to MPU to be used.
+* \param rnr Region number to be configured.
+* \param rbar Value for RBAR register.
+* \param rlar Value for RLAR register.
+*/
+__STATIC_INLINE void ARM_MPU_SetRegionEx(MPU_Type* mpu, uint32_t rnr, uint32_t rbar, uint32_t rlar)
+{
+ mpu->RNR = rnr;
+ mpu->RBAR = rbar;
+ mpu->RLAR = rlar;
+}
+
+/** Configure the given MPU region.
+* \param rnr Region number to be configured.
+* \param rbar Value for RBAR register.
+* \param rlar Value for RLAR register.
+*/
+__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rnr, uint32_t rbar, uint32_t rlar)
+{
+ ARM_MPU_SetRegionEx(MPU, rnr, rbar, rlar);
+}
+
+#ifdef MPU_NS
+/** Configure the given Non-secure MPU region.
+* \param rnr Region number to be configured.
+* \param rbar Value for RBAR register.
+* \param rlar Value for RLAR register.
+*/
+__STATIC_INLINE void ARM_MPU_SetRegion_NS(uint32_t rnr, uint32_t rbar, uint32_t rlar)
+{
+ ARM_MPU_SetRegionEx(MPU_NS, rnr, rbar, rlar);
+}
+#endif
+
+/** Memcopy with strictly ordered memory access, e.g. for register targets.
+* \param dst Destination data is copied to.
+* \param src Source data is copied from.
+* \param len Amount of data words to be copied.
+*/
+__STATIC_INLINE void ARM_MPU_OrderedMemcpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
+{
+ uint32_t i;
+ for (i = 0U; i < len; ++i)
+ {
+ dst[i] = src[i];
+ }
+}
+
+/** Load the given number of MPU regions from a table to the given MPU.
+* \param mpu Pointer to the MPU registers to be used.
+* \param rnr First region number to be configured.
+* \param table Pointer to the MPU configuration table.
+* \param cnt Amount of regions to be configured.
+*/
+__STATIC_INLINE void ARM_MPU_LoadEx(MPU_Type* mpu, uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt)
+{
+ const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U;
+ if (cnt == 1U) {
+ mpu->RNR = rnr;
+ ARM_MPU_OrderedMemcpy(&(mpu->RBAR), &(table->RBAR), rowWordSize);
+ } else {
+ uint32_t rnrBase = rnr & ~(MPU_TYPE_RALIASES-1U);
+ uint32_t rnrOffset = rnr % MPU_TYPE_RALIASES;
+
+ mpu->RNR = rnrBase;
+ while ((rnrOffset + cnt) > MPU_TYPE_RALIASES) {
+ uint32_t c = MPU_TYPE_RALIASES - rnrOffset;
+ ARM_MPU_OrderedMemcpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), c*rowWordSize);
+ table += c;
+ cnt -= c;
+ rnrOffset = 0U;
+ rnrBase += MPU_TYPE_RALIASES;
+ mpu->RNR = rnrBase;
+ }
+
+ ARM_MPU_OrderedMemcpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), cnt*rowWordSize);
+ }
+}
+
+/** Load the given number of MPU regions from a table.
+* \param rnr First region number to be configured.
+* \param table Pointer to the MPU configuration table.
+* \param cnt Amount of regions to be configured.
+*/
+__STATIC_INLINE void ARM_MPU_Load(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt)
+{
+ ARM_MPU_LoadEx(MPU, rnr, table, cnt);
+}
+
+#ifdef MPU_NS
+/** Load the given number of MPU regions from a table to the Non-secure MPU.
+* \param rnr First region number to be configured.
+* \param table Pointer to the MPU configuration table.
+* \param cnt Amount of regions to be configured.
+*/
+__STATIC_INLINE void ARM_MPU_Load_NS(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt)
+{
+ ARM_MPU_LoadEx(MPU_NS, rnr, table, cnt);
+}
+#endif
+
+#endif
+
diff --git a/bsp/hc32l136/Libraries/CMSIS/Include/tz_context.h b/bsp/hc32l136/Libraries/CMSIS/Include/tz_context.h
new file mode 100644
index 0000000000..0d09749f3a
--- /dev/null
+++ b/bsp/hc32l136/Libraries/CMSIS/Include/tz_context.h
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * @file tz_context.h
+ * @brief Context Management for Armv8-M TrustZone
+ * @version V1.0.1
+ * @date 10. January 2018
+ ******************************************************************************/
+/*
+ * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed 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
+ *
+ * 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.
+ */
+
+#if defined ( __ICCARM__ )
+ #pragma system_include /* treat file as system include file for MISRA check */
+#elif defined (__clang__)
+ #pragma clang system_header /* treat file as system include file */
+#endif
+
+#ifndef TZ_CONTEXT_H
+#define TZ_CONTEXT_H
+
+#include <stdint.h>
+
+#ifndef TZ_MODULEID_T
+#define TZ_MODULEID_T
+/// \details Data type that identifies secure software modules called by a process.
+typedef uint32_t TZ_ModuleId_t;
+#endif
+
+/// \details TZ Memory ID identifies an allocated memory slot.
+typedef uint32_t TZ_MemoryId_t;
+
+/// Initialize secure context memory system
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_InitContextSystem_S (void);
+
+/// Allocate context memory for calling secure software modules in TrustZone
+/// \param[in] module identifies software modules called from non-secure mode
+/// \return value != 0 id TrustZone memory slot identifier
+/// \return value 0 no memory available or internal error
+TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
+
+/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
+/// \param[in] id TrustZone memory slot identifier
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
+
+/// Load secure context (called on RTOS thread context switch)
+/// \param[in] id TrustZone memory slot identifier
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
+
+/// Store secure context (called on RTOS thread context switch)
+/// \param[in] id TrustZone memory slot identifier
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
+
+#endif // TZ_CONTEXT_H
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adc.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adc.h
new file mode 100644
index 0000000000..b0f79183f1
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adc.h
@@ -0,0 +1,486 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file adc.h
+ **
+ ** Header file for AD Converter functions
+ ** @link ADC Group Some description @endlink
+ **
+ ** - 2017-06-28 Alex First Version
+ **
+ ******************************************************************************/
+
+#ifndef __ADC_H__
+#define __ADC_H__
+
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup AdcGroup AD Converter (ADC)
+ **
+ ******************************************************************************/
+
+//@{
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+#define ADC_SCAN_CH0_EN (0x1u) /*!< SCAN模式使用ADC CH0 */
+#define ADC_SCAN_CH1_EN (0x1u<<1) /*!< SCAN模式使用ADC CH1 */
+#define ADC_SCAN_CH2_EN (0x1u<<2) /*!< SCAN模式使用ADC CH2 */
+#define ADC_SCAN_CH3_EN (0x1u<<3) /*!< SCAN模式使用ADC CH3 */
+#define ADC_SCAN_CH4_EN (0x1u<<4) /*!< SCAN模式使用ADC CH4 */
+#define ADC_SCAN_CH5_EN (0x1u<<5) /*!< SCAN模式使用ADC CH5 */
+#define ADC_SCAN_CH6_EN (0x1u<<6) /*!< SCAN模式使用ADC CH6 */
+#define ADC_SCAN_CH7_EN (0x1u<<7) /*!< SCAN模式使用ADC CH7 */
+
+
+/******************************************************************************
+ ** Global type definitions
+ *****************************************************************************/
+
+ /**
+ ******************************************************************************
+ ** \brief ADC采样模式
+ *****************************************************************************/
+typedef enum en_adc_op_mode
+{
+ AdcSglMode = 0u, /*!< 单输入通道单次采样模式 */
+ AdcSCanMode = 1u, /*!< 多输入通道顺序扫描采样模式,多输入通道插队扫描采样模式*/
+} en_adc_op_mode_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC时钟选择
+ *****************************************************************************/
+typedef enum en_adc_clk_sel
+{
+ AdcClkSysTDiv1 = 0u, /*!< PCLK */
+ AdcClkSysTDiv2 = 1u, /*!< 1/2 PCLK */
+ AdcClkSysTDiv4 = 2u, /*!< 1/4 PCLK */
+ AdcClkSysTDiv8 = 3u, /*!< 1/8 PCLK */
+
+} en_adc_clk_div_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC参考电压
+ *****************************************************************************/
+typedef enum en_adc_ref_vol_sel
+{
+ RefVolSelInBgr1p5 = 0u, /*!<内部参考电压1.5V(SPS<=200kHz)*/
+ RefVolSelInBgr2p5 = 1u, /*!<内部参考电压2.5V(avdd>3V,SPS<=200kHz)*/
+ RefVolSelExtern1 = 2u, /*!<外部输入(max avdd) PB01*/
+ RefVolSelAVDD = 3u, /*!<AVDD*/
+
+}en_adc_ref_vol_sel_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC采样通道选择
+ *****************************************************************************/
+typedef enum en_adc_samp_ch_sel
+{
+ AdcExInputCH0 = 0u, /*!<使用通道0输入PA00*/
+ AdcExInputCH1 = 1u, /*!<使用通道1输入PA01*/
+ AdcExInputCH2 = 2u, /*!<使用通道2输入PA02*/
+ AdcExInputCH3 = 3u, /*!<使用通道3输入PA03*/
+ AdcExInputCH4 = 4u, /*!<使用通道4输入PA04*/
+ AdcExInputCH5 = 5u, /*!<使用通道5输入PA05*/
+ AdcExInputCH6 = 6u, /*!<使用通道6输入PA06*/
+ AdcExInputCH7 = 7u, /*!<使用通道7输入PA07*/
+ AdcExInputCH8 = 8u, /*!<使用通道8输入PB00*/
+ AdcExInputCH9 = 9u, /*!<使用通道8输入PB01*/
+ AdcExInputCH10 = 10u, /*!<使用通道8输入PC00*/
+ AdcExInputCH11 = 11u, /*!<使用通道1输入PC01*/
+ AdcExInputCH12 = 12u, /*!<使用通道2输入PC02*/
+ AdcExInputCH13 = 13u, /*!<使用通道3输入PC03*/
+ AdcExInputCH14 = 14u, /*!<使用通道4输入PC04*/
+ AdcExInputCH15 = 15u, /*!<使用通道5输入PC05*/
+ AdcExInputCH16 = 16u, /*!<使用通道6输入PB02*/
+ AdcExInputCH17 = 17u, /*!<使用通道7输入PB10*/
+ AdcExInputCH18 = 18u, /*!<使用通道8输入PB11*/
+ AdcExInputCH19 = 19u, /*!<使用通道8输入PB12*/
+ AdcExInputCH20 = 20u, /*!<使用通道7输入PB13*/
+ AdcExInputCH21 = 21u, /*!<使用通道8输入PB14*/
+ AdcExInputCH22 = 22u, /*!<使用通道8输入PB15*/
+ AdcExInputCH23 = 23u, /*!<使用通道8输入PC06*/
+ AdcOPA0Input = 24u, /*!<使用通道8输入OPA0*/
+ AdcOPA1Input = 25u, /*!<使用通道8输入OPA1*/
+ AdcOPA2Input = 26u, /*!<使用通道8输入OPA2*/
+ AdcAVccDiV3Input = 27u, /*!<使用1/3 AVCC(必须使用输入增益)*/
+ AdcAiTsInput = 28u, /*!<使用BGR_TS(必须使用输入增益)*/
+ AdcVref1P2Input = 29u, /*!<使用Vref1P2(必须使用输入增益)*/
+
+}en_adc_samp_ch_sel_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC采样周期数选择
+ *****************************************************************************/
+typedef enum en_adc_samp_time_sel
+{
+ AdcSampTime4Clk = 0u, /*!<4个采样时钟*/
+ AdcSampTime6Clk = 1u, /*!<6个采样时钟*/
+ AdcSampTime8Clk = 2u, /*!<8个采样时钟*/
+ AdcSampTime12Clk = 3u, /*!<12个采样时钟*/
+
+}en_adc_samp_time_sel_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC周边模块反射源选择
+ *****************************************************************************/
+typedef enum en_adc_trig_sel
+{
+ AdcTrigTimer0 = 0u, /*!<选择timer0中断源,自动触发ADC采样*/
+ AdcTrigTimer1 = 1u, /*!<选择timer1中断源,自动触发ADC采样*/
+ AdcTrigTimer2 = 2u, /*!<选择timer2中断源,自动触发ADC采样*/
+ AdcTrigTimer3 = 3u, /*!<选择timer3中断源,自动触发ADC采样*/
+ AdcTrigTimer4 = 4u, /*!<选择timer4中断源,自动触发ADC采样*/
+ AdcTrigTimer5 = 5u, /*!<选择timer5中断源,自动触发ADC采样*/
+ AdcTrigTimer6 = 6u, /*!<选择timer6中断源,自动触发ADC采样*/
+ AdcTrigUart0 = 7u, /*!<选择uart0中断源,自动触发ADC采样*/
+ AdcTrigUart1 = 8u, /*!<选择uart1中断源,自动触发ADC采样*/
+ AdcTrigLpuart0 = 9u, /*!<选择lpuart0中断源,自动触发ADC采样*/
+ AdcTrigLpuart1 = 10u, /*!<选择lpuart1中断源,自动触发ADC采样*/
+ AdcTrigVC0 = 11u, /*!<选择VC0中断源,自动触发ADC采样*/
+ AdcTrigVC1 = 12u, /*!<选择VC1中断源,自动触发ADC采样*/
+ AdcTrigRTC = 13u, /*!<选择RTC中断源,自动触发ADC采样*/
+ AdcTrigPCA = 14u, /*!<选择PCA中断源,自动触发ADC采样*/
+ AdcTrigSPI0 = 15u, /*!<选择SPI0中断源,自动触发ADC采样*/
+ AdcTrigSPI1 = 16u, /*!<选择SPI1中断源,自动触发ADC采样*/
+ AdcTrigDMA = 17u, /*!<选择DMA中断源,自动触发ADC采样*/
+ AdcTrigPA03 = 18u, /*!<选择PA03中断源,自动触发ADC采样*/
+ AdcTrigPB03 = 19u, /*!<选择PB03中断源,自动触发ADC采样*/
+ AdcTrigPC03 = 20u, /*!<选择PC03中断源,自动触发ADC采样*/
+ AdcTrigPD03 = 21u, /*!<选择PD03中断源,自动触发ADC采样*/
+ AdcTrigPA07 = 22u, /*!<选择PA07中断源,自动触发ADC采样*/
+ AdcTrigPB07 = 23u, /*!<选择PB07中断源,自动触发ADC采样*/
+ AdcTrigPC07 = 24u, /*!<选择PC07中断源,自动触发ADC采样*/
+ AdcTrigPD07 = 25u, /*!<选择PD07中断源,自动触发ADC采样*/
+ AdcTrigPA11 = 26u, /*!<选择PA11中断源,自动触发ADC采样*/
+ AdcTrigPB11 = 27u, /*!<选择PB11中断源,自动触发ADC采样*/
+ AdcTrigPC11 = 28u, /*!<选择PC11中断源,自动触发ADC采样*/
+ AdcTrigPA15 = 29u, /*!<选择PA15中断源,自动触发ADC采样*/
+ AdcTrigPB15 = 30u, /*!<选择PB15中断源,自动触发ADC采样*/
+ AdcTrigPC15 = 31u, /*!<选择PC15中断源,自动触发ADC采样*/
+}en_adc_trig_sel_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC外部触发源寄存器选择
+ *****************************************************************************/
+typedef enum en_adc_ext_trig_sel
+{
+ AdcExtTrig0 = 0u, /*!<单次及顺序扫描转换 外部触发源选择寄存器*/
+ AdcExtTrig1 = 1u, /*!<插队扫描转换 外部触发源选择寄存器*/
+}en_adc_ext_trig_sel_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC顺序转换通道
+ *****************************************************************************/
+typedef enum en_adc_sqr_chmux
+{
+ CH0MUX = 0u, /*!<转换通道0*/
+ CH1MUX = 1u, /*!<转换通道1*/
+ CH2MUX = 2u, /*!<转换通道2*/
+ CH3MUX = 3u, /*!<转换通道3*/
+ CH4MUX = 4u, /*!<转换通道4*/
+ CH5MUX = 5u, /*!<转换通道5*/
+ CH6MUX = 6u, /*!<转换通道6*/
+ CH7MUX = 7u, /*!<转换通道7*/
+ CH8MUX = 8u, /*!<转换通道8*/
+ CH9MUX = 9u, /*!<转换通道9*/
+ CH10MUX = 10u, /*!<转换通道10*/
+ CH11MUX = 11u, /*!<转换通道11*/
+ CH12MUX = 12u, /*!<转换通道12*/
+ CH13MUX = 13u, /*!<转换通道13*/
+ CH14MUX = 14u, /*!<转换通道14*/
+ CH15MUX = 15u, /*!<转换通道15*/
+}en_adc_sqr_chmux_t;
+/**
+ ******************************************************************************
+ ** \brief ADC插队转换通道
+ *****************************************************************************/
+typedef enum en_adc_jqr_chmux
+{
+ JQRCH0MUX = 0u, /*!<转换通道0*/
+ JQRCH1MUX = 1u, /*!<转换通道1*/
+ JQRCH2MUX = 2u, /*!<转换通道2*/
+ JQRCH3MUX = 3u, /*!<转换通道3*/
+}en_adc_jqr_chmux_t;
+/**
+ ******************************************************************************
+ ** \brief ADC结果对齐方式
+ *****************************************************************************/
+typedef enum en_adc_align
+{
+ AlignRight = 0u,
+ AlignLeft = 1u,
+}en_adc_align_t;
+/******************************************************************************
+ * Extern type definitions ('typedef') *
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief ADC配置
+ *****************************************************************************/
+typedef struct stc_adc_cfg
+{
+ /*! ADC操作模式*/
+ en_adc_op_mode_t enAdcOpMode;
+
+ /*! ADC时钟选择*/
+ en_adc_clk_div_t enAdcClkDiv;
+
+ /*! ADC采样时间*/
+ en_adc_samp_time_sel_t enAdcSampTimeSel;
+
+ /*! ADC参考电压*/
+ en_adc_ref_vol_sel_t enAdcRefVolSel;
+
+ /*! ADC输入增益使能*/
+ boolean_t bAdcInBufEn;
+}stc_adc_cfg_t;
+
+ /**
+ ******************************************************************************
+ ** \brief ADC DMA触发源寄存器配置
+ *****************************************************************************/
+typedef enum en_adc_dmatrig
+{
+ /*!插队扫描触发DMA读取控制*/
+ DmaJqr = 0,
+ /*!顺序扫描触发DMA读取控制*/
+ DmaSqr = 1
+}en_adc_dmatrig_t;
+ /**
+ ******************************************************************************
+ ** \brief ADC外部触发源寄存器配置
+ *****************************************************************************/
+typedef struct stc_adc_ext_trig_cfg
+{
+ /*! 外部触发源寄存器选择*/
+ en_adc_ext_trig_sel_t enAdcExtTrigRegSel;
+
+ /*! ADC单次及顺序转换触发选择*/
+ en_adc_trig_sel_t enAdcTrig0Sel;
+
+ /*! ADC插队转换触发选择*/
+ en_adc_trig_sel_t enAdcTrig1Sel;
+
+}stc_adc_ext_trig_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADC中断配置
+ *****************************************************************************/
+typedef struct stc_adc_irq
+{
+ /*!<ADC插队扫描完成中断*/
+ boolean_t bAdcJQRIrq;
+ /*!<ADC顺序扫描完成中断*/
+ boolean_t bAdcSQRIrq;
+ /*! ADC区间中断*/
+ boolean_t bAdcRegCmp;
+ /*! ADC上超出区间中断*/
+ boolean_t bAdcHhtCmp;
+ /*! ADC下超出区间中断*/
+ boolean_t bAdcLltCmp;
+ /*!<ADC单次转换完成中断*/
+ boolean_t bAdcIrq;
+}stc_adc_irq_t;
+
+typedef struct stc_adc_threshold_cfg
+{
+
+ boolean_t bAdcRegCmp ; /*!ADC区间使能*/
+
+ boolean_t bAdcHhtCmp ; /*!ADC上超出区间使能*/
+
+ boolean_t bAdcLltCmp ; /*!ADC下超出区间使能*/
+
+ uint32_t u32AdcRegHighThd; /*!ADC下超出区间*/
+
+ uint32_t u32AdcRegLowThd; /*!ADC下超出区间*/
+
+ en_adc_samp_ch_sel_t enThCh; /*!阈值比较通道选择*/
+
+}stc_adc_threshold_cfg_t;
+/**
+ ******************************************************************************
+ ** \brief ADC中断回调函数
+ *****************************************************************************/
+typedef struct stc_adc_irq_calbakfn_pt
+{
+ /*! ADC插队扫描中断回调函数指针*/
+ func_ptr_t pfnAdcJQRIrq;
+ /*! ADC顺序扫描中断回调函数指针*/
+ func_ptr_t pfnAdcSQRIrq;
+ /*! ADC区间中断回调函数指针*/
+ func_ptr_t pfnAdcRegIrq;
+ /*! ADC上超出区间中断回调函数指针*/
+ func_ptr_t pfnAdcHhtIrq;
+ /*! ADC下超出区间中断回调函数指针*/
+ func_ptr_t pfnAdcLltIrq;
+ /*! ADC单次转换中断回调函数指针*/
+ func_ptr_t pfnAdcIrq;
+}stc_adc_irq_calbakfn_pt_t;
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+//ADC initialization
+en_result_t Adc_Init(stc_adc_cfg_t* pstcAdcConfig);
+//ADC ExtTrig Register config
+en_result_t Adc_ExtTrigCfg(stc_adc_ext_trig_cfg_t* pstcExtTrigConfig);
+//ADC de-init
+void Adc_DeInit(void);
+
+//ADC conversion start
+void Adc_SGL_Start(void);
+//ADC conversion stop
+void Adc_SGL_Stop(void);
+
+//ADC SQR conversion start
+void Adc_SQR_Start(void);
+//ADC SQR conversion stop
+void Adc_SQR_Stop(void);
+
+//ADC JQR conversion start
+void Adc_JQR_Start(void);
+//ADC JQR conversion stop
+void Adc_JQR_Stop(void);
+
+//ADC conversion enable
+void Adc_Enable(void);
+//ADC conversion disable
+void Adc_Disable(void);
+
+//ADC single covert mode configuration
+en_result_t Adc_ConfigSglMode(stc_adc_cfg_t* pstcAdcConfig);
+//ADC SQR mode configuration
+en_result_t Adc_ConfigSqrMode(stc_adc_cfg_t* pstcAdcConfig, uint8_t u8AdcSampCnt,boolean_t bAdcResultAccEn);
+//ADC JQR mode configuration
+en_result_t Adc_ConfigJqrMode(stc_adc_cfg_t* pstcAdcConfig, uint8_t u8AdcSampCnt,boolean_t bAdcResultAccEn);
+
+//ADC single covert mode channel configuraion
+en_result_t Adc_ConfigSglChannel( en_adc_samp_ch_sel_t enstcAdcSampCh);
+//ADC SQR mode channel configuraion
+en_result_t Adc_ConfigSqrChannel(en_adc_sqr_chmux_t enstcAdcSqrChMux, en_adc_samp_ch_sel_t enstcAdcSampCh);
+//ADC JQR mode channel configuraion
+en_result_t Adc_ConfigJqrChannel(en_adc_jqr_chmux_t enstcAdcJqrChMux, en_adc_samp_ch_sel_t enstcAdcSampCh);
+//ADC DMA Trigger
+en_result_t Adc_ConfigDmaTrig(en_adc_dmatrig_t enAdcDmaTrig);
+//ADC IRQ configuration
+void Adc_ConfigIrq(stc_adc_irq_t* pstcAdcIrqCfg,
+ stc_adc_irq_calbakfn_pt_t* pstcAdcIrqCalbaks);
+//ADC enable IRQ
+void Adc_EnableIrq(void);
+//ADC disable IRQ
+void Adc_DisableIrq(void);
+//ADC enable threshold compare
+void Adc_ThresholdCfg(stc_adc_threshold_cfg_t* stcAdcThrCfg);
+//ADC get IRQ state
+void Adc_GetIrqState(stc_adc_irq_t* pstcAdcIrqState);
+//ADC clear IRQ states
+void Adc_ClrSglIrqState(void);
+void Adc_ClrJqrIrqState(void);
+void Adc_ClrSqrIrqState(void);
+void Adc_ClrRegIrqState(void);
+void Adc_ClrHtIrqState(void);
+void Adc_ClrLtIrqState(void);
+
+//查询ADC单次转换状态
+boolean_t Adc_PollSglBusyState(void);
+//查询ADC顺序扫描转换转换状态
+boolean_t Adc_PollSqrBusyState(void);
+//查询ADC插队扫描转换状态
+boolean_t Adc_PollJqrBusyState(void);
+//查询ADC结果比较区间状态
+boolean_t Adc_PollRegBusyState(void);
+//查询ADC结果比较上阈值状态
+boolean_t Adc_PollHTBusyState(void);
+//查询ADC结果比较下阈值状态
+boolean_t Adc_PollLtBusyState(void);
+//获取单次转换采样值
+en_result_t Adc_GetSglResult(uint16_t* pu16AdcResult);
+//获取顺序扫描采样值
+en_result_t Adc_GetSqrResult(uint16_t* pu16AdcResult,uint8_t SQRChannelIndex);
+//获取插队扫描采样值
+en_result_t Adc_GetJqrResult(uint16_t* pu16AdcResult,uint8_t JQRChannelIndex);
+//获取累加采样值
+en_result_t Adc_GetAccResult(uint32_t* pu32AdcAccResult);
+//clear ADC accumulated result
+void Adc_ClrAccResult(void);
+//设置参考电压
+en_result_t Adc_SetVref(en_adc_ref_vol_sel_t enAdcRefVolSel);
+//设置结果对齐方式
+en_result_t Adc_SetAlign(en_adc_align_t enAlign);
+//@}
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ADC_H__ */
+/******************************************************************************/
+/* EOF (not truncated) */
+/******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adt.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adt.h
new file mode 100644
index 0000000000..3bc779ed61
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/adt.h
@@ -0,0 +1,819 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file adt.h
+ **
+ ** Headerfile for Advance Timer functions
+ ** @link ADT Group Some description @endlink
+ **
+ ** - 2018-04-18 Husj First Version
+ **
+ ******************************************************************************/
+
+#ifndef __ADT_H__
+#define __ADT_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup AdtGroup Advance Timer (ADT)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+ /**
+ ******************************************************************************
+ ** \brief 高性能定时器选择
+ *****************************************************************************/
+typedef enum en_adt_unit
+{
+ AdtTIM4 = 0u, ///< TIM4
+ AdtTIM5 = 1u, ///< TIM5
+ AdtTIM6 = 2u, ///< TIM6
+}en_adt_unit_t;
+
+ /**
+ ******************************************************************************
+ ** \brief ADT CHx端口定义
+ *****************************************************************************/
+typedef enum en_adt_CHxX_port
+{
+ AdtCHxA = 0u, ///< CHx A端口
+ AdtCHxB = 1u, ///< CHx B端口
+}en_adt_CHxX_port_t;
+
+ /**
+ ******************************************************************************
+ ** \brief ADT TRIG端口定义
+ *****************************************************************************/
+typedef enum en_adt_trig_port
+{
+ AdtTrigA = 0u, ///< TIMx 触发A端口
+ AdtTrigB = 1u, ///< TIMx 触发B端口
+ AdtTrigC = 2u, ///< TIMx 触发C端口
+ AdtTrigD = 3u, ///< TIMx 触发D端口
+}en_adt_trig_port_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT通用控制 - Z相输入屏蔽周期数
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_gconr_zmsk
+{
+ AdtZMaskDis = 0u, ///< Z相输入屏蔽功能无效
+ AdtZMask4Cyl = 1u, ///< 位置计数上溢后或下溢后的4个计数周期内的Z相输入被屏蔽
+ AdtZMask8Cyl = 2u, ///< 位置计数上溢后或下溢后的8个计数周期内的Z相输入被屏蔽
+ AdtZMask16Cyl = 3u, ///< 位置计数上溢后或下溢后的16个计数周期内的Z相输入被屏蔽
+}en_adt_gconr_zmsk_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT通用控制 - 计数时钟选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_cnt_ckdiv
+{
+ AdtClkPClk0 = 0u, ///< PCLK0
+ AdtClkPClk0Div2 = 1u, ///< PCLK0/2
+ AdtClkPClk0Div4 = 2u, ///< PCLK0/4
+ AdtClkPClk0Div8 = 3u, ///< PCLK0/8
+ AdtClkPClk0Div16 = 4u, ///< PCLK0/16
+ AdtClkPClk0Div64 = 5u, ///< PCLK0/64
+ AdtClkPClk0Div256 = 6u, ///< PCLK0/256
+ AdtClkPClk0Div1024 = 7u, ///< PCLK0/1024
+}en_adt_cnt_ckdiv_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT计数模式
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_cnt_mode
+{
+ AdtSawtoothMode = 0u, ///< 锯齿波模式
+ AdtTriangleModeA = 4u, ///< 三角波A模式
+ AdtTriangleModeB = 5u, ///< 三角波B模式
+}en_adt_cnt_mode_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT计数方向
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_cnt_dir
+{
+ AdtCntDown = 0u, ///< 递减计数
+ AdtCntUp = 1u, ///< 递加计数
+}en_adt_cnt_dir_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT通用比较基准
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_compare
+{
+ AdtCompareA = 0u, ///< 通用比较基准A
+ AdtCompareB = 1u, ///< 通用比较基准B
+ AdtCompareC = 2u, ///< 通用比较基准C
+ AdtCompareD = 3u, ///< 通用比较基准D
+}en_adt_compare_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT专用比较基准
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_special_compare
+{
+ AdtSpclCompA = 0u, ///< 专用比较基准A
+ AdtSpclCompB = 1u, ///< 专用比较基准B
+}en_adt_special_compare_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - TIMx输出状态控制
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_disval
+{
+ AdtTIMxDisValNorm = 0u, ///< 强制输出无效条件0~3中被选择的条件成立时,CHx端口正常输出
+ AdtTIMxDisValHiZ = 1u, ///< 强制输出无效条件0~3中被选择的条件成立时,CHx端口输出高阻态
+ AdtTIMxDisValLow = 2u, ///< 强制输出无效条件0~3中被选择的条件成立时,CHx端口输出低电平
+ AdtTIMxDisValHigh = 3u, ///< 强制输出无效条件0~3中被选择的条件成立时,CHx端口输出高电平
+}en_adt_pconr_disval_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - CHx强制输出无效条件选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_dissel
+{
+ AdtCHxDisSel0 = 0u, ///< 选择强制输出无效条件0
+ AdtCHxDisSel1 = 1u, ///< 选择强制输出无效条件1
+ AdtCHxDisSel2 = 2u, ///< 选择强制输出无效条件2
+ AdtCHxDisSel3 = 3u, ///< 选择强制输出无效条件3
+}en_adt_pconr_dissel_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - CHx周期值匹配时端口状态设定
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_perc
+{
+ AdtCHxPeriodLow = 0u, ///< 计数器计数值与周期值相等时,CHx端口输出保持为低电平
+ AdtCHxPeriodHigh = 1u, ///< 计数器计数值与周期值相等时,CHx端口输出设定为高电平
+ AdtCHxPeriodKeep = 2u, ///< 计数器计数值与周期值相等时,CHx端口输出设定为先前状态
+ AdtCHxPeriodInv = 3u, ///< 计数器计数值与周期值相等时,CHx端口输出设定为反转电平
+}en_adt_pconr_perc_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - CHx比较值匹配时端口状态设定
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_cmpc
+{
+ AdtCHxCompareLow = 0u, ///< 计数器计数值与GCMxR相等时,CHx端口输出保持为低电平
+ AdtCHxCompareHigh = 1u, ///< 计数器计数值与GCMxR相等时,CHx端口输出设定为高电平
+ AdtCHxCompareKeep = 2u, ///< 计数器计数值与GCMxR相等时,CHx端口输出设定为先前状态
+ AdtCHxCompareInv = 3u, ///< 计数器计数值与GCMxR相等时,CHx端口输出设定为反转电平
+}en_adt_pconr_cmpc_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - CHx端口输出
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_port_out
+{
+ AdtCHxPortOutLow = 0u, ///< CHx端口输出设定为低电平
+ AdtCHxPortOutHigh = 1u, ///< CHx端口输出设定为高电平
+}en_adt_pconr_port_out_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - CHx端口功能模式选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_capc
+{
+ AdtCHxCompareOutput = 0u, ///< CHx端口设定为比较输出功能
+ AdtCHxCompareInput = 1u, ///< CHx端口设定为捕获输入功能
+}en_adt_pconr_capc_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口控制 - CHx计数开始停止端口状态选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pconr_stastps
+{
+ AdtCHxStateSelSS = 0u, ///< 计数开始或停止时,CHx端口输出由STACB、STPCB决定
+ AdtCHxStateSelKeep = 1u, ///< 计数开始或停止时,CHx端口输出设定为先前状态
+}en_adt_pconr_stastps_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT死区控制 - CHx死区分离设定
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_dconr_sepa
+{
+ AdtCHxDtSeperate = 0u, ///< DTUAR和DTDAR分别设定
+ AdtCHxDtEqual = 1u, ///< DTDAR的值和DTUAR的值自动相等
+}en_adt_dconr_sepa_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT滤波控制 - TRIx/TIMxIx端口滤波采样基准时钟选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_fconr_nofick
+{
+ AdtFltClkPclk0 = 0u, ///< PCLK0
+ AdtFltClkPclk0Div4 = 1u, ///< PCLK0/4
+ AdtFltClkPclk0Div16 = 2u, ///< PCLK0/16
+ AdtFltClkPclk0Div64 = 3u, ///< PCLK0/64
+}en_adt_fconr_nofick_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT有效周期 - TIMx有效周期选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_vperr_pcnts
+{
+ AdtPeriodCnts0 = 0u, ///< 有效周期选择功能无效
+ AdtPeriodCnts1 = 1u, ///< 每隔1个周期有效一次
+ AdtPeriodCnts2 = 2u, ///< 每隔2个周期有效一次
+ AdtPeriodCnts3 = 3u, ///< 每隔3个周期有效一次
+ AdtPeriodCnts4 = 4u, ///< 每隔4个周期有效一次
+ AdtPeriodCnts5 = 5u, ///< 每隔5个周期有效一次
+ AdtPeriodCnts6 = 6u, ///< 每隔6个周期有效一次
+ AdtPeriodCnts7 = 7u, ///< 每隔7个周期有效一次
+}en_adt_vperr_pcnts_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT有效周期 - 计数条件选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_vperr_pcnte
+{
+ AdtPeriodCnteDisable = 0u, ///< 有效周期选择功能无效
+ AdtPeriodCnteMin = 1u, ///< 锯齿波计数上、下溢点或三角波波谷做为计数条件
+ AdtPeriodCnteMax = 2u, ///< 锯齿波计数上、下溢点或三角波波峰做为计数条件
+ AdtPeriodCnteBoth = 3u, ///< 锯齿波计数上、下溢点或三角波波峰,波谷做为计数条件
+}en_adt_vperr_pcnte_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口触发控制 - 触发源选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_ttrig_trigxs
+{
+ AdtTrigxSelPA3 = 0u, ///< PA3
+ AdtTrigxSelPB3 = 1u, ///< PB3
+ AdtTrigxSelPC3 = 2u, ///< PC3
+ AdtTrigxSelPD3 = 3u, ///< PD3
+ AdtTrigxSelPA7 = 4u, ///< PA7
+ AdtTrigxSelPB7 = 5u, ///< PB7
+ AdtTrigxSelPC7 = 6u, ///< PC7
+ AdtTrigxSelPD7 = 7u, ///< PD7
+ AdtTrigxSelPA11 = 8u, ///< PA11
+ AdtTrigxSelPB11 = 9u, ///< PB11
+ AdtTrigxSelPC11 = 10u, ///< PC11
+ AdtTrigxSelPD1 = 11u, ///< PD1
+ AdtTrigxSelPA15 = 12u, ///< PA15
+ AdtTrigxSelPB15 = 13u, ///< PB15
+ AdtTrigxSelPC5 = 14u, ///< PC5
+ AdtTrigxSelPD5 = 15u, ///< PD5
+}en_adt_ttrig_trigxs_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT AOS触发控制 - AOSx触发源选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_itrig_iaosxs
+{
+ AdtAosxTrigSelTim0Int = 0u, ///< TIM0_INT
+ AdtAosxTrigSelTim1Int = 1u, ///< TIM1_INT
+ AdtAosxTrigSelTim2Int = 2u, ///< TIM2_INT
+ AdtAosxTrigSelLpTimInt = 3u, ///< LPTIMER_INT
+ AdtAosxTrigSelTim4Int = 4u, ///< TIM4_INT
+ AdtAosxTrigSelTim5Int = 5u, ///< TIM5_INT
+ AdtAosxTrigSelTim6Int = 6u, ///< TIM6_INT
+ AdtAosxTrigSelUart0Int = 7u, ///< UART0_INT
+ AdtAosxTrigSelUart1Int = 8u, ///< UART1_INT
+ AdtAosxTrigSelLpUartInt = 9u, ///< LPUART_INT
+ AdtAosxTrigSelVc0Int = 10u, ///< VC0_INT
+ AdtAosxTrigSelVc1Int = 11u, ///< VC1_INT
+ AdtAosxTrigSelRtcInt = 12u, ///< RTC_INT
+ AdtAosxTrigSelPcaInt = 13u, ///< PCA_INT
+ AdtAosxTrigSelSpiInt = 14u, ///< SPI_INT
+ AdtAosxTrigSelAdcInt = 15u, ///< ADC_INT
+}en_adt_itrig_iaosxs_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT硬件(启动/停止/清零/捕获)事件触发选择
+ **
+ ** \note
+ ******************************************************************************/
+
+typedef enum en_adt_hw_trig
+{
+ AdtHwTrigAos0 = 0u, ///< 从AOS来的事件触发0有效
+ AdtHwTrigAos1 = 1u, ///< 从AOS来的事件触发1有效
+ AdtHwTrigAos2 = 2u, ///< 从AOS来的事件触发2有效
+ AdtHwTrigAos3 = 3u, ///< 从AOS来的事件触发3有效
+ AdtHwTrigCHxARise = 4u, ///< CHxA端口上采样到上升沿
+ AdtHwTrigCHxAFall = 5u, ///< CHxA端口上采样到下降沿
+ AdtHwTrigCHxBRise = 6u, ///< CHxB端口上采样到上升沿
+ AdtHwTrigCHxBFall = 7u, ///< CHxB端口上采样到下降沿
+ AdtHwTrigTimTriARise = 8u, ///< TIMTRIA端口上采样到上升沿
+ AdtHwTrigTimTriAFall = 9u, ///< TIMTRIA端口上采样到下降沿
+ AdtHwTrigTimTriBRise = 10u, ///< TIMTRIB端口上采样到上升沿
+ AdtHwTrigTimTriBFall = 11u, ///< TIMTRIB端口上采样到下降沿
+ AdtHwTrigTimTriCRise = 12u, ///< TIMTRIC端口上采样到上升沿
+ AdtHwTrigTimTriCFall = 13u, ///< TIMTRIC端口上采样到下降沿
+ AdtHwTrigTimTriDRise = 14u, ///< TIMTRID端口上采样到上升沿
+ AdtHwTrigTimTriDFall = 15u, ///< TIMTRID端口上采样到下降沿
+ AdtHwTrigEnd = 16u,
+}en_adt_hw_trig_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT硬件(递加/递减)事件触发选择
+ **
+ ** \note
+ ******************************************************************************/
+
+typedef enum en_adt_hw_cnt
+{
+ AdtHwCntCHxALowCHxBRise = 0u, ///< CHxA端口为低电平时,CHxB端口上采样到上升沿
+ AdtHwCntCHxALowCHxBFall = 1u, ///< CHxA端口为低电平时,CHxB端口上采样到下降沿
+ AdtHwCntCHxAHighCHxBRise = 2u, ///< CHxA端口为高电平时,CHxB端口上采样到上升沿
+ AdtHwCntCHxAHighCHxBFall = 3u, ///< CHxA端口为高电平时,CHxB端口上采样到下降沿
+ AdtHwCntCHxBLowCHxARise = 4u, ///< CHxB端口为低电平时,CHxA端口上采样到上升沿
+ AdtHwCntCHxBLowCHxAFall = 5u, ///< CHxB端口为低电平时,CHxA端口上采样到下降沿
+ AdtHwCntCHxBHighChxARise = 6u, ///< CHxB端口为高电平时,CHxA端口上采样到上升沿
+ AdtHwCntCHxBHighCHxAFall = 7u, ///< CHxB端口为高电平时,CHxA端口上采样到下降沿
+ AdtHwCntTimTriARise = 8u, ///< TIMTRIA端口上采样到上升沿
+ AdtHwCntTimTriAFall = 9u, ///< TIMTRIA端口上采样到下降沿
+ AdtHwCntTimTriBRise = 10u, ///< TIMTRIB端口上采样到上升沿
+ AdtHwCntTimTriBFall = 11u, ///< TIMTRIB端口上采样到下降沿
+ AdtHwCntTimTriCRise = 12u, ///< TIMTRIC端口上采样到上升沿
+ AdtHwCntTimTriCFall = 13u, ///< TIMTRIC端口上采样到下降沿
+ AdtHwCntTimTriDRise = 14u, ///< TIMTRID端口上采样到上升沿
+ AdtHwCntTimTriDFall = 15u, ///< TIMTRID端口上采样到下降沿
+ AdtHwCntAos0 = 16u, ///< 从AOS来的事件触发0有效
+ AdtHwCntAos1 = 17u, ///< 从AOS来的事件触发1有效
+ AdtHwCntAos2 = 18u, ///< 从AOS来的事件触发2有效
+ AdtHwCntAos3 = 19u, ///< 从AOS来的事件触发3有效
+ AdtHwCntMax = 20u,
+}en_adt_hw_cnt_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT端口刹车极性控制
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_ptbrk_polarity
+{
+ AdtPtBrkHigh = 0u, ///< 端口刹车极性高电平有效
+ AdtPtBrkLow = 1u, ///< 端口刹车极性低电平有效
+}en_adt_ptbrk_polarity_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT PWM展频计数选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_adt_pwm_dither_type
+{
+ AdtPwmDitherUnderFlow = 0u, ///< PWM展频计数下溢出
+ AdtPwmDitherOverFlow = 1u, ///< PWM展频计数上溢出
+}en_adt_pwm_dither_type_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT中断类型
+ **
+ ** \note
+ ******************************************************************************/
+
+typedef enum en_adt_irq_type
+{
+ AdtCMAIrq = 0u, ///< 计数匹配A(或捕获输入)中断
+ AdtCMBIrq = 1u, ///< 计数匹配B(或捕获输入)中断
+ AdtCMCIrq = 2u, ///< 计数匹配C中断
+ AdtCMDIrq = 3u, ///< 计数匹配D中断
+ AdtOVFIrq = 6u, ///< 上溢匹配中断
+ AdtUDFIrq = 7u, ///< 下溢匹配中断
+ AdtDTEIrq = 8u, ///< 死区时间错误中断
+ AdtSAMLIrq = 14u, ///< 同低中断
+ AdtSAMHIrq = 15u, ///< 同高中断
+}en_adt_irq_type_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT软件同步配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_sw_sync
+{
+ boolean_t bAdTim4; ///< Timer 4
+ boolean_t bAdTim5; ///< Timer 5
+ boolean_t bAdTim6; ///< Timer 6
+
+}stc_adt_sw_sync_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT AOS触发配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_aos_trig_cfg
+{
+ en_adt_itrig_iaosxs_t enAos0TrigSrc; ///< AOS0触发源选择
+ en_adt_itrig_iaosxs_t enAos1TrigSrc; ///< AOS1触发源选择
+ en_adt_itrig_iaosxs_t enAos2TrigSrc; ///< AOS2触发源选择
+ en_adt_itrig_iaosxs_t enAos3TrigSrc; ///< AOS3触发源选择
+}stc_adt_aos_trig_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT 中断触发配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_irq_trig_cfg
+{
+ boolean_t bAdtSpecilMatchBTrigDmaEn; ///< 专用比较基准值匹配B使能触发DMA
+ boolean_t bAdtSpecilMatchATrigDmaEn; ///< 专用比较基准值匹配A使能触发DMA
+ boolean_t bAdtUnderFlowTrigDmaEn; ///< 下溢匹配使能触发DMA
+ boolean_t bAdtOverFlowTrigDmaEn; ///< 上溢匹配使能触发DMA
+ boolean_t bAdtCntMatchDTrigDmaEn; ///< 计数匹配D使能触发DMA
+ boolean_t bAdtCntMatchCTrigDmaEn; ///< 计数匹配C使能触发DMA
+ boolean_t bAdtCntMatchBTrigDmaEn; ///< 计数匹配B使能触发DMA
+ boolean_t bAdtCntMatchATrigDmaEn; ///< 计数匹配A使能触发DMA
+ boolean_t bAdtSpecilMatchBTrigEn; ///< 专用比较基准值匹配B使能触发ADC
+ boolean_t bAdtSpecilMatchATrigEn; ///< 专用比较基准值匹配A使能触发ADC
+ boolean_t bAdtUnderFlowTrigEn; ///< 下溢匹配使能触发ADC
+ boolean_t bAdtOverFlowTrigEn; ///< 上溢匹配使能触发ADC
+ boolean_t bAdtCntMatchDTrigEn; ///< 计数匹配D使能触发ADC
+ boolean_t bAdtCntMatchCTrigEn; ///< 计数匹配C使能触发ADC
+ boolean_t bAdtCntMatchBTrigEn; ///< 计数匹配B使能触发ADC
+ boolean_t bAdtCntMatchATrigEn; ///< 计数匹配A使能触发ADC
+}stc_adt_irq_trig_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT Trig端口配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_port_trig_cfg
+{
+ en_adt_ttrig_trigxs_t enTrigSrc; ///< 触发源选择
+ boolean_t bFltEn; ///< 触发源捕获输入滤波使能
+ en_adt_fconr_nofick_t enFltClk; ///< 滤波采样基准时钟
+}stc_adt_port_trig_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT Z相输入屏蔽功能配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_zmask_cfg
+{
+ en_adt_gconr_zmsk_t enZMaskCycle; ///< Z相输入屏蔽计数周期选择
+ boolean_t bFltPosCntMaksEn; ///< Z相输入时的屏蔽周期内,位置计数器的清零功能不屏蔽(FALSE)或屏蔽(TRUE)
+ boolean_t bFltRevCntMaksEn; ///< Z相输入时的屏蔽周期内,公转计数器的计数功能不屏蔽(FALSE)或屏蔽(TRUE)
+}stc_adt_zmask_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT TIMxX端口配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_TIMxX_port_cfg
+{
+ en_adt_pconr_capc_t enCap; ///< 端口功能模式
+ boolean_t bOutEn; ///< 输出使能
+ en_adt_pconr_perc_t enPerc; ///< 周期值匹配时端口状态
+ en_adt_pconr_cmpc_t enCmpc; ///< 比较值匹配时端口状态
+ en_adt_pconr_stastps_t enStaStp; ///< 计数开始停止端口状态选择
+ en_adt_pconr_port_out_t enStaOut; ///< 计数开始端口输出状态
+ en_adt_pconr_port_out_t enStpOut; ///< 计数停止端口输出状态
+ en_adt_pconr_disval_t enDisVal; ///< 强制输出无效时输出状态控制
+ en_adt_pconr_dissel_t enDisSel; ///< 强制输出无效条件选择
+ boolean_t bFltEn; ///< 端口捕获输入滤波使能
+ en_adt_fconr_nofick_t enFltClk; ///< 端口滤波采样基准时钟
+}stc_adt_CHxX_port_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT刹车端口配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_break_port_cfg
+{
+ boolean_t bPortEn; ///< 端口使能
+ en_adt_ptbrk_polarity_t enPol; ///< 极性选择
+}stc_adt_break_port_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT无效条件3配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_disable_3_cfg
+{
+ stc_adt_break_port_cfg_t stcBrkPtCfg[16]; ///< 刹车端口配置
+ boolean_t bFltEn; ///< 刹车端口滤波使能
+ en_adt_fconr_nofick_t enFltClk; ///< 滤波采样基准时钟
+ boolean_t bSwBrk; ///< 软件刹车
+}stc_adt_disable_3_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT无效条件1配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_disable_1_cfg
+{
+ boolean_t bTim6OutSH; ///< TIM6输出同高
+ boolean_t bTim5OutSH; ///< TIM5输出同高
+ boolean_t bTim4OutSH; ///< TIM4输出同高
+ boolean_t bTim6OutSL; ///< TIM6输出同低
+ boolean_t bTim5OutSL; ///< TIM5输出同低
+ boolean_t bTim4OutSL; ///< TIM4输出同低
+}stc_adt_disable_1_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT PWM展频计数配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_pwm_dither_cfg
+{
+ en_adt_pwm_dither_type_t enAdtPDType; ///< PWM展频计数选择
+ boolean_t bTimxBPDEn; ///< PWM通道B展频使能
+ boolean_t bTimxAPDEn; ///< PWM通道A展频使能
+}stc_adt_pwm_dither_cfg_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief ADT基本计数配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_basecnt_cfg
+{
+ en_adt_cnt_mode_t enCntMode; ///< 计数模式
+ en_adt_cnt_dir_t enCntDir; ///< 计数方向
+ en_adt_cnt_ckdiv_t enCntClkDiv; ///< 计数时钟选择
+}stc_adt_basecnt_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT计数状态
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_cntstate_cfg
+{
+ uint16_t u16Counter; ///< 当前计数器的计数值
+ boolean_t enCntDir; ///< 计数方向
+ uint8_t u8ValidPeriod; ///< 有效周期计数
+ boolean_t bCMSBDF; ///< 向下计数专用比较基准值匹配B标志
+ boolean_t bCMSBUF; ///< 向上计数专用比较基准值匹配A标志
+ boolean_t bCMSADF; ///< 向下计数专用比较基准值匹配B标志
+ boolean_t bCMSAUF; ///< 向上计数专用比较基准值匹配A标志
+ boolean_t bDTEF; ///< 死区时间错误标志
+ boolean_t bUDFF; ///< 下溢匹配标志
+ boolean_t bOVFF; ///< 上溢匹配标志
+ boolean_t bCMDF; ///< 计数匹配D标志
+ boolean_t bCMCF; ///< 计数匹配C标志
+ boolean_t bCMBF; ///< 计数匹配B标志
+ boolean_t bCMAF; ///< 计数匹配A标志
+}stc_adt_cntstate_cfg_t;
+
+/**
+ ******************************************************************************
+ ** \brief ADT有效计数周期
+ ** \note
+ ******************************************************************************/
+typedef struct stc_adt_validper_cfg
+{
+ en_adt_vperr_pcnts_t enValidCnt; ///< 有效周期选择
+ en_adt_vperr_pcnte_t enValidCdt; ///< 有效周期计数条件
+ boolean_t bPeriodD; ///< 通用信号有效周期选择D
+ boolean_t bPeriodC; ///< 通用信号有效周期选择C
+ boolean_t bPeriodB; ///< 通用信号有效周期选择B
+ boolean_t bPeriodA; ///< 通用信号有效周期选择A
+}stc_adt_validper_cfg_t;
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+en_result_t Adt_ConfigHwCntUp(en_adt_unit_t enAdtUnit, en_adt_hw_cnt_t enAdtHwCntUp);
+en_result_t Adt_ClearHwCntUp(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ConfigHwCntDwn(en_adt_unit_t enAdtUnit, en_adt_hw_cnt_t enAdtHwCntDwn);
+en_result_t Adt_ClearHwCntDwn(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ConfigHwStart(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwStart);
+en_result_t Adt_ClearHwStart(en_adt_unit_t enAdtUnit);
+en_result_t Adt_EnableHwStart(en_adt_unit_t enAdtUnit);
+en_result_t Adt_DisableHwStart(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ConfigHwStop(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwStop);
+en_result_t Adt_ClearHwStop(en_adt_unit_t enAdtUnit);
+en_result_t Adt_EnableHwStop(en_adt_unit_t enAdtUnit);
+en_result_t Adt_DisableHwStop(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ConfigHwClear(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwClear);
+en_result_t Adt_ClearHwClear(en_adt_unit_t enAdtUnit);
+en_result_t Adt_EnableHwClear(en_adt_unit_t enAdtUnit);
+en_result_t Adt_DisableHwClear(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ConfigHwCaptureA(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwCaptureA);
+en_result_t Adt_ClearHwCaptureA(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ConfigHwCaptureB(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwCaptureB);
+en_result_t Adt_ClearHwCaptureB(en_adt_unit_t enAdtUnit);
+
+en_result_t Adt_SwSyncStart(stc_adt_sw_sync_t* pstcAdtSwSyncStart);
+en_result_t Adt_SwSyncStop(stc_adt_sw_sync_t* pstcAdtSwSyncStop);
+en_result_t Adt_SwSyncClear(stc_adt_sw_sync_t* pstcAdtSwSyncClear);
+en_result_t Adt_GetSwSyncState(stc_adt_sw_sync_t* pstcAdtSwSyncState);
+
+en_result_t Adt_AosTrigConfig(stc_adt_aos_trig_cfg_t* pstcAdtAosTrigCfg);
+
+en_result_t Adt_IrqTrigConfig(en_adt_unit_t enAdtUnit,
+ stc_adt_irq_trig_cfg_t* pstcAdtIrqTrigCfg);
+
+en_result_t Adt_PortTrigConfig(en_adt_trig_port_t enAdtTrigPort,
+ stc_adt_port_trig_cfg_t* pstcAdtPortTrigCfg);
+
+en_result_t Adt_CHxXPortConfig(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ stc_adt_CHxX_port_cfg_t* pstcAdtCHxXCfg);
+
+en_result_t Adt_EnableBreakPort(uint8_t port, stc_adt_break_port_cfg_t* pstcAdtBrkPtCfg);
+void Adt_ClearBrakePort(void);
+en_result_t Adt_Disable3Cfg(stc_adt_disable_3_cfg_t* pstcAdtDisable3);
+boolean_t Adt_GetPortBrakeFlag(void);
+void Adt_ClearPortBrakeFlag(void);
+en_result_t Adt_Disable1Cfg(stc_adt_disable_1_cfg_t* pstcAdtDisable1);
+boolean_t Adt_GetSameBrakeFlag(void);
+void Adt_ClearSameBrakeFlag(void);
+
+en_result_t Adt_PwmDitherConfig(en_adt_unit_t enAdtUnit, stc_adt_pwm_dither_cfg_t* pstcAdtPwmDitherCfg);
+
+en_result_t Adt_Init(en_adt_unit_t enAdtUnit, stc_adt_basecnt_cfg_t* pstcAdtBaseCntCfg);
+en_result_t Adt_DeInit(en_adt_unit_t enAdtUnit);
+
+en_result_t Adt_StartCount(en_adt_unit_t enAdtUnit);
+en_result_t Adt_StopCount(en_adt_unit_t enAdtUnit);
+en_result_t Adt_SetCount(en_adt_unit_t enAdtUnit, uint16_t u16Value);
+uint16_t Adt_GetCount(en_adt_unit_t enAdtUnit);
+en_result_t Adt_ClearCount(en_adt_unit_t enAdtUnit);
+en_result_t Adt_GetCntState(en_adt_unit_t enAdtUnit, stc_adt_cntstate_cfg_t* pstcAdtCntState);
+en_result_t Adt_SetPeriod(en_adt_unit_t enAdtUnit, uint16_t u16Period);
+en_result_t Adt_SetPeriodBuf(en_adt_unit_t enAdtUnit, uint16_t u16PeriodBuf);
+en_result_t Adt_ClearPeriodBuf(en_adt_unit_t enAdtUnit);
+en_result_t Adt_SetValidPeriod(en_adt_unit_t enAdtUnit,
+ stc_adt_validper_cfg_t* pstcAdtValidPerCfg);
+en_result_t Adt_SetCompareValue(en_adt_unit_t enAdtUnit,
+ en_adt_compare_t enAdtCompare,
+ uint16_t u16Compare);
+en_result_t Adt_EnableValueBuf(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ boolean_t bCompareBufEn);
+en_result_t Adt_ClearValueBuf(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort);
+en_result_t Adt_GetCaptureValue(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ uint16_t* pu16Capture);
+en_result_t Adt_GetCaptureBuf(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ uint16_t* pu16CaptureBuf);
+
+en_result_t Adt_SetDTUA(en_adt_unit_t enAdtUnit,
+ uint16_t u16Value);
+en_result_t Adt_SetDTDA(en_adt_unit_t enAdtUnit,
+ uint16_t u16Value);
+en_result_t Adt_ConfigDT(en_adt_unit_t enAdtUnit,
+ boolean_t bDTEn,
+ boolean_t bEqual);
+
+en_result_t Adt_ConfigIrq(en_adt_unit_t enAdtUnit,
+ en_adt_irq_type_t enAdtIrq,
+ boolean_t bEn,
+ func_ptr_t pfnIrqCalbak);
+en_result_t Adt_GetIrqFlag(en_adt_unit_t enAdtUnit,
+ en_adt_irq_type_t enAdtIrq,
+ boolean_t* pbFlag);
+en_result_t Adt_ClearIrqFlag(en_adt_unit_t enAdtUnit,
+ en_adt_irq_type_t enAdtIrq);
+en_result_t Adt_ConfigZMask(en_adt_unit_t enAdtUnit,
+ stc_adt_zmask_cfg_t* pstcAdtZMaskCfg);
+
+//@} // ADT Group
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ADT_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/aes.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/aes.h
new file mode 100644
index 0000000000..495c2ecf3d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/aes.h
@@ -0,0 +1,108 @@
+/******************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file crc.h
+ **
+ ** CRC 数据结构及API声明.
+ **
+ ** - 2016-05-04 LuX V1.0.
+ **
+ ******************************************************************************/
+
+#ifndef __CRC_H__
+#define __CRC_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup CrcGroup Cyclic Redundancy Check (CRC)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+//AES 加密
+en_result_t AES_Encrypt(uint32_t* pu32Data, uint32_t *pu32Key, uint32_t *pu32Cipher);
+//AES 解密
+en_result_t AES_Decrypt(uint32_t *pu32Cipher, uint32_t *pu32Key, uint32_t* pu32Plaintext);
+
+
+//@} // CRC Group
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CRC_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bgr.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bgr.h
new file mode 100644
index 0000000000..f9493abfff
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bgr.h
@@ -0,0 +1,109 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file bgr.h
+ **
+ ** BGR 数据结构及API声明.
+ **
+ ** - 2018-04-21 LuX V1.0.
+ **
+ ******************************************************************************/
+
+#ifndef __CRC_H__
+#define __CRC_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup BGR
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///<内部温度传感器使能/关闭
+en_result_t Bgr_TempSensorEnable(void);
+en_result_t Bgr_TempSensorDisable(void);
+///<BGR使能/关闭
+en_result_t Bgr_BgrEnable(void);
+en_result_t Bgr_BgrDisable(void);
+
+//@} // BGR Group
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BGR_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bt.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bt.h
new file mode 100644
index 0000000000..e543c2420e
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/bt.h
@@ -0,0 +1,770 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file bt.h
+ **
+ ** 基本定时器数据结构及API声明
+ ** @link BT Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-18 Husj First Version
+ **
+ *****************************************************************************/
+
+#ifndef __BT_H__
+#define __BT_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup BtGroup Base Timer (BT)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief 定时器选择数据类型重定义
+ *****************************************************************************/
+typedef enum en_bt_unit
+{
+ TIM0 = 0u, ///< Timer 0
+ TIM1 = 1u, ///< Timer 1
+ TIM2 = 2u, ///< Timer 2
+}en_bt_unit_t;
+
+/**
+ ******************************************************************************
+ ** \brief 工作模式选择数据类型重定义 (MODE)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_bt_work_mode
+{
+ BtWorkMode0 = 0u, ///< 定时器模式
+ BtWorkMode1 = 1u, ///< PWC模式
+ BtWorkMode2 = 2u, ///< 锯齿波模式
+ BtWorkMode3 = 3u, ///< 三角波模式
+}en_bt_work_mode_t;
+
+/**
+ ******************************************************************************
+ ** \brief 极性控制数据类型重定义 (GATE_P)(模式0)
+ *****************************************************************************/
+typedef enum en_bt_m0_gatep
+{
+ BtGatePositive = 0u, ///< 高电平有效
+ BtGateOpposite = 1u, ///< 低电平有效
+}en_bt_m0_gatep_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM 预除频选择 (PRS)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_bt_cr_timclkdiv
+{
+ BtPCLKDiv1 = 0u, ///< Div 1
+ BtPCLKDiv2 = 1u, ///< Div 2
+ BtPCLKDiv4 = 2u, ///< Div 4
+ BtPCLKDiv8 = 3u, ///< Div 8
+ BtPCLKDiv16 = 4u, ///< Div 16
+ BtPCLKDiv32 = 5u, ///< Div 32
+ BtPCLKDiv64 = 6u, ///< Div 64
+ BtPCLKDiv256 = 7u, ///< Div 256
+}en_bt_cr_timclkdiv_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数/定时器功能选择数据类型重定义 (CT)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_bt_cr_ct
+{
+ BtTimer = 0u, ///< 定时器功能,计数时钟为内部PCLK
+ BtCounter = 1u, ///< 计数器功能,计数时钟为外部ETR
+}en_bt_cr_ct_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 定时器工作模式数据类型重定义 (MD)(模式0)
+ *****************************************************************************/
+typedef enum en_bt_m0cr_md
+{
+ Bt32bitFreeMode = 0u, ///< 32位计数器/定时器
+ Bt16bitArrMode = 1u, ///< 自动重载16位计数器/定时器
+}en_bt_m0cr_md_t;
+
+/**
+ ******************************************************************************
+** \brief BT0/BT1/BT2中断类型数据类型重定义(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_bt_irq_type
+{
+ BtUevIrq = 0u, ///< 溢出/事件更新中断
+ BtCA0Irq = 2u, ///< 捕获/比较中断A(仅模式1/23存在)
+ BtCB0Irq = 5u, ///< 捕获/比较中断B(仅模式23存在)
+ BtCA0E = 8u, ///< CH0A捕获数据丢失标志(仅模式23存在),不是中断
+ BtCB0E = 11u, ///< CH0B捕获数据丢失标志(仅模式23存在),不是中断
+ BtBkIrq = 14u, ///< 刹车中断(仅模式23存在)
+ BtTrigIrq = 15u, ///< 触发中断(仅模式23存在)
+}en_bt_irq_type_t;
+
+/**
+ ******************************************************************************
+ ** \brief 测量开始结束数据类型重定义 (Edg1stEdg2nd)(模式1)
+ *****************************************************************************/
+typedef enum en_bt_m1cr_Edge
+{
+ BtPwcRiseToRise = 0u, ///< 上升沿到上升沿(周期)
+ BtPwcFallToRise = 1u, ///< 下降沿到上升沿(低电平)
+ BtPwcRiseToFall = 2u, ///< 上升沿到下降沿(高电平)
+ BtPwcFallToFall = 3u, ///< 下降沿到下降沿(周期)
+}en_bt_m1cr_Edge_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC测量测试模式选择数据类型重定义 (Oneshot)(模式1)
+ *****************************************************************************/
+typedef enum en_bt_m1cr_oneshot
+{
+ BtPwcCycleDetect = 0u, ///< PWC循环测量
+ BtPwcOneShotDetect = 1u, ///< PWC单次测量
+}en_bt_m1cr_oneshot_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC IA0选择数据类型重定义 (IA0S)(模式1)
+ *****************************************************************************/
+typedef enum en_bt_m1_mscr_ia0s
+{
+ BtIA0Input = 0u, ///< IAO输入
+ BtXORInput = 1u, ///< IA0 ETR GATE XOR(TIM0/1/2)/IA0 IA1 IA2 XOR(TIM3)
+}en_bt_m1_mscr_ia0s_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC IB0选择数据类型重定义 (IA0S)(模式1)
+ *****************************************************************************/
+typedef enum en_bt_m1_mscr_ib0s
+{
+ BtIB0Input = 0u, ///< IBO输入
+ BtTsInput = 1u, ///< 内部触发TS选择信号
+}en_bt_m1_mscr_ib0s_t;
+
+/**
+ ******************************************************************************
+ ** \brief 输出极性、输入相位 数据类型重定义 (CCPA0/CCPB0/ETP/BKP)(模式1/23)
+ *****************************************************************************/
+typedef enum en_bt_port_polarity
+{
+ BtPortPositive = 0u, ///< 正常输入输出
+ BtPortOpposite = 1u, ///< 反向输入输出
+}en_bt_port_polarity_t;
+
+/**
+ ******************************************************************************
+ ** \brief 滤波选择数据类型重定义 (FLTET/FLTA0/FLAB0)(模式1/23)
+ *****************************************************************************/
+typedef enum en_bt_flt
+{
+ BtFltNone = 0u, ///< 无滤波
+ BtFltPCLKCnt3 = 4u, ///< PCLK 3个连续有效
+ BtFltPCLKDiv4Cnt3 = 5u, ///< PCLK/4 3个连续有效
+ BtFltPCLKDiv16Cnt3 = 6u, ///< PCLK/16 3个连续有效
+ BtFltPCLKDiv64Cnt3 = 7u, ///< PCLK/64 3个连续有效
+}en_bt_flt_t;
+
+/**
+ ******************************************************************************
+ ** \brief 通道比较控制 数据类型重定义 (OCMA/OCMB)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_fltr_ocm
+{
+ BtForceLow = 0u, ///< 强制为0
+ BtForceHigh = 1u, ///< 强制为1
+ BtCMPForceLow = 2u, ///< 比较匹配时强制为0
+ BtCMPForceHigh = 3u, ///< 比较匹配时强制为1
+ BtCMPInverse = 4u, ///< 比较匹配时翻转电平
+ BtCMPOnePrdHigh = 5u, ///< 比较匹配时输出一个计数周期的高电平
+ BtPWMMode1 = 6u, ///< 通道控制为PWM mode 1
+ BtPWMMode2 = 7u, ///< 通道控制为PWM mode 2
+}en_bt_m23_fltr_ocm_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式TS数据类型重定义 (TS)(模式1/23)
+ *****************************************************************************/
+typedef enum en_bt_mscr_ts
+{
+ BtTs0ETR = 0u, ///< ETR外部输入滤波后的相位选择信号
+ BtTs1TIM0TRGO = 1u, ///< Timer0的TRGO输出信号
+ BtTs2TIM1TRGO = 2u, ///< Timer1的TRGO输出信号
+ BtTs3TIM2TRGO = 3u, ///< Timer2的TRGO输出信号
+ BtTs4TIM3TRGO = 4u, ///< Timer3的TRGO输出信号
+ //BtTs5IA0ED = 5u, ///< 无效
+ BtTs6IAFP = 6u, ///< CH0A 外部输输入滤波后的相位选择信号
+ BtTs7IBFP = 7u, ///< CH0B 外部输输入滤波后的相位选择信
+}en_bt_mscr_ts_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWM输出模式选择数据类型重定义 (COMP)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23cr_comp
+{
+ BtIndependentPWM = 0u, ///< 独立PWM输出
+ BtComplementaryPWM = 1u, ///< 互补PWM输出
+}en_bt_m23cr_comp_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数方向选择数据类型重定义 (DIR)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23cr_dir
+{
+ BtCntUp = 0u, ///< 向上计数
+ BtCntDown = 1u, ///< 向下计数
+}en_bt_m23cr_dir_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数方向选择数据类型重定义 (PWM2S)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23cr_pwm2s
+{
+ BtDoublePointCmp = 0u, ///< 双点比较使能,使用CCRA,CCRB比较控制OCREFA输出
+ BtSinglePointCmp = 1u, ///< 单点比较使能,使用CCRA比较控制OCREFA输出
+}en_bt_m23cr_pwm2s_t;
+
+/**
+ ******************************************************************************
+ ** \brief GATE在PWM互补模式下捕获或比较功能 选择数据类型重定义 (CSG)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23cr_csg
+{
+ BtPWMCompGateCmpOut = 0u, ///< 在PWM互补模式下,Gate作为比较输出
+ BtPWMCompGateCapIn = 1u, ///< 在PWM互补模式下,Gate作为捕获输入
+}en_bt_m23cr_csg_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 比较捕获寄存器 数据类型重定义 (CCR0A,CCR0B)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_ccrx
+{
+ BtCCR0A = 0u, ///< CCR0A比较捕获寄存器
+ BtCCR0B = 1u, ///< CCR0B比较捕获寄存器
+}en_bt_m23_ccrx_t;
+
+/**
+ ******************************************************************************
+ ** \brief OCREF清除源 选择数据类型重定义 (OCCS)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23ce_occs
+{
+ BtOC_Ref_Clr = 0u, ///< 来自VC的OC_Ref_Clr
+ BtETRf = 1u, ///< 外部ETRf
+}en_bt_m23ce_occs_t;
+
+/**
+ ******************************************************************************
+ ** \brief 比较匹配中断模式 选择数据类型重定义 (CIS/CISB)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_cisa_cisb
+{
+ BtCmpIntNone = 0u, ///< 无比较匹配中断
+ BtCmpIntRise = 1u, ///< 比较匹配上升沿中断
+ BtCmpIntFall = 2u, ///< 比较匹配下降沿中断
+ BtCmpIntRiseFall = 3u, ///< 比较匹配上升沿下降沿中断
+}en_bt_m23_cisa_cisb_t;
+
+/**
+ ******************************************************************************
+ ** \brief BT端口控制 - 刹车时CHx输出状态控制(BKSA/BKSB)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_bt_m23_crch0_bks
+{
+ BtCHxBksHiZ = 0u, ///< 刹车使能时,CHx端口输出高阻态
+ BtCHxBksNorm = 1u, ///< 刹车使能时,CHx端口正常输出
+ BtCHxBksLow = 2u, ///< 刹车使能时,CHx端口输出低电平
+ BtCHxBksHigh = 3u, ///< 刹车使能时,CHx端口输出高电平
+}en_bt_m23_crch0_bks_t;
+
+/**
+ ******************************************************************************
+** \brief BT端口控制 - CHx上升沿下降沿捕获(CRx/CFx)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_bt_m23_crch0_cfx_crx
+{
+ BtCHxCapNone = 0u, ///< CHx通道捕获禁止
+ BtCHxCapRise = 1u, ///< CHx通道上升沿捕获使能
+ BtCHxCapFall = 2u, ///< CHx通道下降沿捕获使能
+ BtCHxCapFallRise = 3u, ///< CHx通道上升沿下降沿捕获都使能
+}en_bt_m23_crch0_cfx_crx_t;
+
+/**
+ ******************************************************************************
+** \brief BT端口控制 - CHx比较捕获模式(CSA/CSB)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_bt_m23_crch0_csa_csb
+{
+ BtCHxCmpMode = 0u, ///< CHx通道设置为比较模式
+ BtCHxCapMode = 1u, ///< CHx通道设置为捕获模式
+}en_bt_m23_crch0_csa_csb_t;
+
+/**
+ ******************************************************************************
+ ** \brief 比较模式下 DMA比较触发选择 数据类型重定义 (CCDS)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_mscr_ccds
+{
+ BtCmpTrigDMA = 0u, ///< 比较匹配触发DMA
+ BtUEVTrigDMA = 1u, ///< 事件更新代替比较匹配触发DMA
+}en_bt_m23_mscr_ccds_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式选择 数据类型重定义 (MSM)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_mscr_msm
+{
+ BtSlaveMode = 0u, ///< 从模式
+ BtMasterMode = 1u, ///< 主模式
+}en_bt_m23_mscr_msm_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发主模式输出源 数据类型重定义 (MMS)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_mscr_mms
+{
+ BtMasterUG = 0u, ///< UG(软件更新)源
+ BtMasterCTEN = 1u, ///< CTEN源
+ BtMasterUEV = 2u, ///< UEV更新源
+ BtMasterCMPSO = 3u, ///< 比较匹配选择输出源
+ BtMasterOCA0Ref = 4u, ///< OCA0_Ref源
+ BtMasterOCB0Ref = 5u, ///< OCB0_Ref源
+ //BtMasterOCB0Ref = 6u,
+ //BtMasterOCB0Ref = 7u,
+}en_bt_m23_mscr_mms_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发从模式选择 数据类型重定义 (SMS)(模式23)
+ *****************************************************************************/
+typedef enum en_bt_m23_mscr_sms
+{
+ BtSlaveIClk = 0u, ///< 使用内部时钟
+ BtSlaveResetTIM = 1u, ///< 复位功能
+ BtSlaveTrigMode = 2u, ///< 触发模式
+ BtSlaveEClk = 3u, ///< 外部时钟模式
+ BtSlaveCodeCnt1 = 4u, ///< 正交编码计数模式1
+ BtSlaveCodeCnt2 = 5u, ///< 正交编码计数模式2
+ BtSlaveCodeCnt3 = 6u, ///< 正交编码计数模式3
+ BtSlaveGateCtrl = 7u, ///< 门控功能
+}en_bt_m23_mscr_sms_t;
+
+/**
+ ******************************************************************************
+ ** \brief 定时器运行控制数据类型重定义 (CTEN)
+ *****************************************************************************/
+typedef enum en_bt_start
+{
+ BtCTENDisable = 0u, ///< 停止
+ BtCTENEnable = 1u, ///< 运行
+}en_bt_start_t;
+
+/**
+ ******************************************************************************
+ ** \brief BaseTimer mode0 配置结构体定义(模式0)
+ *****************************************************************************/
+typedef struct stc_bt_mode0_config
+{
+ en_bt_work_mode_t enWorkMode; ///< 工作模式设置
+ en_bt_m0_gatep_t enGateP; ///< 门控极性控制
+ boolean_t bEnGate; ///< 门控使能
+ en_bt_cr_timclkdiv_t enPRS; ///< 预除频配置
+ boolean_t bEnTog; ///< 翻转输出使能
+ en_bt_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_bt_m0cr_md_t enCntMode; ///< 计数模式配置
+
+ func_ptr_t pfnTim0Cb; ///< Timer0中断服务回调函数[void function(void)]
+ func_ptr_t pfnTim1Cb; ///< Timer1中断服务回调函数[void function(void)]
+ func_ptr_t pfnTim2Cb; ///< Timer2中断服务回调函数[void function(void)]
+}stc_bt_mode0_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief BaseTimer mode1 配置结构体定义(模式1)
+ *****************************************************************************/
+typedef struct stc_bt_mode1_config
+{
+ en_bt_work_mode_t enWorkMode; ///< 工作模式设置
+ en_bt_cr_timclkdiv_t enPRS; ///< 预除频配置
+ en_bt_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_bt_m1cr_oneshot_t enOneShot; ///< 单次测量/循环测量选择
+
+
+ func_ptr_t pfnTim0Cb; ///< Timer0中断服务回调函数[void function(void)]
+ func_ptr_t pfnTim1Cb; ///< Timer1中断服务回调函数[void function(void)]
+ func_ptr_t pfnTim2Cb; ///< Timer2中断服务回调函数[void function(void)]
+}stc_bt_mode1_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC输入配置结构体定义(模式1)
+ *****************************************************************************/
+typedef struct stc_bt_pwc_input_config
+{
+ en_bt_mscr_ts_t enTsSel; ///< 触发输入源选择
+ en_bt_m1_mscr_ia0s_t enIA0Sel; ///< CHA0输入选择
+ en_bt_m1_mscr_ib0s_t enIB0Sel; ///< CHB0输入选择
+ en_bt_port_polarity_t enETRPhase; ///< ETR相位选择
+ en_bt_flt_t enFltETR; ///< ETR滤波设置
+ en_bt_flt_t enFltIA0; ///< CHA0滤波设置
+ en_bt_flt_t enFltIB0; ///< CHB0滤波设置
+}stc_bt_pwc_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief BaseTimer mode23 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_mode23_config
+{
+ en_bt_work_mode_t enWorkMode; ///< 工作模式设置
+ en_bt_m23cr_dir_t enCntDir; ///< 计数方向
+ en_bt_cr_timclkdiv_t enPRS; ///< 时钟预除频配置
+ en_bt_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_bt_m23cr_comp_t enPWMTypeSel; ///< PWM模式选择(独立/互补)
+ en_bt_m23cr_pwm2s_t enPWM2sSel; ///< OCREFA双点比较功能选择
+ boolean_t bOneShot; ///< 单次触发模式使能/禁止
+ boolean_t bURSSel; ///< 更新源选择
+
+ func_ptr_t pfnTim0Cb; ///< Timer0中断服务回调函数[void function(void)]
+ func_ptr_t pfnTim1Cb; ///< Timer1中断服务回调函数[void function(void)]
+ func_ptr_t pfnTim2Cb; ///< Timer2中断服务回调函数[void function(void)]
+}stc_bt_mode23_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief GATE在PWM互补模式下捕获或比较功能 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_gate_config
+{
+ en_bt_m23cr_csg_t enGateFuncSel; ///< Gate比较、捕获功能选择
+ boolean_t bGateRiseCap; ///< GATE作为捕获功能时,上沿捕获有效控制
+ boolean_t bGateFallCap; ///< GATE作为捕获功能时,下沿捕获有效控制
+}stc_bt_m23_gate_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief CHA/CHB通道比较控制 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_compare_config
+{
+ en_bt_m23_crch0_csa_csb_t enCh0ACmpCap; ///< CH0A比较/捕获功能选择
+ en_bt_m23_fltr_ocm_t enCH0ACmpCtrl; ///< CH0A通道比较控制
+ en_bt_port_polarity_t enCH0APolarity; ///< CH0A输出极性控制
+ boolean_t bCh0ACmpBufEn; ///< 比较A缓存功能 使能/禁止
+ en_bt_m23_cisa_cisb_t enCh0ACmpIntSel; ///< CHA比较匹配中断选择
+
+ en_bt_m23_crch0_csa_csb_t enCh0BCmpCap; ///< CH0B比较/捕获功能选择
+ en_bt_m23_fltr_ocm_t enCH0BCmpCtrl; ///< CH0B通道比较控制
+ en_bt_port_polarity_t enCH0BPolarity; ///< CH0B输出极性控制
+ boolean_t bCH0BCmpBufEn; ///< 比较B缓存功能 使能/禁止
+ en_bt_m23_cisa_cisb_t enCH0BCmpIntSel; ///< CHB0比较匹配中断选择
+}stc_bt_m23_compare_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief CHA/CHB通道捕获控制 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_input_config
+{
+ en_bt_m23_crch0_csa_csb_t enCh0ACmpCap; ///< CH0A比较/捕获功能选择
+ en_bt_m23_crch0_cfx_crx_t enCH0ACapSel; ///< CH0A捕获边沿选择
+ en_bt_flt_t enCH0AInFlt; ///< CH0A通道捕获滤波控制
+ en_bt_port_polarity_t enCH0APolarity; ///< CH0A输入相位
+
+ en_bt_m23_crch0_csa_csb_t enCh0BCmpCap; ///< CH0B比较/捕获功能选择
+ en_bt_m23_crch0_cfx_crx_t enCH0BCapSel; ///< HC0B捕获边沿选择
+ en_bt_flt_t enCH0BInFlt; ///< CH0B通道捕获滤波控制
+ en_bt_port_polarity_t enCH0BPolarity; ///< CH0B输入相位
+
+}stc_bt_m23_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief ETR输入相位滤波配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_etr_input_config
+{
+ en_bt_port_polarity_t enETRPolarity; ///< ETR输入极性设置
+ en_bt_flt_t enETRFlt; ///< ETR滤波设置
+}stc_bt_m23_etr_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 刹车BK输入相位滤波配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_bk_input_config
+{
+ boolean_t bEnBrake; ///< 刹车使能
+ boolean_t bEnVC0Brake; ///< 使能VC0刹车
+ boolean_t bEnVC1Brake; ///< 使能VC1刹车
+ boolean_t bEnSafetyBk; ///< 使能safety刹车
+ boolean_t bEnBKSync; ///< TIM0/TIM1/TIM2刹车同步使能
+ en_bt_m23_crch0_bks_t enBkCH0AStat; ///< 刹车时CHA端口状态设置
+ en_bt_m23_crch0_bks_t enBkCH0BStat; ///< 刹车时CHB端口状态设置
+ en_bt_port_polarity_t enBrakePolarity; ///< 刹车BK输入极性设置
+ en_bt_flt_t enBrakeFlt; ///< 刹车BK滤波设置
+}stc_bt_m23_bk_input_config_t;
+
+/**
+ ******************************************************************************
+** \brief 死区功能配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_dt_config
+{
+ boolean_t bEnDeadTime; ///< 刹车时CHA端口状态设置
+ uint8_t u8DeadTimeValue; ///< 刹车时CHA端口状态设置
+}stc_bt_m23_dt_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发ADC配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_adc_trig_config
+{
+ boolean_t bEnTrigADC; ///< 触发ADC全局控制
+ boolean_t bEnUevTrigADC; ///< 事件更新触发ADC
+ boolean_t bEnCH0ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH0BCmpTrigADC; ///< CH0B比较匹配触发ADC
+}stc_bt_m23_adc_trig_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief DMA触发 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_trig_dma_config
+{
+ boolean_t bUevTrigDMA; ///< 更新 触发DMA使能
+ boolean_t bTITrigDMA; ///< Trig 触发DMA功能
+ boolean_t bCmpATrigDMA; ///< A捕获比较触发DMA使能
+ boolean_t bCmpBTrigDMA; ///< B捕获比较触发DMA使能
+ en_bt_m23_mscr_ccds_t enCmpUevTrigDMA; ///< 比较模式下DMA比较触发选择
+}stc_bt_m23_trig_dma_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_master_slave_config
+{
+ en_bt_m23_mscr_msm_t enMasterSlaveSel; ///< 主从模式选择
+ en_bt_m23_mscr_mms_t enMasterSrc; ///< 主模式触发源选择
+ en_bt_m23_mscr_sms_t enSlaveModeSel; ///< 从模式选择
+ en_bt_mscr_ts_t enTsSel; ///< 触发输入源选择
+}stc_bt_m23_master_slave_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief OCREF清除功能 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_bt_m23_OCREF_Clr_config
+{
+ en_bt_m23ce_occs_t enOCRefClrSrcSel; ///< OCREF清除源选择
+ boolean_t bVCClrEn; ///< 是否使能来自VC的OCREF_Clr
+}stc_bt_m23_OCREF_Clr_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+//中断相关函数
+
+//中断标志获取
+boolean_t Bt_GetIntFlag(en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq);
+//中断标志清除
+en_result_t Bt_ClearIntFlag(en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq);
+//所有中断标志清除
+en_result_t Bt_ClearAllIntFlag(en_bt_unit_t enUnit);
+//模式0中断使能
+en_result_t Bt_Mode0_EnableIrq(en_bt_unit_t enUnit);
+//模式1中断使能
+en_result_t Bt_Mode1_EnableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq);
+//模式2中断使能
+en_result_t Bt_Mode23_EnableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq);
+//模式0中断禁止
+en_result_t Bt_Mode0_DisableIrq(en_bt_unit_t enUnit);
+//模式1中断禁止
+en_result_t Bt_Mode1_DisableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq);
+//模式2中断禁止
+en_result_t Bt_Mode23_DisableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq);
+
+
+//模式0初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Bt_Mode0_Init(en_bt_unit_t enUnit, stc_bt_mode0_config_t* pstcConfig);
+//timer 启动/停止
+en_result_t Bt_M0_Run(en_bt_unit_t enUnit);
+en_result_t Bt_M0_Stop(en_bt_unit_t enUnit);
+//重载值设置
+en_result_t Bt_M0_ARRSet(en_bt_unit_t enUnit, uint16_t u16Data);
+//16位计数值设置/获取
+en_result_t Bt_M0_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data);
+uint16_t Bt_M0_Cnt16Get(en_bt_unit_t enUnit);
+//32位计数值设置/获取
+en_result_t Bt_M0_Cnt32Set(en_bt_unit_t enUnit, uint32_t u32Data);
+uint32_t Bt_M0_Cnt32Get(en_bt_unit_t enUnit);
+//翻转输出使能/禁止设定
+en_result_t Bt_M0_EnTOG_Output(en_bt_unit_t enUnit, boolean_t bEnOutput);
+
+
+//模式1初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Bt_Mode1_Init(en_bt_unit_t enUnit, stc_bt_mode1_config_t* pstcConfig);
+//PWC 输入配置
+en_result_t Bt_M1_Input_Config(en_bt_unit_t enUnit, stc_bt_pwc_input_config_t* pstcConfig);
+//PWC测量边沿起始结束选择
+en_result_t Bt_M1_PWC_Edge_Sel(en_bt_unit_t enUnit,en_bt_m1cr_Edge_t enEdgeSel);
+//timer 启动/停止
+en_result_t Bt_M1_Run(en_bt_unit_t enUnit);
+en_result_t Bt_M1_Stop(en_bt_unit_t enUnit);
+//16位计数值设置/获取
+en_result_t Bt_M1_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data);
+uint16_t Bt_M1_Cnt16Get(en_bt_unit_t enUnit);
+//脉冲宽度测量结果数值获取
+uint16_t Bt_M1_PWC_CapValueGet(en_bt_unit_t enUnit);
+
+
+//模式23初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Bt_Mode23_Init(en_bt_unit_t enUnit, stc_bt_mode23_config_t* pstcConfig);
+//timer 启动/停止
+en_result_t Bt_M23_Run(en_bt_unit_t enUnit);
+en_result_t Bt_M23_Stop(en_bt_unit_t enUnit);
+//PWM输出使能
+en_result_t Bt_M23_EnPWM_Output(en_bt_unit_t enUnit, boolean_t bEnOutput, boolean_t bEnAutoOutput);
+//重载值设置
+en_result_t Bt_M23_ARRSet(en_bt_unit_t enUnit, uint16_t u16Data, boolean_t bArrBufEn);
+//16位计数值设置/获取
+en_result_t Bt_M23_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data);
+uint16_t Bt_M23_Cnt16Get(en_bt_unit_t enUnit);
+//比较捕获寄存器CCR0A/CCR0B设置/读取
+en_result_t Bt_M23_CCR_Set(en_bt_unit_t enUnit, en_bt_m23_ccrx_t enCCRSel, uint16_t u16Data);
+uint16_t Bt_M23_CCR_Get(en_bt_unit_t enUnit, en_bt_m23_ccrx_t enCCRSel);
+//PWM互补输出模式下,GATE功能选择
+en_result_t Bt_M23_GateFuncSel(en_bt_unit_t enUnit,stc_bt_m23_gate_config_t* pstcConfig);
+//主从模式配置
+en_result_t Bt_M23_MasterSlave_Set(en_bt_unit_t enUnit, stc_bt_m23_master_slave_config_t* pstcConfig);
+//CH0A/CH0B比较通道控制
+en_result_t Bt_M23_PortOutput_Config(en_bt_unit_t enUnit, stc_bt_m23_compare_config_t* pstcConfig);
+//CH0A/CH0B输入控制
+en_result_t Bt_M23_PortInput_Config(en_bt_unit_t enUnit, stc_bt_m23_input_config_t* pstcConfig);
+//ERT输入控制
+en_result_t Bt_M23_ETRInput_Config(en_bt_unit_t enUnit, stc_bt_m23_etr_input_config_t* pstcConfig);
+//刹车BK输入控制
+en_result_t Bt_M23_BrakeInput_Config(en_bt_unit_t enUnit, stc_bt_m23_bk_input_config_t* pstcConfig);
+//触发ADC控制
+en_result_t Bt_M23_TrigADC_Config(en_bt_unit_t enUnit, stc_bt_m23_adc_trig_config_t* pstcConfig);
+//死区功能
+en_result_t Bt_M23_DT_Config(en_bt_unit_t enUnit, stc_bt_m23_dt_config_t* pstcConfig);
+//重复周期设置
+en_result_t Bt_M23_SetValidPeriod(en_bt_unit_t enUnit, uint8_t u8ValidPeriod);
+//OCREF清除功能
+en_result_t Bt_M23_OCRefClr(en_bt_unit_t enUnit, stc_bt_m23_OCREF_Clr_config_t* pstcConfig);
+//使能DMA传输
+en_result_t Bt_M23_EnDMA(en_bt_unit_t enUnit, stc_bt_m23_trig_dma_config_t* pstcConfig);
+//捕获比较A软件触发
+en_result_t Bt_M23_EnSwTrigCapCmpA(en_bt_unit_t enUnit);
+//捕获比较B软件触发
+en_result_t Bt_M23_EnSwTrigCapCmpB(en_bt_unit_t enUnit);
+//软件更新使能
+en_result_t Bt_M23_EnSwUev(en_bt_unit_t enUnit);
+//软件触发使能
+en_result_t Bt_M23_EnSwTrig(en_bt_unit_t enUnit);
+//软件刹车使能
+en_result_t Bt_M23_EnSwBk(en_bt_unit_t enUnit);
+
+
+//@} // BtGroup
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __BT_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/crc.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/crc.h
new file mode 100644
index 0000000000..e85102e64b
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/crc.h
@@ -0,0 +1,120 @@
+/******************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file crc.h
+ **
+ ** CRC 数据结构及API声明.
+ **
+ ** - 2016-05-04 LuX V1.0.
+ **
+ ******************************************************************************/
+
+#ifndef __CRC_H__
+#define __CRC_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "sysctrl.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup CrcGroup Cyclic Redundancy Check (CRC)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+//CRC16 编码值获取
+uint16_t CRC16_Get8(uint8_t* pu8Data, uint32_t u32Len);
+uint16_t CRC16_Get16(uint16_t* pu16Data, uint32_t u32Len);
+uint16_t CRC16_Get32(uint32_t* pu32Data, uint32_t u32Len);
+//CRC16 校验
+en_result_t CRC16_Check8(uint8_t* pu8Data, uint32_t u32Len, uint16_t u16CRC);
+en_result_t CRC16_Check16(uint16_t* pu16Data, uint32_t u32Len, uint16_t u16CRC);
+en_result_t CRC16_Check32(uint32_t* pu32Data, uint32_t u32Len, uint16_t u16CRC);
+
+
+//CRC32 编码值获取
+uint32_t CRC32_Get8(uint8_t* pu8Data, uint32_t u32Len);
+uint32_t CRC32_Get16(uint16_t* pu16Data, uint32_t u32Len);
+uint32_t CRC32_Get32(uint32_t* pu32Data, uint32_t u32Len);
+//CRC32 校验
+en_result_t CRC32_Check8(uint8_t* pu8Data, uint32_t u32Len, uint32_t u32CRC);
+en_result_t CRC32_Check16(uint16_t* pu16Data, uint32_t u32Len, uint32_t u32CRC);
+en_result_t CRC32_Check32(uint32_t* pu32Data, uint32_t u32Len, uint32_t u32CRC);
+//@} // CRC Group
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CRC_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/ddl.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/ddl.h
new file mode 100644
index 0000000000..6b60df1c71
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/ddl.h
@@ -0,0 +1,207 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file ddl.h
+ **
+ ** DDL common define.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-04-15 1.0 Lux First version.
+ **
+ ******************************************************************************/
+
+#ifndef __DDL_H__
+#define __DDL_H__
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "base_types.h"
+#include "hc32l136.h"
+#include "system_hc32l136.h"
+#include "sysctrl.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/* Macro for initializing local structures to zero */
+/******************************************************************************/
+#define DDL_ZERO_STRUCT(x) ddl_memclr((uint8_t*)&(x), (uint32_t)(sizeof(x)))
+
+#define DEC2BCD(x) ((((x)/10)<<4) + ((x)%10))
+#define BCD2DEC(x) ((((x)>>4)*10) + ((x)&0x0F))
+
+#define setBit(addr,offset,flag) { if( (flag) > 0u){\
+ *((volatile uint32_t *)(addr)) |= ((1UL)<<(offset));\
+ }else{\
+ *((volatile uint32_t *)(addr)) &= (~(1UL<<(offset)));\
+ }\
+ }
+
+#define getBit(addr,offset) ((((*((volatile uint32_t *)(addr))) >> (offset)) & 1u)>0?1u:0)
+
+/**
+ ******************************************************************************
+ ** Global Device Series List
+ ******************************************************************************/
+#define DDL_DEVICE_SERIES_HC32L136 (0u)
+
+/**
+ ******************************************************************************
+ ** Global Device Package List
+ ******************************************************************************/
+// package definitions of HC device.
+#define DDL_DEVICE_PACKAGE_HC_C (0x00u)
+#define DDL_DEVICE_PACKAGE_HC_F (0x10u)
+#define DDL_DEVICE_PACKAGE_HC_J (0x20u)
+#define DDL_DEVICE_PACKAGE_HC_K (0x30u)
+
+/******************************************************************************/
+/* User Device Setting Include file */
+/******************************************************************************/
+#include "ddl_device.h" // MUST be included here!
+
+/**
+ ******************************************************************************
+ ** \brief IRQ name definition for all type MCUs
+ ******************************************************************************/
+
+ #define PORTA_IRQHandler(void) IRQ000_Handler(void)
+ #define PORTB_IRQHandler(void) IRQ001_Handler(void)
+ #define PORTC_IRQHandler(void) IRQ002_Handler(void)
+ #define PORTD_IRQHandler(void) IRQ003_Handler(void)
+ #define DMAC_IRQHandler(void) IRQ004_Handler(void)
+ #define TIM3_IRQHandler(void) IRQ005_Handler(void)
+ #define UART0_IRQHandler(void) IRQ006_Handler(void)
+ #define UART1_IRQHandler(void) IRQ007_Handler(void)
+ #define LPUART0_IRQHandler(void) IRQ008_Handler(void)
+ #define LPUART1_IRQHandler(void) IRQ009_Handler(void)
+ #define SPI0_IRQHandler(void) IRQ010_Handler(void)
+ #define SPI1_IRQHandler(void) IRQ011_Handler(void)
+ #define I2C0_IRQHandler(void) IRQ012_Handler(void)
+ #define I2C1_IRQHandler(void) IRQ013_Handler(void)
+ #define TIM0_IRQHandler(void) IRQ014_Handler(void)
+ #define TIM1_IRQHandler(void) IRQ015_Handler(void)
+ #define TIM2_IRQHandler(void) IRQ016_Handler(void)
+ #define LPTIM_IRQHandler(void) IRQ017_Handler(void)
+ #define TIM4_IRQHandler(void) IRQ018_Handler(void)
+ #define TIM5_IRQHandler(void) IRQ019_Handler(void)
+ #define TIM6_IRQHandler(void) IRQ020_Handler(void)
+ #define PCA_IRQHandler(void) IRQ021_Handler(void)
+ #define WDT_IRQHandler(void) IRQ022_Handler(void)
+ #define RTC_IRQHandler(void) IRQ023_Handler(void)
+ #define ADC_IRQHandler(void) IRQ024_Handler(void)
+ #define PCNT_IRQHandler(void) IRQ025_Handler(void)
+ #define VC0_IRQHandler(void) IRQ026_Handler(void)
+ #define VC1_IRQHandler(void) IRQ027_Handler(void)
+ #define LVD_IRQHandler(void) IRQ028_Handler(void)
+ #define LCD_IRQHandler(void) IRQ029_Handler(void)
+ #define EF_RAM_IRQHandler(void) IRQ030_Handler(void)
+ #define CLKTRIM_IRQHandler(void) IRQ031_Handler(void)
+
+/******************************************************************************/
+/* Global type definitions ('typedef') */
+/******************************************************************************/
+/**
+ ******************************************************************************
+ ** \brief Level
+ **
+ ** Specifies levels.
+ **
+ ******************************************************************************/
+typedef enum en_level
+{
+ DdlLow = 0u, ///< Low level '0'
+ DdlHigh = 1u ///< High level '1'
+} en_level_t;
+
+/**
+ ******************************************************************************
+ ** \brief Generic Flag Code
+ **
+ ** Specifies flags.
+ **
+ ******************************************************************************/
+typedef enum en_flag
+{
+ DdlClr = 0u, ///< Flag clr '0'
+ DdlSet = 1u ///< Flag set '1'
+} en_stat_flag_t, en_irq_flag_t;
+/******************************************************************************/
+/* Global variable declarations ('extern', definition in C source) */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Global function prototypes ('extern', definition in C source) */
+/******************************************************************************/
+
+/*******************************************************************************
+ * Global function prototypes
+ ******************************************************************************/
+extern void ddl_memclr(void* pu8Address, uint32_t u32Count);
+uint32_t Log2(uint32_t u32Val);
+/**
+ *******************************************************************************
+ ** This hook is part of wait loops.
+ ******************************************************************************/
+extern void DDL_WAIT_LOOP_HOOK(void);
+
+void Debug_UartInit(void);
+
+void delay1ms(uint32_t u32Cnt);
+void delay100us(uint32_t u32Cnt);
+void delay10us(uint32_t u32Cnt);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DDL_H__ */
+
+/******************************************************************************/
+/* EOF (not truncated) */
+/******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/debug.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/debug.h
new file mode 100644
index 0000000000..c29060d2b8
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/debug.h
@@ -0,0 +1,129 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file debug.h
+ **
+ ** Headerfile for DEBUG functions
+ ** @link Debug Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-15 Lux First Version
+ **
+ ******************************************************************************/
+
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup DebugGroup (DEBUG)
+ **
+ ******************************************************************************/
+//@{
+
+/**
+ *******************************************************************************
+ ** function prototypes.
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+/**
+ *******************************************************************************
+ ** \brief 调试模式下各模块工作状态类型定义
+ ** \note
+ ******************************************************************************/
+typedef enum en_debug_module_active
+{
+ DebugTim0 = 0x001u, ///< TIM0
+ DebugTim1 = 0x002u, ///< TIM1
+ DebugTim2 = 0x004u, ///< TIM2
+ DebugLpTim = 0x008u, ///< LPTIM
+ DebugTim4 = 0x010u, ///< TIM4
+ DebugTim5 = 0x020u, ///< TIM5
+ DebugTim6 = 0x040u, ///< TIM6
+ DebugPca = 0x080u, ///< PCA
+ DebugWdt = 0x100u, ///< WDT
+ DebugRtc = 0x200u, ///< RTC
+ DebugTick = 0x400u, ///< TICK
+ DebugTim3 = 0x800u, ///< TIM3
+}en_debug_module_active_t;
+
+/*******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< 在SWD调试界面下,使能模块功能
+en_result_t Debug_ActiveEnable(en_debug_module_active_t enModule);
+///< 在SWD调试界面下,暂停模块功能
+en_result_t Debug_ActiveDisable(en_debug_module_active_t enModule);
+
+//@} // Debug Group
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __DEBUG_H__ */
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/dmac.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/dmac.h
new file mode 100644
index 0000000000..7e68f2547f
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/dmac.h
@@ -0,0 +1,327 @@
+/*****************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file dma.h
+**
+** A detailed description is available at
+** @link DmacGroup Dmac description @endlink
+**
+** - 2018-03-09 1.0 Hongjh First version for Device Driver Library of Dmac.
+**
+******************************************************************************/
+#ifndef __DMAC_H__
+#define __DMAC_H__
+
+/*******************************************************************************
+* Include files
+******************************************************************************/
+#include "ddl.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /**
+ *******************************************************************************
+ ** \defgroup DmacGroup Direct Memory Access Control(DMAC)
+ **
+ ******************************************************************************/
+ //@{
+
+ /*******************************************************************************
+ * Global type definitions ('typedef')
+ ******************************************************************************/
+ /**
+ *******************************************************************************
+ ** \brief DMA Channel
+ **
+ ******************************************************************************/
+ typedef enum en_dma_channel
+ {
+ DmaCh0 = 0U, ///< DMA channel 0
+ DmaCh1 = 1U, ///< DMA channel 1
+ DmaChMax = 2U ///< DMA channel max
+ } en_dma_channel_t;
+ /**
+ *******************************************************************************
+ ** \brief DMA priority
+ **
+ ******************************************************************************/
+ typedef enum en_dma_priority
+ {
+ DmaPriorityFix = 0U, ///< DMA channel priority fix (CH0>CH1)
+ DmaPriorityLoop = 1U, ///< DMA channel priority loop
+ } en_dma_priority_t;
+
+ /**
+ *******************************************************************************
+ ** \brief DMA transfer data width
+ **
+ ******************************************************************************/
+ typedef enum en_dma_transfer_width
+ {
+ Dma8Bit = 0U, ///< 8 bit transfer via DMA
+ Dma16Bit = 1U, ///< 16 bit transfer via DMA
+ Dma32Bit = 2U ///< 32 bit transfer via DMA
+ } en_dma_transfer_width_t;
+
+ /**
+ *******************************************************************************
+ ** \brief DMA transfer mode
+ **
+ ******************************************************************************/
+ typedef enum en_dma_transfer_mode
+ {
+ DmaBlock = 0U, ///< block transfer via DMA
+ DmaBurst = 1U, ///< burst transfer via DMA
+ } en_dma_transfer_mode_t;
+
+ /**
+ *******************************************************************************
+ ** \brief DMA flag
+ **
+ ******************************************************************************/
+ typedef enum en_dma_stat
+ {
+ DEFAULT = 0U, ///< Reserve
+ DmaAddOverflow = 1U, ///< DMA address overflow
+ DmaHALT = 2U, ///< DMA HALT
+ DmaAccSCRErr = 3U, ///< DMA access source address error
+ DmaAccDestErr = 4U, ///< DMA access dest address error
+ DmaTransferComplete = 5U, ///< DMA transfer complete
+ DmaTransferPause = 7U, ///< DMA transfer pause
+ } en_dma_stat_t;
+
+ /**
+ *******************************************************************************
+ ** \brief DMA address mode
+ **
+ ******************************************************************************/
+ typedef enum en_address_mode
+ {
+ AddressIncrease = 0U, ///< Address increased
+ AddressFix = 1U, ///< Address fixed
+ } en_address_mode_t;
+
+ /**
+ *******************************************************************************
+ ** \brief DMA repeat tranfer
+ **
+ ******************************************************************************/
+ typedef enum en_dma_msk
+ {
+ OneTranfer = 0U, ///< One Tranfer
+ ContinuousTranfer = 1U, ///< Continuous Tranfer
+ } en_dma_msk_t;
+ /**
+ *******************************************************************************
+ ** \brief DMA trigger selection
+ **
+ ******************************************************************************/
+ typedef enum stc_dma_trig_sel
+ {
+ SWTrig = 0U, ///< Select DMA software trig
+ SPI0RXTrig = 32U, ///< Select DMA hardware trig 0
+ SPI0TXTrig = 33U, ///< Select DMA hardware trig 1
+ SPI1RXTrig = 34U, ///< Select DMA hardware trig 2
+ SPI1TXTrig = 35U, ///< Select DMA hardware trig 3
+ ADCJQRTrig = 36U, ///< Select DMA hardware trig 4
+ ADCSQRTrig = 37U, ///< Select DMA hardware trig 5
+ LCDTxTrig = 38U, ///< Select DMA hardware trig 6
+ Uart0RxTrig = 40U, ///< Select DMA hardware trig 8
+ Uart0TxTrig = 41U, ///< Select DMA hardware trig 9
+ Uart1RxTrig = 42U, ///< Select DMA hardware trig 10
+ Uart1TxTrig = 43U, ///< Select DMA hardware trig 11
+ LpUart0RxTrig = 44U, ///< Select DMA hardware trig 12
+ LpUart0TxTrig = 45U, ///< Select DMA hardware trig 13
+ LpUart1RxTrig = 46U, ///< Select DMA hardware trig 14
+ LpUart1TxTrig = 47U, ///< Select DMA hardware trig 15
+ TIM0ATrig = 50U, ///< Select DMA hardware trig 18
+ TIM0BTrig = 51U, ///< Select DMA hardware trig 19
+ TIM1ATrig = 52U, ///< Select DMA hardware trig 20
+ TIM1BTrig = 53U, ///< Select DMA hardware trig 21
+ TIM2ATrig = 54U, ///< Select DMA hardware trig 22
+ TIM2BTrig = 55U, ///< Select DMA hardware trig 23
+ TIM3ATrig = 56U, ///< Select DMA hardware trig 24
+ TIM3BTrig = 57U, ///< Select DMA hardware trig 25
+ TIM4ATrig = 58U, ///< Select DMA hardware trig 26
+ TIM4BTrig = 59U, ///< Select DMA hardware trig 27
+ TIM5ATrig = 60U, ///< Select DMA hardware trig 28
+ TIM5BTrig = 61U, ///< Select DMA hardware trig 29
+ TIM6ATrig = 62U, ///< Select DMA hardware trig 30
+ TIM6BTrig = 63U, ///< Select DMA hardware trig 31
+ }en_dma_trig_sel_t;
+ /**
+ *******************************************************************************
+ ** \brief DMA interrupt selection
+ **
+ ******************************************************************************/
+typedef struct stc_dma_irq
+ {
+ boolean_t TrnErrIrq; ///< Select DMA transfer error interrupt
+ boolean_t TrnCpltIrq; ///< Select DMA transfer completion interrupt
+ }stc_dma_irq_sel_t;
+
+
+
+ /**
+ *******************************************************************************
+ ** \brief DMA configuration
+ **
+ ******************************************************************************/
+ typedef struct stc_dma_config
+ {
+ en_dma_transfer_mode_t enMode;
+
+ uint16_t u16BlockSize; ///< Transfer Block counter
+ uint16_t u16TransferCnt; ///< Transfer counter
+ en_dma_transfer_width_t enTransferWidth; ///< DMA transfer width (see #en_dma_transfer_width_t for details)
+
+ en_address_mode_t enSrcAddrMode; ///< Source address mode(see #en_source_address_mode_t for details)
+ en_address_mode_t enDstAddrMode; ///< Destination address mode(see #en_dest_address_mode_t for details)
+
+ boolean_t bSrcAddrReloadCtl; ///< Source address reload(TRUE: reload;FALSE: reload forbidden)
+ boolean_t bDestAddrReloadCtl; ///< Dest address reload(TRUE: reload;FALSE: reload forbidden)
+ boolean_t bSrcBcTcReloadCtl; ///< Bc/Tc address reload(TRUE: reload;FALSE: reload forbidden)
+ uint32_t u32SrcAddress; ///< Source address>
+ uint32_t u32DstAddress; ///< Dest address>
+ boolean_t bMsk; ///0: clear the bit (CONFA:ENS) after tarnfer;1: remain the bit (CONFA:ENS) after tarnfer
+
+ en_dma_trig_sel_t enRequestNum; ///< DMA trigger request number
+ } stc_dma_config_t;
+ /**
+ ******************************************************************************
+ ** \brief DMA中断回调函数
+ *****************************************************************************/
+typedef struct stc_dma_irq_calbakfn_pt
+{
+ /*! Dma传输完成中断回调函数指针*/
+ func_ptr_t pfnDma0TranferCompleteIrq;
+ /*! Dma传输完成中断回调函数指针*/
+ func_ptr_t pfnDma1TranferCompleteIrq;
+ /*! Dma传输错误中断回调函数指针*/
+ func_ptr_t pfnDma0TranferErrIrq;
+ /*! Dma传输错误中断回调函数指针*/
+ func_ptr_t pfnDma1TranferErrIrq;
+}stc_dma_irq_calbakfn_pt_t;
+ /*******************************************************************************
+ * Global pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+ /*******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+ /*******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+ en_result_t Dma_InitChannel(en_dma_channel_t enCh, stc_dma_config_t* pstcConfig);
+
+ void Dma_SwTrigger(en_dma_channel_t enCh);
+
+ void Dma_Enable(void);
+ void Dma_Disable(void);
+
+ void Dma_Start(en_dma_channel_t enCh);
+ void Dma_Stop(en_dma_channel_t enCh);
+
+ en_result_t Dma_EnableChannel(en_dma_channel_t enCh);
+ en_result_t Dma_DisableChannel(en_dma_channel_t enCh);
+
+ en_result_t Dma_SetTriggerSel(en_dma_channel_t enCh, en_dma_trig_sel_t enTrgSel);
+
+ en_result_t Dma_SetSourceAddress(en_dma_channel_t enCh, uint32_t u32Address);
+ en_result_t Dma_SetDestinationAddress(en_dma_channel_t enCh, uint32_t u32Address);
+
+ en_result_t Dma_SetBlockSize(en_dma_channel_t enCh, uint16_t u16BlkSize);
+ en_result_t Dma_SetTransferCnt(en_dma_channel_t enCh, uint16_t u16TrnCnt);
+
+
+ en_result_t Dma_SetSourceIncMode(en_dma_channel_t enCh, en_address_mode_t enMode);
+ en_result_t Dma_SetDestinationIncMode(en_dma_channel_t enCh, en_address_mode_t enMode);
+
+ en_result_t Dma_EnableSourceRload(en_dma_channel_t enCh);
+ en_result_t Dma_DisableSourceRload(en_dma_channel_t enCh);
+
+ en_result_t Dma_EnableDestinationRload(en_dma_channel_t enCh);
+ en_result_t Dma_DisableDestinationRload(en_dma_channel_t enCh);
+
+ en_result_t Dma_EnableContinusTranfer(en_dma_channel_t enCh);
+ en_result_t Dma_DisableContinusTranfer(en_dma_channel_t enCh);
+
+ en_result_t Dma_EnableBcTcReload(en_dma_channel_t enCh);
+ en_result_t Dma_DisableBcTcReload(en_dma_channel_t enCh);
+
+ void Dma_HaltTranfer(void);
+ void Dma_RecoverTranfer(void);
+ en_result_t Dma_PauseChannelTranfer(en_dma_channel_t enCh);
+ en_result_t Dma_RecoverChannelTranfer(en_dma_channel_t enCh);
+
+ en_result_t Dma_SetTransferWidth(en_dma_channel_t enCh, en_dma_transfer_width_t enWidth);
+
+ en_result_t Dma_SetChPriority(en_dma_priority_t enPrio);
+
+ en_result_t Dma_EnableChannelIrq(en_dma_channel_t enCh);
+ en_result_t Dma_DisableChannelIrq(en_dma_channel_t enCh);
+
+ en_result_t Dma_EnableChannelErrIrq(en_dma_channel_t enCh);
+ en_result_t Dma_DisableChannelErrIrq(en_dma_channel_t enCh);
+
+ en_result_t Dma_ConfigIrq(en_dma_channel_t enCh,stc_dma_irq_sel_t* stcDmaIrqCfg,stc_dma_irq_calbakfn_pt_t* pstcDmaIrqCalbaks);
+
+
+ en_dma_stat_t Dma_GetStat(en_dma_channel_t enCh);
+
+ void Dma_ClrStat(en_dma_channel_t enCh);
+ //@} // DmacGroup
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DMAC_H__ */
+
+/*******************************************************************************
+* EOF (not truncated)
+******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/flash.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/flash.h
new file mode 100644
index 0000000000..106e803791
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/flash.h
@@ -0,0 +1,196 @@
+/*************************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file flash.h
+ **
+ ** FLASH 数据结构及API声明.
+ **
+ ** - 2017-05-02 LuX V1.0
+ **
+ ******************************************************************************/
+
+#ifndef __FLASH_H__
+#define __FLASH_H__
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "ddl.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup FlashGroup Flash Controller (Flash)
+ **
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+/**
+ ******************************************************************************
+ ** \brief Flash中断类型重定义
+ *****************************************************************************/
+typedef enum en_flash_int_type
+{
+ FlashPCInt = 1u, ///<擦写PC地址报警中断
+ FlashSlockInt = 0u, ///<擦写保护报警中断
+} en_flash_int_type_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief Flash读等待周期类型重定义
+ *****************************************************************************/
+typedef enum en_flash_waitcycle
+{
+ FlashWaitCycle0 = 0u, ///< 读等待周期设置为0(当HCLK小于等于24MHz时)
+ FlashWaitCycle1 = 1u, ///< 读等待周期设置为1(当HCLK大于24MHz时必须至少为1)
+ FlashWaitCycle2 = 2u, ///< 读等待周期设置为2(当HCK大于48MHz时必须至少为2)
+} en_flash_waitcycle_t;
+
+/**
+ ******************************************************************************
+ ** \brief Flash擦写保护范围重定义
+ *****************************************************************************/
+typedef enum en_flash_sector_lock
+{
+ FlashSector0_3 = 0x00000001u, ///<Sector0_3
+ FlashSector4_7 = 0x00000002u, ///<Sector4_7
+ FlashSector8_11 = 0x00000004u, ///<Sector8_11
+ FlashSector12_15 = 0x00000008u, ///<Sector12_15
+ FlashSector16_19 = 0x00000010u, ///<Sector16_19
+ FlashSector20_23 = 0x00000020u, ///<Sector20_23
+ FlashSector24_27 = 0x00000040u, ///<Sector24_27
+ FlashSector28_31 = 0x00000080u, ///<Sector28_31
+ FlashSector32_35 = 0x00000100u, ///<Sector32_35
+ FlashSector36_39 = 0x00000200u, ///<Sector36_39
+ FlashSector40_43 = 0x00000400u, ///<Sector40_43
+ FlashSector44_47 = 0x00000800u, ///<Sector44_47
+ FlashSector48_51 = 0x00001000u, ///<Sector48_51
+ FlashSector52_55 = 0x00002000u, ///<Sector52_55
+ FlashSector56_59 = 0x00004000u, ///<Sector56_59
+ FlashSector60_63 = 0x00008000u, ///<Sector60_63
+ FlashSector64_67 = 0x00010000u, ///<Sector64_67
+ FlashSector68_71 = 0x00020000u, ///<Sector68_71
+ FlashSector72_75 = 0x00040000u, ///<Sector72_75
+ FlashSector76_79 = 0x00080000u, ///<Sector76_79
+ FlashSector80_83 = 0x00100000u, ///<Sector80_83
+ FlashSector84_87 = 0x00200000u, ///<Sector84_87
+ FlashSector88_91 = 0x00400000u, ///<Sector88_91
+ FlashSector92_95 = 0x00800000u, ///<Sector92_95
+ FlashSector96_99 = 0x01000000u, ///<Sector96_99
+ FlashSector100_103 = 0x02000000u, ///<Sector100_103
+ FlashSector104_107 = 0x04000000u, ///<Sector104_107
+ FlashSector108_111 = 0x08000000u, ///<Sector108_111
+ FlashSector112_115 = 0x10000000u, ///<Sector112_115
+ FlashSector116_119 = 0x20000000u, ///<Sector116_119
+ FlashSector120_123 = 0x40000000u, ///<Sector120_123
+ FlashSector124_127 = (int)0x80000000u, ///<Sector124_127
+ FlashSectorAll = (int)0xFFFFFFFFu, ///<SectorAll
+} en_flash_sector_lock_t;
+
+/**
+ ******************************************************************************
+ ** \brief Redefinition of FLASH register structure
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///<Flash 初始化配置(中断函数、编程时间参数及休眠模式配置)
+en_result_t Flash_Init(func_ptr_t pfnFlashCb, uint8_t u8FreqCfg, boolean_t bDpstbEn);
+
+///<Flash 页/全片擦除
+en_result_t Flash_SectorErase(uint32_t u32SectorAddr);
+en_result_t Flash_ChipErase(void);
+
+///<Flash 字节/半字/字写
+en_result_t Flash_WriteByte(uint32_t u32Addr, uint8_t u8Data);
+en_result_t Flash_WriteHalfWord(uint32_t u32Addr, uint16_t u16Data);
+en_result_t Flash_WriteWord(uint32_t u32Addr, uint32_t u32Data);
+
+///<Flash 编程保护加锁/解锁
+en_result_t Flash_Lock(en_flash_sector_lock_t enFlashSector);
+en_result_t Flash_Unlock(en_flash_sector_lock_t enFlashSector);
+
+///<Flash 读等待周期设定
+en_result_t Flash_WaitCycle(en_flash_waitcycle_t enWaitCycle);
+
+///<中断相关函数
+///<中断使能/禁止
+en_result_t Flash_EnableIrq(en_flash_int_type_t enFlashIntType);
+en_result_t Flash_DisableIrq(en_flash_int_type_t enFlashIntType);
+///<中断标志获取
+boolean_t Flash_GetIntFlag(en_flash_int_type_t enFlashIntType);
+///<中断标志清除
+en_result_t Flash_ClearIntFlag(en_flash_int_type_t enFlashIntType);
+
+//@} // FlashGroup
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FLASH_H__ */
+/******************************************************************************/
+/* EOF (not truncated) */
+/******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/gpio.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/gpio.h
new file mode 100644
index 0000000000..9a9f97d637
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/gpio.h
@@ -0,0 +1,506 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file gpio.h
+ **
+ ** GPIO driver
+ ** @link GPIO Group Some description @endlink
+ **
+ ** - 2018-04-18
+ **
+ ******************************************************************************/
+
+#ifndef __GPIO_H__
+#define __GPIO_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ *******************************************************************************
+ ** \defgroup GpioGroup General Purpose I/O (GPIO)
+ **
+ **
+ ******************************************************************************/
+//@{
+#define GPIO_GPSZ (0x40u)
+
+/*******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+/**
+ *******************************************************************************
+ ** \brief GPIO PORT类型定义
+ ******************************************************************************/
+typedef enum en_gpio_port
+{
+ GpioPortA = 0x00u, ///< GPIO PORT A
+ GpioPortB = 0x40u, ///< GPIO PORT B
+ GpioPortC = 0x80u, ///< GPIO PORT C
+ GpioPortD = 0xc0u, ///< GPIO PORT D
+}en_gpio_port_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PIN类型定义
+ ******************************************************************************/
+typedef enum en_gpio_pin
+{
+ GpioPin0 = 0u, ///< GPIO PIN0
+ GpioPin1 = 1u, ///< GPIO PIN1
+ GpioPin2 = 2u, ///< GPIO PIN2
+ GpioPin3 = 3u, ///< GPIO PIN3
+ GpioPin4 = 4u, ///< GPIO PIN4
+ GpioPin5 = 5u, ///< GPIO PIN5
+ GpioPin6 = 6u, ///< GPIO PIN6
+ GpioPin7 = 7u, ///< GPIO PIN7
+ GpioPin8 = 8u, ///< GPIO PIN8
+ GpioPin9 = 9u, ///< GPIO PIN9
+ GpioPin10 = 10u, ///< GPIO PIN10
+ GpioPin11 = 11u, ///< GPIO PIN11
+ GpioPin12 = 12u, ///< GPIO PIN12
+ GpioPin13 = 13u, ///< GPIO PIN13
+ GpioPin14 = 14u, ///< GPIO PIN14
+ GpioPin15 = 15u, ///< GPIO PIN15
+}en_gpio_pin_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口复用功能(AF-Alternate function)类型定义
+ ******************************************************************************/
+typedef enum en_gpio_af
+{
+ GpioAf0 = 0u, ///< GPIO功能
+ GpioAf1 = 1u, ///< GPIO AF1:
+ ///< PA:UART1/SPI0/UART0/IR
+ ///< PB:PCA/LPTIM/SPI0/I2C0/I2C1/SPI1
+ ///< PC:LPTIM/SPI1/LPUART0/PCA/LPUART1
+ ///< PD:I2C0/PCA/I2C1
+ GpioAf2 = 2u, ///< GPIO AF2:
+ ///< PA:LPUART1/TIM0/UART1/PCA/TIM3
+ ///< PB:TIM3/PCLK_OUT/PCA/TIM0/UART0/TIM1/IR/SPI1/I2C1
+ ///< PC:PCNT/TIM5/LPTIM/TIM2/TIM6/TIM4/LPUART0/LPUART1/RTC
+ ///< PD:TIM4/LPUART0/LPUART1
+ GpioAf3 = 3u, ///< GPIO AF3:
+ ///< PA:TIM0/VC1/TIM1/PCA/TIM3/HCLK_OUT/TIM0/TIM2/I2C1/LVD/LPUART1
+ ///< PB:LPUART0/TIM3/LPUART1/TIM1/TIM2/SPI1/TIM0
+ ///< PC:UART1/PCNT/LPTIM/IR/PCA/TIM2/TIM1/TIM3
+ ///< PD:UART1/TIM1/UART0
+ GpioAf4 = 4u, ///< GPIO AF4:
+ ///< PA:VC0/TIM1/TIM2/TIM0/TIM3/I2C0/LVD
+ ///< PB:TIM5/TIM6/TIM4/TIM3/UART0/PCA/TIM0/LPUART1/TIM2/LPUART0
+ ///< PC:RESERVED
+ ///< PD:RESERVED
+ GpioAf5 = 5u, ///< GPIO AF5:
+ ///< PA:TIM1/TIM2/SPI1/TIM5/VC0/VC1/RTC/RCH_OUT/TIM0
+ ///< PB:RCH_OUT/LPUART0/TIM1/LPTIM/TIM2/TIM0/TIM3/TIM6/RTC
+ ///< PC:RESERVED
+ ///< PD:RESERVED
+ GpioAf6 = 6u, ///< GPIO AF6:
+ ///< PA:TIM3/HCLK_OUT/PCLK_OUT/LVD/XTL_OUT/VC1/TIM4/SPI0/PCNT/RCL_OUT
+ ///< PB:TIM0/XTL_OUT/TIM3/PCNT/LPTIM/TIM2/LPUART1/LPUART0/TIM1/RTC
+ ///< PC:RESERVED
+ ///< PD:RESERVED
+ GpioAf7 = 7u, ///< GPIO AF7:
+ ///< PA:TIM0/SPI1/TIM5/TIM3/XTH_OUT/LPUART0/TIM4/TIM6/PCNT/PLL_OUT
+ ///< PB:PLL_OUT/TIM2/XTH_OUT/LPTIM/UART0/PCNT/UART1/TIM6/TIM1/LPUART1
+ ///< PC:RESERVED
+ ///< PD:RESERVED
+}en_gpio_af_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO输入输出配置数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_dir
+{
+ GpioDirOut = 0u, ///< GPIO 输出
+ GpioDirIn = 1u, ///< GPIO 输入
+}en_gpio_dir_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO端口上拉、下拉配置数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_pupd
+{
+ GpioNoPuPd = 0u, ///< GPIO无上拉下拉
+ GpioPu = 1u, ///< GPIO上拉
+ GpioPd = 2u, ///< GPIO下拉
+}en_gpio_pupd_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO端口输出驱动能力配置数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_drv
+{
+ GpioDrvH = 0u, ///< GPIO高驱动能力
+ GpioDrvL = 1u, ///< GPIO低驱动能力
+}en_gpio_drv_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO端口开漏输出控制数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_od
+{
+ GpioOdDisable = 0u, ///< GPIO开漏输出关闭
+ GpioOdEnable = 1u, ///< GPIO开漏输出使能
+}en_gpio_od_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO端口输入/输出值寄存器总线控制模式选择
+ ******************************************************************************/
+typedef enum en_gpio_ctrl_mode
+{
+ GpioFastIO = 0u, ///< FAST IO 总线控制模式
+ GpioAHB = 1u, ///< AHB 总线控制模式
+}en_gpio_ctrl_mode_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO中断触发方式类型定义
+ ******************************************************************************/
+typedef enum en_gpio_irqtype
+{
+ GpioIrqHigh = 1u, ///< GPIO高电平触发
+ GpioIrqLow = 2u, ///< GPIO低电平触发
+ GpioIrqRising = 4u, ///< GPIO上升沿触发
+ GpioIrqFalling = 8u, ///< GPIO下降沿触发
+}en_gpio_irqtype_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)端口中断模式类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_irqmode
+{
+ GpioSfIrqDpslpMode = 1u, ///< Deep Sleep模式
+ GpioSfIrqActSlpMode = 0u, ///< Active/Sleep模式
+}en_gpio_sf_irqmode_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)HCLK输出门控类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_hclkout_g
+{
+ GpioSfHclkOutDisable = 0u, ///< HCLK输出门控关闭
+ GpioSfHclkOutEnable = 1u, ///< HCLK输出门控使能
+}en_gpio_sf_hclkout_g_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)HCLK输出分频选择类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_hclkout_div
+{
+ GpioSfHclkOutDiv1 = 0u, ///< HCLK
+ GpioSfHclkOutDiv2 = 1u, ///< HCLK/2
+ GpioSfHclkOutDiv4 = 2u, ///< HCLK/4
+ GpioSfHclkOutDiv8 = 3u, ///< HCLK/8
+}en_gpio_sf_hclkout_div_t;
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)PCLK输出门控类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_pclkout_g
+{
+ GpioSfPclkOutDisable = 0u, ///< PCLK输出门控关闭
+ GpioSfPclkOutEnable = 1u, ///< PCLK输出门控使能
+}en_gpio_sf_pclkout_g_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)PCLK输出分频选择类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_pclkout_div
+{
+ GpioSfPclkOutDiv1 = 0u, ///< PCLK
+ GpioSfPclkOutDiv2 = 1u, ///< PCLK/2
+ GpioSfPclkOutDiv4 = 2u, ///< PCLK/4
+ GpioSfPclkOutDiv8 = 3u, ///< PCLK/8
+}en_gpio_sf_pclkout_div_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)IR输出极性选择类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_irpol
+{
+ GpioSfIrP = 0u, ///< IR正向输出
+ GpioSfIrN = 1u, ///< IR反向输出
+}en_gpio_sf_irpol_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)SSN通道类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_ssnspi
+{
+ GpioSpi0 = 0u, ///< SPI0 SSN
+ GpioSpi1 = 1u, ///< SPI1 SSN
+}en_gpio_sf_ssnspi_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)SSN与外部时钟输入信号源选择类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_ssn_extclk
+{
+ GpioSfSsnExtClkH = 0u, ///< 高电平
+ GpioSfSsnExtClkPA03 = 1u, ///< PA03
+ GpioSfSsnExtClkPA04 = 2u, ///< PA04
+ GpioSfSsnExtClkPA06 = 3u, ///< PA06
+ GpioSfSsnExtClkPA08 = 4u, ///< PA08
+ GpioSfSsnExtClkPA09 = 5u, ///< PA09
+ GpioSfSsnExtClkPA12 = 6u, ///< PA12
+ GpioSfSsnExtClkPA15 = 7u, ///< PA15
+ GpioSfSsnExtClkPB01 = 8u, ///< PB01
+ GpioSfSsnExtClkPB02 = 9u, ///< PB02
+ GpioSfSsnExtClkPB05 = 10u, ///< PB05
+ GpioSfSsnExtClkPB06 = 11u, ///< PB06
+ GpioSfSsnExtClkPB09 = 12u, ///< PB09
+ GpioSfSsnExtClkPB10 = 13u, ///< PB10
+ GpioSfSsnExtClkPB12 = 14u, ///< PB12
+ GpioSfSsnExtClkPB14 = 15u, ///< PB14
+}en_gpio_sf_ssn_extclk_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)定时器互联功能选择类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf
+{
+ GpioSf0 = 0u, ///< SF0:PX_SEL的配置功能
+ GpioSf1 = 1u, ///< SF1:
+ ///< TIM_G:UART0_RXD/LPUART0_RXD
+ ///< TIM_E:UART0_RXD/LPUART0_RXD/PCNT_S0
+ ///< TIM_C:UART0_RXD/LPUART0_RXD/UART1_RXD/LPUART1_RXD
+ ///< PCA:PCNT_S1/PCNT_S0
+ GpioSf2 = 2u, ///< SF2:
+ ///< TIM_G:UART1_RXD/LPUART1_RXD
+ ///< TIM_E:UART1_RXD/LPUART1_RXD/LVD_OUT
+ ///< TIM_C:PA00/VC0_OUT/LPUART0_RXD/UART1_RXD
+ ///< PCA:LVD_OUT/PCNT_S1
+ GpioSf3 = 3u, ///< SF3:
+ ///< TIM_G:VC0_OUT/LPUART0
+ ///< TIM_E:VC0_OUT/VC1OUT
+ ///< TIM_C:PA02/PCNT_S0/PCNT_S1
+ ///< PCA:VC0_OUT/LVD_OUT
+ GpioSf4 = 4u, ///< SF4:
+ ///< TIM_G:VC1_OUT/LPUART1
+ ///< TIM_E:LVD_OUT/PCNT_S1/PCNT_S0/VC1_OUT
+ ///< TIM_C:PA05/PA06/PA07/VC0_OUT/VC1_OUT
+ ///< PCA:VC1_OUT
+ GpioSf5 = 5u, ///< SF5:
+ ///< TIM_G:PA03/PA08/PA10/VC0_OUT/PB03
+ ///< TIM_E:PA00/PA01/PA04
+ ///< TIM_C:PA15/PB08/PA08/PA07
+ ///< PCA:PA05/PA06
+ GpioSf6 = 6u, ///< SF6:
+ ///< TIM_G:PB08/PB03/PB04/PA06/PB05
+ ///< TIM_E:PA05/PC09/PC04/PA12/PB06
+ ///< TIM_C:PB06/PB10/PB09/PB03/PB04
+ ///< PCA:PB02/PB04
+ GpioSf7 = 7u, ///< SF7:
+ ///< TIM_G:PB15/PB13/PB11/PC00
+ ///< TIM_E:PA15/PD02/PC08/PA13/PC03
+ ///< TIM_C:PB14/PB13/PC06/PB06
+ ///< PCA:PD02/PC06
+}en_gpio_sf_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)定时器门控类型选择数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_tim_g
+{
+ GpioSfTim0G = 0u, ///<Tim0定时器GATE输入选择
+ GpioSfTim1G = 3u, ///<Tim1定时器GATE输入选择
+ GpioSfTim2G = 6u, ///<Tim2定时器GATE输入选择
+ GpioSfTim3G = 9u, ///<Tim3定时器GATE输入选择
+ GpioSfLpTimG = 12u, ///<LPTim定时器GATE输入选择
+}en_gpio_sf_tim_g_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)定时器ETR类型选择数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_tim_e
+{
+ GpioSfTim0E = 0u, ///<Tim0定时器ETR输入选择
+ GpioSfTim1E = 3u, ///<Tim1定时器ETR输入选择
+ GpioSfTim2E = 6u, ///<Tim2定时器ETR输入选择
+ GpioSfTim3E = 9u, ///<Tim3定时器ETR输入选择
+ GpioSfLpTimE = 12u, ///<LPTim定时器ETR输入选择
+}en_gpio_sf_tim_e_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)定时器捕获输入类型选择数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_tim_c
+{
+ GpioSfTim0CA = 0u, ///<Tim0定时器CHA输入选择
+ GpioSfTim1CA = 3u, ///<Tim1定时器CHA输入选择
+ GpioSfTim2CA = 6u, ///<Tim2定时器CHA输入选择
+ GpioSfTim3CA = 9u, ///<Tim3定时器CH0A输入选择
+ GpioSfTim3CB = 12u, ///<Tim3定时器CH0B输入选择
+}en_gpio_sf_tim_c_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 辅助功能(SF-Secondary Function)PCA捕获选择数据类型定义
+ ******************************************************************************/
+typedef enum en_gpio_sf_pca
+{
+ GpioSfPcaCH0 = 0u, ///<PCA_CH0捕获口输入选择
+ GpioSfPcaECI = 3u, ///<PCA ECI时钟输入选择
+}en_gpio_sf_pca_t;
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口配置结构体定义
+ ******************************************************************************/
+typedef struct
+{
+ en_gpio_dir_t enDir; ///< 端口方向配置
+ en_gpio_drv_t enDrv; ///< 端口驱动能力配置
+ en_gpio_pupd_t enPuPd; ///< 端口上下拉配置
+ en_gpio_od_t enOD; ///< 端口开漏输出配置
+ en_gpio_ctrl_mode_t enCtrlMode; ///< 端口输入/输出值寄存器总线控制模式配置
+}stc_gpio_config_t;
+
+/*******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ Global function prototypes (definition in C source)
+*******************************************************************************/
+ ///< GPIO IO初始化/去初始化
+en_result_t Gpio_Init(en_gpio_port_t enPort, en_gpio_pin_t enPin, stc_gpio_config_t *pstcGpioCfg);
+
+///< GPIO 获取端口输入电平
+boolean_t Gpio_GetInputIO(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+uint16_t Gpio_GetInputData(en_gpio_port_t enPort);
+
+///< GPIO 设置端口输出
+///< GPIO 端口输出电平配置及获取
+en_result_t Gpio_WriteOutputIO(en_gpio_port_t enPort, en_gpio_pin_t enPin, boolean_t bVal);
+boolean_t Gpio_ReadOutputIO(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+///< GPIO 端口/引脚输出电平置位
+en_result_t Gpio_SetPort(en_gpio_port_t enPort, uint16_t u16ValMsk);
+en_result_t Gpio_SetIO(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+///< GPIO 端口/引脚输出电平清零
+en_result_t Gpio_ClrPort(en_gpio_port_t enPort, uint16_t u16ValMsk);
+en_result_t Gpio_ClrIO(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+///< GPIO 端口输出电平置位与清零设置
+en_result_t Gpio_SetClrPort(en_gpio_port_t enPort, uint32_t u32ValMsk);
+
+///< GPIO 设置端口为模拟功能
+en_result_t Gpio_SetAnalogMode(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+
+///< GPIO 设置端口为端口复用功能
+en_result_t Gpio_SetAfMode(en_gpio_port_t enPort, en_gpio_pin_t enPin, en_gpio_af_t enAf);
+
+///< GPIO 端口中断控制功能使能/关闭
+en_result_t Gpio_EnableIrq(en_gpio_port_t enPort, en_gpio_pin_t enPin, en_gpio_irqtype_t enType);
+en_result_t Gpio_DisableIrq(en_gpio_port_t enPort, en_gpio_pin_t enPin, en_gpio_irqtype_t enType);
+///< GPIO 中断状态获取
+boolean_t Gpio_GetIrqStatus(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+///< GPIO 中断标志清除
+en_result_t Gpio_ClearIrq(en_gpio_port_t enPort, en_gpio_pin_t enPin);
+
+///< GPIO 端口辅助功能配置
+///< GPIO 中断模式配置
+en_result_t Gpio_SfIrqModeConfig(en_gpio_sf_irqmode_t enIrqMode);
+///< GPIO IR输出极性配置
+en_result_t Gpio_SfIrPolConfig(en_gpio_sf_irpol_t enIrPolMode);
+///< GPIO HCLK输出配置
+en_result_t Gpio_SfHClkOutputConfig(en_gpio_sf_hclkout_g_t enGate, en_gpio_sf_hclkout_div_t enDiv);
+///< GPIO PCLK输出配置
+en_result_t Gpio_SfPClkOutputConfig(en_gpio_sf_pclkout_g_t enGate, en_gpio_sf_pclkout_div_t enDiv);
+///< GPIO 外部时钟输入配置
+en_result_t Gpio_SfExtClkConfig(en_gpio_sf_ssn_extclk_t enExtClk);
+///< GPIO SPI SSN输入配置
+en_result_t Gpio_SfSsnConfig(en_gpio_sf_ssnspi_t enSpi, en_gpio_sf_ssn_extclk_t enSsn);
+///< GPIO Timer 门控输入配置
+en_result_t Gpio_SfTimGConfig(en_gpio_sf_tim_g_t enTimG, en_gpio_sf_t enSf);
+///< GPIO Timer ETR选择配置
+en_result_t Gpio_SfTimEConfig(en_gpio_sf_tim_e_t enTimE, en_gpio_sf_t enSf);
+///< GPIO Timer 捕获输入配置
+en_result_t Gpio_SfTimCConfig(en_gpio_sf_tim_c_t enTimC, en_gpio_sf_t enSf);
+///< GPIO PCA捕获选择配置
+en_result_t Gpio_SfPcaConfig(en_gpio_sf_pca_t enPca, en_gpio_sf_t enSf);
+
+
+//@} // GpioGroup
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GPIO_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/hdiv.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/hdiv.h
new file mode 100644
index 0000000000..4595f6b5d7
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/hdiv.h
@@ -0,0 +1,119 @@
+/******************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file crc.h
+**
+** CRC 数据结构及API声明.
+**
+** - 2016-05-04 LuX V1.0.
+**
+******************************************************************************/
+
+#ifndef __CRC_H__
+#define __HDIV_H__
+
+/******************************************************************************
+* Include files
+******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /**
+ ******************************************************************************
+ ** \defgroup CrcGroup Cyclic Redundancy Check (CRC)
+ **
+ ******************************************************************************/
+ //@{
+
+ /******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+ /******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+ /******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+ typedef struct stc_div_unsigned_result
+ {
+ uint32_t Quotient;
+ uint32_t Remainder;
+ }stc_div_unsigned_result_t;
+
+ typedef struct stc_div_signed_result
+ {
+ int32_t Quotient;
+ int32_t Remainder;
+ }stc_div_signed_result_t;
+ /******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+ /******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+ //HDIV
+ en_result_t Hdiv_Unsigned(uint32_t Dividend,uint16_t Divisor,stc_div_unsigned_result_t* stcDivResult);
+ en_result_t Hdiv_Signed(int32_t Dividend,int16_t Divisor,stc_div_signed_result_t* stcDivResult);
+
+ boolean_t Hdiv_GetEndState(void);
+ boolean_t Hdiv_GetZeroState(void);
+
+ //@} // CRC Group
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CRC_H__ */
+/******************************************************************************
+* EOF (not truncated)
+******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/i2c.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/i2c.h
new file mode 100644
index 0000000000..ba3e11a339
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/i2c.h
@@ -0,0 +1,167 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file i2c.h
+ **
+ ** Headerfile for I2C functions
+ **
+ **
+ ** History:
+ ** - 2018-03-1 CJ First Version
+ **
+ *****************************************************************************/
+
+#ifndef __I2C_H__
+#define __I2C_H__
+
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/**
+ *******************************************************************************
+ ** \defgroup I2cGroup Inter-Integrated Circuit (I2C)
+ **
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+ /**
+ ******************************************************************************
+ ** \brief I2C通道选择
+ *****************************************************************************/
+ typedef enum en_i2c_channel
+ {
+ I2C0 = 0,///<通道0
+ I2C1 = 1,///<通道1
+ }en_i2c_channel_t;
+ /**
+ ******************************************************************************
+ ** \brief I2C功能配置
+ *****************************************************************************/
+typedef enum en_i2c_func
+{
+ I2cMode_En = 0, ///<I2C模块使能
+ I2cStart_En = 1, ///<开始信号
+ I2cStop_En = 2, ///<结束信号
+ I2cAck_En = 3, ///<应答信号
+ I2cHlm_En = 4, ///<高速使能
+ I2cBaud_En = 5, ///<波特率使能
+}en_i2c_func_t;
+/**
+ ******************************************************************************
+ ** \brief I2C从机地址配置
+ *****************************************************************************/
+typedef struct stc_i2c_addr
+{
+ uint8_t Addr; ///<从机模式地址
+ uint8_t Gc; ///<广播地址使能
+
+}stc_i2c_addr_t;
+/**
+ ******************************************************************************
+ ** \brief I2C初始化配置结构
+ *****************************************************************************/
+typedef struct stc_i2c_config
+{
+ en_i2c_func_t enFunc; ///<功能使能
+ uint8_t u8Tm; ///<波特率计数器配置
+ stc_i2c_addr_t stcSlaveAddr;///<从机地址
+ func_ptr_t pfnI2c0Cb; ///<中断服务函数指针
+ func_ptr_t pfnI2c1Cb;
+ boolean_t bTouchNvic; ///<是否使能NVIC
+}stc_i2c_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+ //I2C初始化函数
+ en_result_t I2C_Init(en_i2c_channel_t enCh,stc_i2c_config_t *pstcI2CCfg);
+ //I2C模块关闭函数
+ en_result_t I2C_DeInit(en_i2c_channel_t enCh);
+ //设置波特率配置寄存器
+ en_result_t I2C_SetBaud(en_i2c_channel_t enCh,uint8_t u8Tm);
+ //I2C功能设置函数
+ en_result_t I2C_SetFunc(en_i2c_channel_t enCh,en_i2c_func_t enFunc);
+ //I2C功能清除函数
+ en_result_t I2C_ClearFunc(en_i2c_channel_t enCh,en_i2c_func_t enFunc);
+ //获取中断标记SI
+ boolean_t I2C_GetIrq(en_i2c_channel_t enCh);
+ //清除中断标记SI
+ en_result_t I2C_ClearIrq(en_i2c_channel_t enCh);
+ //获取状态
+ uint8_t I2C_GetState(en_i2c_channel_t enCh);
+ //写从机地址函数
+ en_result_t I2C_WriteSlaveAddr(en_i2c_channel_t enCh,stc_i2c_addr_t *pstcSlaveAddr);
+ //主发送函数
+ en_result_t I2C_MasterWriteData(en_i2c_channel_t enCh,uint8_t u8DevAddr,uint8_t u8Addr,uint8_t *pu8Data,uint32_t u32Len);
+ //从发送函数
+ en_result_t I2C_SlaveWriteData(en_i2c_channel_t enCh,uint8_t *pu8Data,uint32_t *u32Len);
+ //字节写函数
+ en_result_t I2C_WriteByte(en_i2c_channel_t enCh,uint8_t u8Data);
+ //主接收函数
+ en_result_t I2C_MasterReadData(en_i2c_channel_t enCh,uint8_t u8DevAddr,uint8_t *pu8Data,uint8_t u8Addr,uint32_t u32Len);
+ //主接收函数
+ en_result_t I2C_SlaveReadData(en_i2c_channel_t enCh,uint8_t *pu8Data,uint32_t *pu32Len);
+ //字节读函数
+uint8_t I2C_ReadByte(en_i2c_channel_t enCh);
+
+//@} // I2cGroup
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __I2C_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/interrupts_hc32l136.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/interrupts_hc32l136.h
new file mode 100644
index 0000000000..14b182be53
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/interrupts_hc32l136.h
@@ -0,0 +1,103 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file interrupts_hc32l136.h
+ **
+ ** Interrupt common define.
+ ** @link IRQGroup Some description @endlink
+ **
+ ** - 2018-04-15 1.0 Lux First version.
+ **
+ ******************************************************************************/
+#ifndef __INTERRUPTS_HC32L136_H__
+#define __INTERRUPTS_HC32L136_H__
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+#define DDL_IRQ_LEVEL_DEFAULT 3u
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+/**
+ *******************************************************************************
+ ** \brief 中断优先级数据类型定义
+ ** \note
+ ******************************************************************************/
+typedef enum en_irq_level
+{
+ IrqLevel0 = 0u, ///< 优先级0
+ IrqLevel1 = 1u, ///< 优先级1
+ IrqLevel2 = 2u, ///< 优先级2
+ IrqLevel3 = 3u, ///< 优先级3
+} en_irq_level_t;
+
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< 系统中断使能开关
+void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __INTERRUPTS_HC32L136_H__ */
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lcd.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lcd.h
new file mode 100644
index 0000000000..6723c13db8
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lcd.h
@@ -0,0 +1,270 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file lcd.h
+ **
+ ** Headerfile for LCD functions
+ **
+ **
+ ** History:
+ ** - 2018-05-03 CJ First Version
+ **
+ *****************************************************************************/
+
+#ifndef __LCD_H__
+#define __LCD_H__
+
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/**
+ *******************************************************************************
+ ** \def group LCD Group LCD
+ **
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+#define LCDFULLWRITE 0XFFFFFFFF ///<LCD全显
+#define LCDFULLCLEAR 0X00000000 ///<LCD全清
+#define LCDRAM0_7SIZE 31
+#define LCDRAM8_FSIZE 7
+#define LCDRAMSIZE 0x0F
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+ /**
+ ******************************************************************************
+ ** \brief LCD bias源选择
+ *****************************************************************************/
+ typedef enum en_lcd_biassrc
+ {
+ LcdInRes_High = 6,///<内部电阻分压,大功耗模式
+ LcdInRes_Low = 4,///<内部电阻分压,小功耗模式
+ LcdInRes_Mid = 2,///<内部电阻分压,中功耗模式
+ LcdExtCap = 1,///<外部电容分压模式
+ LcdExtRes = 0,///<外部电阻模式
+ }en_lcd_biassrc_t;
+ /**
+ ******************************************************************************
+ ** \brief LCD duty源选择
+ *****************************************************************************/
+ typedef enum en_lcd_duty
+ {
+ LcdStatic = 0,///<静态
+ LcdDuty2 = 1,///<1/2duty
+ LcdDuty3 = 2,///<1/3duty
+ LcdDuty4 = 3,///<1/4duty
+ LcdDuty6 = 5,///<1/6duty
+ LcdDuty8 = 7,///<1/8duty
+ }en_lcd_duty_t;
+/**
+ ******************************************************************************
+ ** \brief LCD bias配置
+ *****************************************************************************/
+ typedef enum en_lcd_bias
+ {
+ LcdBias3 = 0,///<1/3 BIAS
+ LcdBias2 = 1,///<1/2 BIAS
+ }en_lcd_bias_t;
+ /**
+ ******************************************************************************
+ ** \brief LCD 电压泵时钟频率配置
+ *****************************************************************************/
+ typedef enum en_lcd_cpclk
+ {
+ LcdClk2k = 0,///<2k
+ LcdClk4k = 1,///<4k
+ LcdClk8k = 2,///<8k
+ LcdClk16k = 3,///<16k
+ }en_lcd_cpclk_t;
+ /**
+ ******************************************************************************
+ ** \brief LCD 扫描频率配置
+ *****************************************************************************/
+ typedef enum en_lcd_scanclk
+ {
+ LcdClk64hz = 0,///<64hz
+ LcdClk128hz = 1,///<128hz
+ LcdClk256hz = 2,///<256hz
+ LcdClk512hz = 3,///<512hz
+ }en_lcd_scanclk_t;
+/**
+ ******************************************************************************
+ ** \brief LCD功能使能
+ *****************************************************************************/
+ typedef enum en_lcd_func
+ {
+ LcdEn = 0,///<模块使能
+ LcdBlinkEn = 1,///<LCD闪屏使能
+ }en_lcd_func_t;
+/**
+ ******************************************************************************
+ ** \brief LCD显示模式
+ *****************************************************************************/
+ typedef enum en_lcd_dispmode
+ {
+ LcdMode0 = 0,///<模式0
+ LcdMode1 = 1,///<模式1
+ }en_lcd_dispmode_t;
+/**
+ ******************************************************************************
+ ** \brief LCD时钟源选择
+ *****************************************************************************/
+ typedef enum en_lcd_clk
+ {
+ LcdXTL = 1,///<外部32k
+ LcdRCL = 0,///<内部32k
+ }en_lcd_clk_t;
+/**
+ ******************************************************************************
+ ** \brief LCD显示SEG COM端口配置
+ *****************************************************************************/
+typedef struct stc_lcd_segcom
+{
+ uint32_t u32Seg0_31; ///<SEG0-31配置
+ boolean_t bMux; ///<SEG32-35
+ uint8_t u8Com0_3; ///<COM0-3配置
+ union Seg32_39VLcdCom7_4 ///<Seg32_39/Com7_4配置
+ {
+ uint8_t SegVLcdCom;
+ struct
+ {
+ uint8_t Seg39Com4 :1;
+ uint8_t Seg38Com5 :1;
+ uint8_t Seg37Com6 :1;
+ uint8_t Seg36Com7 :1;
+ uint8_t Seg35LcdH :1;
+ uint8_t Seg34Lcd3 :1;
+ uint8_t Seg33Lcd2 :1;
+ uint8_t Seg32Lcd1 :1;
+
+ }Bits;
+ }Seg32_39VLcdCom7_4_t;
+}stc_lcd_segcom_t;
+/**
+ ******************************************************************************
+ ** \brief LCD端口配置参数
+ *****************************************************************************/
+typedef struct stc_lcd_segcompara
+{
+ en_lcd_duty_t enDuty; ///<占空比
+ en_lcd_biassrc_t enBiasSrc; ///<时钟源
+ uint8_t u8MaxSeg; ///<最大SEG口
+}stc_lcd_segcompara_t;
+/**
+ ******************************************************************************
+ ** \brief I2C初始化配置结构
+ *****************************************************************************/
+typedef struct stc_lcd_config
+{
+ en_lcd_biassrc_t enBiasSrc; ///<Bias源选择
+ en_lcd_duty_t enDuty; ///<占空比选择
+ en_lcd_bias_t enBias; ///bias配置
+ en_lcd_cpclk_t enCpClk; ///<电压泵时钟频率选择
+ en_lcd_scanclk_t enScanClk; ///<扫描频率选择
+ en_lcd_dispmode_t enDispMode;///<显示模式选择
+ en_lcd_clk_t enClk; ///<模块clk选择
+ boolean_t bTouchNvic; ///<是否使能NVIC
+}stc_lcd_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+ //LCD初始化函数
+ en_result_t LCD_Init(stc_lcd_config_t *pstcLcdCfg);
+ //lcd模块关闭函数
+ en_result_t LCD_DeInit(void);
+ //lcd 时钟源选择函数
+ en_result_t LCD_SetClkSrc(en_lcd_clk_t enLcdClk);
+ //lcd bias源选择函数
+ en_result_t LCD_SelBiasSrc(en_lcd_biassrc_t enBiasSrc);
+ //lcd duty配置函数
+ en_result_t LCD_SetDuty(en_lcd_duty_t enDuty);
+ //lcd bias配置函数
+ en_result_t LCD_SetBias(en_lcd_bias_t enBias);
+ //lcd电压泵时钟频率选择
+ en_result_t LCD_SelCpClk(en_lcd_cpclk_t enCpClk);
+ //lcd扫描频率选择
+ en_result_t LCD_SelScanClk(en_lcd_scanclk_t enScanClk);
+ //lcd 功能使能禁止函数
+ en_result_t LCD_EnFunc(en_lcd_func_t enFunc,boolean_t bFlag);
+ //lcd显示模式函数
+ en_result_t LCD_SetDispMode(en_lcd_dispmode_t enDispMode);
+ //lcd对比度设置
+ en_result_t LCD_SetContrast(uint8_t u8Contrast);
+ //lcd闪屏计数器设置
+ en_result_t LCD_SetBlinkCnt(uint8_t u8BlinkCnt);
+ //lcd中断清除
+ en_result_t LCD_ClrIntState(void);
+ //LCD运行模式获取端口配置
+ en_result_t LCD_GetSegCom(stc_lcd_segcompara_t *pstcSegComPara,stc_lcd_segcom_t *pstcSegCom);
+ //lcd segcom端口配置
+ en_result_t LCD_SetSegCom(stc_lcd_segcom_t *pstcSegCom);
+ //lcd全显
+ en_result_t LCD_FullDisp(void);
+ //lcd全清
+ en_result_t LCD_ClearDisp(void);
+ //lcd写RAM函数
+ en_result_t LCD_WriteRam(uint16_t u16Row, uint32_t u32List, boolean_t bData);
+ en_result_t LCD_WriteRam0_7Int32(uint8_t u8Row,uint32_t u32Data);
+ en_result_t LCD_WriteRam8_FInt8(uint8_t u8Row,uint8_t u8Data);
+
+
+//@} // LCDGroup
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __LCD_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpm.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpm.h
new file mode 100644
index 0000000000..d763ff52a5
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpm.h
@@ -0,0 +1,147 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file lpm.h
+ **
+ ** Lpm 数据结构及API声明
+ **
+ **
+ ** History:
+ ** - 2017-06-06 Lux V1.0
+ **
+ *****************************************************************************/
+
+#ifndef __LPM_H__
+#define __LPM_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ *******************************************************************************
+ ** \defgroup LpmGroup Low Power Management (LPM)
+ **
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ ** Global pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+ /**
+ ******************************************************************************
+ ** \brief 事件挂起使能枚举重定义 (SEVONPEND)
+ *****************************************************************************/
+typedef enum en_lpm_sevonpend
+{
+ SevPndDisable = 0u, ///< 事件挂起禁止
+ SevPndEnable = 1u, ///< 事件挂起使能
+}en_lpm_sevonpend_t;
+
+ /**
+ ******************************************************************************
+ ** \brief 深度睡眠使能枚举重定义 (SLEEPDEEP)
+ *****************************************************************************/
+typedef enum en_lpm_sleepdeep
+{
+ SlpDpDisable = 0u, ///< 深度睡眠禁止
+ SlpDpEnable = 1u, ///< 深度睡眠使能
+}en_lpm_sleepdeep_t;
+
+/**
+ ******************************************************************************
+ ** \brief 异常退出进睡眠使能枚举重定义 (SLEEPONEXIT)
+ *****************************************************************************/
+typedef enum en_lpm_sleeponexit
+{
+ SlpExtDisable = 0u, ///< 异常退出进睡眠禁止
+ SlpExtEnable = 1u, ///< 异常退出进睡眠使能
+}en_lpm_sleeponexit_t;
+
+/**
+ ******************************************************************************
+ ** \brief Low Power Mode 配置结构体定义
+ *****************************************************************************/
+typedef struct stc_lpm_config
+{
+ en_lpm_sevonpend_t enSEVONPEND; ///< 使能:每次新中断会产生一个事件,如果使用WFE休眠,则可用于唤醒处理器.
+ en_lpm_sleepdeep_t enSLEEPDEEP; ///< 使能:执行WFI进入深度休眠;不使能:执行WFI进入休眠.
+ en_lpm_sleeponexit_t enSLEEPONEXIT; ///< 使能:退出异常处理并返回时,处理器自动进入休眠模式;不使能:该特性禁止.
+}stc_lpm_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+///<功能配置及操作函数
+///<低功耗模式配置
+en_result_t Lpm_Config(stc_lpm_config_t* pstcConfig);
+///<进入低功耗模式
+void Lpm_GotoLpmMode(void);
+
+//@} // LpmGroup
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __LPM_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpt.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpt.h
new file mode 100644
index 0000000000..0873dbd32c
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpt.h
@@ -0,0 +1,211 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file lpt.h
+ **
+ ** 低功耗定时器数据结构及API声明
+ **
+ **
+ ** History:
+ ** - 2018-04-15 Husj First version
+ **
+ *****************************************************************************/
+
+#ifndef __LPT_H__
+#define __LPT_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ *******************************************************************************
+ ** \defgroup LptGroup Low Power Timer (LPT)
+ **
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief GATE 极性控制数据类型重定义 (GATE_P)
+ *****************************************************************************/
+typedef enum en_lpt_gatep
+{
+ LptActHighLevel = 0u, ///< 高电平有效
+ LptActLowLevel = 1u, ///< 低电平有效
+}en_lpt_gatep_t;
+
+/**
+ ******************************************************************************
+ ** \brief 定时器门控数据类型重定义 (GATE)
+ *****************************************************************************/
+typedef enum en_lpt_gate
+{
+ LptGateDisable = 0u, ///< 无门控
+ LptGateEnable = 1u, ///< 门控使能
+}en_lpt_gate_t;
+
+/**
+ ******************************************************************************
+ ** \brief Lptimer 时钟选择数据类型重定义 (TCK_SEL)
+ *****************************************************************************/
+typedef enum en_lpt_clksel
+{
+ LptPCLK = 0u, ///< PCLK
+ LptXIL32K = 2u, ///< XIL32K
+ LptIRC32K = 3u, ///< IRC32K
+}en_lpt_clksel_t;
+
+/**
+ ******************************************************************************
+ ** \brief 翻转输出使能数据类型重定义 (TOG_EN)
+ *****************************************************************************/
+typedef enum en_lpt_toggle
+{
+ LptTogDisable = 0u, ///< 翻转输出禁止
+ LptTogEnable = 1u, ///< 翻转输出使能
+}en_lpt_toggle_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数/定时器功能选择数据类型重定义 (CT)
+ *****************************************************************************/
+typedef enum en_lpt_function
+{
+ LptTimer = 0u, ///< 定时器功能
+ LptCounter = 1u, ///< 计数器功能
+}en_lpt_function_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 定时器工作模式数据类型重定义 (MD)
+ *****************************************************************************/
+typedef enum en_lpt_mode
+{
+ Lpt16bitFreeMode = 0u, ///< 无重载16位计数器/定时器
+ Lpt16bitArrMode = 1u, ///< 自动重装载16位计数器/定时器
+}en_lpt_mode_t;
+
+/**
+ ******************************************************************************
+ ** \brief 定时器运行控制数据类型重定义 (TR)
+ *****************************************************************************/
+typedef enum en_lpt_start
+{
+ LptTRDisable = 0u, ///< 停止
+ LptTREnable = 1u, ///< 运行
+}en_lpt_start_t;
+
+/**
+ ******************************************************************************
+ ** \brief Lptimer 配置结构体定义
+ *****************************************************************************/
+typedef struct stc_lpt_config
+{
+ en_lpt_gatep_t enGateP; ///< 门控极性控制
+ en_lpt_gate_t enGate; ///< 门控使能
+ en_lpt_clksel_t enTckSel; ///< 时钟选择
+ en_lpt_toggle_t enTog; ///< 翻转输出使能
+ en_lpt_function_t enCT; ///< 定时/计数模式选择
+ en_lpt_mode_t enMD; ///< 工作模式选择
+
+ func_ptr_t pfnLpTimCb; ///< LpTimer中断服务回调函数[void function(void)]
+}stc_lpt_config_t;
+
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+//中断相关函数
+//中断标志获取
+boolean_t Lpt_GetIntFlag(void);
+//中断标志清除
+en_result_t Lpt_ClearIntFlag(void);
+//中断使能/禁止
+en_result_t Lpt_EnableIrq (void);
+en_result_t Lpt_DisableIrq(void);
+
+//初始化及相关功能操作
+//Lptimer配置及初始化
+en_result_t Lpt_Init(stc_lpt_config_t* pstcConfig);
+//Lptimer 启动/停止
+en_result_t Lpt_Run(void);
+en_result_t Lpt_Stop(void);
+//重载值设置
+en_result_t Lpt_ARRSet(uint16_t u16Data);
+//计数值获取
+en_result_t Lpt_Cnt16Set(uint16_t u16Data);
+uint16_t Lpt_Cnt16Get(void);
+
+//@} // LptGroup
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __LPT_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpuart.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpuart.h
new file mode 100644
index 0000000000..6e53717268
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lpuart.h
@@ -0,0 +1,325 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file uart.h
+ **
+ ** Headerfile for LPUART functions
+ **
+ **
+ ** History:
+ ** - 2017-05-10 Cathy First Version
+ **
+ *****************************************************************************/
+
+#ifndef __LPUART_H__
+#define __LPUART_H__
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup LPUartGroup Universal Asynchronous Receiver/Transmitter (LPUART)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+ /**
+ ******************************************************************************
+ **\brief LPuart通道选择
+ ******************************************************************************/
+
+typedef enum en_lpuart_channel
+{
+ LPUART0 = 0u, ///<串口2
+ LPUART1 = 1u, ///<串口3
+}en_lpuart_channel_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 的sclk时钟源选择
+ ******************************************************************************/
+
+typedef enum en_lpuart_sclk_sel
+{
+ LPUart_Pclk = 0u, ///<pclk
+ LPUart_Pclk_1 = 1u, ///<pclk
+ LPUart_Xtl = 2u, ///<外部低速晶振
+ LPUart_Rcl = 3u, ///<内部低速晶振
+} en_lpuart_sclksel_t;
+
+/**
+ ******************************************************************************
+ ** \brief lpuart多主机模式地址帧/数据帧或者奇偶校验
+ ******************************************************************************/
+typedef enum en_lpuart_mmdorck
+{
+ LPUartDataOrAddr = 0u, ///<多主机模式时,通过读写SBUF[8]决定帧为数据帧或地址帧
+ LPUartEven = 1u, ///<非多主机模式偶校验
+ LPUartOdd = 2u, ///<非多主机模式奇校验
+}en_lpuart_mmdorck_t;
+
+/**
+ ******************************************************************************
+ ** \brief lpuart多主机模式配置
+ ******************************************************************************/
+typedef enum en_lpuart_multimode
+{
+ LPUartNormal = 0u, ///<正常工作模式
+ LPUartMulti = 1u, ///<多主机工作模式
+}en_lpuart_multimode_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart多主机模式及从机地址和地址掩码配置
+ ******************************************************************************/
+
+typedef struct stc_lpuart_multimode
+{
+ en_lpuart_multimode_t enMulti_mode; ///<多主机模式配置
+ uint8_t u8SlaveAddr; ///<从机地址
+ uint8_t u8SaddEn; ///<从及地址掩码
+}stc_lpuart_multimode_t;
+
+/**
+ ******************************************************************************
+ ** \brief lpuart 四种工作模式选择
+ ******************************************************************************/
+
+typedef enum en_lpuart_mode
+{
+ LPUartMode0 = 0u, ///<模式0
+ LPUartMode1 = 1u, ///<模式1
+ LPUartMode2 = 2u, ///<模式2
+ LPUartMode3 = 3u, ///<模式3
+} en_lpuart_mode_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart stop长度选择
+ ******************************************************************************/
+
+typedef enum en_lpuart_stop
+{
+ LPUart1bit = 0u, ///<1位停止位
+ LPUart15bit = 1u, ///<1.5位停止位
+ LPUart2bit = 2u, ///<2位停止位
+} en_lpuart_stop_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 功能使能
+ ******************************************************************************/
+typedef enum en_lpuart_func
+{
+ LPUartTx = 0u, ///<mode0模式代表TX
+ LPUartRx = 1u, ///<非mode0模式代表RX and TX ,mode0模式代表RX
+ LPUartDmaTx = 3u, ///<DMA发送使能
+ LPUartDmaRx = 4u, ///<DMA接收使能
+ LPUartCtsRts = 5u, ///<硬件流使能
+}en_lpuart_func_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart中断使能控制
+ ******************************************************************************/
+typedef enum en_lpuart_irq_sel
+{
+ LPUartTxIrq = 0u, ///<发送中断使能
+ LPUartRxIrq = 1u, ///<接收中断使能
+ LPUartFEIrq = 3u, ///<帧错误中断使能
+ LPUartCtsIrq = 4u, ///<CTS信号翻转中断使能
+ LPUartPEIrq = 5u, ///<奇偶校验中断使能
+ LPUartTxEIrq = 6u, ///<TX空中断使能
+}en_lpuart_irq_sel_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart发送接收中断处理函数接口
+ ******************************************************************************/
+
+typedef struct stc_lpuart_irq_cb
+{
+ func_ptr_t pfnTxIrqCb; ///<发送中断服务函数
+ func_ptr_t pfnRxFEIrqCb; ///<接收帧错误中断服务函数
+ func_ptr_t pfnRxIrqCb; ///<接收中断服务函数
+ func_ptr_t pfnCtsIrqCb; ///<CTS信号翻转中断服务函数
+ func_ptr_t pfnPEIrqCb; ///<奇偶校验错误中断服务函数
+}stc_lpuart_irq_cb_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 状态标志位
+ ******************************************************************************/
+typedef enum en_lpuart_status
+{
+ LPUartCts = 0u, ///<CTS信号标记
+ LPUartRC = 1u, ///<接收数据完成标记
+ LPUartTC = 2u, ///<发送数据完成标记
+ LPUartPE = 3u, ///<奇偶校验错误标记
+ LPUartFE = 4u, ///<帧错误标记
+ LPUartCtsIf = 5u, ///CTS中断标志
+ LPUartTxe = 6u, ///TXbuff空标记
+}en_lpuart_status_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 通道地址及中断函数地址结构
+ ******************************************************************************/
+typedef struct stc_lpuart_instance_data
+{
+ uint32_t u32Idx; ///< 通道号
+ M0P_LPUART_TypeDef *pstcInstance; ///< 通道寄存器地址
+ stc_lpuart_irq_cb_t stcLPUartInternIrqCb; ///< 通道中断服务函数
+} stc_lpuart_instance_data_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 通道波特率配置
+ ******************************************************************************/
+typedef enum en_lpuart_clkdiv
+{
+ LPUart16Or32Div = 0u,///<模式0无效,模式1/3为16分频,模式2为32分频
+ LPUart8Or16Div = 1u,///<模式0无效,模式1/3为8分频,模式2为16分频
+ LPUart4Or8Div = 2u,///<模式0无效,模式1/3为4分频,模式2为8分频
+}en_lpuart_clkdiv_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 时钟相关配置
+ ******************************************************************************/
+typedef struct stc_lpuart_sclk_sel
+{
+ en_lpuart_clkdiv_t enSclk_Prs; ///<分频选择
+ en_lpuart_sclksel_t enSclk_sel; ///<传输时钟选择
+}stc_lpuart_sclk_sel_t;
+/**
+ ******************************************************************************
+ ** \brief lpuart 通道波特率计算参数
+ ******************************************************************************/
+typedef struct stc_lpuart_baud
+{
+ uint32_t u32Sclk; ///<sclk
+ en_lpuart_mode_t enRunMode; ///< 四种模式配置
+ uint32_t u32Baud; ///< 波特率
+} stc_lpuart_baud_t;
+/**
+ ******************************************************************************
+ ** \lpuart 总体配置
+ ******************************************************************************/
+
+typedef struct stc_lpuart_config
+{
+ en_lpuart_mode_t enRunMode; ///< 四种模式配置
+ stc_lpuart_sclk_sel_t* pstcLpuart_clk; ///<时钟源配置
+ en_lpuart_stop_t enStopBit; ///<停止位长度
+ stc_lpuart_multimode_t* pstcMultiMode; ///<多主机模式配置
+ stc_lpuart_irq_cb_t* pstcIrqCb; ///<中断服务函数
+ boolean_t bTouchNvic; ///<NVIC中断使能
+} stc_lpuart_config_t;
+//中断相关设置函数
+en_result_t LPUart_EnableIrq(uint8_t u8Idx,
+ en_lpuart_irq_sel_t enIrqSel);
+en_result_t LPUart_DisableIrq(uint8_t u8Idx,
+ en_lpuart_irq_sel_t enIrqSel);
+// 总初始化处理
+en_result_t LPUart_Init(uint8_t u8Idx,
+ stc_lpuart_config_t* pstcConfig);
+//LPUART模块工作模式设置函数
+en_result_t LPUart_SetMode(uint8_t u8Idx,en_lpuart_mode_t enMode);
+//LPUART模块工作模式设置函数
+en_result_t LPUart_SetMultiMode(uint8_t u8Idx,stc_lpuart_multimode_t* pstcMultiConfig);
+//LPUART通道多主机模式发送数据/地址帧或者奇偶校验配置TB8
+en_result_t LPUart_SetMMDOrCk(uint8_t u8Idx,en_lpuart_mmdorck_t enTb8);
+//从机地址配置
+en_result_t LPUart_SetSaddr(uint8_t u8Idx,uint8_t u8Addr);
+//从机地址掩码配置
+en_result_t LPUart_SetSaddrEn(uint8_t u8Idx,uint8_t u8Addren);
+//停止位配置
+en_result_t LPUart_SetStopBit(uint8_t u8Idx,uint8_t u8Len);
+//数据寄存器bit8位获取
+boolean_t LPUart_GetRb8(uint8_t u8Idx);
+//时钟源选择
+en_result_t LPUart_SelSclk(uint8_t u8Idx,en_lpuart_sclksel_t enClk);
+//时钟源时钟获取
+uint32_t LPUart_GetSclk(uint8_t u8Idx);
+//采样分频设置
+en_result_t LPUart_SetClkDiv(uint8_t u8Idx,en_lpuart_clkdiv_t enClkDiv);
+//波特率设置值计算
+uint16_t LPUart_CalScnt(uint8_t u8Idx,stc_lpuart_baud_t *pstcBaud);
+//波特率设置
+en_result_t LPUart_SetBaud(uint8_t u8Idx,uint16_t u16Scnt);
+//获取波特率
+uint32_t LPUart_GetBaud(uint8_t u8Idx,uint8_t u8Mode,uint32_t u32Pclk);
+
+//功能使能和禁止
+en_result_t LPUart_EnableFunc(uint8_t u8Idx, en_lpuart_func_t enFunc);
+en_result_t LPUart_DisableFunc(uint8_t u8Idx, en_lpuart_func_t enFunc);
+//某个状态bit获取函数
+boolean_t LPUart_GetStatus(uint8_t u8Idx,en_lpuart_status_t enStatus);
+//某个状态bit状态位的清除
+en_result_t LPUart_ClrStatus(uint8_t u8Idx,en_lpuart_status_t enStatus);
+//整个状态寄存器获取
+uint8_t LPUart_GetIsr(uint8_t u8Idx);
+//整个状态寄存器清除
+en_result_t LPUart_ClrIsr(uint8_t u8Idx);
+//数据查询方式的发送操作
+en_result_t LPUart_SendData(uint8_t u8Idx, uint8_t u8Data);
+//数据查询方式的接收操作
+uint8_t LPUart_ReceiveData(uint8_t u8Idx);
+
+//@} // LPUartGroup
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __UART_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lvd.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lvd.h
new file mode 100644
index 0000000000..cf43862a3e
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/lvd.h
@@ -0,0 +1,208 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file lvd.h
+ **
+ ** Headerfile for Low Voltage Detector functions
+ **
+ ** - 2017-06-28 Alex First Version
+ **
+ ******************************************************************************/
+
+#ifndef __LVD_H__
+#define __LVD_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup LvdGroup Low Voltage Detector (LVD)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief LVD输入电压源
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_lvd_input
+{
+ LvdInputVCC = 0u, ///< Vcc
+ LvdInputPC13 = 1u, ///< PC13
+ LvdInputPB08 = 2u, ///< PB08
+ LvdInputPB07 = 3u, ///< PB07
+}en_lvd_input_t;
+
+/**
+ ******************************************************************************
+ ** \brief LVD监测电压选择
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_lvd_threshold
+{
+ LvdTH1p8V = 0u, ///< 1.8V
+ LvdTH1p9V = 1u, ///< 1.9V
+ LvdTH2p0V = 2u, ///< 2.0V
+ LvdTH2p1V = 3u, ///< 2.1V
+ LvdTH2p2V = 4u, ///< 2.2V
+ LvdTH2p3V = 5u, ///< 2.3V
+ LvdTH2p4V = 6u, ///< 2.4V
+ LvdTH2p5V = 7u, ///< 2.5V
+ LvdTH2p6V = 8u, ///< 2.6V 默认电压
+ LvdTH2p7V = 9u, ///< 2.7V
+ LvdTH2p8V = 10u, ///< 2.8V
+ LvdTH2p9V = 11u, ///< 2.9V
+ LvdTH3p0V = 12u, ///< 3.0V
+ LvdTH3p1V = 13u, ///< 3.1V
+ LvdTH3p2V = 14u, ///< 3.2V
+ LvdTH3p3V = 15u, ///< 3.3V
+}en_lvd_threshold_t;
+
+/**
+ ******************************************************************************
+ ** \brief LVD输出滤波时间
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_lvd_filter_time
+{
+ LvdFilter30us = 0u, ///< 30us
+ LvdFilter40us = 1u, ///< 40us
+ LvdFilter50us = 2u, ///< 50us
+ LvdFilter130us = 3u, ///< 130us
+ LvdFilter480us = 4u, ///< 480us
+ LvdFilter1800us = 5u, ///< 1.8ms
+ LvdFilter7d3ms = 6u, ///< 7.3ms
+ LvdFilter29ms = 7u, ///< 29ms
+}en_lvd_filter_time_t;
+
+/**
+ ******************************************************************************
+ ** \brief LVD中断触发方式
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_lvd_irq_type
+{
+ LvdIrqHigh = 0u, ///< 高电平触发
+ LvdIrqRise = 1u, ///< 上升沿触发
+ LvdIrqFall = 2u, ///< 下降沿触发
+}en_lvd_irq_type_t;
+
+/**
+ ******************************************************************************
+ ** \brief LVD配置
+ ** \note
+ ******************************************************************************/
+typedef struct stc_lvd_config
+{
+ boolean_t bLvdReset; ///< TRUE-重启,FALSE-中断
+ en_lvd_input_t enInput; ///< LVD输入电压源
+ en_lvd_threshold_t enThreshold; ///< LVD监测电压
+ boolean_t bFilter; ///< 是否使用输出滤波
+ en_lvd_filter_time_t enFilterTime; ///< 输出滤波时间
+ en_lvd_irq_type_t enIrqType; ///< 中断触发方式
+ func_ptr_t pfnIrqCbk; ///< 中断回调函数
+}stc_lvd_config_t;
+
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+//irq enable/disable
+en_result_t Lvd_EnableIrq(en_lvd_irq_type_t enType);
+void Lvd_DisableIrq(void);
+
+// irq function
+void Lvd_ClearIrq(void);
+boolean_t Lvd_GetIrqStat(void);
+
+// fliter function
+boolean_t Lvd_GetFilterResult(void);
+
+//init/deinit function
+void Lvd_Init(stc_lvd_config_t *pstcConfig);
+void Lvd_DeInit(void);
+
+//LVD function enable/disable
+void Lvd_Enable(void);
+void Lvd_Disable(void);
+
+//@} // LvdGroup
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LVD_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/opa.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/opa.h
new file mode 100644
index 0000000000..96824dc3c0
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/opa.h
@@ -0,0 +1,205 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file OPA.h
+ **
+ ** Headerfile for OPA functions
+ ** @link OPA Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-15 Devi First Version
+ **
+ ******************************************************************************/
+
+#ifndef __OPA_H__
+#define __OPA_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup OPAGroup (OPA)
+ **
+ ******************************************************************************/
+//@{
+
+/**
+ *******************************************************************************
+ ** function prototypes.
+ ******************************************************************************/
+/**
+ *******************************************************************************
+ ** \brief OPA通道选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_opa_channel
+{
+ OPA0 = 0u, ///<<OPA0
+ OPA1 = 1u, ///<<OPA1
+ OPA2 = 2u, ///<<OPA2
+}en_opa_channel_t;
+
+/**
+ *******************************************************************************
+ ** \brief OPA反向增益选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_opa_invert_pagagain
+{
+ Gain15 = 0u, ///< 反向增益15倍
+ Gain07 = 1u, ///< 反向增益7倍
+ Gain13_3 = 2u, ///< 反向增益13/3倍
+ Gain03 = 3u, ///< 反向增益3倍
+ Gain05_3 = 4u, ///< 反向增益5/3倍
+ Gain01 = 5u, ///< 反向增益1倍
+ Gain01_3 = 6u, ///< 反向增益1/3倍
+ Gain11_5 = 7u, ///< 反向增益11/5倍
+}en_opa_invert_pagagain_t;
+
+/**
+ *******************************************************************************
+ ** \brief OPA正向增益选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_opa_noinvert_pagagain
+{
+ Gain16 = 0u, ///< 正向增益16倍
+ Gain08 = 1u, ///< 正向增益8倍
+ Gain16_3 = 2u, ///< 正向增益16/3倍
+ Gain04 = 3u, ///< 正向增益4倍
+ Gain08_3 = 4u, ///< 正向增益8/3倍
+ Gain02 = 5u, ///< 正向增益2倍
+ Gain04_3 = 6u, ///< 正向增益4/3倍
+ Gain16_5 = 7u, ///< 正向增益16/5倍
+}en_opa_noinvert_pagagain_t;
+
+/**
+ *******************************************************************************
+ ** \brief 仪表增益配置
+ ******************************************************************************/
+typedef enum opa_metergain
+{
+ OpaMeterGain3 = 0u,
+ OpaMeterGain1_3 = 1u,
+ OpaMeterGain1 = 2u,
+}en_opa_metergain_t;
+
+
+/**
+ *******************************************************************************
+ ** \brief opa 模式选择
+ ******************************************************************************/
+typedef enum opa_modesel
+{
+ OpaUintMode = 0u, ///< PGA单位增益
+ OpaForWardMode = 1u, ///< 正向输入PGA
+ OpaOppositeMode = 2u, ///< 反向输入PGA
+ OpaThreeOppMode = 3u, ///< 3个OPA级联反向输入PGA
+ OpaThreeForMode = 4u, ///< 3个OPA级联正向输入PGA
+ OpaDiffMode = 5u, ///< 两运放差分输入PGA
+ OpaMeterMode = 6u, ///< 仪表放大器
+ OpaGpMode = 7u, ///< 通用运放
+}en_opa_modesel_t;
+
+/**
+ *******************************************************************************
+ ** \brief opa 校正模式
+ ******************************************************************************/
+typedef enum opa_calsel
+{
+ OpaSoftMode = 0u, ///< 软件控制
+ OpaSoftTriggerMode = 1u, ///< 软件触发
+ OpaADCTriggerMode = 2u, ///< ADC触发
+}en_opa_calsel_t;
+
+/**
+ ******************************************************************************
+ ** \brief OPA增益配置
+ *****************************************************************************/
+typedef struct stc_opa_gain_config
+{
+ en_opa_invert_pagagain_t enInGain; ///< 反向增益
+ en_opa_noinvert_pagagain_t enNoInGain; ///< 正向增益
+}stc_opa_gain_config_t;
+
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< OPA初始化
+en_result_t OPA_Init(void);
+///< OPA去初始化
+en_result_t OPA_DeInit(void);
+///< OPA基本功能设置
+en_result_t OPA_Operate(en_opa_channel_t enchannel ,en_opa_modesel_t enMode,stc_opa_gain_config_t *pstrGain);
+///< OPA三级联设置
+en_result_t OPA_ThreeOperate(en_opa_modesel_t enMode,stc_opa_gain_config_t *pstrGain0,stc_opa_gain_config_t *pstrGain1,stc_opa_gain_config_t *pstrGain2);
+///< OPA 仪表模式
+en_result_t OPA_MeterOperate(en_opa_metergain_t enGainMode);
+///< OPA校正模式
+en_result_t OPA_Cal(en_opa_calsel_t enCalMode);
+
+
+//@} // OPA Group
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __OPA_H__ */
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pca.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pca.h
new file mode 100644
index 0000000000..214d6dfe0d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pca.h
@@ -0,0 +1,301 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file pca.h
+ **
+ ** PCA(可编程计数阵列)数据结构及API声明
+ **
+ **
+ ** History:
+ ** - 2017-04-15 Husj First version
+ **
+ *****************************************************************************/
+
+#ifndef __PCA_H__
+#define __PCA_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup PcaGroup Programmable Counter Array (PCA)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+ /**
+ ******************************************************************************
+ ** \brief PCA 模块选择数据类型重定义
+ *****************************************************************************/
+typedef enum en_pca_module
+{
+ Module0 = 0u, ///< 模块0
+ Module1 = 1u, ///< 模块1
+ Module2 = 2u, ///< 模块2
+ Module3 = 3u, ///< 模块3
+ Module4 = 4u, ///< 模块4
+}en_pca_module_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 计数启/停控制数据类型重定义 (CR)
+ *****************************************************************************/
+typedef enum en_pca_start
+{
+ CRStop = 0u, ///< 停止计数
+ CRStart = 1u, ///< 开始计数
+}en_pca_start_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA IDLE 模式下启/停控制数据类型重定义 (CIDL)
+ *****************************************************************************/
+typedef enum en_pca_cidl
+{
+ IdleGoOn = 0u, ///< 休眠模式下 PCA继续工作
+ IdleStop = 1u, ///< 休眠模式下 PCA停止工作
+}en_pca_cidl_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 模块4 WDT功能控制数据类型重定义 (WDTE)
+ *****************************************************************************/
+typedef enum en_pca_wdte
+{
+ PCAWDTDisable = 0u, ///< 关闭 PCA模块4 WDT功能
+ PCAWDTEnable = 1u, ///< 启动 PCA模块4 WDT功能
+}en_pca_wdte_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 时钟分频及时钟源选择功能数据类型重定义 (CPS)
+ *****************************************************************************/
+typedef enum en_pca_clksel
+{
+ PCAPCLKDiv32 = 0u, ///< PCLK/32
+ PCAPCLKDiv16 = 1u, ///< PCLK/16
+ PCAPCLKDiv8 = 2u, ///< PCLK/8
+ PCAPCLKDiv4 = 3u, ///< PCLK/4
+ PCAPCLKDiv2 = 4u, ///< PCLK/2
+ PCATimer0Over = 5u, ///< timer0 overflow
+ PCATimer1Over = 6u, ///< timer1 overflow
+ PCAECI = 7u, ///< ECI 外部时钟,时钟PCLK四分频采样
+}en_pca_clksel_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 允许比较器功能控制数据类型重定义 (ECOM)
+ *****************************************************************************/
+typedef enum en_pca_ecom
+{
+ ECOMDisable = 0u, ///< 禁止比较器功能
+ ECOMEnable = 1u, ///< 允许比较器功能
+}en_pca_ecom_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 正沿捕获控制位数据类型重定义 (CAPP)
+ *****************************************************************************/
+typedef enum en_pca_capp
+{
+ CAPPDisable = 0u, ///< 禁止上升沿捕获
+ CAPPEnable = 1u, ///< 允许上升沿捕获
+}en_pca_capp_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 负沿捕获控制位数据类型重定义 (CAPN)
+ *****************************************************************************/
+typedef enum en_pca_capn
+{
+ CAPNDisable = 0u, ///< 禁止下降沿捕获
+ CAPNEnable = 1u, ///< 允许下降沿捕获
+}en_pca_capn_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 匹配控制位数据类型重定义 (MAT)
+ *****************************************************************************/
+typedef enum en_pca_mat
+{
+ MATDisable = 0u, ///< 禁止匹配
+ MATEnable = 1u, ///< 允许匹配
+}en_pca_mat_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 翻转控制位数据类型重定义 (TOG)
+ *****************************************************************************/
+typedef enum en_pca_tog
+{
+ TOGDisable = 0u, ///< 禁止翻转功能
+ TOGEnable = 1u, ///< 允许翻转功能
+}en_pca_tog_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 8bit脉宽调制控制数据类型重定义 (8bitPWM)
+ *****************************************************************************/
+typedef enum en_pca_pwm_8_bit
+{
+ PCA8bitPWMDisable = 0u, ///< 禁止 PWM功能
+ PCA8bitPWMEnable = 1u, ///< 允许CCPx引脚作为PWM输出
+}en_pca_8bit_pwm_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 16bit脉宽调制控制数据类型重定义 (16bitPWM)
+ *****************************************************************************/
+typedef enum en_pca_pwm_16_bit
+{
+ PCA16bitPWMDisable = 0u, ///< 16bitPWM 禁止
+ PCA16bitPWMEnable = 1u, ///< 16bitPWM 使能
+}en_pca_16bit_pwm_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 配置结构体定义
+ *****************************************************************************/
+typedef struct stc_pca_config
+{
+ en_pca_cidl_t enCIDL; ///< 模式下启/停控制
+ en_pca_wdte_t enWDTE; ///< WDT功能控制
+ en_pca_clksel_t enCPS; ///< 时钟分频及时钟源选择功能
+
+ func_ptr_t pfnPcaCb; ///< Pca中断服务回调函数[void function(void)]
+}stc_pca_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCA 捕获模式配置结构体定义
+ *****************************************************************************/
+typedef struct stc_pca_capmodconfig
+{
+ en_pca_ecom_t enECOM; ///< 允许比较器功能控制
+ en_pca_capp_t enCAPP; ///< 正沿捕获控制
+ en_pca_capn_t enCAPN; ///< 负沿捕获控制
+ en_pca_mat_t enMAT; ///< 匹配控制
+ en_pca_tog_t enTOG; ///< 翻转控制
+ en_pca_8bit_pwm_t en8bitPWM; ///< 8位脉宽调制控制
+}stc_pca_capmodconfig_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+//Interrupt related
+//PCA中断标志获取
+boolean_t Pca_GetIntFlag(en_pca_module_t enModule);
+//PCA计数器中断标志获取
+boolean_t Pca_GetCntIntFlag(void);
+//PCA中断标志清除
+en_result_t Pca_ClearIntFlag(en_pca_module_t enModule);
+//PCA计数器中断标志清除
+en_result_t Pca_ClearCntIntFlag(void);
+//PCA中断使能
+en_result_t Pca_EnableIrq (en_pca_module_t enModule);
+//PCA计数器中断使能
+en_result_t Pca_EnableCntIrq (void);
+//PCA中断关闭
+en_result_t Pca_DisableIrq(en_pca_module_t enModule);
+//PCA计数器中断关闭
+en_result_t Pca_DisableCntIrq(void);
+
+//PCA配置及操作
+//PCA初始化
+en_result_t Pca_Init(stc_pca_config_t* pstcConfig);
+//PCA捕获模式配置
+en_result_t Pca_CapModConfig(en_pca_module_t enModule, stc_pca_capmodconfig_t* pstcCapMod);
+//PCA计数器启动/停止
+en_result_t Pca_Run(void);
+en_result_t Pca_Stop(void);
+//PCA16位比较数据设置
+en_result_t Pca_CmpData16Set(en_pca_module_t enModule, uint16_t u16Data);
+//PCA捕获16位数据获取
+uint16_t Pca_CapData16Get(en_pca_module_t enModule);
+//PCA比较数据高8位设置
+en_result_t Pca_CmpDataHSet(en_pca_module_t enModule, uint8_t u8Data);
+//PCA比较数据低8位设置
+en_result_t Pca_CmpDataLSet(en_pca_module_t enModule, uint8_t u8Data);
+//PCA计数值设置/获取
+en_result_t Pca_Cnt16Set(uint16_t u16Data);
+uint16_t Pca_Cnt16Get(void);
+//PCA周期重载值设置/获取
+en_result_t Pca_CARRSet(uint16_t u16Data);
+uint16_t Pca_CARRGet(void);
+//PCA 增强PWM功能使能/禁止
+en_result_t Pca_Enable16bitPWM(void);
+en_result_t Pca_Disable16bitPWM(void);
+//PCA比较高速输出标志获取
+boolean_t Pca_GetCmpHighFlag(en_pca_module_t enModule);
+//@} // PcaGroup
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __PCA_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pcnt.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pcnt.h
new file mode 100644
index 0000000000..62c714506d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/pcnt.h
@@ -0,0 +1,214 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file pcnt.h
+ **
+ ** Headerfile for PCNT functions
+ ** @link PCNT Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-15 Devi First Version
+ **
+ ******************************************************************************/
+
+#ifndef __PCNT_H__
+#define __PCNT_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup PCNTGroup (PCNT)
+ **
+ ******************************************************************************/
+//@{
+
+/**
+ *******************************************************************************
+ ** function prototypes.
+ ******************************************************************************/
+/**
+ *******************************************************************************
+ ** \brief PCNT S1通道极性选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_pcnt_s1sel
+{
+ S1P_Noinvert = 0u, ///<<S1通道极性不取反
+ S1P_Invert = 1u, ///<<S1通道极性取反
+}en_pcnt_s1sel_t;
+
+/**
+ *******************************************************************************
+ ** \brief PCNT S0通道极性选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_pcnt_s0sel
+{
+ S0P_Noinvert = 0u, ///<<S0通道极性不取反
+ S0P_Invert = 1u, ///<<S0通道极性取反
+}en_pcnt_s0sel_t;
+
+/**
+ *******************************************************************************
+ ** \brief PCNT 计数方向选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_pcnt_direcsel
+{
+ Direct_Add = 0u, ///<<加计数
+ Direct_Sub = 1u, ///<<减计数
+}en_pcnt_direcsel_t;
+
+/**
+ *******************************************************************************
+ ** \brief PCNT 计数时钟选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_pcnt_clksel
+{
+ CLK_Pclk = 1u, ///<<PCLK
+ CLK_Xtl = 2u, ///<<XTL
+ CLK_Rcl = 3u, ///<<RCL
+}en_pcnt_clksel_t;
+
+/**
+ *******************************************************************************
+ ** \brief PCNT 脉冲计数模式选择
+ ** \note
+ ******************************************************************************/
+typedef enum en_pcnt_modesel
+{
+ Single_Mode = 1u, ///<<单通道脉冲计数模式
+ Special_Mode = 2u, ///<<双通道非正交脉冲计数模式
+ Double_Mode = 3u, ///<<双通道正交脉冲计数模式
+}en_pcnt_modesel_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCNT 状态
+ *****************************************************************************/
+typedef enum en_pcnt_status
+{
+ PCNT_S1E = 0x80, ///<S1通道脉冲解码错误
+ PCNT_S0E = 0x40, ///<S0通道脉冲解码错误
+ PCNT_BB = 0x20, ///<脉冲解码错误
+ PCNT_FE = 0x10, ///<采样周期脉冲解码错误
+ PCNT_DIR = 0x08, ///<反向改变中断
+ PCNT_TO = 0x04, ///<超时中断标识
+ PCNT_OV = 0x02, ///<上溢中断标识
+ PCNT_UF = 0x01, ///<下溢中断标识
+}en_pcnt_status_t;
+
+/**
+ ******************************************************************************
+ ** \brief PCNT 整体配置结构体
+ *****************************************************************************/
+typedef struct stc_pcnt_config
+{
+ en_pcnt_s1sel_t bS1Sel; ///< S1通道极性选择
+ en_pcnt_s0sel_t bS0Sel; ///< S0通道极性选择
+ en_pcnt_direcsel_t u8Direc; ///< 计数方向选择
+ en_pcnt_clksel_t u8Clk; ///< 计数时钟选择
+ en_pcnt_modesel_t u8Mode; ///< 脉冲计数模式选择
+ boolean_t bFLTEn; ///< 滤波控制使能
+ uint8_t u8FLTDep; ///< 滤波阀值
+ uint8_t u8FLTClk; ///< 滤波时钟
+ boolean_t bTOEn; ///< 超时使能
+ uint16_t u16TODep; ///< 超时阀值
+ uint8_t u8IrqStatus; ///< 中断方式
+ boolean_t bIrqEn; ///< 中断使能
+ func_ptr_t pfnIrqCb; ///< 中断回调函数
+}stc_pcnt_config_t;
+
+//PCNT 中断
+void Pcnt_IRQHandler(void);
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< PCNT初始化
+en_result_t PCNT_Init(stc_pcnt_config_t* pstcPcntConfig);
+///< PCNT去初始化
+void PCNT_DeInit(void);
+///< PCNT 参数设置
+en_result_t PCNT_Parameter(uint8_t start,uint8_t end);
+///< PCNT 读取PCNT 方向
+en_pcnt_direcsel_t PCNT_Direction(void);
+///< PCNT 读取PCNT 计数值
+uint16_t PCNT_Count(void);
+///< PCNT 读取PCNT 溢出值
+uint16_t PCNT_TopCount(void);
+///< PCNT 设置PCNT
+void PCNT_Run(boolean_t work);
+///< PCNT获取状态
+boolean_t PCNT_GetStatus(en_pcnt_status_t enStatus);
+///< PCNT清除状态
+void PCNT_ClrStatus(en_pcnt_status_t enStatus);
+///< PCNT设置中断
+void PCNT_SetIrqStatus(en_pcnt_status_t enStatus);
+
+
+//@} // PCNT Group
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __PCNT_H__ */
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/reset.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/reset.h
new file mode 100644
index 0000000000..804d301e60
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/reset.h
@@ -0,0 +1,166 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file reset.h
+ **
+ ** Headerfile for reset functions
+ **
+ **
+ ** History:
+ ** - 2018-04-21 Lux First Version
+ **
+ ******************************************************************************/
+
+#ifndef __RESET_H__
+#define __RESET_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup ResetGroup Reset (RST)
+ **
+ ******************************************************************************/
+//@{
+
+/**
+ *******************************************************************************
+ ** function prototypes.
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+
+/**
+ *******************************************************************************
+ ** \brief 外设复位控制类型定义
+ ** \note
+ ******************************************************************************/
+typedef enum
+{
+ ResetUart0 = 0x00000001u, ///< 串口0
+ ResetUart1 = 0x00000002u, ///< 串口1
+ ResetLpUart0 = 0x00000004u, ///< 低功耗串口0
+ ResetLpUart1 = 0x00000008u, ///< 低功耗串口1
+ ResetI2c0 = 0x00000010u, ///< I2C0
+ ResetI2c1 = 0x00000020u, ///< I2C1
+ ResetSpi0 = 0x00000040u, ///< SPI0
+ ResetSpi1 = 0x00000080u, ///< SPI1
+ ResetBaseTim = 0x00000100u, ///< BASETIM
+ ResetLpTim = 0x00000200u, ///< LPTIM
+ ResetAdvTim = 0x00000400u, ///< ADVTIM
+ ResetTim3 = 0x00000800u, ///< TIM3
+ ResetOpa = 0x00002000u, ///< OPA
+ ResetPca = 0x00004000u, ///< PCA
+ ResetAdc = 0x00010000u, ///< ADC
+ ResetVc = 0x00020000u, ///< VC
+ ResetRng = 0x00040000u, ///< RNG
+ ResetPcnt = 0x00080000u, ///< PCNT
+ ResetRtc = 0x00100000u, ///< RTC
+ ResetTrim = 0x00200000u, ///< TRIM
+ ResetLcd = 0x00400000u, ///< LCD
+ ResetTick = 0x01000000u, ///< TICK
+ ResetSwd = 0x02000000u, ///< SWD
+ ResetCrc = 0x04000000u, ///< CRC
+ ResetAes = 0x08000000u, ///< AES
+ ResetGpio = 0x10000000u, ///< GPIO
+ ResetDma = 0x20000000u, ///< DMA
+ ResetDiv = 0x40000000u, ///< DIV
+}en_reset_peripheral_t;
+
+
+
+/**
+ *******************************************************************************
+ ** \brief 复位源(标识)显示
+ **
+ ** \note
+ ******************************************************************************/
+typedef struct
+{
+ uint8_t u8Por5V :1; ///< 5V启动复位
+ uint8_t u8Por1_5V :1; ///< 1.5V启动复位
+ uint8_t u8Lvd :1; ///< 低电压检测复位
+ uint8_t u8Wdt :1; ///< 看门狗复位
+ uint8_t u8Pca :1; ///< PCA复位
+ uint8_t u8Lockup :1; ///< 系统异常复位
+ uint8_t u8Sysreq :1; ///< 软件复位
+ uint8_t u8RSTB :1; ///< RESET脚 复位
+}stc_reset_cause_t;
+
+/*******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< 获得复位源
+en_result_t Reset_GetCause(stc_reset_cause_t *pstcOut);
+///< 清除复位源
+en_result_t Reset_Clear(stc_reset_cause_t stcval);
+///< 外设模块复位控制
+en_result_t Reset_SetPeripheralReset(en_reset_peripheral_t enPeri,boolean_t bFlag);
+
+//@} // ResetGroup
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __RESET_H__ */
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rng.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rng.h
new file mode 100644
index 0000000000..06090fc832
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rng.h
@@ -0,0 +1,108 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file rng.h
+ **
+ ** Headerfile for RNG functions
+ ** @link RNG Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-15 Lux First Version
+ **
+ ******************************************************************************/
+
+#ifndef __RNG_H__
+#define __RNG_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup RngGroup (RNG)
+ **
+ ******************************************************************************/
+//@{
+
+/**
+ *******************************************************************************
+ ** function prototypes.
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< 随机数初始化(上电第一次生成随机数)
+en_result_t Rng_Init(void);
+///< 生成随机数(非上电第一次生成随机数)
+en_result_t Rng_Generate(void);
+///< 获取64bits随机数(执行随机数初始化或生成随机数函数后可使用该函数获取随机数值)
+uint32_t Rng_GetData0(void);
+uint32_t Rng_GetData1(void);
+
+//@} // Rng Group
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __RNG_H__ */
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rtc.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rtc.h
new file mode 100644
index 0000000000..4022c635d7
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/rtc.h
@@ -0,0 +1,298 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file rtc.h
+ **
+ ** Headerfile for RTC functions
+ **
+ **
+ ** History:
+ ** - 2017-05-10 Cathy First Version
+ **
+ *****************************************************************************/
+
+#ifndef __RTC_H__
+#define __RTC_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup RtcGroup Real Time Clock (RTC)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+/**
+ ******************************************************************************
+ ** \brief rtc时钟源选择
+ *****************************************************************************/
+typedef enum en_rtc_clk
+{
+ RtcClk32768 = 0u, ///<外部32.768k
+ RtcClk32768_1 = 1u, ///<外部32.768k
+ RtcClk32 = 2u, ///<内部RC32
+ RtcClk32_1 = 3u, ///<内部RC32
+ RtcClkHxt128 = 4u, ///<外部晶振4M
+ RtcClkHxt256 = 5u, ///<外部晶振8M
+ RtcClkHxt512 = 6u, ///<外部晶振16M
+ RtcClkHxt1024 = 7u, ///<外部晶振32M
+}en_rtc_clk_t;
+/**
+ ******************************************************************************
+ ** \brief rtc周期中断方式选择
+ *****************************************************************************/
+typedef enum en_rtc_cyc
+{
+ RtcPrads = 0u, ///<月、天、时分秒
+ RtcPradx = 1u, ///<step 0.5s
+}en_rtc_cyc_t;
+/**
+ ******************************************************************************
+ ** \brief rtc 12h制或24h制方式选择
+ *****************************************************************************/
+typedef enum en_rtc_ampm
+{
+ Rtc12h = 0u, ///<12h
+ Rtc24h = 1u, ///<24h
+}en_rtc_ampm_t;
+/**
+ ******************************************************************************
+ ** \brief prds中断周期
+ *****************************************************************************/
+typedef enum en_rtc_cycprds
+{
+ Rtc_None = 0u, ///<无周期中断
+ Rtc_05S = 1u, ///<0.5S中断
+ Rtc_1S = 2u, ///<1s
+ Rtc_1Min = 3u, ///<1min
+ Rtc_1H = 4u, ///<1h
+ Rtc_1Day = 5u, ///<1d
+ Rtc_1Mon = 6u, ///<1月
+ Rtc_1Mon_1 = 7u, ///<1月
+}en_rtc_cycprds_t;
+/**
+ ******************************************************************************
+ ** \brief rtc周期中断总配置
+ *****************************************************************************/
+typedef struct stc_rtc_cyc_sel
+{
+ en_rtc_cyc_t enCyc_sel; ///<周期类型配置
+ en_rtc_cycprds_t enPrds_sel;///<周期配置
+ uint8_t u8Prdx;
+}stc_rtc_cyc_sel_t;
+/**
+ ******************************************************************************
+ ** \brief 闹钟源配置
+ *****************************************************************************/
+typedef struct stc_rtc_alarmset
+{
+ uint8_t u8Minute; ///<闹钟分钟
+ uint8_t u8Hour; ///<闹钟小时
+ uint8_t u8Week; ///<闹钟周
+}stc_rtc_alarmset_t;
+/**
+ ******************************************************************************
+ ** \brief 闹钟中断使能设置
+ *****************************************************************************/
+typedef enum en_rtc_alarmirq
+{
+ Rtc_AlarmInt_Disable = 0u,///<闹钟中断禁止
+ Rtc_AlarmInt_Enable = 1u,///<闹钟中断使能
+}en_rtc_alarmirq_t;
+
+/**
+ ******************************************************************************
+ ** \brief rtc 1hz补偿功能开启设置
+ *****************************************************************************/
+typedef enum en_rtc_compen_en
+{
+ Rtc_Comp_Disable = 0u,///<时钟补偿禁止
+ Rtc_Comp_Enable = 1u,///<时钟补偿使能
+}en_rtc_compen_en_t;
+/**
+ ******************************************************************************
+ ** \brief rtc计数功能使能设置
+ *****************************************************************************/
+typedef enum en_rtc_count_en
+{
+ Rtc_Count_Disable = 0u,///<计数禁止
+ Rtc_Count_Enable = 1u,///<计数使能
+}en_rtc_count_en_t;
+/**
+ ******************************************************************************
+ ** \brief rtc计数模式还是读写模式状态
+ *****************************************************************************/
+typedef enum en_rtc_status
+{
+ RtcRunStatus = 0u, ///<计数状态
+ RtcRdWStatus = 1u, ///<读写状态
+}en_rtc_status_t;
+/**
+ ******************************************************************************
+ ** \brief rtc 中断请求标志
+ *****************************************************************************/
+typedef enum en_rtc_status_irq
+{
+ RtcAlmf = 0u, ///<闹钟中断请求
+ RtcPrdf = 1u, ///<周期中断请求
+}en_rtc_status_irq_t;
+/**
+ ******************************************************************************
+ ** \brief rtc时钟年、月、日、时、分、秒读写结构
+ *****************************************************************************/
+typedef struct stc_rtc_time
+{
+ uint8_t u8Second; ///<秒
+ uint8_t u8Minute; ///<分
+ uint8_t u8Hour; ///<时
+ uint8_t u8DayOfWeek; ///<周
+ uint8_t u8Day; ///<日
+ uint8_t u8Month; ///<月
+ uint8_t u8Year; ///<年
+} stc_rtc_time_t;
+/**
+ ******************************************************************************
+ ** \brief rtc功能描述
+ ******************************************************************************/
+typedef enum en_rtc_func
+{
+ RtcCount = 0u, ///< RTC计数使能
+ RtcAlarmEn = 1u, ///< RTC闹钟使能
+ Rtc_ComenEn = 2u, ///<RTC补偿使能
+ Rtc1HzOutEn = 3u, ///<使能1hz输出
+}en_rtc_func_t;
+/**
+ ******************************************************************************
+ ** \brief rtc 闹钟及周期中断处理函数
+ *****************************************************************************/
+typedef struct stc_rtc_irq_cb
+{
+ func_ptr_t pfnAlarmIrqCb; ///<闹钟中断服务函数
+ func_ptr_t pfnTimerIrqCb; ///<周期中断服务函数
+}stc_rtc_irq_cb_t, stc_rtc_intern_cb_t;
+/**
+ ******************************************************************************
+ ** \brief rtc 总体配置结构体
+ *****************************************************************************/
+typedef struct stc_rtc_config
+{
+ en_rtc_clk_t enClkSel; ///<时钟源配置
+ en_rtc_ampm_t enAmpmSel; ///<时制配置
+ stc_rtc_cyc_sel_t* pstcCycSel; ///<周期配置
+ stc_rtc_time_t* pstcTimeDate; ///<时间日期初值配置
+ stc_rtc_irq_cb_t* pstcIrqCb; ///<中断服务函数
+ boolean_t bTouchNvic; ///<NVIC中断配置
+} stc_rtc_config_t;
+
+//rtc 计数时钟源选择
+en_result_t Rtc_SelClk(en_rtc_clk_t enClk);
+//rtc 计数周期设置
+en_result_t Rtc_SetCyc(stc_rtc_cyc_sel_t* pstcCyc);
+//rtc ampm模式设置
+en_result_t Rtc_SetAmPm(en_rtc_ampm_t enMode);
+//rtc时制模式获取
+boolean_t Rtc_GetHourMode(void);
+//rtc 闹钟相关配置
+en_result_t Rtc_SetAlarmTime(stc_rtc_alarmset_t* pstcAlarmTime);
+en_result_t Rtc_GetAlarmTime(stc_rtc_alarmset_t* pstcAlarmTime);
+//1hz 输出模式及补偿值设置
+en_result_t Rtc_Set1HzMode(boolean_t bMode);
+en_result_t Rtc_SetCompCr(uint16_t u16Cr);
+//周计算
+uint8_t Rtc_CalWeek(uint8_t* pu8Date);
+//判断是否闰年
+uint8_t Rtc_CheckLeapYear(uint8_t u8year);
+//12时制上午或下午读取
+boolean_t Rtc_RDAmPm(void);
+//rtc 读写时间计数器
+en_result_t Rtc_WriteDateTime(stc_rtc_time_t* pstcTimeDate,boolean_t bUpdateTime,
+ boolean_t bUpdateDate);
+en_result_t Rtc_ReadDateTime(stc_rtc_time_t* pstcTimeDate);
+//格式转换函数
+uint8_t Change_DateTimeFormat(uint8_t u8sr);
+//时间格式检查函数
+en_result_t Rtc_CheckDateTimeFormat(uint8_t* pu8TimeDate,uint8_t u8Mode);
+//数据大小判断函数
+en_result_t Check_BCD_Format(uint8_t u8data, uint8_t u8limit_min, uint8_t u8limit_max);
+//获取某年某月最大天数
+uint8_t Get_Month_Max_Day(uint8_t u8month, uint8_t u8year);
+//rtc 读取当前状态(读写状态或计数状态),中断请求状态、中断清除状态
+en_result_t Rtc_EnAlarmIrq(en_rtc_alarmirq_t enIrqEn);
+boolean_t Rtc_RDStatus(void);
+boolean_t Rtc_GetIrqStatus(en_rtc_status_irq_t enIrqSel);
+en_result_t Rtc_ClrIrqStatus(en_rtc_status_irq_t enIrqSel);
+
+//rtc功能使能禁止函数
+en_result_t Rtc_EnableFunc(en_rtc_func_t enFunc);
+en_result_t Rtc_DisableFunc(en_rtc_func_t enFunc);
+//rtc初始化、禁止函数
+en_result_t Rtc_Init(stc_rtc_config_t* pstcRtcConfig);
+en_result_t Rtc_DeInit(void);
+
+//@} // RtcGroup
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __RTC_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/spi.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/spi.h
new file mode 100644
index 0000000000..8fb0a64f06
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/spi.h
@@ -0,0 +1,212 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED , ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file spi.h
+ **
+ ** Headerfile for SPI functions
+ **
+ **
+ ** History:
+ ** - 2017-05-17 1.0 Devi First Version
+ **
+ *****************************************************************************/
+#ifndef __SPI_H__
+#define __SPI_H__
+
+/******************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ *****************************************************************************/
+ /**
+ ******************************************************************************
+ ** \brief SPI 功能通道选择设置
+ ******************************************************************************/
+typedef enum en_spi_channel
+{
+ Spi0 = 0u, ///< SPI通道0
+ Spi1 = 1u, ///< SPI通道1
+}en_spi_channel_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 功能使能设置
+ ******************************************************************************/
+typedef enum en_spi_en
+{
+ SpiEnable = 1u, ///< SPI模块使能
+ SpiDisable = 0u, ///< SPI模块禁止
+}en_spi_en_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 模式配置
+ ******************************************************************************/
+typedef enum en_spi_mode
+{
+ SpiMaster = 1u, ///<主机
+ SpiSlave = 0u, ///<从机
+}en_spi_mode_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 时钟极性设置
+ ******************************************************************************/
+typedef enum en_spi_cpol
+{
+ Spicpollow = 0u, ///<极性为低
+ Spicpolhigh = 1u, ///<极性为高
+}en_spi_cpol_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 时钟相位设置
+ ******************************************************************************/
+typedef enum en_spi_cpha
+{
+ Spicphafirst = 0u, ///<第一边沿采样
+ Spicphasecond = 1u, ///<第二边沿采样
+}en_spi_cpha_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 时钟分频配置
+ *****************************************************************************/
+typedef enum en_spi_clk_div
+{
+ SpiClkDiv2 = 0u, ///<2分频
+ SpiClkDiv4 = 1u, ///<4分频
+ SpiClkDiv8 = 2u, ///<8分频
+ SpiClkDiv16 = 3u, ///<16分频
+ SpiClkDiv32 = 4u, ///<32分频
+ SpiClkDiv64 = 5u, ///<64分频
+ SpiClkDiv128 = 6u, ///<128分频
+}en_spi_clk_div_t;
+
+/**
+ ******************************************************************************
+ ** \brief SPI 片选脚电平选择
+ *****************************************************************************/
+typedef enum en_spi_cspin
+{
+ SpiCsLow = 0u, ///<片选低电平
+ SpiCsHigh = 1u, ///<片选高电平
+}en_spi_cspin_t;
+
+/**
+ ******************************************************************************
+ ** \brief SPI 状态
+ *****************************************************************************/
+typedef enum en_spi_status
+{
+ SpiIf = 0x80, ///<传输结束中断标志
+ SpiSserr = 0x20, ///<从机模式错误标志
+ SpiMdf = 0x10, ///<主机模式错误标志
+ SpiBusy = 0x08, ///<SPI总线忙标志
+ SpiTxe = 0x04, ///<发送缓冲器器空标志
+ SpiRxne = 0x02, ///<接受缓冲器非空标志
+}en_spi_status_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 功能开启函数
+ *****************************************************************************/
+typedef enum en_spi_func
+{
+ SpiRxNeIe = 0x40, ///<接收缓冲器非空中断使能
+ SpiTxEIe = 0x20, ///<发送缓冲器空中断使能
+ SpiDmaTxEn = 0x10, ///<DMA硬件访问发送使能
+ SpiDmaRxEn = 0x08, ///<DMA硬件访问接收使能
+}en_spi_func_t;
+/**
+ ******************************************************************************
+ ** \brief SPI 总体配置结构体
+ *****************************************************************************/
+typedef struct stc_spi_config
+{
+ boolean_t bMasterMode; ///< 主从模式选择
+ uint8_t u8BaudRate; ///< 波特率设置
+ boolean_t bCPOL; ///< 时钟极性选择
+ boolean_t bCPHA; ///< 时钟相位选择
+ boolean_t bIrqEn; ///< 中断使能
+ func_ptr_t pfnSpi0IrqCb; ///< 中断回调函数
+ func_ptr_t pfnSpi1IrqCb; ///< 中断回调函数
+}stc_spi_config_t;
+
+//SPI 中断
+void Spi_IRQHandler(en_spi_channel_t enCh);
+
+//SPI 获取状态
+uint8_t Spi_GetState(en_spi_channel_t enCh);
+boolean_t Spi_GetStatus(en_spi_channel_t enCh,en_spi_status_t enStatus);
+//SPI 清除中断标记
+en_result_t Spi_ClearStatus(en_spi_channel_t enCh);
+//SPI初始化函数
+en_result_t Spi_Init(en_spi_channel_t enCh,stc_spi_config_t* pstcSpiConfig);
+//SPI 功能使能禁止函数
+en_result_t Spi_FuncEn(en_spi_channel_t enCh,en_spi_func_t enFunc,boolean_t bFlag);
+//SPI关闭函数
+en_result_t Spi_DeInit(en_spi_channel_t enCh);
+//SPI 配置主发送的电平
+void Spi_SetCS(en_spi_channel_t enCh,boolean_t bFlag);
+//SPI 发送数据
+en_result_t Spi_SendData(en_spi_channel_t enCh,uint8_t u8Data);
+//SPI 主机接收数据
+uint8_t Spi_ReceiveData(en_spi_channel_t enCh,boolean_t bMasterOrSlave);
+
+//@} // Spi Group
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SPI_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/sysctrl.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/sysctrl.h
new file mode 100644
index 0000000000..59c063d8c0
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/sysctrl.h
@@ -0,0 +1,457 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file sysctrl.h
+ **
+ ** Headerfile for SYSCTRL functions
+ ** @link SYSCTRL Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-15 Lux First Version
+ **
+ ******************************************************************************/
+
+#ifndef __SYSCTRL_H__
+#define __SYSCTRL_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup SysCtrlGroup (SYSCTRL)
+ **
+ ******************************************************************************/
+//@{
+
+/**
+ *******************************************************************************
+ ** function prototypes.
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+#define SYSTEM_XTH 32*1000*1000u //默认32MHz,具体值应根据实际系统修改
+#define SYSTEM_XTL 32768u //默认32768Hz,具体值应根据实际系统修改
+
+/**
+ *******************************************************************************
+ ** \brief 系统时钟输入源类型定义
+ ** \note
+ ******************************************************************************/
+typedef enum en_sysctrl_clk_source
+{
+ SysctrlClkRCH = 0u, ///< 内部高速时钟
+ SysctrlClkXTH = 1u, ///< 外部高速时钟
+ SysctrlClkRCL = 2u, ///< 内部低速时钟
+ SysctrlClkXTL = 3u, ///< 外部低速时钟
+ SysctrlClkPLL = 4u, ///< PLL时钟
+}en_sysctrl_clk_source_t;
+
+/**
+ *******************************************************************************
+ ** \brief RCH频率值枚举类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_rch_freq
+{
+ SysctrlRchFreq4MHz = 0u, ///< 4MHz
+ SysctrlRchFreq8MHz = 1u, ///< 8MHz
+ SysctrlRchFreq16MHz = 2u, ///< 16MHz
+ SysctrlRchFreq22_12MHz = 3u, ///< 22.12MHz
+ SysctrlRchFreq24MHz = 4u, ///< 24MHz
+}en_sysctrl_rch_freq_t;
+
+/**
+ *******************************************************************************
+ ** \brief XTAL驱动能力类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_xtal_driver
+{
+ SysctrlXtalDriver0 = 0u, ///< 最弱驱动能力
+ SysctrlXtalDriver1 = 1u, ///< 弱驱动能力
+ SysctrlXtalDriver2 = 3u, ///< 一般驱动能力
+ SysctrlXtalDriver3 = 3u, ///< 最强驱动能力
+}en_sysctrl_xtal_driver_t;
+
+/**
+ *******************************************************************************
+ ** \brief XTH频率值范围选择类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_xth_freq
+{
+ SysctrlXthFreq4_6MHz = 0u, ///< 4~6MHz
+ SysctrlXthFreq6_12MHz = 1u, ///< 6~12MHz
+ SysctrlXthFreq12_20MHz = 2u, ///< 12~20MHz
+ SysctrlXthFreq20_32MHz = 3u, ///< 20~32MHz
+}en_sysctrl_xth_freq_t;
+
+/**
+ *******************************************************************************
+ ** \brief XTH时钟稳定周期数类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_xth_cycle
+{
+ SysctrlXthStableCycle256 = 0u, ///< 256 个周期数
+ SysctrlXthStableCycle1024 = 1u, ///< 1024 个周期数
+ SysctrlXthStableCycle4096 = 2u, ///< 4096 个周期数
+ SysctrlXthStableCycle16384 = 3u, ///< 16384 个周期数
+}en_sysctrl_xth_cycle_t;
+
+/**
+ *******************************************************************************
+ ** \brief RCL频率值枚举类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_rcl_freq
+{
+ SysctrlRclFreq32768 = 0u, ///< 32.768KHz
+ SysctrlRclFreq38400 = 1u, ///< 38.4KHz
+}en_sysctrl_rcl_freq_t;
+
+/**
+ *******************************************************************************
+ ** \brief RCL时钟稳定周期数类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_rcl_cycle
+{
+ SysctrlRclStableCycle4 = 0u, ///< 4 个周期数
+ SysctrlRclStableCycle16 = 1u, ///< 16 个周期数
+ SysctrlRclStableCycle64 = 2u, ///< 64 个周期数
+ SysctrlRclStableCycle256 = 3u, ///< 256 个周期数
+}en_sysctrl_rcl_cycle_t;
+
+/**
+ *******************************************************************************
+ ** \brief XTL时钟稳定周期数类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_xtl_cycle
+{
+ SysctrlXtlStableCycle256 = 0u, ///< 256 个周期数
+ SysctrlXtlStableCycle1024 = 1u, ///< 1024 个周期数
+ SysctrlXtlStableCycle4096 = 2u, ///< 4096 个周期数
+ SysctrlXtlStableCycle16384 = 3u, ///< 16384 个周期数
+}en_sysctrl_xtl_cycle_t;
+
+/**
+ *******************************************************************************
+ ** \brief XTL晶体振幅枚举类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_xtl_amp
+{
+ SysctrlXtlAmp0 = 0u, ///< 最小振幅
+ SysctrlXtlAmp1 = 1u, ///< 小振幅
+ SysctrlXtlAmp2 = 2u, ///< 一般振幅
+ SysctrlXtlAmp3 = 3u, ///< 最大振幅
+}en_sysctrl_xtl_amp_t;
+
+/**
+ *******************************************************************************
+ ** \brief PLL时钟稳定周期数类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_pll_cycle
+{
+ SysctrlPllStableCycle128 = 0u, ///< 128个周期数
+ SysctrlPllStableCycle256 = 1u, ///< 256个周期数
+ SysctrlPllStableCycle512 = 2u, ///< 512个周期数
+ SysctrlPllStableCycle1024 = 3u, ///< 1024个周期数
+ SysctrlPllStableCycle2048 = 4u, ///< 2048个周期数
+ SysctrlPllStableCycle4096 = 5u, ///< 4096个周期数
+ SysctrlPllStableCycle8192 = 6u, ///< 8192个周期数
+ SysctrlPllStableCycle16384 = 7u, ///< 16384个周期数
+}en_sysctrl_pll_cycle_t;
+
+/**
+ *******************************************************************************
+ ** \brief PLL输入频率范围类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_pll_infreq
+{
+ SysctrlPllInFreq4_6MHz = 0u, ///< 4~16MHz
+ SysctrlPllInFreq6_12MHz = 1u, ///< 6~12MHz
+ SysctrlPllInFreq12_20MHz = 2u, ///< 12~20MHz
+ SysctrlPllInFreq20_24MHz = 3u, ///< 20~24MHz
+}en_sysctrl_pll_infreq_t;
+
+/**
+ *******************************************************************************
+ ** \brief PLL输出频率范围类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_pll_outfreq
+{
+ SysctrlPllOutFreq8_12MHz = 0u, ///< 8~12MHz
+ SysctrlPllOutFreq12_18MHz = 1u, ///< 12~18MHz
+ SysctrlPllOutFreq18_24MHz = 2u, ///< 18~24MHz
+ SysctrlPllOutFreq24_36MHz = 3u, ///< 24~36MHz
+ SysctrlPllOutFreq36_48MHz = 4u, ///< 36~48MHz
+}en_sysctrl_pll_outfreq_t;
+
+/**
+ *******************************************************************************
+ ** \brief PLL输入时钟源类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_pll_clksource
+{
+ SysctrlPllXthXtal = 0u, ///< XTH晶振输入的时钟
+ SysctrlPllXthPd00In = 2u, ///< XTH从端口PD00输入的时钟
+ SysctrlPllRch = 3u, ///< RCH时钟
+}en_sysctrl_pll_clksource_t;
+
+/**
+ *******************************************************************************
+ ** \brief PLL输入时钟源类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_pll_mul
+{
+ SysctrlPllMul1 = 1u, ///< 1倍频
+ SysctrlPllMul2 = 2u, ///< 2倍频
+ SysctrlPllMul3 = 3u, ///< 3倍频
+ SysctrlPllMul4 = 4u, ///< 4倍频
+ SysctrlPllMul5 = 5u, ///< 5倍频
+ SysctrlPllMul6 = 6u, ///< 6倍频
+ SysctrlPllMul7 = 7u, ///< 7倍频
+ SysctrlPllMul8 = 8u, ///< 8倍频
+ SysctrlPllMul9 = 9u, ///< 9倍频
+ SysctrlPllMul10 = 10u, ///< 10倍频
+ SysctrlPllMul11 = 11u, ///< 11倍频
+ SysctrlPllMul12 = 12u, ///< 12倍频
+}en_sysctrl_pll_mul_t;
+
+/**
+ *******************************************************************************
+ ** \brief HCLK时钟分频系数类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_hclk_div
+{
+ SysctrlHclkDiv1 = 0u, ///< SystemClk
+ SysctrlHclkDiv2 = 1u, ///< SystemClk/2
+ SysctrlHclkDiv4 = 2u, ///< SystemClk/4
+ SysctrlHclkDiv8 = 3u, ///< SystemClk/8
+ SysctrlHclkDiv16 = 4u, ///< SystemClk/16
+ SysctrlHclkDiv32 = 5u, ///< SystemClk/32
+ SysctrlHclkDiv64 = 6u, ///< SystemClk/64
+ SysctrlHclkDiv128 = 7u, ///< SystemClk/128
+}en_sysctrl_hclk_div_t;
+
+/**
+ *******************************************************************************
+ ** \brief PCLK分频系数
+ ******************************************************************************/
+typedef enum en_sysctrl_pclk_div
+{
+ SysctrlPclkDiv1 = 0u, ///< HCLK
+ SysctrlPclkDiv2 = 1u, ///< HCLK/2
+ SysctrlPclkDiv4 = 2u, ///< HCLK/4
+ SysctrlPclkDiv8 = 3u, ///< HCLK/8
+}en_sysctrl_pclk_div_t;
+
+/**
+ *******************************************************************************
+ ** \brief RTC高速时钟补偿时钟频率数据类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_rtc_adjust
+{
+ SysctrlRTC4MHz = 0u, ///< 4MHz
+ SysctrlRTC6MHz = 1u, ///< 6MHz
+ SysctrlRTC8MHz = 2u, ///< 8MHz
+ SysctrlRTC12MHz = 3u, ///< 12MHz
+ SysctrlRTC16MHz = 4u, ///< 16MHz
+ SysctrlRTC20MHz = 5u, ///< 20MHz
+ SysctrlRTC24MHz = 6u, ///< 24MHz
+ SysctrlRTC32MHz = 7u, ///< 32MHz
+}en_sysctrl_rtc_adjust_t;
+
+/**
+ *******************************************************************************
+ ** \brief 系统控制模块其他功能数据类型定义
+ ******************************************************************************/
+typedef enum en_sysctrl_func
+{
+ SysctrlWkupByRCHEn =0u, ///< 唤醒时使用RCH时钟
+ SysctrlEXTHEn =1u, ///< 使能外部高速时钟从输入引脚PD00输入
+ SysctrlEXTLEn =2u, ///< 使能外部低速速时钟从输入引脚PC14输入
+ SysctrlXTLAlwaysOnEn =3u, ///< 使能后XTL_EN只可置位
+ SysctrlClkFuncRTCLpmEn =4u, ///< 使能RTC低功耗模式
+ SysctrlCMLockUpEn =5u, ///< 使能后CPU执行无效指令会复位MCU
+ SysctrlSWDUseIOEn =6u, ///< SWD端口设为IO功能
+}en_sysctrl_func_t;
+
+/**
+ *******************************************************************************
+ ** \brief 外设时钟门控开关类型枚举
+ ******************************************************************************/
+typedef enum en_sysctrl_peripheral_gate
+{
+ SysctrlPeripheralUart0 = 0u, ///< 串口0
+ SysctrlPeripheralUart1 = 1u, ///< 串口1
+ SysctrlPeripheralLpUart0 = 2u, ///< 低功耗串口0
+ SysctrlPeripheralLpUart1 = 3u, ///< 低功耗串口1
+ SysctrlPeripheralI2c0 = 4u, ///< I2C0
+ SysctrlPeripheralI2c1 = 5u, ///< I2C1
+ SysctrlPeripheralSpi0 = 6u, ///< SPI0
+ SysctrlPeripheralSpi1 = 7u, ///< SPI1
+ SysctrlPeripheralBTim = 8u, ///< 基础定时器
+ SysctrlPeripheralLpTim = 9u, ///< 低功耗定时器
+ SysctrlPeripheralAdvTim = 10u, ///< 高级定时器
+ SysctrlPeripheralTim3 = 11u, ///< 定时器3
+ SysctrlPeripheralOpa = 13u, ///< OPA
+ SysctrlPeripheralPca = 14u, ///< 可编程计数阵列
+ SysctrlPeripheralWdt = 15u, ///< 看门狗
+ SysctrlPeripheralAdcBgr = 16u, ///< ADC&BGR
+ SysctrlPeripheralVcLvd = 17u, ///< 电压比较和低电压检测
+ SysctrlPeripheralRng = 18u, ///< RNG
+ SysctrlPeripheralPcnt = 19u, ///< PCNT
+ SysctrlPeripheralRtc = 20u, ///< RTC
+ SysctrlPeripheralTrim = 21u, ///< 时钟校准
+ SysctrlPeripheralLcd = 22u, ///< LCD
+ SysctrlPeripheralTick = 24u, ///< 系统定时器
+ SysctrlPeripheralSwd = 25u, ///< SWD
+ SysctrlPeripheralCrc = 26u, ///< CRC
+ SysctrlPeripheralAes = 27u, ///< AES
+ SysctrlPeripheralGpio = 28u, ///< GPIO
+ SysctrlPeripheralDma = 29u, ///< DMA
+ SysctrlPeripheralDiv = 30u, ///< 除法器
+ SysctrlPeripheralFlash = 31u, ///< Flash
+}en_sysctrl_peripheral_gate_t;
+
+/**
+ *******************************************************************************
+ ** \brief 时钟初始化配置结构体定义
+ ******************************************************************************/
+typedef struct
+{
+ en_sysctrl_clk_source_t enClkSrc; ///< 时钟源选择
+ en_sysctrl_hclk_div_t enHClkDiv; ///< HCLK分频系数
+ en_sysctrl_pclk_div_t enPClkDiv; ///< PCLK分频系数
+}stc_sysctrl_clk_config_t;
+
+/**
+ *******************************************************************************
+ ** \brief 时钟初始化配置结构体定义
+ ******************************************************************************/
+typedef struct
+{
+ en_sysctrl_pll_infreq_t enInFreq; ///< PLL输入时钟频率范围选择
+ en_sysctrl_pll_outfreq_t enOutFreq; ///< PLL输出时钟频率范围选择
+ en_sysctrl_pll_clksource_t enPllClkSrc; ///< PLL输入时钟源选择
+ en_sysctrl_pll_mul_t enPllMul; ///< PLL倍频系数选择
+}stc_sysctrl_pll_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+///< 系统时钟初始化API:用于上电后,系统工作之前对主频及外设时钟进行初始化;
+///< 注意1:使用该初始化函数前需要根据系统,必须优先设置目标内部时钟源的TRIM值或外部时钟源的频率范围,
+///< 注意2:XTH、XTL的频率范围设定,需要根据外部晶振决定,
+///< 注意3:本驱动默认宏定义:SYSTEM_XTH=32MHz,SYSTEM_XTL=32768Hz,如使用其它外部晶振,必须修改这两个宏定义的值。
+en_result_t Sysctrl_ClkInit(stc_sysctrl_clk_config_t *pstcCfg);
+
+///< 系统时钟去初始化API:恢复为上电默认状态->PCLK=HCLK=SystemClk=RCH4MHz
+en_result_t Sysctrl_ClkDeInit(void);
+
+///< 系统时钟模块的基本功能设置
+///< 注意:使能需要使用的时钟源之前,必须优先设置目标内部时钟源的TRIM值或外部时钟源的频率范围
+en_result_t Sysctrl_ClkSourceEnable(en_sysctrl_clk_source_t enSource, boolean_t bFlag);
+
+///<外部晶振驱动配置:系统初始化Sysctrl_ClkInit()之后,可根据需要配置外部晶振的驱动能力,时钟初始化Sysctrl_ClkInit()默认为最大值;
+en_result_t Sysctrl_XTHDriverConfig(en_sysctrl_xtal_driver_t enDriver);
+en_result_t Sysctrl_XTLDriverConfig(en_sysctrl_xtl_amp_t enAmp, en_sysctrl_xtal_driver_t enDriver);
+
+///<时钟稳定周期设置:系统初始化Sysctrl_ClkInit()之后,可根据需要配置时钟开启后的稳定之间,默认为最大值;
+en_result_t Sysctrl_SetXTHStableTime(en_sysctrl_xth_cycle_t enCycle);
+en_result_t Sysctrl_SetRCLStableTime(en_sysctrl_rcl_cycle_t enCycle);
+en_result_t Sysctrl_SetXTLStableTime(en_sysctrl_xtl_cycle_t enCycle);
+en_result_t Sysctrl_SetPLLStableTime(en_sysctrl_pll_cycle_t enCycle);
+
+///<系统时钟源切换并更新系统时钟:如果需要在系统时钟初始化Sysctrl_ClkInit()之后切换主频时钟源,则使用该函数;
+///< 时钟切换前后,必须根据目标频率值设置Flash读等待周期,可配置插入周期为0、1、2,
+///< 注意!!!:当HCLK大于24MHz时,FLASH等待周期插入必须至少为1,否则程序运行可能产生未知错误
+en_result_t Sysctrl_SysClkSwitch(en_sysctrl_clk_source_t enSource);
+
+///< 时钟源频率设定:根据系统情况,单独设置不同时钟源的频率值;
+///< 时钟频率设置前,必须根据目标频率值设置Flash读等待周期,可配置插入周期为0、1、2,
+///< 其中XTL的时钟由外部晶振决定,无需设置。
+en_result_t Sysctrl_SetRCHTrim(en_sysctrl_rch_freq_t enRCHFreq);
+en_result_t Sysctrl_SetRCLTrim(en_sysctrl_rcl_freq_t enRCLFreq);
+en_result_t Sysctrl_SetXTHFreq(en_sysctrl_xth_freq_t enXTHFreq);
+en_result_t Sysctrl_SetPLLFreq(stc_sysctrl_pll_config_t *pstcPLLCfg);
+
+///< 时钟分频设置:根据系统情况,单独设置HCLK、PCLK的分配值;
+en_result_t Sysctrl_SetHCLKDiv(en_sysctrl_hclk_div_t enHCLKDiv);
+en_result_t Sysctrl_SetPCLKDiv(en_sysctrl_pclk_div_t enPCLKDiv);
+
+///< 时钟频率获取:根据系统需要,获取当前HCLK及PCLK的频率值
+uint32_t Sysctrl_GetHClkFreq(void);
+uint32_t Sysctrl_GetPClkFreq(void);
+
+///< 外设门控开关/状态获取:用于控制外设模块的使能,使用该模块的功能之前,必须使能该模块的门控时钟;
+en_result_t Sysctrl_SetPeripheralGate(en_sysctrl_peripheral_gate_t enPeripheral, boolean_t bFlag);
+boolean_t Sysctrl_GetPeripheralGate(en_sysctrl_peripheral_gate_t enPeripheral);
+
+///< 系统功能配置:用于设置其他系统相关特殊功能;
+en_result_t Sysctrl_SetFunc(en_sysctrl_func_t enFunc, boolean_t bFlag);
+
+///< RTC高速时钟补偿:用于设置RTC高速时钟下的频率补偿
+en_result_t Sysctrl_SetRTCAdjustClkFreq(en_sysctrl_rtc_adjust_t enRtcAdj);
+
+//@} // Sysctrl Group
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __SYSCTRL_H__ */
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer0.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer0.h
new file mode 100644
index 0000000000..26398b0e6b
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer0.h
@@ -0,0 +1,788 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file bt.h
+ **
+ ** 基本定时器数据结构及API声明
+ ** @link BT Timer3 Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-29 Husj First Version
+ **
+ *****************************************************************************/
+
+#ifndef __TIMER0_H__
+#define __TIMER0_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup Tim0Group Base Timer (BT)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief Timer3 通道定义
+ *****************************************************************************/
+typedef enum en_tim0_channel
+{
+ Tim0CH0 = 0u, ///< Timer3通道0
+ Tim0CH1 = 1u, ///< Timer3通道1
+ Tim0CH2 = 2u, ///< Timer3通道2
+}en_tim0_channel_t;
+
+/**
+ ******************************************************************************
+ ** \brief 工作模式选择数据类型重定义 (MODE)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim0_work_mode
+{
+ Tim0WorkMode0 = 0u, ///< 定时器模式
+ Tim0WorkMode1 = 1u, ///< PWC模式
+ Tim0WorkMode2 = 2u, ///< 锯齿波模式
+ Tim0WorkMode3 = 3u, ///< 三角波模式
+}en_tim0_work_mode_t;
+
+/**
+ ******************************************************************************
+ ** \brief 极性控制数据类型重定义 (GATE_P)(模式0)
+ *****************************************************************************/
+typedef enum en_tim0_m0cr_gatep
+{
+ Tim0GatePositive = 0u, ///< 高电平有效
+ Tim0GateOpposite = 1u, ///< 低电平有效
+}en_tim0_m0cr_gatep_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 预除频选择 (PRS)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim0_cr_timclkdiv
+{
+ Tim0PCLKDiv1 = 0u, ///< Div 1
+ Tim0PCLKDiv2 = 1u, ///< Div 2
+ Tim0PCLKDiv4 = 2u, ///< Div 4
+ Tim0PCLKDiv8 = 3u, ///< Div 8
+ Tim0PCLKDiv16 = 4u, ///< Div 16
+ Tim0PCLKDiv32 = 5u, ///< Div 32
+ Tim0PCLKDiv64 = 6u, ///< Div 64
+ Tim0PCLKDiv256 = 7u, ///< Div 256
+}en_tim0_cr_timclkdiv_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数/定时器功能选择数据类型重定义 (CT)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim0_cr_ct
+{
+ Tim0Timer = 0u, ///< 定时器功能,计数时钟为内部PCLK
+ Tim0Counter = 1u, ///< 计数器功能,计数时钟为外部ETR
+}en_tim0_cr_ct_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 定时器工作模式数据类型重定义 (MD)(模式0)
+ *****************************************************************************/
+typedef enum en_tim0_m0cr_md
+{
+ Tim032bitFreeMode = 0u, ///< 32位计数器/定时器
+ Tim016bitArrMode = 1u, ///< 自动重装载16位计数器/定时器
+}en_tim0_m0cr_md_t;
+
+/**
+ ******************************************************************************
+** \brief TIM3中断类型数据类型重定义(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim0_irq_type
+{
+ Tim0UevIrq = 0u, ///< 溢出/事件更新中断
+ Tim0CA0Irq = 2u, ///< CH0A捕获/比较中断(仅模式1/23存在)
+ Tim0CA1Irq = 3u, ///< CH1A捕获/比较中断(仅模式23存在)
+ Tim0CA2Irq = 4u, ///< CH2A捕获/比较中断(仅模式23存在)
+ Tim0CB0Irq = 5u, ///< CH0B捕获/比较中断(仅模式23存在)
+ Tim0CB1Irq = 6u, ///< CH1B捕获/比较中断(仅模式23存在)
+ Tim0CB2Irq = 7u, ///< CH2B捕获/比较中断(仅模式23存在)
+ Tim0CA0E = 8u, ///< CH0A捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim0CA1E = 9u, ///< CH1A捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim0CA2E = 10u, ///< CH2A捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim0CB0E = 11u, ///< CH0B捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim0CB1E = 12u, ///< CH1B捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim0CB2E = 13u, ///< CH2B捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim0BkIrq = 14u, ///< 刹车中断(仅模式23存在)
+ Tim0TrigIrq = 15u, ///< 触发中断(仅模式23存在)
+}en_tim0_irq_type_t;
+
+/**
+ ******************************************************************************
+ ** \brief 测量开始结束数据类型重定义 (Edg1stEdg2nd)(模式1)
+ *****************************************************************************/
+typedef enum en_tim0_m1cr_Edge
+{
+ Tim0PwcRiseToRise = 0u, ///< 上升沿到上升沿(周期)
+ Tim0PwcFallToRise = 1u, ///< 下降沿到上升沿(低电平)
+ Tim0PwcRiseToFall = 2u, ///< 上升沿到下降沿(高电平)
+ Tim0PwcFallToFall = 3u, ///< 下降沿到下降沿(周期)
+}en_tim0_m1cr_Edge_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC测量测试模式选择数据类型重定义 (Oneshot)(模式1)
+ *****************************************************************************/
+typedef enum en_tim0_m1cr_oneshot
+{
+ Tim0PwcCycleDetect = 0u, ///< PWC循环测量
+ Tim0PwcOneShotDetect = 1u, ///< PWC单次测量
+}en_tim0_m1cr_oneshot_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC IA0选择数据类型重定义 (IA0S)(模式1)
+ *****************************************************************************/
+typedef enum en_tim0_m1_mscr_ia0s
+{
+ Tim0IA0Input = 0u, ///< IAO输入
+ Tim0XORInput = 1u, ///< IA0 ETR GATE XOR(TIM0/1/2)/IA0 IA1 IA2 XOR(TIM3)
+}en_tim0_m1_mscr_ia0s_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC IB0选择数据类型重定义 (IA0S)(模式1)
+ *****************************************************************************/
+typedef enum en_tim0_m1_mscr_ib0s
+{
+ Tim0IB0Input = 0u, ///< IBO输入
+ Tim0TsInput = 1u, ///< 内部触发TS选择信号
+}en_tim0_m1_mscr_ib0s_t;
+
+/**
+ ******************************************************************************
+ ** \brief 输出极性、输入相位 数据类型重定义 (CCPA0/CCPB0/ETP/BKP)(模式1/23)
+ *****************************************************************************/
+typedef enum en_tim0_port_polarity
+{
+ Tim0PortPositive = 0u, ///< 正常输入输出
+ Tim0PortOpposite = 1u, ///< 反向输入输出
+}en_tim0_port_polarity_t;
+
+/**
+ ******************************************************************************
+ ** \brief 滤波选择数据类型重定义 (FLTET/FLTA0/FLAB0)(模式1/23)
+ *****************************************************************************/
+typedef enum en_tim0_flt
+{
+ Tim0FltNone = 0u, ///< 无滤波
+ Tim0FltPCLKCnt3 = 4u, ///< PCLK 3个连续有效
+ Tim0FltPCLKDiv4Cnt3 = 5u, ///< PCLK/4 3个连续有效
+ Tim0FltPCLKDiv16Cnt3 = 6u, ///< PCLK/16 3个连续有效
+ Tim0FltPCLKDiv64Cnt3 = 7u, ///< PCLK/64 3个连续有效
+}en_tim0_flt_t;
+
+/**
+ ******************************************************************************
+ ** \brief 通道比较控制 数据类型重定义 (OCMA/OCMB)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_fltr_ocm
+{
+ Tim0ForceLow = 0u, ///< 强制为0
+ Tim0ForceHigh = 1u, ///< 强制为1
+ Tim0CMPForceLow = 2u, ///< 比较匹配时强制为0
+ Tim0CMPForceHigh = 3u, ///< 比较匹配时强制为1
+ Tim0CMPInverse = 4u, ///< 比较匹配时翻转电平
+ Tim0CMPOnePrdHigh = 5u, ///< 比较匹配时输出一个计数周期的高电平
+ Tim0PWMMode1 = 6u, ///< 通道控制为PWM mode 1
+ Tim0PWMMode2 = 7u, ///< 通道控制为PWM mode 2
+}en_tim0_m23_fltr_ocm_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式TS数据类型重定义 (TS)(模式1/23)
+ *****************************************************************************/
+typedef enum en_tim0_mscr_ts
+{
+ Tim0Ts0ETR = 0u, ///< ETR外部输入滤波后的相位选择信号
+ Tim0Ts1TIM0TRGO = 1u, ///< Timer0的TRGO输出信号
+ Tim0Ts2TIM1TRGO = 2u, ///< Timer1的TRGO输出信号
+ Tim0Ts3TIM2TRGO = 3u, ///< Timer2的TRGO输出信号
+ Tim0Ts4TIM3TRGO = 4u, ///< Timer3的TRGO输出信号
+ //Tim0Ts5IA0ED = 5u, ///< 无效
+ Tim0Ts6IAFP = 6u, ///< CH0A 外部输输入滤波后的相位选择信号
+ Tim0Ts7IBFP = 7u, ///< CH0B 外部输输入滤波后的相位选择信
+}en_tim0_mscr_ts_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWM输出模式选择数据类型重定义 (COMP)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23cr_comp
+{
+ Tim0IndependentPWM = 0u, ///< 独立PWM输出
+ Tim0ComplementaryPWM = 1u, ///< 互补PWM输出
+}en_tim0_m23cr_comp_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数方向选择数据类型重定义 (DIR)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23cr_dir
+{
+ Tim0CntUp = 0u, ///< 向上计数
+ Tim0CntDown = 1u, ///< 向下计数
+}en_tim0_m23cr_dir_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数方向选择数据类型重定义 (PWM2S)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23cr_pwm2s
+{
+ Tim0DoublePointCmp = 0u, ///< 双点比较使能,使用CCRA,CCRB比较控制OCREFA输出
+ Tim0SinglePointCmp = 1u, ///< 单点比较使能,使用CCRA比较控制OCREFA输出
+}en_tim0_m23cr_pwm2s_t;
+
+/**
+ ******************************************************************************
+ ** \brief GATE在PWM互补模式下捕获或比较功能 选择数据类型重定义 (CSG)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23cr_csg
+{
+ Tim0PWMCompGateCmpOut = 0u, ///< 在PWM互补模式下,Gate作为比较输出
+ Tim0PWMCompGateCapIn = 1u, ///< 在PWM互补模式下,Gate作为捕获输入
+}en_tim0_m23cr_csg_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 比较捕获寄存器 数据类型重定义 (CCR0A,CCR0B)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_ccrx
+{
+ Tim0CCR0A = 0u, ///< CCR0A比较捕获寄存器
+ Tim0CCR0B = 1u, ///< CCR0B比较捕获寄存器
+ Tim0CCR1A = 2u, ///< CCR1A比较捕获寄存器
+ Tim0CCR1B = 3u, ///< CCR1B比较捕获寄存器
+ Tim0CCR2A = 4u, ///< CCR2A比较捕获寄存器
+ Tim0CCR2B = 5u, ///< CCR2B比较捕获寄存器
+}en_tim0_m23_ccrx_t;
+
+/**
+ ******************************************************************************
+ ** \brief OCREF清除源 选择数据类型重定义 (OCCS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23ce_occs
+{
+ Tim0OC_Ref_Clr = 0u, ///< 来自VC的OC_Ref_Clr
+ Tim0ETRf = 1u, ///< 外部ETRf
+}en_tim0_m23ce_occs_t;
+
+/**
+ ******************************************************************************
+ ** \brief 比较匹配中断模式 选择数据类型重定义 (CIS/CISB)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_cisa_cisb
+{
+ Tim0CmpIntNone = 0u, ///< 无比较匹配中断
+ Tim0CmpIntRise = 1u, ///< 比较匹配上升沿中断
+ Tim0CmpIntFall = 2u, ///< 比较匹配下降沿中断
+ Tim0CmpIntRiseFall = 3u, ///< 比较匹配上升沿下降沿中断
+}en_tim0_m23_cisa_cisb_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3端口控制 - 刹车时CHx输出状态控制(BKSA/BKSB)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_tim0_m23_crchx_bks
+{
+ Tim0CHxBksHiZ = 0u, ///< 刹车使能时,CHx端口输出高阻态
+ Tim0CHxBksNorm = 1u, ///< 刹车使能时,CHx端口正常输出
+ Tim0CHxBksLow = 2u, ///< 刹车使能时,CHx端口输出低电平
+ Tim0CHxBksHigh = 3u, ///< 刹车使能时,CHx端口输出高电平
+}en_tim0_m23_crchx_bks_t;
+
+/**
+ ******************************************************************************
+** \brief TIM3端口控制 - CHx上升沿下降沿捕获(CRx/CFx)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_tim0_m23_crch0_cfx_crx
+{
+ Tim0CHxCapNone = 0u, ///< CHx通道捕获禁止
+ Tim0CHxCapRise = 1u, ///< CHx通道上升沿捕获使能
+ Tim0CHxCapFall = 2u, ///< CHx通道下降沿捕获使能
+ Tim0CHxCapFallRise = 3u, ///< CHx通道上升沿下降沿捕获都使能
+}en_tim0_m23_crch0_cfx_crx_t;
+
+/**
+ ******************************************************************************
+** \brief TIM3端口控制 - CHx比较捕获模式(CSA/CSB)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_tim0_m23_crch0_csa_csb
+{
+ Tim0CHxCmpMode = 0u, ///< CHx通道设置为比较模式
+ Tim0CHxCapMode = 1u, ///< CHx通道设置为捕获模式
+}en_tim0_m23_crch0_csa_csb_t;
+
+/**
+ ******************************************************************************
+ ** \brief 比较模式下 DMA比较触发选择 数据类型重定义 (CCDS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_mscr_ccds
+{
+ Tim0CmpTrigDMA = 0u, ///< 比较匹配触发DMA
+ Tim0UEVTrigDMA = 1u, ///< 事件更新代替比较匹配触发DMA
+}en_tim0_m23_mscr_ccds_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式选择 数据类型重定义 (MSM)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_mscr_msm
+{
+ Tim0SlaveMode = 0u, ///< 从模式
+ Tim0MasterMode = 1u, ///< 主模式
+}en_tim0_m23_mscr_msm_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发主模式输出源 数据类型重定义 (MMS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_mscr_mms
+{
+ Tim0MasterUG = 0u, ///< UG(软件更新)源
+ Tim0MasterCTEN = 1u, ///< CTEN源
+ Tim0MasterUEV = 2u, ///< UEV更新源
+ Tim0MasterCMPSO = 3u, ///< 比较匹配选择输出源
+ Tim0MasterOCA0Ref = 4u, ///< OCA0_Ref源
+ Tim0MasterOCB0Ref = 5u, ///< OCB0_Ref源
+ //Tim0MasterOCB0Ref = 6u,
+ //Tim0MasterOCB0Ref = 7u,
+}en_tim0_m23_mscr_mms_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发从模式选择 数据类型重定义 (SMS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim0_m23_mscr_sms
+{
+ Tim0SlaveIClk = 0u, ///< 使用内部时钟
+ Tim0SlaveResetTIM = 1u, ///< 复位功能
+ Tim0SlaveTrigMode = 2u, ///< 触发模式
+ Tim0SlaveEClk = 3u, ///< 外部时钟模式
+ Tim0SlaveCodeCnt1 = 4u, ///< 正交编码计数模式1
+ Tim0SlaveCodeCnt2 = 5u, ///< 正交编码计数模式2
+ Tim0SlaveCodeCnt3 = 6u, ///< 正交编码计数模式3
+ Tim0SlaveGateCtrl = 7u, ///< 门控功能
+}en_tim0_m23_mscr_sms_t;
+
+/**
+ ******************************************************************************
+ ** \brief 定时器运行控制数据类型重定义 (CTEN)
+ *****************************************************************************/
+typedef enum en_tim0_start
+{
+ Tim0CTENDisable = 0u, ///< 停止
+ Tim0CTENEnable = 1u, ///< 运行
+}en_tim0_start_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 mode0 配置结构体定义(模式0)
+ *****************************************************************************/
+typedef struct stc_tim0_mode0_config
+{
+ en_tim0_work_mode_t enWorkMode; ///< 工作模式设置
+ en_tim0_m0cr_gatep_t enGateP; ///< 门控极性控制
+ boolean_t bEnGate; ///< 门控使能
+ en_tim0_cr_timclkdiv_t enPRS; ///< 预除频配置
+ boolean_t bEnTog; ///< 翻转输出使能
+ en_tim0_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_tim0_m0cr_md_t enCntMode; ///< 计数模式配置
+
+ func_ptr_t pfnTim0Cb; ///< Timer3中断服务回调函数[void function(void)]
+}stc_tim0_mode0_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 mode1 配置结构体定义(模式1)
+ *****************************************************************************/
+typedef struct stc_tim0_mode1_config
+{
+ en_tim0_work_mode_t enWorkMode; ///< 工作模式设置
+ en_tim0_cr_timclkdiv_t enPRS; ///< 预除频配置
+ en_tim0_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_tim0_m1cr_oneshot_t enOneShot; ///< 单次测量/循环测量选择
+
+ func_ptr_t pfnTim0Cb; ///< Timer3中断服务回调函数[void function(void)]
+
+}stc_tim0_mode1_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC输入配置结构体定义(模式1)
+ *****************************************************************************/
+typedef struct stc_tim0_pwc_input_config
+{
+ en_tim0_mscr_ts_t enTsSel; ///< 触发输入源选择
+ en_tim0_m1_mscr_ia0s_t enIA0Sel; ///< CHA0输入选择
+ en_tim0_m1_mscr_ib0s_t enIB0Sel; ///< CHB0输入选择
+ en_tim0_port_polarity_t enETRPhase; ///< ETR相位选择
+ en_tim0_flt_t enFltETR; ///< ETR滤波设置
+ en_tim0_flt_t enFltIA0; ///< CHA0滤波设置
+ en_tim0_flt_t enFltIB0; ///< CHB0滤波设置
+}stc_tim0_pwc_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 mode23 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_mode23_config
+{
+ en_tim0_work_mode_t enWorkMode; ///< 工作模式设置
+ en_tim0_m23cr_dir_t enCntDir; ///< 计数方向
+ en_tim0_cr_timclkdiv_t enPRS; ///< 时钟预除频配置
+ en_tim0_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_tim0_m23cr_comp_t enPWMTypeSel; ///< PWM模式选择(独立/互补)
+ en_tim0_m23cr_pwm2s_t enPWM2sSel; ///< OCREFA双点比较功能选择
+ boolean_t bOneShot; ///< 单次触发模式使能/禁止
+ boolean_t bURSSel; ///< 更新源选择
+
+ func_ptr_t pfnTim0Cb; ///< Timer3中断服务回调函数[void function(void)]
+}stc_tim0_mode23_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief GATE在PWM互补模式下捕获或比较功能 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_gate_config
+{
+ en_tim0_m23cr_csg_t enGateFuncSel; ///< Gate比较、捕获功能选择
+ boolean_t bGateRiseCap; ///< GATE作为捕获功能时,上沿捕获有效控制
+ boolean_t bGateFallCap; ///< GATE作为捕获功能时,下沿捕获有效控制
+}stc_tim0_m23_gate_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief CHA/CHB通道比较控制 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_compare_config
+{
+ en_tim0_m23_crch0_csa_csb_t enCHxACmpCap; ///< CH0A比较/捕获功能选择
+ en_tim0_m23_fltr_ocm_t enCHxACmpCtrl; ///< CH0A通道比较控制
+ en_tim0_port_polarity_t enCHxAPolarity; ///< CH0A输出极性控制
+ boolean_t bCHxACmpBufEn; ///< 比较A缓存功能 使能/禁止
+ en_tim0_m23_cisa_cisb_t enCHxACmpIntSel; ///< CHA比较匹配中断选择
+
+ en_tim0_m23_crch0_csa_csb_t enCHxBCmpCap; ///< CH0B比较/捕获功能选择
+ en_tim0_m23_fltr_ocm_t enCHxBCmpCtrl; ///< CH0B通道比较控制
+ en_tim0_port_polarity_t enCHxBPolarity; ///< CH0B输出极性控制
+ boolean_t bCHxBCmpBufEn; ///< 比较B缓存功能 使能/禁止
+ en_tim0_m23_cisa_cisb_t enCHxBCmpIntSel; ///< CHB0比较匹配中断选择
+}stc_tim0_m23_compare_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief CHA/CHB通道捕获控制 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_input_config
+{
+ en_tim0_m23_crch0_csa_csb_t enCHxACmpCap; ///< CH0A比较/捕获功能选择
+ en_tim0_m23_crch0_cfx_crx_t enCHxACapSel; ///< CH0A捕获边沿选择
+ en_tim0_flt_t enCHxAInFlt; ///< CH0A通道捕获滤波控制
+ en_tim0_port_polarity_t enCHxAPolarity; ///< CH0A输入相位
+
+ en_tim0_m23_crch0_csa_csb_t enCHxBCmpCap; ///< CH0A比较/捕获功能选择
+ en_tim0_m23_crch0_cfx_crx_t enCHxBCapSel; ///< CH0B捕获边沿选择
+ en_tim0_flt_t enCHxBInFlt; ///< CH0B通道捕获滤波控制
+ en_tim0_port_polarity_t enCHxBPolarity; ///< CH0B输入相位
+
+}stc_tim0_m23_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief ETR输入相位滤波配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_etr_input_config
+{
+ en_tim0_port_polarity_t enETRPolarity; ///< ETR输入极性设置
+ en_tim0_flt_t enETRFlt; ///< ETR滤波设置
+}stc_tim0_m23_etr_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 刹车BK输入相位滤波配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_bk_input_config
+{
+ boolean_t bEnBrake; ///< 刹车使能
+ boolean_t bEnVC0Brake; ///< 使能VC0刹车
+ boolean_t bEnVC1Brake; ///< 使能VC1刹车
+ boolean_t bEnSafetyBk; ///< 使能safety刹车
+ boolean_t bEnBKSync; ///< TIM0/TIM1/TIM2刹车同步使能
+ en_tim0_m23_crchx_bks_t enBkCH0AStat; ///< 刹车时CHA端口状态设置
+ en_tim0_m23_crchx_bks_t enBkCH0BStat; ///< 刹车时CHB端口状态设置
+ en_tim0_m23_crchx_bks_t enBkCH1AStat; ///< 刹车时CHA端口状态设置
+ en_tim0_m23_crchx_bks_t enBkCH1BStat; ///< 刹车时CHB端口状态设置
+ en_tim0_m23_crchx_bks_t enBkCH2AStat; ///< 刹车时CHA端口状态设置
+ en_tim0_m23_crchx_bks_t enBkCH2BStat; ///< 刹车时CHB端口状态设置
+ en_tim0_port_polarity_t enBrakePolarity; ///< 刹车BK输入极性设置
+ en_tim0_flt_t enBrakeFlt; ///< 刹车BK滤波设置
+}stc_tim0_m23_bk_input_config_t;
+
+/**
+ ******************************************************************************
+** \brief 死区功能配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_dt_config
+{
+ boolean_t bEnDeadTime; ///< 刹车时CHA端口状态设置
+ uint8_t u8DeadTimeValue; ///< 刹车时CHA端口状态设置
+}stc_tim0_m23_dt_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发ADC配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_adc_trig_config
+{
+ boolean_t bEnTrigADC; ///< 触发ADC全局控制
+ boolean_t bEnUevTrigADC; ///< 事件更新触发ADC
+ boolean_t bEnCH0ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH0BCmpTrigADC; ///< CH0B比较匹配触发ADC
+ boolean_t bEnCH1ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH1BCmpTrigADC; ///< CH0B比较匹配触发ADC
+ boolean_t bEnCH2ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH2BCmpTrigADC; ///< CH0B比较匹配触发ADC
+}stc_tim0_m23_adc_trig_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief DMA触发 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_trig_dma_config
+{
+ boolean_t bUevTrigDMA; ///< 更新 触发DMA使能
+ boolean_t bTITrigDMA; ///< Trig 触发DMA功能
+ boolean_t bCmpA0TrigDMA; ///< CH0A捕获比较触发DMA使能
+ boolean_t bCmpB0TrigDMA; ///< CH0B捕获比较触发DMA使能
+ boolean_t bCmpA1TrigDMA; ///< CH1A捕获比较触发DMA使能
+ boolean_t bCmpB1TrigDMA; ///< CH1B捕获比较触发DMA使能
+ boolean_t bCmpA2TrigDMA; ///< CH2A捕获比较触发DMA使能
+ boolean_t bCmpB2TrigDMA; ///< CH2B捕获比较触发DMA使能
+ en_tim0_m23_mscr_ccds_t enCmpUevTrigDMA; ///< 比较模式下DMA比较触发选择
+}stc_tim0_m23_trig_dma_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_master_slave_config
+{
+ en_tim0_m23_mscr_msm_t enMasterSlaveSel; ///< 主从模式选择
+ en_tim0_m23_mscr_mms_t enMasterSrc; ///< 主模式触发源选择
+ en_tim0_m23_mscr_sms_t enSlaveModeSel; ///< 从模式选择
+ en_tim0_mscr_ts_t enTsSel; ///< 触发输入源选择
+}stc_tim0_m23_master_slave_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief OCREF清除功能 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim0_m23_OCREF_Clr_config
+{
+ en_tim0_m23ce_occs_t enOCRefClrSrcSel; ///< OCREF清除源选择
+ boolean_t bVCClrEn; ///< 是否使能来自VC的OCREF_Clr
+}stc_tim0_m23_OCREF_Clr_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+//中断相关函数
+
+//中断标志获取
+boolean_t Tim0_GetIntFlag(en_tim0_irq_type_t enTim0Irq);
+//中断标志清除
+en_result_t Tim0_ClearIntFlag(en_tim0_irq_type_t enTim0Irq);
+//所有中断标志清除
+en_result_t Tim0_ClearAllIntFlag(void);
+//模式0中断使能
+en_result_t Tim0_Mode0_EnableIrq(void);
+//模式1中断使能
+en_result_t Tim0_Mode1_EnableIrq (en_tim0_irq_type_t enTim0Irq);
+//模式2中断使能
+en_result_t Tim0_Mode23_EnableIrq (en_tim0_irq_type_t enTim0Irq);
+//模式0中断禁止
+en_result_t Tim0_Mode0_DisableIrq(void);
+//模式1中断禁止
+en_result_t Tim0_Mode1_DisableIrq (en_tim0_irq_type_t enTim0Irq);
+//模式2中断禁止
+en_result_t Tim0_Mode23_DisableIrq (en_tim0_irq_type_t enTim0Irq);
+
+
+//模式0初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Tim0_Mode0_Init(stc_tim0_mode0_config_t* pstcConfig);
+//timer 启动/停止
+en_result_t Tim0_M0_Run(void);
+en_result_t Tim0_M0_Stop(void);
+//重载值设置
+en_result_t Tim0_M0_ARRSet(uint16_t u16Data);
+//16位计数值设置/获取
+en_result_t Tim0_M0_Cnt16Set(uint16_t u16Data);
+uint16_t Tim0_M0_Cnt16Get(void);
+//32位计数值设置/获取
+en_result_t Tim0_M0_Cnt32Set(uint32_t u32Data);
+uint32_t Tim0_M0_Cnt32Get(void);
+//翻转输出使能/禁止设定
+en_result_t Tim0_M0_EnTOG_Output(boolean_t bEnOutput);
+
+
+//模式1初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Tim0_Mode1_Init(stc_tim0_mode1_config_t* pstcConfig);
+//PWC 输入配置
+en_result_t Tim0_M1_Input_Config(stc_tim0_pwc_input_config_t* pstcConfig);
+//PWC测量边沿起始结束选择
+en_result_t Tim0_M1_PWC_Edge_Sel(en_tim0_m1cr_Edge_t enEdgeSel);
+//timer 启动/停止
+en_result_t Tim0_M1_Run(void);
+en_result_t Tim0_M1_Stop(void);
+//16位计数值设置/获取
+en_result_t Tim0_M1_Cnt16Set(uint16_t u16Data);
+uint16_t Tim0_M1_Cnt16Get(void);
+//脉冲宽度测量结果数值获取
+uint16_t Tim0_M1_PWC_CapValueGet(void);
+
+
+//模式1初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Tim0_Mode23_Init(stc_tim0_mode23_config_t* pstcConfig);
+//timer 启动/停止
+en_result_t Tim0_M23_Run(void);
+en_result_t Tim0_M23_Stop(void);
+//PWM输出使能
+en_result_t Tim0_M23_EnPWM_Output(boolean_t bEnOutput, boolean_t bEnAutoOutput);
+//重载值设置
+en_result_t Tim0_M23_ARRSet(uint16_t u16Data, boolean_t bArrBufEn);
+//16位计数值设置/获取
+en_result_t Tim0_M23_Cnt16Set(uint16_t u16Data);
+uint16_t Tim0_M23_Cnt16Get(void);
+//比较捕获寄存器CCR0A/CCR0B设置/读取
+en_result_t Tim0_M23_CCR_Set(en_tim0_m23_ccrx_t enCCRSel, uint16_t u16Data);
+uint16_t Tim0_M23_CCR_Get(en_tim0_m23_ccrx_t enCCRSel);
+//PWM互补输出模式下,GATE功能选择
+en_result_t Tim0_M23_GateFuncSel(stc_tim0_m23_gate_config_t* pstcConfig);
+//主从模式配置
+en_result_t Tim0_M23_MasterSlave_Set(stc_tim0_m23_master_slave_config_t* pstcConfig);
+//CH0A/CH0B比较通道控制
+en_result_t Tim0_M23_PortOutput_Config(en_tim0_channel_t enTim0Chx, stc_tim0_m23_compare_config_t* pstcConfig);
+//CH0A/CH0B输入控制
+en_result_t Tim0_M23_PortInput_Config(en_tim0_channel_t enTim0Chx, stc_tim0_m23_input_config_t* pstcConfig);
+//ERT输入控制
+en_result_t Tim0_M23_ETRInput_Config(stc_tim0_m23_etr_input_config_t* pstcConfig);
+//刹车BK输入控制
+en_result_t Tim0_M23_BrakeInput_Config(stc_tim0_m23_bk_input_config_t* pstcConfig);
+//触发ADC控制
+en_result_t Tim0_M23_TrigADC_Config(stc_tim0_m23_adc_trig_config_t* pstcConfig);
+//死区功能
+en_result_t Tim0_M23_DT_Config(stc_tim0_m23_dt_config_t* pstcConfig);
+//重复周期设置
+en_result_t Tim0_M23_SetValidPeriod(uint8_t u8ValidPeriod);
+//OCREF清除功能
+en_result_t Tim0_M23_OCRefClr(stc_tim0_m23_OCREF_Clr_config_t* pstcConfig);
+//使能DMA传输
+en_result_t Tim0_M23_EnDMA(stc_tim0_m23_trig_dma_config_t* pstcConfig);
+//捕获比较A软件触发
+en_result_t Tim0_M23_EnSwTrigCapCmpA(en_tim0_channel_t enTim0Chx);
+//捕获比较B软件触发
+en_result_t Tim0_M23_EnSwTrigCapCmpB(en_tim0_channel_t enTim0Chx);
+//软件更新使能
+en_result_t Tim0_M23_EnSwUev(void);
+//软件触发使能
+en_result_t Tim0_M23_EnSwTrig(void);
+//软件刹车使能
+en_result_t Tim0_M23_EnSwBk(void);
+
+
+//@} // Tim0Group
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __BT_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer3.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer3.h
new file mode 100644
index 0000000000..1ac153ab94
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/timer3.h
@@ -0,0 +1,788 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file bt.h
+ **
+ ** 基本定时器数据结构及API声明
+ ** @link BT Timer3 Group Some description @endlink
+ **
+ ** History:
+ ** - 2018-04-29 Husj First Version
+ **
+ *****************************************************************************/
+
+#ifndef __TIMER3_H__
+#define __TIMER3_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup Tim3Group Base Timer (BT)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief Timer3 通道定义
+ *****************************************************************************/
+typedef enum en_tim3_channel
+{
+ Tim3CH0 = 0u, ///< Timer3通道0
+ Tim3CH1 = 1u, ///< Timer3通道1
+ Tim3CH2 = 2u, ///< Timer3通道2
+}en_tim3_channel_t;
+
+/**
+ ******************************************************************************
+ ** \brief 工作模式选择数据类型重定义 (MODE)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim3_work_mode
+{
+ Tim3WorkMode0 = 0u, ///< 定时器模式
+ Tim3WorkMode1 = 1u, ///< PWC模式
+ Tim3WorkMode2 = 2u, ///< 锯齿波模式
+ Tim3WorkMode3 = 3u, ///< 三角波模式
+}en_tim3_work_mode_t;
+
+/**
+ ******************************************************************************
+ ** \brief 极性控制数据类型重定义 (GATE_P)(模式0)
+ *****************************************************************************/
+typedef enum en_tim3_m0cr_gatep
+{
+ Tim3GatePositive = 0u, ///< 高电平有效
+ Tim3GateOpposite = 1u, ///< 低电平有效
+}en_tim3_m0cr_gatep_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 预除频选择 (PRS)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim3_cr_timclkdiv
+{
+ Tim3PCLKDiv1 = 0u, ///< Div 1
+ Tim3PCLKDiv2 = 1u, ///< Div 2
+ Tim3PCLKDiv4 = 2u, ///< Div 4
+ Tim3PCLKDiv8 = 3u, ///< Div 8
+ Tim3PCLKDiv16 = 4u, ///< Div 16
+ Tim3PCLKDiv32 = 5u, ///< Div 32
+ Tim3PCLKDiv64 = 6u, ///< Div 64
+ Tim3PCLKDiv256 = 7u, ///< Div 256
+}en_tim3_cr_timclkdiv_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数/定时器功能选择数据类型重定义 (CT)(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim3_cr_ct
+{
+ Tim3Timer = 0u, ///< 定时器功能,计数时钟为内部PCLK
+ Tim3Counter = 1u, ///< 计数器功能,计数时钟为外部ETR
+}en_tim3_cr_ct_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 定时器工作模式数据类型重定义 (MD)(模式0)
+ *****************************************************************************/
+typedef enum en_tim3_m0cr_md
+{
+ Tim332bitFreeMode = 0u, ///< 32位计数器/定时器
+ Tim316bitArrMode = 1u, ///< 自动重装载16位计数器/定时器
+}en_tim3_m0cr_md_t;
+
+/**
+ ******************************************************************************
+** \brief TIM3中断类型数据类型重定义(模式0/1/23)
+ *****************************************************************************/
+typedef enum en_tim3_irq_type
+{
+ Tim3UevIrq = 0u, ///< 溢出/事件更新中断
+ Tim3CA0Irq = 2u, ///< CH0A捕获/比较中断(仅模式1/23存在)
+ Tim3CA1Irq = 3u, ///< CH1A捕获/比较中断(仅模式23存在)
+ Tim3CA2Irq = 4u, ///< CH2A捕获/比较中断(仅模式23存在)
+ Tim3CB0Irq = 5u, ///< CH0B捕获/比较中断(仅模式23存在)
+ Tim3CB1Irq = 6u, ///< CH1B捕获/比较中断(仅模式23存在)
+ Tim3CB2Irq = 7u, ///< CH2B捕获/比较中断(仅模式23存在)
+ Tim3CA0E = 8u, ///< CH0A捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim3CA1E = 9u, ///< CH1A捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim3CA2E = 10u, ///< CH2A捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim3CB0E = 11u, ///< CH0B捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim3CB1E = 12u, ///< CH1B捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim3CB2E = 13u, ///< CH2B捕获数据丢失标志(仅模式23存在)(不是中断)
+ Tim3BkIrq = 14u, ///< 刹车中断(仅模式23存在)
+ Tim3TrigIrq = 15u, ///< 触发中断(仅模式23存在)
+}en_tim3_irq_type_t;
+
+/**
+ ******************************************************************************
+ ** \brief 测量开始结束数据类型重定义 (Edg1stEdg2nd)(模式1)
+ *****************************************************************************/
+typedef enum en_tim3_m1cr_Edge
+{
+ Tim3PwcRiseToRise = 0u, ///< 上升沿到上升沿(周期)
+ Tim3PwcFallToRise = 1u, ///< 下降沿到上升沿(低电平)
+ Tim3PwcRiseToFall = 2u, ///< 上升沿到下降沿(高电平)
+ Tim3PwcFallToFall = 3u, ///< 下降沿到下降沿(周期)
+}en_tim3_m1cr_Edge_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC测量测试模式选择数据类型重定义 (Oneshot)(模式1)
+ *****************************************************************************/
+typedef enum en_tim3_m1cr_oneshot
+{
+ Tim3PwcCycleDetect = 0u, ///< PWC循环测量
+ Tim3PwcOneShotDetect = 1u, ///< PWC单次测量
+}en_tim3_m1cr_oneshot_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC IA0选择数据类型重定义 (IA0S)(模式1)
+ *****************************************************************************/
+typedef enum en_tim3_m1_mscr_ia0s
+{
+ Tim3IA0Input = 0u, ///< IAO输入
+ Tim3XORInput = 1u, ///< IA0 ETR GATE XOR(TIM0/1/2)/IA0 IA1 IA2 XOR(TIM3)
+}en_tim3_m1_mscr_ia0s_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC IB0选择数据类型重定义 (IA0S)(模式1)
+ *****************************************************************************/
+typedef enum en_tim3_m1_mscr_ib0s
+{
+ Tim3IB0Input = 0u, ///< IBO输入
+ Tim3TsInput = 1u, ///< 内部触发TS选择信号
+}en_tim3_m1_mscr_ib0s_t;
+
+/**
+ ******************************************************************************
+ ** \brief 输出极性、输入相位 数据类型重定义 (CCPA0/CCPB0/ETP/BKP)(模式1/23)
+ *****************************************************************************/
+typedef enum en_tim3_port_polarity
+{
+ Tim3PortPositive = 0u, ///< 正常输入输出
+ Tim3PortOpposite = 1u, ///< 反向输入输出
+}en_tim3_port_polarity_t;
+
+/**
+ ******************************************************************************
+ ** \brief 滤波选择数据类型重定义 (FLTET/FLTA0/FLAB0)(模式1/23)
+ *****************************************************************************/
+typedef enum en_tim3_flt
+{
+ Tim3FltNone = 0u, ///< 无滤波
+ Tim3FltPCLKCnt3 = 4u, ///< PCLK 3个连续有效
+ Tim3FltPCLKDiv4Cnt3 = 5u, ///< PCLK/4 3个连续有效
+ Tim3FltPCLKDiv16Cnt3 = 6u, ///< PCLK/16 3个连续有效
+ Tim3FltPCLKDiv64Cnt3 = 7u, ///< PCLK/64 3个连续有效
+}en_tim3_flt_t;
+
+/**
+ ******************************************************************************
+ ** \brief 通道比较控制 数据类型重定义 (OCMA/OCMB)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_fltr_ocm
+{
+ Tim3ForceLow = 0u, ///< 强制为0
+ Tim3ForceHigh = 1u, ///< 强制为1
+ Tim3CMPForceLow = 2u, ///< 比较匹配时强制为0
+ Tim3CMPForceHigh = 3u, ///< 比较匹配时强制为1
+ Tim3CMPInverse = 4u, ///< 比较匹配时翻转电平
+ Tim3CMPOnePrdHigh = 5u, ///< 比较匹配时输出一个计数周期的高电平
+ Tim3PWMMode1 = 6u, ///< 通道控制为PWM mode 1
+ Tim3PWMMode2 = 7u, ///< 通道控制为PWM mode 2
+}en_tim3_m23_fltr_ocm_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式TS数据类型重定义 (TS)(模式1/23)
+ *****************************************************************************/
+typedef enum en_tim3_mscr_ts
+{
+ Tim3Ts0ETR = 0u, ///< ETR外部输入滤波后的相位选择信号
+ Tim3Ts1TIM0TRGO = 1u, ///< Timer0的TRGO输出信号
+ Tim3Ts2TIM1TRGO = 2u, ///< Timer1的TRGO输出信号
+ Tim3Ts3TIM2TRGO = 3u, ///< Timer2的TRGO输出信号
+ Tim3Ts4TIM3TRGO = 4u, ///< Timer3的TRGO输出信号
+ //Tim3Ts5IA0ED = 5u, ///< 无效
+ Tim3Ts6IAFP = 6u, ///< CH0A 外部输输入滤波后的相位选择信号
+ Tim3Ts7IBFP = 7u, ///< CH0B 外部输输入滤波后的相位选择信
+}en_tim3_mscr_ts_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWM输出模式选择数据类型重定义 (COMP)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23cr_comp
+{
+ Tim3IndependentPWM = 0u, ///< 独立PWM输出
+ Tim3ComplementaryPWM = 1u, ///< 互补PWM输出
+}en_tim3_m23cr_comp_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数方向选择数据类型重定义 (DIR)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23cr_dir
+{
+ Tim3CntUp = 0u, ///< 向上计数
+ Tim3CntDown = 1u, ///< 向下计数
+}en_tim3_m23cr_dir_t;
+
+/**
+ ******************************************************************************
+ ** \brief 计数方向选择数据类型重定义 (PWM2S)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23cr_pwm2s
+{
+ Tim3DoublePointCmp = 0u, ///< 双点比较使能,使用CCRA,CCRB比较控制OCREFA输出
+ Tim3SinglePointCmp = 1u, ///< 单点比较使能,使用CCRA比较控制OCREFA输出
+}en_tim3_m23cr_pwm2s_t;
+
+/**
+ ******************************************************************************
+ ** \brief GATE在PWM互补模式下捕获或比较功能 选择数据类型重定义 (CSG)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23cr_csg
+{
+ Tim3PWMCompGateCmpOut = 0u, ///< 在PWM互补模式下,Gate作为比较输出
+ Tim3PWMCompGateCapIn = 1u, ///< 在PWM互补模式下,Gate作为捕获输入
+}en_tim3_m23cr_csg_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief 比较捕获寄存器 数据类型重定义 (CCR0A,CCR0B)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_ccrx
+{
+ Tim3CCR0A = 0u, ///< CCR0A比较捕获寄存器
+ Tim3CCR0B = 1u, ///< CCR0B比较捕获寄存器
+ Tim3CCR1A = 2u, ///< CCR1A比较捕获寄存器
+ Tim3CCR1B = 3u, ///< CCR1B比较捕获寄存器
+ Tim3CCR2A = 4u, ///< CCR2A比较捕获寄存器
+ Tim3CCR2B = 5u, ///< CCR2B比较捕获寄存器
+}en_tim3_m23_ccrx_t;
+
+/**
+ ******************************************************************************
+ ** \brief OCREF清除源 选择数据类型重定义 (OCCS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23ce_occs
+{
+ Tim3OC_Ref_Clr = 0u, ///< 来自VC的OC_Ref_Clr
+ Tim3ETRf = 1u, ///< 外部ETRf
+}en_tim3_m23ce_occs_t;
+
+/**
+ ******************************************************************************
+ ** \brief 比较匹配中断模式 选择数据类型重定义 (CIS/CISB)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_cisa_cisb
+{
+ Tim3CmpIntNone = 0u, ///< 无比较匹配中断
+ Tim3CmpIntRise = 1u, ///< 比较匹配上升沿中断
+ Tim3CmpIntFall = 2u, ///< 比较匹配下降沿中断
+ Tim3CmpIntRiseFall = 3u, ///< 比较匹配上升沿下降沿中断
+}en_tim3_m23_cisa_cisb_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3端口控制 - 刹车时CHx输出状态控制(BKSA/BKSB)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_tim3_m23_crchx_bks
+{
+ Tim3CHxBksHiZ = 0u, ///< 刹车使能时,CHx端口输出高阻态
+ Tim3CHxBksNorm = 1u, ///< 刹车使能时,CHx端口正常输出
+ Tim3CHxBksLow = 2u, ///< 刹车使能时,CHx端口输出低电平
+ Tim3CHxBksHigh = 3u, ///< 刹车使能时,CHx端口输出高电平
+}en_tim3_m23_crchx_bks_t;
+
+/**
+ ******************************************************************************
+** \brief TIM3端口控制 - CHx上升沿下降沿捕获(CRx/CFx)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_tim3_m23_crch0_cfx_crx
+{
+ Tim3CHxCapNone = 0u, ///< CHx通道捕获禁止
+ Tim3CHxCapRise = 1u, ///< CHx通道上升沿捕获使能
+ Tim3CHxCapFall = 2u, ///< CHx通道下降沿捕获使能
+ Tim3CHxCapFallRise = 3u, ///< CHx通道上升沿下降沿捕获都使能
+}en_tim3_m23_crch0_cfx_crx_t;
+
+/**
+ ******************************************************************************
+** \brief TIM3端口控制 - CHx比较捕获模式(CSA/CSB)(模式23)
+ **
+ ** \note
+ ******************************************************************************/
+typedef enum en_tim3_m23_crch0_csa_csb
+{
+ Tim3CHxCmpMode = 0u, ///< CHx通道设置为比较模式
+ Tim3CHxCapMode = 1u, ///< CHx通道设置为捕获模式
+}en_tim3_m23_crch0_csa_csb_t;
+
+/**
+ ******************************************************************************
+ ** \brief 比较模式下 DMA比较触发选择 数据类型重定义 (CCDS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_mscr_ccds
+{
+ Tim3CmpTrigDMA = 0u, ///< 比较匹配触发DMA
+ Tim3UEVTrigDMA = 1u, ///< 事件更新代替比较匹配触发DMA
+}en_tim3_m23_mscr_ccds_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式选择 数据类型重定义 (MSM)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_mscr_msm
+{
+ Tim3SlaveMode = 0u, ///< 从模式
+ Tim3MasterMode = 1u, ///< 主模式
+}en_tim3_m23_mscr_msm_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发主模式输出源 数据类型重定义 (MMS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_mscr_mms
+{
+ Tim3MasterUG = 0u, ///< UG(软件更新)源
+ Tim3MasterCTEN = 1u, ///< CTEN源
+ Tim3MasterUEV = 2u, ///< UEV更新源
+ Tim3MasterCMPSO = 3u, ///< 比较匹配选择输出源
+ Tim3MasterOCA0Ref = 4u, ///< OCA0_Ref源
+ Tim3MasterOCB0Ref = 5u, ///< OCB0_Ref源
+ //Tim3MasterOCB0Ref = 6u,
+ //Tim3MasterOCB0Ref = 7u,
+}en_tim3_m23_mscr_mms_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发从模式选择 数据类型重定义 (SMS)(模式23)
+ *****************************************************************************/
+typedef enum en_tim3_m23_mscr_sms
+{
+ Tim3SlaveIClk = 0u, ///< 使用内部时钟
+ Tim3SlaveResetTIM = 1u, ///< 复位功能
+ Tim3SlaveTrigMode = 2u, ///< 触发模式
+ Tim3SlaveEClk = 3u, ///< 外部时钟模式
+ Tim3SlaveCodeCnt1 = 4u, ///< 正交编码计数模式1
+ Tim3SlaveCodeCnt2 = 5u, ///< 正交编码计数模式2
+ Tim3SlaveCodeCnt3 = 6u, ///< 正交编码计数模式3
+ Tim3SlaveGateCtrl = 7u, ///< 门控功能
+}en_tim3_m23_mscr_sms_t;
+
+/**
+ ******************************************************************************
+ ** \brief 定时器运行控制数据类型重定义 (CTEN)
+ *****************************************************************************/
+typedef enum en_tim3_start
+{
+ Tim3CTENDisable = 0u, ///< 停止
+ Tim3CTENEnable = 1u, ///< 运行
+}en_tim3_start_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 mode0 配置结构体定义(模式0)
+ *****************************************************************************/
+typedef struct stc_tim3_mode0_config
+{
+ en_tim3_work_mode_t enWorkMode; ///< 工作模式设置
+ en_tim3_m0cr_gatep_t enGateP; ///< 门控极性控制
+ boolean_t bEnGate; ///< 门控使能
+ en_tim3_cr_timclkdiv_t enPRS; ///< 预除频配置
+ boolean_t bEnTog; ///< 翻转输出使能
+ en_tim3_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_tim3_m0cr_md_t enCntMode; ///< 计数模式配置
+
+ func_ptr_t pfnTim3Cb; ///< Timer3中断服务回调函数[void function(void)]
+}stc_tim3_mode0_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 mode1 配置结构体定义(模式1)
+ *****************************************************************************/
+typedef struct stc_tim3_mode1_config
+{
+ en_tim3_work_mode_t enWorkMode; ///< 工作模式设置
+ en_tim3_cr_timclkdiv_t enPRS; ///< 预除频配置
+ en_tim3_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_tim3_m1cr_oneshot_t enOneShot; ///< 单次测量/循环测量选择
+
+ func_ptr_t pfnTim3Cb; ///< Timer3中断服务回调函数[void function(void)]
+
+}stc_tim3_mode1_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief PWC输入配置结构体定义(模式1)
+ *****************************************************************************/
+typedef struct stc_tim3_pwc_input_config
+{
+ en_tim3_mscr_ts_t enTsSel; ///< 触发输入源选择
+ en_tim3_m1_mscr_ia0s_t enIA0Sel; ///< CHA0输入选择
+ en_tim3_m1_mscr_ib0s_t enIB0Sel; ///< CHB0输入选择
+ en_tim3_port_polarity_t enETRPhase; ///< ETR相位选择
+ en_tim3_flt_t enFltETR; ///< ETR滤波设置
+ en_tim3_flt_t enFltIA0; ///< CHA0滤波设置
+ en_tim3_flt_t enFltIB0; ///< CHB0滤波设置
+}stc_tim3_pwc_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief TIM3 mode23 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_mode23_config
+{
+ en_tim3_work_mode_t enWorkMode; ///< 工作模式设置
+ en_tim3_m23cr_dir_t enCntDir; ///< 计数方向
+ en_tim3_cr_timclkdiv_t enPRS; ///< 时钟预除频配置
+ en_tim3_cr_ct_t enCT; ///< 定时/计数功能选择
+ en_tim3_m23cr_comp_t enPWMTypeSel; ///< PWM模式选择(独立/互补)
+ en_tim3_m23cr_pwm2s_t enPWM2sSel; ///< OCREFA双点比较功能选择
+ boolean_t bOneShot; ///< 单次触发模式使能/禁止
+ boolean_t bURSSel; ///< 更新源选择
+
+ func_ptr_t pfnTim3Cb; ///< Timer3中断服务回调函数[void function(void)]
+}stc_tim3_mode23_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief GATE在PWM互补模式下捕获或比较功能 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_gate_config
+{
+ en_tim3_m23cr_csg_t enGateFuncSel; ///< Gate比较、捕获功能选择
+ boolean_t bGateRiseCap; ///< GATE作为捕获功能时,上沿捕获有效控制
+ boolean_t bGateFallCap; ///< GATE作为捕获功能时,下沿捕获有效控制
+}stc_tim3_m23_gate_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief CHA/CHB通道比较控制 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_compare_config
+{
+ en_tim3_m23_crch0_csa_csb_t enCHxACmpCap; ///< CH0A比较/捕获功能选择
+ en_tim3_m23_fltr_ocm_t enCHxACmpCtrl; ///< CH0A通道比较控制
+ en_tim3_port_polarity_t enCHxAPolarity; ///< CH0A输出极性控制
+ boolean_t bCHxACmpBufEn; ///< 比较A缓存功能 使能/禁止
+ en_tim3_m23_cisa_cisb_t enCHxACmpIntSel; ///< CHA比较匹配中断选择
+
+ en_tim3_m23_crch0_csa_csb_t enCHxBCmpCap; ///< CH0B比较/捕获功能选择
+ en_tim3_m23_fltr_ocm_t enCHxBCmpCtrl; ///< CH0B通道比较控制
+ en_tim3_port_polarity_t enCHxBPolarity; ///< CH0B输出极性控制
+ boolean_t bCHxBCmpBufEn; ///< 比较B缓存功能 使能/禁止
+ en_tim3_m23_cisa_cisb_t enCHxBCmpIntSel; ///< CHB0比较匹配中断选择
+}stc_tim3_m23_compare_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief CHA/CHB通道捕获控制 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_input_config
+{
+ en_tim3_m23_crch0_csa_csb_t enCHxACmpCap; ///< CH0A比较/捕获功能选择
+ en_tim3_m23_crch0_cfx_crx_t enCHxACapSel; ///< CH0A捕获边沿选择
+ en_tim3_flt_t enCHxAInFlt; ///< CH0A通道捕获滤波控制
+ en_tim3_port_polarity_t enCHxAPolarity; ///< CH0A输入相位
+
+ en_tim3_m23_crch0_csa_csb_t enCHxBCmpCap; ///< CH0A比较/捕获功能选择
+ en_tim3_m23_crch0_cfx_crx_t enCHxBCapSel; ///< CH0B捕获边沿选择
+ en_tim3_flt_t enCHxBInFlt; ///< CH0B通道捕获滤波控制
+ en_tim3_port_polarity_t enCHxBPolarity; ///< CH0B输入相位
+
+}stc_tim3_m23_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief ETR输入相位滤波配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_etr_input_config
+{
+ en_tim3_port_polarity_t enETRPolarity; ///< ETR输入极性设置
+ en_tim3_flt_t enETRFlt; ///< ETR滤波设置
+}stc_tim3_m23_etr_input_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 刹车BK输入相位滤波配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_bk_input_config
+{
+ boolean_t bEnBrake; ///< 刹车使能
+ boolean_t bEnVC0Brake; ///< 使能VC0刹车
+ boolean_t bEnVC1Brake; ///< 使能VC1刹车
+ boolean_t bEnSafetyBk; ///< 使能safety刹车
+ boolean_t bEnBKSync; ///< TIM0/TIM1/TIM2刹车同步使能
+ en_tim3_m23_crchx_bks_t enBkCH0AStat; ///< 刹车时CHA端口状态设置
+ en_tim3_m23_crchx_bks_t enBkCH0BStat; ///< 刹车时CHB端口状态设置
+ en_tim3_m23_crchx_bks_t enBkCH1AStat; ///< 刹车时CHA端口状态设置
+ en_tim3_m23_crchx_bks_t enBkCH1BStat; ///< 刹车时CHB端口状态设置
+ en_tim3_m23_crchx_bks_t enBkCH2AStat; ///< 刹车时CHA端口状态设置
+ en_tim3_m23_crchx_bks_t enBkCH2BStat; ///< 刹车时CHB端口状态设置
+ en_tim3_port_polarity_t enBrakePolarity; ///< 刹车BK输入极性设置
+ en_tim3_flt_t enBrakeFlt; ///< 刹车BK滤波设置
+}stc_tim3_m23_bk_input_config_t;
+
+/**
+ ******************************************************************************
+** \brief 死区功能配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_dt_config
+{
+ boolean_t bEnDeadTime; ///< 刹车时CHA端口状态设置
+ uint8_t u8DeadTimeValue; ///< 刹车时CHA端口状态设置
+}stc_tim3_m23_dt_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 触发ADC配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_adc_trig_config
+{
+ boolean_t bEnTrigADC; ///< 触发ADC全局控制
+ boolean_t bEnUevTrigADC; ///< 事件更新触发ADC
+ boolean_t bEnCH0ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH0BCmpTrigADC; ///< CH0B比较匹配触发ADC
+ boolean_t bEnCH1ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH1BCmpTrigADC; ///< CH0B比较匹配触发ADC
+ boolean_t bEnCH2ACmpTrigADC; ///< CH0A比较匹配触发ADC
+ boolean_t bEnCH2BCmpTrigADC; ///< CH0B比较匹配触发ADC
+}stc_tim3_m23_adc_trig_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief DMA触发 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_trig_dma_config
+{
+ boolean_t bUevTrigDMA; ///< 更新 触发DMA使能
+ boolean_t bTITrigDMA; ///< Trig 触发DMA功能
+ boolean_t bCmpA0TrigDMA; ///< CH0A捕获比较触发DMA使能
+ boolean_t bCmpB0TrigDMA; ///< CH0B捕获比较触发DMA使能
+ boolean_t bCmpA1TrigDMA; ///< CH1A捕获比较触发DMA使能
+ boolean_t bCmpB1TrigDMA; ///< CH1B捕获比较触发DMA使能
+ boolean_t bCmpA2TrigDMA; ///< CH2A捕获比较触发DMA使能
+ boolean_t bCmpB2TrigDMA; ///< CH2B捕获比较触发DMA使能
+ en_tim3_m23_mscr_ccds_t enCmpUevTrigDMA; ///< 比较模式下DMA比较触发选择
+}stc_tim3_m23_trig_dma_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief 主从模式 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_master_slave_config
+{
+ en_tim3_m23_mscr_msm_t enMasterSlaveSel; ///< 主从模式选择
+ en_tim3_m23_mscr_mms_t enMasterSrc; ///< 主模式触发源选择
+ en_tim3_m23_mscr_sms_t enSlaveModeSel; ///< 从模式选择
+ en_tim3_mscr_ts_t enTsSel; ///< 触发输入源选择
+}stc_tim3_m23_master_slave_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief OCREF清除功能 配置结构体定义(模式23)
+ *****************************************************************************/
+typedef struct stc_tim3_m23_OCREF_Clr_config
+{
+ en_tim3_m23ce_occs_t enOCRefClrSrcSel; ///< OCREF清除源选择
+ boolean_t bVCClrEn; ///< 是否使能来自VC的OCREF_Clr
+}stc_tim3_m23_OCREF_Clr_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+//中断相关函数
+
+//中断标志获取
+boolean_t Tim3_GetIntFlag(en_tim3_irq_type_t enTim3Irq);
+//中断标志清除
+en_result_t Tim3_ClearIntFlag(en_tim3_irq_type_t enTim3Irq);
+//所有中断标志清除
+en_result_t Tim3_ClearAllIntFlag(void);
+//模式0中断使能
+en_result_t Tim3_Mode0_EnableIrq(void);
+//模式1中断使能
+en_result_t Tim3_Mode1_EnableIrq (en_tim3_irq_type_t enTim3Irq);
+//模式2中断使能
+en_result_t Tim3_Mode23_EnableIrq (en_tim3_irq_type_t enTim3Irq);
+//模式0中断禁止
+en_result_t Tim3_Mode0_DisableIrq(void);
+//模式1中断禁止
+en_result_t Tim3_Mode1_DisableIrq (en_tim3_irq_type_t enTim3Irq);
+//模式2中断禁止
+en_result_t Tim3_Mode23_DisableIrq (en_tim3_irq_type_t enTim3Irq);
+
+
+//模式0初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Tim3_Mode0_Init(stc_tim3_mode0_config_t* pstcConfig);
+//timer 启动/停止
+en_result_t Tim3_M0_Run(void);
+en_result_t Tim3_M0_Stop(void);
+//重载值设置
+en_result_t Tim3_M0_ARRSet(uint16_t u16Data);
+//16位计数值设置/获取
+en_result_t Tim3_M0_Cnt16Set(uint16_t u16Data);
+uint16_t Tim3_M0_Cnt16Get(void);
+//32位计数值设置/获取
+en_result_t Tim3_M0_Cnt32Set(uint32_t u32Data);
+uint32_t Tim3_M0_Cnt32Get(void);
+//翻转输出使能/禁止设定
+en_result_t Tim3_M0_EnTOG_Output(boolean_t bEnOutput);
+
+
+//模式1初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Tim3_Mode1_Init(stc_tim3_mode1_config_t* pstcConfig);
+//PWC 输入配置
+en_result_t Tim3_M1_Input_Config(stc_tim3_pwc_input_config_t* pstcConfig);
+//PWC测量边沿起始结束选择
+en_result_t Tim3_M1_PWC_Edge_Sel(en_tim3_m1cr_Edge_t enEdgeSel);
+//timer 启动/停止
+en_result_t Tim3_M1_Run(void);
+en_result_t Tim3_M1_Stop(void);
+//16位计数值设置/获取
+en_result_t Tim3_M1_Cnt16Set(uint16_t u16Data);
+uint16_t Tim3_M1_Cnt16Get(void);
+//脉冲宽度测量结果数值获取
+uint16_t Tim3_M1_PWC_CapValueGet(void);
+
+
+//模式1初始化及相关功能操作
+
+//timer配置及初始化
+en_result_t Tim3_Mode23_Init(stc_tim3_mode23_config_t* pstcConfig);
+//timer 启动/停止
+en_result_t Tim3_M23_Run(void);
+en_result_t Tim3_M23_Stop(void);
+//PWM输出使能
+en_result_t Tim3_M23_EnPWM_Output(boolean_t bEnOutput, boolean_t bEnAutoOutput);
+//重载值设置
+en_result_t Tim3_M23_ARRSet(uint16_t u16Data, boolean_t bArrBufEn);
+//16位计数值设置/获取
+en_result_t Tim3_M23_Cnt16Set(uint16_t u16Data);
+uint16_t Tim3_M23_Cnt16Get(void);
+//比较捕获寄存器CCR0A/CCR0B设置/读取
+en_result_t Tim3_M23_CCR_Set(en_tim3_m23_ccrx_t enCCRSel, uint16_t u16Data);
+uint16_t Tim3_M23_CCR_Get(en_tim3_m23_ccrx_t enCCRSel);
+//PWM互补输出模式下,GATE功能选择
+en_result_t Tim3_M23_GateFuncSel(stc_tim3_m23_gate_config_t* pstcConfig);
+//主从模式配置
+en_result_t Tim3_M23_MasterSlave_Set(stc_tim3_m23_master_slave_config_t* pstcConfig);
+//CH0A/CH0B比较通道控制
+en_result_t Tim3_M23_PortOutput_Config(en_tim3_channel_t enTim3Chx, stc_tim3_m23_compare_config_t* pstcConfig);
+//CH0A/CH0B输入控制
+en_result_t Tim3_M23_PortInput_Config(en_tim3_channel_t enTim3Chx, stc_tim3_m23_input_config_t* pstcConfig);
+//ERT输入控制
+en_result_t Tim3_M23_ETRInput_Config(stc_tim3_m23_etr_input_config_t* pstcConfig);
+//刹车BK输入控制
+en_result_t Tim3_M23_BrakeInput_Config(stc_tim3_m23_bk_input_config_t* pstcConfig);
+//触发ADC控制
+en_result_t Tim3_M23_TrigADC_Config(stc_tim3_m23_adc_trig_config_t* pstcConfig);
+//死区功能
+en_result_t Tim3_M23_DT_Config(stc_tim3_m23_dt_config_t* pstcConfig);
+//重复周期设置
+en_result_t Tim3_M23_SetValidPeriod(uint8_t u8ValidPeriod);
+//OCREF清除功能
+en_result_t Tim3_M23_OCRefClr(stc_tim3_m23_OCREF_Clr_config_t* pstcConfig);
+//使能DMA传输
+en_result_t Tim3_M23_EnDMA(stc_tim3_m23_trig_dma_config_t* pstcConfig);
+//捕获比较A软件触发
+en_result_t Tim3_M23_EnSwTrigCapCmpA(en_tim3_channel_t enTim3Chx);
+//捕获比较B软件触发
+en_result_t Tim3_M23_EnSwTrigCapCmpB(en_tim3_channel_t enTim3Chx);
+//软件更新使能
+en_result_t Tim3_M23_EnSwUev(void);
+//软件触发使能
+en_result_t Tim3_M23_EnSwTrig(void);
+//软件刹车使能
+en_result_t Tim3_M23_EnSwBk(void);
+
+
+//@} // Tim3Group
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __BT_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/trim.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/trim.h
new file mode 100644
index 0000000000..7534eb0269
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/trim.h
@@ -0,0 +1,186 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file trim.h
+ **
+ ** TRIM 数据结构及API声明
+ **
+ **
+ ** History:
+ ** - 2018-04-21 Lux V1.0
+ **
+ *****************************************************************************/
+
+#ifndef __TRIM_H__
+#define __TRIM_H__
+
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup TrimGroup Clock Trimming (TRIM)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ ** Global pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+ /**
+ ******************************************************************************
+ ** \brief 监测模式使能枚举重定义 (MON_EN)
+ *****************************************************************************/
+typedef enum en_trim_monitor
+{
+ TrimMonDisable = 0u, ///< 禁止
+ TrimMonEnable = 1u, ///< 使能
+}en_trim_monitor_t;
+
+ /**
+ ******************************************************************************
+ ** \brief 待校准/监测时钟选择枚举重定义 (CALCLK_SEL)
+ *****************************************************************************/
+typedef enum en_trim_calclksel
+{
+ TrimCalRCH = 0u, ///< RCH
+ TrimCalXTH = 1u, ///< XTH
+ TrimCalRCL = 2u, ///< RCL
+ TrimCalXTL = 3u, ///< XTL
+ TrimCalPLL = 4u, ///< PLL
+}en_trim_calclksel_t;
+
+/**
+ ******************************************************************************
+ ** \brief 参考时钟选择枚举重定义 (REFCLK_SEL)
+ *****************************************************************************/
+typedef enum en_trim_refclksel
+{
+ TrimRefRCH = 0u, ///< RCH
+ TrimRefXTH = 1u, ///< XTH
+ TrimRefRCL = 2u, ///< RCL
+ TrimRefXTL = 3u, ///< XTL
+ TrimRefIRC10K = 4u, ///< IRC10K
+ TrimRefExtClk = 5u, ///< 外部输入时钟
+}en_trim_refclksel_t;
+
+/**
+ ******************************************************************************
+ ** \brief 中断标志类型枚举重定义
+ *****************************************************************************/
+typedef enum en_trim_inttype
+{
+ TrimStop = 0u, ///< 参考计数器停止标志
+ TrimCalCntOf = 1u, ///< 校准计数器溢出标志
+ TrimXTLFault = 2u, ///< XTL 失效标志
+ TrimXTHFault = 3u, ///< XTH 失效标志
+ TrimPLLFault = 4u, ///< PLL 失效标志
+}en_trim_inttype_t;
+
+/**
+ ******************************************************************************
+ ** \brief TRIM 配置结构体定义
+ *****************************************************************************/
+typedef struct stc_trim_config
+{
+ en_trim_monitor_t enMON; ///< 监测模式使能
+ en_trim_calclksel_t enCALCLK; ///< 校准时钟选择
+ uint32_t u32CalCon; ///< 校准计数器溢出值配置
+ en_trim_refclksel_t enREFCLK; ///< 参考时钟选择
+ uint32_t u32RefCon; ///< 参考计数器初值配置
+
+ func_ptr_t pfnTrimCb; ///< TRIM 中断服务回调函数[void function(void)]
+}stc_trim_config_t;
+
+/******************************************************************************
+ * Global variable declarations ('extern', definition in C source)
+ *****************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ *****************************************************************************/
+///<<功能配置及操作函数
+///<Trim 配置及初始化
+en_result_t Trim_Init(stc_trim_config_t* pstcConfig);
+///<校准/监测启动/停止
+en_result_t Trim_Run(void);
+en_result_t Trim_Stop(void);
+
+///<参考计数器计数值获取
+uint32_t Trim_RefCntGet(void);
+///<校准计数器计数值获取
+uint32_t Trim_CalCntGet(void);
+
+///<中断操作相关函数
+///中断使能/禁止
+en_result_t Trim_EnableIrq(void);
+en_result_t Trim_DisableIrq(void);
+///<中断标志获取
+boolean_t Trim_GetIntFlag(en_trim_inttype_t enIntType);
+///<中断标志清除
+en_result_t Trim_ClearIntFlag(en_trim_inttype_t enIntType);
+
+//@} // TrimGroup
+
+#ifdef __cplusplus
+#endif
+
+
+#endif /* __TRIM_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/uart.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/uart.h
new file mode 100644
index 0000000000..12d29be8fa
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/uart.h
@@ -0,0 +1,297 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file uart.h
+ **
+ ** Headerfile for UART functions
+ **
+ **
+ ** History:
+ ** - 2017-05-10 Cathy First Version
+ **
+ *****************************************************************************/
+
+#ifndef __UART_H__
+#define __UART_H__
+/*****************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup UartGroup Universal Asynchronous Receiver/Transmitter (UART)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+ /**
+ ******************************************************************************
+ **\brief uart通道选择
+ ******************************************************************************/
+
+typedef enum en_uart_channel
+{
+ UARTCH0 = 0u, ///<串口0
+ UARTCH1 = 1u, ///<串口1
+}en_uart_channel_t;
+/**
+ ******************************************************************************
+ ** \brief uart多主机模式地址帧/数据帧或者奇偶校验
+ ******************************************************************************/
+typedef enum en_uart_mmdorck
+{
+ UartDataOrAddr = 0u, ///<多主机模式时,通过读写SBUF[8]决定帧为数据帧或地址帧
+ UartEven = 1u, ///<非多主机模式偶校验
+ UartOdd = 2u, ///<非多主机模式奇校验
+}en_uart_mmdorck_t;
+
+/**
+ ******************************************************************************
+ ** \brief uart多主机模式配置
+ ******************************************************************************/
+typedef enum en_uart_multimode
+{
+ UartNormal = 0u, ///<正常工作模式
+ UartMulti = 1u, ///<多主机工作模式
+}en_uart_multimode_t;
+/**
+ ******************************************************************************
+ ** \brief uart多主机模式及从机地址和地址掩码配置
+ ******************************************************************************/
+
+typedef struct stc_uart_multimode
+{
+ en_uart_multimode_t enMulti_mode; ///<多主机模式配置
+ uint8_t u8SlaveAddr; ///<从机地址
+ uint8_t u8SaddEn; ///<从及地址掩码
+}stc_uart_multimode_t;
+
+/**
+ ******************************************************************************
+ ** \brief uart 四种工作模式选择
+ ******************************************************************************/
+
+typedef enum en_uart_mode
+{
+ UartMode0 = 0u, ///<模式0
+ UartMode1 = 1u, ///<模式1
+ UartMode2 = 2u, ///<模式2
+ UartMode3 = 3u, ///<模式3
+} en_uart_mode_t;
+/**
+ ******************************************************************************
+ ** \brief uart stop长度选择
+ ******************************************************************************/
+
+typedef enum en_uart_stop
+{
+ Uart1bit = 0u, ///<1位停止位
+ Uart15bit = 1u, ///<1.5位停止位
+ Uart2bit = 2u, ///<2位停止位
+} en_uart_stop_t;
+/**
+ ******************************************************************************
+ ** \brief uart 功能使能
+ ******************************************************************************/
+typedef enum en_uart_func
+{
+ UartTx = 0u, ///<mode0模式代表TX
+ UartRx = 1u, ///<非mode0模式代表RX and TX ,mode0模式代表RX
+ UartDmaTx = 3u, ///<DMA发送使能
+ UartDmaRx = 4u, ///<DMA接收使能
+ UartCtsRts = 5u, ///<硬件流使能
+}en_uart_func_t;
+/**
+ ******************************************************************************
+ ** \brief uart中断使能控制
+ ******************************************************************************/
+typedef enum en_uart_irq_sel
+{
+ UartTxIrq = 0u, ///<发送中断使能
+ UartRxIrq = 1u, ///<接收中断使能
+ UartFEIrq = 3u, ///<帧错误中断使能
+ UartCtsIrq = 4u, ///<CTS信号翻转中断使能
+ UartPEIrq = 5u, ///<奇偶校验中断使能
+ UartTxEIrq = 6u, ///<TX空中断使能
+}en_uart_irq_sel_t;
+/**
+ ******************************************************************************
+ ** \brief uart发送接收中断处理函数接口
+ ******************************************************************************/
+
+typedef struct stc_uart_irq_cb
+{
+ func_ptr_t pfnTxIrqCb; ///<发送中断服务函数
+ func_ptr_t pfnRxFEIrqCb; ///<接收帧错误中断服务函数
+ func_ptr_t pfnRxIrqCb; ///<接收中断服务函数
+ func_ptr_t pfnCtsIrqCb; ///<CTS信号翻转中断服务函数
+ func_ptr_t pfnPEIrqCb; ///<奇偶校验错误中断服务函数
+}stc_uart_irq_cb_t;
+/**
+ ******************************************************************************
+ ** \brief uart 状态标志位
+ ******************************************************************************/
+typedef enum en_uart_status
+{
+ UartCts = 0u, ///<CTS信号标记
+ UartRC = 1u, ///<接收数据完成标记
+ UartTC = 2u, ///<发送数据完成标记
+ UartPE = 3u, ///<奇偶校验错误标记
+ UartFE = 4u, ///<帧错误标记
+ UartCtsIf = 5u, ///<CTS中断标记
+ UartTxe = 6u, ///<TXbuff空标记
+}en_uart_status_t;
+/**
+ ******************************************************************************
+ ** \brief uart 通道地址及中断函数地址结构
+ ******************************************************************************/
+typedef struct stc_uart_instance_data
+{
+ uint32_t u32Idx; ///< 通道号
+ M0P_UART_TypeDef *pstcInstance; ///< 通道寄存器地址
+ stc_uart_irq_cb_t stcUartInternIrqCb; ///< 通道中断服务函数
+} stc_uart_instance_data_t;
+/**
+ ******************************************************************************
+ ** \brief uart 通道波特率配置
+ ******************************************************************************/
+typedef enum en_uart_clkdiv
+{
+ Uart16Or32Div = 0u,///<模式0无效,模式1/3为16分频,模式2为32分频
+ Uart8Or16Div = 1u,///<模式0无效,模式1/3为8分频,模式2为16分频
+}en_uart_clkdiv_t;
+/**
+ ******************************************************************************
+ ** \brief uart 通道波特率计算参数
+ ******************************************************************************/
+typedef struct stc_uart_baud
+{
+ uint32_t u32Pclk; ///<pclk
+ en_uart_mode_t enRunMode; ///< 四种模式配置
+ uint32_t u32Baud; ///< 波特率
+} stc_uart_baud_t;
+/**
+ ******************************************************************************
+ ** \uart 总体配置
+ ******************************************************************************/
+
+typedef struct stc_uart_config
+{
+ en_uart_mode_t enRunMode; ///< 四种模式配置
+ en_uart_stop_t enStopBit; ///<停止位长度
+ stc_uart_multimode_t* pstcMultiMode; ///<多主机模式配置
+ stc_uart_irq_cb_t* pstcIrqCb; ///<中断服务函数
+ boolean_t bTouchNvic; ///<NVIC中断使能
+} stc_uart_config_t;
+//中断相关设置函数
+en_result_t Uart_EnableIrq(uint8_t u8Idx,
+ en_uart_irq_sel_t enIrqSel);
+en_result_t Uart_DisableIrq(uint8_t u8Idx,
+ en_uart_irq_sel_t enIrqSel);
+//void Uart_IrqHandler(uint8_t u8Idx);
+// 总初始化处理
+en_result_t Uart_Init(uint8_t u8Idx,
+ stc_uart_config_t* pstcConfig);
+en_result_t Uart_DeInit(uint8_t u8Idx, boolean_t bTouchNvic);
+//UART模块工作模式设置函数
+en_result_t Uart_SetMode(uint8_t u8Idx,en_uart_mode_t enMode);
+//UART模块多主机模式设置函数
+en_result_t Uart_SetMultiMode(uint8_t u8Idx,stc_uart_multimode_t* pstcMultiConfig);
+//UART通道多主机模式发送数据/地址帧或者奇偶校验配置TB8
+en_result_t Uart_SetMMDOrCk(uint8_t u8Idx,en_uart_mmdorck_t enTb8);
+//从机地址配置
+en_result_t Uart_SetSaddr(uint8_t u8Idx,uint8_t u8Addr);
+//从机地址掩码配置
+en_result_t Uart_SetSaddrEn(uint8_t u8Idx,uint8_t u8Addren);
+//停止位长度设置
+en_result_t Uart_SetStopBit(uint8_t u8Idx,uint8_t u8Len);
+//RB8数据获取
+boolean_t Uart_GetRb8(uint8_t u8Idx);
+
+//采样分频设置
+en_result_t Uart_SetClkDiv(uint8_t u8Idx,en_uart_clkdiv_t enClkDiv);
+//波特率设置值计算
+uint16_t Uart_CalScnt(uint8_t u8Idx,stc_uart_baud_t *pstcBaud);
+//波特率设置
+en_result_t Uart_SetBaud(uint8_t u8Idx,uint16_t u16Scnt);
+//获取波特率
+uint32_t Uart_GetBaud(uint8_t u8Idx,uint8_t u8Mode,uint32_t u32Pclk);
+
+// 功能使能和禁止
+en_result_t Uart_EnableFunc(uint8_t u8Idx, en_uart_func_t enFunc);
+en_result_t Uart_DisableFunc(uint8_t u8Idx, en_uart_func_t enFunc);
+//状态位的获取和清除
+uint8_t Uart_GetIsr(uint8_t u8Idx);
+boolean_t Uart_GetStatus(uint8_t u8Idx,en_uart_status_t enStatus);
+en_result_t Uart_ClrIsr(uint8_t u8Idx);
+en_result_t Uart_ClrStatus(uint8_t u8Idx,en_uart_status_t enStatus);
+//数据查询方式的收发操作
+//en_result_t Uart_MultiSendFirstData(uint8_t U8Addr);
+en_result_t Uart_SendData(uint8_t u8Idx, uint8_t u8Data);
+int Uart_ReceiveData(uint8_t u8Idx);
+
+//@} // UartGroup
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __UART_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/vc.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/vc.h
new file mode 100644
index 0000000000..6e8ceb6cf2
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/vc.h
@@ -0,0 +1,311 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file vc.h
+ **
+ ** Headerfile for Voltage Comparator functions
+ ** @link VC Group Some description @endlink
+ **
+ ** - 2017-06-28 Alex First Version
+ **
+ ******************************************************************************/
+
+#ifndef __VC_H__
+#define __VC_H__
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ ******************************************************************************
+ ** \defgroup VcGroup Voltage Comparator (VC)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+
+/**
+ ******************************************************************************
+ ** \brief VC通道
+ *****************************************************************************/
+typedef enum en_vc_channel
+{
+ VcChannel0 = 0u, ///< 通道0
+ VcChannel1 = 1u, ///< 通道1
+}en_vc_channel_t;
+
+
+/**
+ ******************************************************************************
+ ** \brief VC迟滞
+ *****************************************************************************/
+typedef enum en_vc_cmp_delay
+{
+ VcDelayoff = 0u, ///< 迟滞关闭
+ VcDelay10mv = 1u, ///< 迟滞10mv
+ VcDelay20mv = 2u, ///< 迟滞20mv
+ VcDelay30mv = 3u, ///< 迟滞30mv
+}en_vc_cmp_delay_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC偏置电流
+ *****************************************************************************/
+typedef enum en_vc_bias_current
+{
+ VcBias300na = 0u, ///< 偏置电流300na
+ VcBias1200na = 1u, ///< 偏置电流1.2ua
+ VcBias10ua = 2u, ///< 偏置电流10ua
+ VcBias20ua = 3u, ///< 偏置电流20ua
+}en_vc_bias_current_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC输出滤波时间
+ *****************************************************************************/
+typedef enum en_vc_resp_filter
+{
+ VcFilter7us = 0u, ///< 输出滤波时间7us
+ VcFilter14us = 1u, ///< 输出滤波时间14us
+ VcFilter28us = 2u, ///< 输出滤波时间28us
+ VcFilter112us = 3u, ///< 输出滤波时间112us
+ VcFilter450us = 4u, ///< 输出滤波时间450us
+ VcFilter1800us = 5u, ///< 输出滤波时间1.8ms
+ VcFilter7200us = 6u, ///< 输出滤波时间7.2ms
+ VcFilter28800us = 7u, ///< 输出滤波时间28.8ms
+}en_vc_resp_filter_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC P端输入
+ *****************************************************************************/
+typedef enum en_vc_input_p_src
+{
+ //VC0 //VC1
+ VcInPCh0 = 0u, ///< 输入通道0 PC0 输入通道0 PA0
+ VcInPCh1 = 1u, ///< 输入通道1 PC1 输入通道0 PA1
+ VcInPCh2 = 2u, ///< 输入通道2 PC2 输入通道0 PA2
+ VcInPCh3 = 3u, ///< 输入通道3 PC3 输入通道0 PA3
+ VcInPCh4 = 4u, ///< 输入通道4 PA0 输入通道0 PA4
+ VcInPCh5 = 5u, ///< 输入通道5 PA1 输入通道0 PA5
+ VcInPCh6 = 6u, ///< 输入通道6 PA2 输入通道0 PB1
+ VcInPCh7 = 7u, ///< 输入通道7 PA3 输入通道0 PB2
+ VcInPCh8 = 8u, ///< 输入通道7 PA4 输入通道0 PB10
+ VcInPCh9 = 9u, ///< 输入通道7 PA5 输入通道0 PB12
+ VcInPCh10 = 10u, ///< 输入通道7 PA6 输入通道0 PB13
+ VcInPCh11 = 11u, ///< 输入通道7 PA7 输入通道0 PB14
+ VcInPCh12 = 12u, ///< 输入通道7 PB4 输入通道0 PB4
+ VcInPCh13 = 13u, ///< 输入通道7 PB5 输入通道0 PB5
+ VcInPCh14 = 14u, ///< 输入通道7 PB6 输入通道0 PB6
+ VcInPCh15 = 15u, ///< 输入通道7 PB7 输入通道0 PB7
+}en_vc_input_p_src_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC N端输入
+ *****************************************************************************/
+typedef enum en_vc_input_n_src
+{
+ //VC0 //VC1
+ VcInNCh0 = 0u, ///< 输入通道0 PA0 输入通道0 PC0
+ VcInNCh1 = 1u, ///< 输入通道1 PA1 输入通道0 PC1
+ VcInNCh2 = 2u, ///< 输入通道2 PA2 输入通道0 PC2
+ VcInNCh3 = 3u, ///< 输入通道3 PA3 输入通道0 PC3
+ VcInNCh4 = 4u, ///< 输入通道4 PA4 输入通道0 PA0
+ VcInNCh5 = 5u, ///< 输入通道5 PA5 输入通道0 PA1
+ VcInNCh6 = 6u, ///< 输入通道6 PA6 输入通道0 PB0
+ VcInNCh7 = 7u, ///< 输入通道7 PA7 输入通道0 PB1
+ VcInNCh8 = 8u, ///< 输入通道8 PC4 输入通道0 PB2
+ VcInNCh9 = 9u, ///< 输入通道9 PC5 输入通道0 PB3
+ VcInNCh10 = 10u, ///< 输入通道10 PB0 输入通道0 PB4
+ ResDivOut = 11u, ///< Vcc分压 Vcc分压
+ AiTs = 12u, ///< 温度传感器 温度传感器
+ AiBg1p2 = 13u, ///< BGR 1.2V BGR 1.2V
+ AiAdcVref = 14u, ///< ADCVREF ADCVREF
+ AiLdo = 15u, ///< LDO LDO
+}en_vc_input_n_src_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC中断触发方式
+ *****************************************************************************/
+typedef enum en_vc_irq_sel
+{
+ VcIrqNone = 0u, ///< 无中断
+ VcIrqRise = 1u, ///< 上升沿触发
+ VcIrqFall = 2u, ///< 下降沿触发
+ VcIrqHigh = 3u, ///< 高电平触发
+
+}en_vc_irq_sel_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC状态
+ *****************************************************************************/
+typedef enum en_vc_stat
+{
+ VcCmpResult = 0u, ///< VC比较输出结果
+ VcIntrResult = 1u, ///< VC中断状态
+}en_vc_stat_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC输出配置
+ *****************************************************************************/
+typedef enum en_vc_output_config
+{
+ VcOutInvTimer = 0u, ///< 结果输出负向到各Timer0,1,2,3
+ VcOutTIM0RCLR = 1u, ///< 结果使能输出到TIM0 REFCLR
+ VcOutTIM1RCLR = 2u, ///< 结果使能输出到TIM1 REFCLR
+ VcOutTIM2RCLR = 3u, ///< 结果使能输出到TIM2 REFCLR
+ VcOutTIM3RCLR = 4u, ///< 结果使能输出到TIM3 REFCLR
+ VcOutTIMBK = 5u, ///< 结果使能输出到Timer0,1,2,3刹车
+ VcOutInvTIM4 = 9u, ///< 结果输出负向到Timer4
+ VcOutTIM4 = 10u, ///< 结果使能输出到Timer4
+ VcOutInvTIM5 = 11u, ///< 结果输出负向到Timer5
+ VcOutTIM5 = 12u, ///< 结果使能输出到Timer5
+ VcOutInvTIM6 = 13u, ///< 结果输出负向到Timer6
+ VcOutTIM6 = 14u, ///< 结果使能输出到Timer6
+ VcOutBrake = 15u, ///< 结果使能输出到Advanced Timer刹车
+ VcOutDisable = 16u, ///< 结果输出除能
+}en_vc_output_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC DIV参考电压Vref选择
+ *****************************************************************************/
+typedef enum en_vc_div_vref
+{
+ VcDivVrefAvcc = 0u, ///< AVCC
+ VcDivVrefAdc = 1u, ///< ADC_CR0 SREF选择参考电压
+}en_vc_div_vref_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC模块配置
+ *****************************************************************************/
+typedef struct stc_vc_dac_config
+{
+ boolean_t bDivEn; ///< 使能/除能 6-bit VCC divider
+ uint8_t u8DivVal; ///< 6-bit VCC divider设置值
+ en_vc_div_vref_t enDivVref; ///< 6-bit VCC divider输入参考电压选择
+}stc_vc_dac_config_t;
+
+/**
+ ******************************************************************************
+ ** \brief VC通道配置
+ *****************************************************************************/
+typedef struct stc_vc_channel_config
+{
+ en_vc_channel_t enVcChannel; ///< VC通道选择
+ en_vc_cmp_delay_t enVcCmpDly; ///< VC迟滞
+ en_vc_bias_current_t enVcBiasCurrent; ///< VC偏转电流
+ en_vc_resp_filter_t enVcFilterTime; ///< 输出滤波时间
+ en_vc_input_p_src_t enVcInPin_P; ///< P端输入
+ en_vc_input_n_src_t enVcInPin_N; ///< N端输入
+ en_vc_output_config_t enVcOutConfig; ///< 输出配置
+ en_vc_irq_sel_t enVcIrqSel; ///< 中断触发方式
+ func_ptr_t pfnAnalogCmpCb; ///< 中断回调函数
+}stc_vc_channel_config_t;
+
+/******************************************************************************
+ * Global definitions
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+
+//VC init/deinit
+
+en_result_t Vc_ChannelInit(en_vc_channel_t enChannel,
+ stc_vc_channel_config_t *pstcChannelConfig);
+en_result_t Vc_ChannelDeInit(en_vc_channel_t enChannel);
+en_result_t Vc_DACInit(stc_vc_dac_config_t *pstcDacConfig);
+//VC function enable/disable
+en_result_t Vc_EnableChannel(en_vc_channel_t enChannel);
+en_result_t Vc_DisableChannel(en_vc_channel_t enChannel);
+
+//VC filter enable/disable
+en_result_t Vc_EnableFilter(en_vc_channel_t enChannel);
+en_result_t Vc_DisableFilter(en_vc_channel_t enChannel);
+
+//get stat
+boolean_t Vc_GetStat(en_vc_channel_t enChannel, en_vc_stat_t enStat);
+//clear stat
+void Vc_ClearIrq(en_vc_channel_t enChannel);
+
+//irq enable/disable
+en_result_t Vc_EnableIrq(en_vc_channel_t enChannel);
+en_result_t Vc_DisableIrq(en_vc_channel_t enChannel);
+en_result_t Vc_ConfigIrq(en_vc_channel_t enChannel, en_vc_irq_sel_t enSel);
+//@} // VcGroup
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VC_H__ */
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/wdt.h b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/wdt.h
new file mode 100644
index 0000000000..460334be0a
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/inc/wdt.h
@@ -0,0 +1,127 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file wdt.h
+ **
+ ** Headerfile for WDT functions
+ **
+ **
+ ** History:
+ ** - 2017-05-10 Cathy First Version
+ **
+ *****************************************************************************/
+
+#ifndef __WDT_H__
+#define __WDT_H__
+
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+
+/**
+ ******************************************************************************
+ ** \defgroup WdtGroup Watchdog Timer (WDT)
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Global pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************
+ * Global type definitions
+ ******************************************************************************/
+/**
+ ******************************************************************************
+ ** \brief wdt溢出后复位或中断配置
+ *****************************************************************************/
+typedef enum en_wdt_reset
+{
+ WRESET_EN = 0,///<复位使能
+ WINT_EN = 1,///<中断使能
+}en_wdt_reset_t;
+/**
+ ******************************************************************************
+ ** \brief wdt当前运行状态
+ *****************************************************************************/
+
+typedef enum en_wdt_status
+{
+ Stop_Mode = 0,///<停止模块
+ Run_Mode = 1,///<正常运行模式
+}en_wdt_status_t;
+
+/**
+ ******************************************************************************
+ ** \brief wdt总体配置,定时时间 、中断函数等
+ *****************************************************************************/
+
+typedef struct stc_wdt_config
+{
+ uint8_t u8LoadValue; ///<溢出时间
+ en_wdt_reset_t enResetEnable; ///<中断或复位使能
+ func_ptr_t pfnWdtIrqCb; ///<中断服务接口函数
+} stc_wdt_config_t;
+//wdt初始化
+en_result_t Wdt_Init(stc_wdt_config_t* pstcConfig);
+void Wdt_DeInit(void);
+
+//wdt开始和停止
+en_result_t Wdt_Start(void);
+
+//wdt溢出时间设置及当前计数时间、状态读取
+void Wdt_WriteWdtLoad(uint8_t u8LoadValue);
+uint8_t Wdt_ReadWdtValue(void);
+uint8_t Wdt_ReadwdtStatus(void);
+
+//喂狗处理
+void Wdt_Feed(void);
+
+//@} // WdtGroup
+
+#ifdef __cplusplus
+#endif
+
+#endif /* __WDT_H__ */
+
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adc.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adc.c
new file mode 100644
index 0000000000..7d3b04ce16
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adc.c
@@ -0,0 +1,1022 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file adc.c
+ **
+ ** ADC driver API.
+ **
+ ** - 2017-06-28 Alex First Version
+ **
+ ******************************************************************************/
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "adc.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup AdcGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static stc_adc_irq_calbakfn_pt_t stcAdcIrqCalbaks = {NULL, NULL, NULL, NULL,NULL,NULL};
+
+/*****************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ *****************************************************************************/
+
+/**
+ * \brief
+ * ADC中断服务程序
+ *
+ * \param [in] u8Param 未使用
+ *
+ * \retval 无
+ */
+
+void Adc_IRQHandler(uint8_t u8Param)
+{
+ if (TRUE == M0P_ADC->IFR_f.REGIF)
+ {
+ if (NULL != stcAdcIrqCalbaks.pfnAdcRegIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcRegIrq();
+ }
+ M0P_ADC->ICR_f.REGIC = 0u;
+ }
+
+ if (TRUE == M0P_ADC->IFR_f.HTIF)
+ {
+ if (NULL != stcAdcIrqCalbaks.pfnAdcHhtIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcHhtIrq();
+ }
+ M0P_ADC->ICR_f.HTIC = 0u;
+ }
+
+ if (TRUE == M0P_ADC->IFR_f.LTIF)
+ {
+ if (NULL != stcAdcIrqCalbaks.pfnAdcLltIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcLltIrq();
+ }
+ M0P_ADC->ICR_f.LTIC = 0u;
+ }
+
+ if (TRUE == M0P_ADC->IFR_f.SGLIF)
+ {
+ if (NULL != stcAdcIrqCalbaks.pfnAdcIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcIrq();
+ }
+ M0P_ADC->ICR_f.SGLIC = 0u;
+ }
+ if(TRUE == M0P_ADC->IFR_f.SQRIF)
+ {
+ if (NULL != stcAdcIrqCalbaks.pfnAdcSQRIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcSQRIrq();
+ }
+ M0P_ADC->ICR_f.SQRIC = 0u;
+ }
+ if(TRUE == M0P_ADC->IFR_f.JQRIF)
+ {
+ if (NULL != stcAdcIrqCalbaks.pfnAdcJQRIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcJQRIrq();
+ }
+ M0P_ADC->ICR_f.JQRIC = 0u;
+ }
+}
+
+/**
+ * \brief
+ * 配置ADC中断函数入口
+ *
+ * \param [in] pstcAdcIrqCfg ADC中断配置指针
+ * \param [in] pstcAdcIrqCalbaks ADC中断回调函数指针
+ *
+ * \retval 无
+ */
+void Adc_ConfigIrq(stc_adc_irq_t* pstcAdcIrqCfg,
+ stc_adc_irq_calbakfn_pt_t* pstcAdcIrqCalbaks)
+{
+ if (TRUE == pstcAdcIrqCfg->bAdcIrq)
+ {
+ if (NULL != pstcAdcIrqCalbaks->pfnAdcIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcIrq = pstcAdcIrqCalbaks->pfnAdcIrq;
+ }
+ }
+ if (TRUE == pstcAdcIrqCfg->bAdcJQRIrq)
+ {
+ if (NULL != pstcAdcIrqCalbaks->pfnAdcJQRIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcJQRIrq = pstcAdcIrqCalbaks->pfnAdcJQRIrq;
+ }
+ }
+ if (TRUE == pstcAdcIrqCfg->bAdcSQRIrq)
+ {
+ if (NULL != pstcAdcIrqCalbaks->pfnAdcSQRIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcSQRIrq = pstcAdcIrqCalbaks->pfnAdcSQRIrq;
+ }
+ }
+ if (TRUE == pstcAdcIrqCfg->bAdcRegCmp)
+ {
+ if (NULL != pstcAdcIrqCalbaks->pfnAdcRegIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcRegIrq = pstcAdcIrqCalbaks->pfnAdcRegIrq;
+ }
+ }
+
+ if (TRUE == pstcAdcIrqCfg->bAdcHhtCmp)
+ {
+ if (NULL != pstcAdcIrqCalbaks->pfnAdcHhtIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcHhtIrq = pstcAdcIrqCalbaks->pfnAdcHhtIrq;
+ }
+ }
+
+ if (TRUE == pstcAdcIrqCfg->bAdcLltCmp)
+ {
+ if (NULL != pstcAdcIrqCalbaks->pfnAdcLltIrq)
+ {
+ stcAdcIrqCalbaks.pfnAdcLltIrq = pstcAdcIrqCalbaks->pfnAdcLltIrq;
+ }
+ }
+
+}
+
+/**
+ * \brief
+ * 获取ADC中断状态
+ *
+ * \param [in] pstcAdcIrqState ADC中断状态指针
+ *
+ * \retval 无
+ */
+void Adc_GetIrqState(stc_adc_irq_t* pstcAdcIrqState)
+{
+ pstcAdcIrqState->bAdcIrq = M0P_ADC->IFR_f.SGLIF;
+ pstcAdcIrqState->bAdcRegCmp = M0P_ADC->IFR_f.REGIF;
+ pstcAdcIrqState->bAdcHhtCmp = M0P_ADC->IFR_f.HTIF;
+ pstcAdcIrqState->bAdcLltCmp = M0P_ADC->IFR_f.LTIF;
+ pstcAdcIrqState->bAdcJQRIrq = M0P_ADC->IFR_f.JQRIF;
+ pstcAdcIrqState->bAdcSQRIrq = M0P_ADC->IFR_f.SQRIF;
+}
+/**
+ * \brief
+ * 清除ADC SGL中断状态
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrSglIrqState(void)
+{
+ M0P_ADC->ICR_f.SGLIC = 0;
+}
+/**
+ * \brief
+ * 清除ADC JQR中断状态
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrJqrIrqState(void)
+{
+ M0P_ADC->ICR_f.JQRIC = 0;
+}
+/**
+ * \brief
+ * 清除ADC SQR中断状态
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrSqrIrqState(void)
+{
+ M0P_ADC->ICR_f.SQRIC = 0;
+}
+
+/**
+ * \brief
+ * 清除ADC REG中断状态
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrRegIrqState(void)
+{
+ M0P_ADC->ICR_f.REGIC = 0;
+}
+
+/**
+ * \brief
+ * 清除ADC HT中断状态
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrHtIrqState(void)
+{
+ M0P_ADC->ICR_f.HTIC = 0;
+}
+
+/**
+ * \brief
+ * 清除ADC LT中断状态
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrLtIrqState(void)
+{
+ M0P_ADC->ICR_f.LTIC = 0;
+}
+
+
+/**
+ * \brief
+ * ADC中断使能
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_EnableIrq(void)
+{
+ M0P_ADC->CR0_f.IE = 1u;
+}
+
+/**
+ * \brief
+ * ADC比较使能(比较中断)
+ *
+ * \param [in] pstcAdcIrqCfg ADC比较配置
+ *
+ * \retval 无
+ */
+
+void Adc_ThresholdCfg(stc_adc_threshold_cfg_t* stcAdcThrCfg)
+{
+
+ M0P_ADC->HT_f.HT = stcAdcThrCfg->u32AdcRegHighThd; //使用比较
+ M0P_ADC->LT_f.LT = stcAdcThrCfg->u32AdcRegLowThd; //使用比较
+
+ M0P_ADC->CR1_f.THCH = stcAdcThrCfg->enThCh; //阈值比较通道选择
+
+ if (TRUE == stcAdcThrCfg->bAdcRegCmp)
+ {
+ M0P_ADC->CR1_f.REGCMP = 1u;
+ }
+ else
+ {
+ M0P_ADC->CR1_f.REGCMP = 0u;
+ }
+
+ if (TRUE == stcAdcThrCfg->bAdcHhtCmp)
+ {
+ M0P_ADC->CR1_f.HTCMP = 1u;
+ }
+ else
+ {
+ M0P_ADC->CR1_f.HTCMP = 0u;
+ }
+
+ if (TRUE == stcAdcThrCfg->bAdcLltCmp)
+ {
+ M0P_ADC->CR1_f.LTCMP = 1u;
+ }
+ else
+ {
+ M0P_ADC->CR1_f.LTCMP = 0u;
+ }
+
+}
+
+/**
+ * \brief
+ * ADC中断除能
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_DisableIrq(void)
+{
+ uint32_t u32Cr1;
+
+ M0P_ADC->CR0_f.IE = 0u;
+
+ u32Cr1 = M0P_ADC->CR1 | (1<<15); // must write 1 to bit 15 to avoid clear ADC_result_acc
+ u32Cr1 &= ~((1u<<12)|(1u<<13)|(1u<<14));
+ M0P_ADC->CR1 = u32Cr1;
+}
+
+/**
+ * \brief
+ * ADC初始化
+ *
+ * \param [in] pstcAdcConfig ADC配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_Init(stc_adc_cfg_t* pstcAdcConfig)
+{
+ if (NULL == pstcAdcConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+ M0P_ADC->CR0_f.CLKDIV = pstcAdcConfig->enAdcClkDiv;
+ M0P_ADC->CR0_f.SAM = pstcAdcConfig->enAdcSampTimeSel;
+ M0P_ADC->CR0_f.REF = pstcAdcConfig->enAdcRefVolSel;
+ M0P_ADC->CR0_f.BUF = pstcAdcConfig->bAdcInBufEn;
+ M0P_ADC->CR1_f.REGCMP = 0u;
+ M0P_ADC->CR1_f.HTCMP = 0u;
+ M0P_ADC->CR1_f.LTCMP = 0u;
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * ADC外部中断触发源配置
+ *
+ * \param [in] pstcAdcConfig ADC配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ExtTrigCfg(stc_adc_ext_trig_cfg_t* pstcExtTrigConfig)
+{
+ if (NULL == pstcExtTrigConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(pstcExtTrigConfig->enAdcExtTrigRegSel == AdcExtTrig0)
+ {
+ M0P_ADC->EXTTRIGGER0 |= 1u << pstcExtTrigConfig->enAdcTrig0Sel;
+ }
+ else if(pstcExtTrigConfig->enAdcExtTrigRegSel == AdcExtTrig1)
+ {
+ M0P_ADC->EXTTRIGGER1 |= 1u << pstcExtTrigConfig->enAdcTrig1Sel;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * ADC Deinit
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_DeInit(void)
+{
+
+ M0P_ADC->CR0_f.EN = 0u;
+
+ M0P_ADC->CR0_f.IE = 0u;
+ M0P_ADC->CR1_f.REGCMP = 0u;
+ M0P_ADC->CR1_f.HTCMP = 0u;
+ M0P_ADC->CR1_f.LTCMP = 0u;
+
+ M0P_ADC->ICR_f.SGLIC = 0u;
+ M0P_ADC->ICR_f.LTIC = 0u;
+ M0P_ADC->ICR_f.HTIC = 0u;
+ M0P_ADC->ICR_f.REGIC = 0u;
+ M0P_ADC->ICR_f.SQRIC = 0u;
+ M0P_ADC->ICR_f.JQRIC = 0u;
+
+ M0P_ADC->CR0_f.CLKDIV = 0u;
+ M0P_ADC->CR0_f.SAM = 0x2u;
+ M0P_ADC->CR0_f.REF = 0x3u;
+ M0P_ADC->CR0_f.SGLMUX = 0xFu;
+ M0P_ADC->CR0_f.BUF = 0u;
+ M0P_ADC->HT_f.HT = 0xFFFu;
+ M0P_ADC->LT_f.LT = 0u;
+}
+
+/**
+ * \brief
+ * ADC 单次转换开始
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+
+void Adc_SGL_Start(void)
+{
+ M0P_ADC->SGLSTART_f.START = 1u;
+}
+
+/**
+ * \brief
+ * ADC 单次转换停止
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_SGL_Stop(void)
+{
+ M0P_ADC->SGLSTART_f.START = 0u;
+}
+/**
+ * \brief
+ * ADC 顺序转换开始
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+
+void Adc_SQR_Start(void)
+{
+ M0P_ADC->SQRSTART_f.START = 1u;
+}
+
+/**
+ * \brief
+ * ADC 顺序转换停止
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_SQR_Stop(void)
+{
+ M0P_ADC->SQRSTART_f.START = 0u;
+}
+/**
+ * \brief
+ * ADC 插队转换开始
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+
+void Adc_JQR_Start(void)
+{
+ M0P_ADC->JQRSTART_f.START = 1u;
+}
+
+/**
+ * \brief
+ * ADC 插队转换停止
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_JQR_Stop(void)
+{
+ M0P_ADC->JQRSTART_f.START = 0u;
+}
+/**
+ * \brief
+ * ADC使能
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_Enable(void)
+{
+ M0P_ADC->CR0_f.EN = 1u;
+}
+
+/**
+ * \brief
+ * ADC除能
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_Disable(void)
+{
+ M0P_ADC->CR0_f.EN = 0u;
+}
+
+/**
+ * \brief
+ * 配置单次转换模式
+ *
+ * \param [in] pstcAdcConfig ADC配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigSglMode(stc_adc_cfg_t* pstcAdcConfig)
+{
+ if (NULL == pstcAdcConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_ADC->CR1_f.MODE = pstcAdcConfig->enAdcOpMode;
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * 配置顺序扫描转换模式
+ *
+ * \param [in] pstcAdcConfig ADC配置指针
+ * \param [in] pstcAdcNormCfg 连续转换模式配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigSqrMode(stc_adc_cfg_t* pstcAdcConfig, uint8_t u8AdcSampCnt,boolean_t bAdcResultAccEn)
+{
+ if (NULL == pstcAdcConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_ADC->CR1_f.MODE = pstcAdcConfig->enAdcOpMode;
+ M0P_ADC->CR1_f.RACCCLR = 0;//ADC转换结果累加寄存器(ADC_ResultAcc)清零
+ M0P_ADC->CR1_f.RACCEN = bAdcResultAccEn;
+ if (bAdcResultAccEn)
+ {
+ M0P_ADC->CR1_f.RACCCLR = 1u;
+ }
+ M0P_ADC->SQR2_f.CNT = u8AdcSampCnt - 1;
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * 配置插队扫描转换模式
+ *
+ * \param [in] pstcAdcConfig ADC配置指针
+ * \param [in] pstcAdcNormCfg 扫描转换模式配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigJqrMode(stc_adc_cfg_t* pstcAdcConfig, uint8_t u8AdcSampCnt,boolean_t bAdcResultAccEn)
+{
+ if (NULL == pstcAdcConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_ADC->CR1_f.MODE = pstcAdcConfig->enAdcOpMode;
+ M0P_ADC->CR1_f.RACCEN = bAdcResultAccEn;
+ M0P_ADC->JQR_f.CNT = u8AdcSampCnt - 1;
+
+ return Ok;
+}
+/**
+ * \brief
+ * 配置单次转换通道
+ *
+ * \param [in]enstcAdcSampCh 转换通道
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigSglChannel( en_adc_samp_ch_sel_t enstcAdcSampCh)
+{
+ M0P_ADC->CR0_f.SGLMUX = enstcAdcSampCh;
+ return Ok;
+}
+
+/**
+ * \brief
+ * 配置顺序扫描转换通道
+ *
+ * \param [in]enstcAdcSqrChMux 顺序扫描转换通道顺序
+ * \param [in]enstcAdcSampCh 转换通道
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigSqrChannel(en_adc_sqr_chmux_t enstcAdcSqrChMux, en_adc_samp_ch_sel_t enstcAdcSampCh)
+{
+ switch(enstcAdcSqrChMux)
+ {
+ case CH0MUX:
+ M0P_ADC->SQR0_f.CH0MUX = enstcAdcSampCh;
+ break;
+ case CH1MUX:
+ M0P_ADC->SQR0_f.CH1MUX = enstcAdcSampCh;
+ break;
+ case CH2MUX:
+ M0P_ADC->SQR0_f.CH2MUX = enstcAdcSampCh;
+ break;
+ case CH3MUX:
+ M0P_ADC->SQR0_f.CH3MUX = enstcAdcSampCh;
+ break;
+ case CH4MUX:
+ M0P_ADC->SQR0_f.CH4MUX = enstcAdcSampCh;
+ break;
+ case CH5MUX:
+ M0P_ADC->SQR0_f.CH5MUX = enstcAdcSampCh;
+ break;
+ case CH6MUX:
+ M0P_ADC->SQR1_f.CH6MUX = enstcAdcSampCh;
+ break;
+ case CH7MUX:
+ M0P_ADC->SQR1_f.CH7MUX = enstcAdcSampCh;
+ break;
+ case CH8MUX:
+ M0P_ADC->SQR1_f.CH8MUX = enstcAdcSampCh;
+ break;
+ case CH9MUX:
+ M0P_ADC->SQR1_f.CH9MUX = enstcAdcSampCh;
+ break;
+ case CH10MUX:
+ M0P_ADC->SQR1_f.CH10MUX = enstcAdcSampCh;
+ break;
+ case CH11MUX:
+ M0P_ADC->SQR1_f.CH11MUX = enstcAdcSampCh;
+ break;
+ case CH12MUX:
+ M0P_ADC->SQR2_f.CH12MUX = enstcAdcSampCh;
+ break;
+ case CH13MUX:
+ M0P_ADC->SQR2_f.CH13MUX = enstcAdcSampCh;
+ break;
+ case CH14MUX:
+ M0P_ADC->SQR2_f.CH14MUX = enstcAdcSampCh;
+ break;
+ case CH15MUX:
+ M0P_ADC->SQR2_f.CH15MUX = enstcAdcSampCh;
+ break;
+ default:
+ break;
+
+ }
+ return Ok;
+}
+/**
+ * \brief
+ * 配置插队扫描转换通道
+ *
+ * \param [in]enstcAdcSqrChMux 插队扫描转换通道顺序
+ * \param [in]enstcAdcSampCh 转换通道
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigJqrChannel(en_adc_jqr_chmux_t enstcAdcJqrChMux, en_adc_samp_ch_sel_t enstcAdcSampCh)
+{
+ switch(enstcAdcJqrChMux)
+ {
+ case CH0MUX:
+ M0P_ADC->JQR_f.CH0MUX = enstcAdcSampCh;
+ break;
+ case CH1MUX:
+ M0P_ADC->JQR_f.CH1MUX = enstcAdcSampCh;
+ break;
+ case CH2MUX:
+ M0P_ADC->JQR_f.CH2MUX = enstcAdcSampCh;
+ break;
+ case CH3MUX:
+ M0P_ADC->JQR_f.CH3MUX = enstcAdcSampCh;
+ break;
+ default:
+ break;
+ }
+ return Ok;
+}
+/**
+ * \brief
+ * 配置触发DMA读取控制
+ *
+ * \param [in]enAdcDmaTrig 触发DMA读取控制
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_ConfigDmaTrig(en_adc_dmatrig_t enAdcDmaTrig)
+{
+ if(enAdcDmaTrig == DmaJqr)
+ {
+ M0P_ADC->CR1_f.DMAJQR = 1;
+ }else
+ {
+ M0P_ADC->CR1_f.DMASQR = 1;
+ }
+ return Ok;
+}
+
+/**
+ * \brief
+ * 查询ADC单次转换状态
+ *
+ * \param none
+ *
+ * \retval boolean_t TRUE: ADC转换完成
+ * \retval boolean_t FALSE: ADC转换中
+ */
+boolean_t Adc_PollSglBusyState(void)
+{
+ return M0P_ADC->IFR_f.SGLIF;
+}
+
+
+/**
+ * \brief
+ * 查询ADC顺序扫描转换状态
+ *
+ * \retval boolean_t TRUE: ADC转换完成
+ * \retval boolean_t FALSE: ADC转换中
+ * \param none
+ *
+ */
+boolean_t Adc_PollSqrBusyState(void)
+{
+ return M0P_ADC->IFR_f.SQRIF;
+}
+
+/**
+ * \brief
+ * 查询ADC插队扫描转换状态
+ *
+ * \param none
+ *
+ * \retval boolean_t TRUE: ADC转换完成
+ * \retval boolean_t FALSE: ADC转换中
+ */
+boolean_t Adc_PollJqrBusyState(void)
+{
+ return M0P_ADC->IFR_f.JQRIF;
+}
+
+/**
+ * \brief
+ * 获取采样值
+ *
+ * \param [out] pu16AdcResult 采样值指针
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_GetSglResult(uint16_t* pu16AdcResult)
+{
+ if (NULL == pu16AdcResult)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ *pu16AdcResult = M0P_ADC->RESULT_f.RESULT;
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * 查询ADC结果比较区间状态
+ *
+ * \retval boolean_t TRUE: ADC转换完成
+ * \retval boolean_t FALSE: ADC转换中
+ * \param none
+ *
+ */
+boolean_t Adc_PollRegBusyState(void)
+{
+ return M0P_ADC->IFR_f.REGIF;
+}
+/**
+ * \brief
+ * 查询ADC结果比较上阈值状态
+ *
+ * \retval boolean_t TRUE: ADC转换完成
+ * \retval boolean_t FALSE: ADC转换中
+ * \param none
+ *
+ */
+boolean_t Adc_PollHTBusyState(void)
+{
+ return M0P_ADC->IFR_f.HTIF;
+}
+/**
+ * \brief
+ * 查询ADC结果比较区间状态
+ *
+ * \retval boolean_t TRUE: ADC转换完成
+ * \retval boolean_t FALSE: ADC转换中
+ * \param none
+ *
+ */
+boolean_t Adc_PollLtBusyState(void)
+{
+ return M0P_ADC->IFR_f.LTIF;
+}
+/**
+ * \brief
+ * 获取采样值
+ *
+ * \param [out] pu16AdcResult 采样值指针
+ * \param [in] SQRChannelIndex 顺序扫描通道序号
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_GetSqrResult(uint16_t* pu16AdcResult,uint8_t SQRChannelIndex)
+{
+ volatile uint32_t *BaseSqrResultAddress =(volatile uint32_t *) &(M0P_ADC->SQRRESULT0);
+
+ if (NULL == pu16AdcResult)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(SQRChannelIndex > 15)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ *pu16AdcResult = (uint16_t)(*(BaseSqrResultAddress + SQRChannelIndex));
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * 获取插队扫描采样值
+ *
+ * \param [out] pu16AdcResult 采样值指针
+ * \param [in] JQRChannelIndex 插队扫描通道序号
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_GetJqrResult(uint16_t* pu16AdcResult,uint8_t JQRChannelIndex)
+{
+ volatile uint32_t *BaseJqrResultAddress =(volatile uint32_t *) &(M0P_ADC->JQRRESULT0);
+ if (NULL == pu16AdcResult)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(JQRChannelIndex > 3)
+ {
+ return ErrorInvalidParameter;
+ }
+ *pu16AdcResult = (uint16_t)(*(BaseJqrResultAddress + JQRChannelIndex));
+ return Ok;
+}
+/**
+ * \brief
+ * 获取累加采样值
+ *
+ * \param [out] pu32AdcAccResult 累加采样值指针
+ *
+ * \retval en_result_t Ok: 成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_GetAccResult(uint32_t* pu32AdcAccResult)
+{
+ if (NULL == pu32AdcAccResult)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ *pu32AdcAccResult = M0P_ADC->RESULTACC_f.RESULTACC;
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * 清零累加采样值
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Adc_ClrAccResult(void)
+{
+ M0P_ADC->CR1_f.RACCCLR = 0u;
+}
+
+
+/**
+ * \brief
+ * 设置ADC参考电压
+ *
+ * \param [in] enAdcRefVolSel ADC参考电压
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_SetVref(en_adc_ref_vol_sel_t enAdcRefVolSel)
+{
+ if (enAdcRefVolSel > RefVolSelAVDD)
+ {
+ return ErrorInvalidParameter;
+ }
+ if((RefVolSelInBgr1p5 == enAdcRefVolSel) || (RefVolSelInBgr2p5 == enAdcRefVolSel))
+ {
+ M0P_ADC->CR0_f.INREFEN = 1;
+ }else
+ {
+ M0P_ADC->CR0_f.INREFEN = 0;
+ }
+ M0P_ADC->CR0_f.REF = enAdcRefVolSel;
+ return Ok;
+}
+/**
+ * \brief
+ * 设置ADC结果对齐方式
+ *
+ * \param [in] enAlign ADC结果对齐方式
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adc_SetAlign(en_adc_align_t enAlign)
+{
+ M0P_ADC->CR1_f.ALIGN = enAlign;
+ return Ok;
+}
+//@} // AdcGroup
+
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adt.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adt.c
new file mode 100644
index 0000000000..471cf96a1d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/adt.c
@@ -0,0 +1,1952 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file adt.c
+ **
+ ** Low Voltage Detect driver API.
+ ** @link Lvd Group Some description @endlink
+ **
+ ** - 2018-04-18 Husj First Version
+ **
+ ******************************************************************************/
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "adt.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup AdtGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Global variable definitions (declared in header file with 'extern') *
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static func_ptr_t pfnAdtIrqCbk[3][16] = {NULL};
+
+/*****************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ *****************************************************************************/
+
+/*************************************************
+ * \brief
+ * 使能NVIC中ADT中断
+ *
+ * \param [in] enIrqn 中断号
+ *
+ * \retval 无
+ **************************************************/
+static void AdtEnableNvic(IRQn_Type enIrqn)
+{
+ NVIC_ClearPendingIRQ(enIrqn);
+ NVIC_EnableIRQ(enIrqn);
+ NVIC_SetPriority(enIrqn, DDL_IRQ_LEVEL_DEFAULT);
+}
+
+/**************************************************
+ * \brief
+ * 除能NVIC中ADT中断
+ *
+ * \param [in] enIrqn 中断号
+ *
+ * \retval 无
+ **************************************************/
+static void AdtDisableNvic(IRQn_Type enIrqn)
+{
+ NVIC_ClearPendingIRQ(enIrqn);
+ NVIC_DisableIRQ(enIrqn);
+ NVIC_SetPriority(enIrqn, DDL_IRQ_LEVEL_DEFAULT);
+}
+
+/***************************************************
+ * \brief
+ * ADT中断服务程序
+ *
+ * \param [in] u8Param 未使用
+ *
+ * \retval 无
+ ****************************************************/
+void Adt_IRQHandler(uint8_t u8Param)
+{
+ uint8_t u8Adt = u8Param - 4;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*u8Adt);
+
+ if (TRUE == pstcM0PAdt->IFR_f.CMAF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtCMAIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtCMAIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtCMAIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.CMBF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtCMBIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtCMBIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtCMBIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.CMCF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtCMCIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtCMCIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtCMCIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.CMDF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtCMDIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtCMDIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtCMDIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.OVFF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtOVFIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtOVFIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtOVFIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.UDFF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtUDFIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtUDFIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtUDFIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.DTEF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtDTEIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtDTEIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtDTEIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.SAMLF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtSAMLIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtSAMLIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtSAMLIrq);
+ }
+
+ if (TRUE == pstcM0PAdt->IFR_f.SAMHF)
+ {
+ if (NULL != pfnAdtIrqCbk[u8Adt][AdtSAMHIrq])
+ {
+ pfnAdtIrqCbk[u8Adt][AdtSAMHIrq]();
+ }
+ pstcM0PAdt->ICLR = ~(1<<AdtSAMHIrq);
+ }
+}
+
+/*****************************************************************
+ * \brief
+ * 配置中断
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtIrq 中断类型
+ * \param [in] bEn 中断使能/禁止
+ * \param [in] pfnIrqCalbak 回调函数指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ****************************************************************/
+en_result_t Adt_ConfigIrq(en_adt_unit_t enAdtUnit,
+ en_adt_irq_type_t enAdtIrq,
+ boolean_t bEn,
+ func_ptr_t pfnIrqCalbak)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pfnAdtIrqCbk[enAdtUnit][enAdtIrq] = pfnIrqCalbak;
+
+ u32Val = pstcM0PAdt->ICONR;
+ if (bEn)
+ {
+ u32Val |= 1u<<enAdtIrq;
+ }
+ else
+ {
+ u32Val &= ~(1u<<enAdtIrq);
+ }
+ pstcM0PAdt->ICONR = u32Val;
+ return Ok;
+}
+
+/*******************************************************************
+ * \brief
+ * 获取中断标志
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtIrq 中断类型
+ * \param [in] pbFlag 中断标志指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *****************************************************************/
+en_result_t Adt_GetIrqFlag(en_adt_unit_t enAdtUnit,
+ en_adt_irq_type_t enAdtIrq,
+ boolean_t* pbFlag)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->IFR;
+ *pbFlag = (u32Val>>enAdtIrq) & 0x1;
+
+ return Ok;
+}
+
+/****************************************************************
+ * \brief
+ * 清除中断标志
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtIrq 中断类型
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ****************************************************************/
+en_result_t Adt_ClearIrqFlag(en_adt_unit_t enAdtUnit,
+ en_adt_irq_type_t enAdtIrq)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->ICLR = ~(1u<<enAdtIrq);
+ return Ok;
+}
+
+
+/**************************************************************
+ * \brief
+ * 配置硬件递加事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwCntUp 硬件递加事件
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ****************************************************************/
+en_result_t Adt_ConfigHwCntUp(en_adt_unit_t enAdtUnit, en_adt_hw_cnt_t enAdtHwCntUp)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwCntMax <= enAdtHwCntUp))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HCUPR;
+ pstcM0PAdt->HCUPR = u32Val | (1u<<enAdtHwCntUp);
+ return Ok;
+}
+
+/**************************************************************
+ * \brief
+ * 清除硬件递加事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ************************************************************/
+en_result_t Adt_ClearHwCntUp(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcM0PAdt->HCUPR = 0;
+ return Ok;
+}
+
+
+/**
+ * \brief
+ * 配置硬件递减事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwCntDwn 硬件递减事件
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Adt_ConfigHwCntDwn(en_adt_unit_t enAdtUnit, en_adt_hw_cnt_t enAdtHwCntDwn)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwCntMax <= enAdtHwCntDwn))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HCDOR;
+ pstcM0PAdt->HCDOR = u32Val | (1u<<enAdtHwCntDwn);
+ return Ok;
+}
+
+/******************************************************************
+ * \brief
+ * 清除硬件递减事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *****************************************************************/
+en_result_t Adt_ClearHwCntDwn(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->HCDOR = 0;
+ return Ok;
+}
+
+/******************************************************************
+ * \brief
+ * 配置硬件启动事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwStart 硬件启动事件
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+en_result_t Adt_ConfigHwStart(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwStart)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwTrigEnd <= enAdtHwStart))
+ {
+ return ErrorInvalidParameter;
+ }
+ u32Val = pstcM0PAdt->HSTAR;
+ pstcM0PAdt->HSTAR = u32Val | (1u<<enAdtHwStart);
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * 清除硬件启动事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_ClearHwStart(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->HSTAR = 0;
+ return Ok;
+}
+
+/*********************************************************************
+ * \brief
+ * 使能硬件启动
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *********************************************************************/
+en_result_t Adt_EnableHwStart(en_adt_unit_t enAdtUnit)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HSTAR;
+ pstcM0PAdt->HSTAR = u32Val | (1u<<31);
+ return Ok;
+}
+
+/*************************************************************************
+ * \brief
+ * 除能硬件启动
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ************************************************************************/
+en_result_t Adt_DisableHwStart(en_adt_unit_t enAdtUnit)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HSTAR;
+ pstcM0PAdt->HSTAR = u32Val & 0x7FFFFFFF;
+ return Ok;
+}
+
+/****************************************************************
+ * \brief
+ * 配置硬件停止事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwStop 硬件停止事件
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***************************************************************/
+en_result_t Adt_ConfigHwStop(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwStop)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwTrigEnd <= enAdtHwStop))
+ {
+ return ErrorInvalidParameter;
+ }
+ u32Val = pstcM0PAdt->HSTPR;
+ pstcM0PAdt->HSTPR = u32Val | (1u<<enAdtHwStop);
+ return Ok;
+}
+
+/***************************************************************
+ * \brief
+ * 清除硬件停止事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***************************************************************/
+en_result_t Adt_ClearHwStop(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->HSTPR = 0;
+ return Ok;
+}
+
+/*************************************************************
+ * \brief
+ * 使能硬件停止
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************/
+en_result_t Adt_EnableHwStop(en_adt_unit_t enAdtUnit)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HSTPR;
+ pstcM0PAdt->HSTPR = u32Val | (1u<<31);
+ return Ok;
+}
+
+/*****************************************************************************
+ * \brief
+ * 除能硬件停止
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***************************************************************************/
+en_result_t Adt_DisableHwStop(en_adt_unit_t enAdtUnit)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HSTPR;
+ pstcM0PAdt->HSTPR = u32Val & 0x7FFFFFFF;
+ return Ok;
+}
+
+/**************************************************************************
+ * \brief
+ * 配置硬件清零事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwClear 硬件清零事件
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_ConfigHwClear(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwClear)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwTrigEnd <= enAdtHwClear))
+ {
+ return ErrorInvalidParameter;
+ }
+ u32Val = pstcM0PAdt->HCELR & (1u<<31);
+ pstcM0PAdt->HCELR = u32Val | (1u<<enAdtHwClear);
+ return Ok;
+}
+
+/**************************************************************************
+ * \brief
+ * 清除硬件清零事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **************************************************************************/
+en_result_t Adt_ClearHwClear(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->HCELR = 0;
+ return Ok;
+}
+
+/***************************************************************************
+ * \brief
+ * 使能硬件清零
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_EnableHwClear(en_adt_unit_t enAdtUnit)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HCELR;
+ pstcM0PAdt->HCELR = u32Val | (1u<<31);
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * 除能硬件清零
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************************/
+en_result_t Adt_DisableHwClear(en_adt_unit_t enAdtUnit)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HCELR;
+ pstcM0PAdt->HCELR = u32Val & 0x7FFFFFFF;
+ return Ok;
+}
+
+/*******************************************************************
+ * \brief
+ * 配置硬件捕获A事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwCaptureA 硬件捕获A事件选择
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+en_result_t Adt_ConfigHwCaptureA(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwCaptureA)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwTrigEnd <= enAdtHwCaptureA))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HCPAR;
+ pstcM0PAdt->HCPAR = u32Val | (1u<<enAdtHwCaptureA);
+ pstcM0PAdt->PCONR_f.CAPCA = 1;
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * 清除硬件捕获A事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_ClearHwCaptureA(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->HCPAR = 0;
+ return Ok;
+}
+
+/*********************************************************************
+ * \brief
+ * 配置硬件捕获B事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtHwCaptureB 硬件捕获B事件选择
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ********************************************************************/
+en_result_t Adt_ConfigHwCaptureB(en_adt_unit_t enAdtUnit, en_adt_hw_trig_t enAdtHwCaptureB)
+{
+ uint32_t u32Val;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (AdtHwTrigEnd <= enAdtHwCaptureB))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = pstcM0PAdt->HCPBR;
+ pstcM0PAdt->HCPBR = u32Val | (1u<<enAdtHwCaptureB);
+ pstcM0PAdt->PCONR_f.CAPCB = 1;
+ return Ok;
+}
+
+/********************************************************************
+ * \brief
+ * 清除硬件捕获B事件
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+en_result_t Adt_ClearHwCaptureB(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->HCPBR = 0;
+ return Ok;
+}
+
+/*****************************************************************
+ * \brief
+ * 软件同步开始
+ *
+ * \param [in] pstcAdtSwSyncStart 软件同步开始指针
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***************************************************************/
+en_result_t Adt_SwSyncStart(stc_adt_sw_sync_t* pstcAdtSwSyncStart)
+{
+ uint32_t u32Val = 0;
+
+ if (NULL == pstcAdtSwSyncStart)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (pstcAdtSwSyncStart->bAdTim4)
+ {
+ u32Val |= 0x1;
+ }
+ if (pstcAdtSwSyncStart->bAdTim5)
+ {
+ u32Val |= 0x2;
+ }
+ if (pstcAdtSwSyncStart->bAdTim6)
+ {
+ u32Val |= 0x4;
+ }
+
+ M0P_TIM4->SSTAR = u32Val;
+ return Ok;
+}
+
+/***************************************************************
+ * \brief
+ * 软件同步停止
+ *
+ * \param [in] pstcAdtSwSyncStop 软件同步停止指针
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***************************************************************/
+en_result_t Adt_SwSyncStop(stc_adt_sw_sync_t* pstcAdtSwSyncStop)
+{
+ uint32_t u32Val = 0;
+
+ if (NULL == pstcAdtSwSyncStop)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (pstcAdtSwSyncStop->bAdTim4)
+ {
+ u32Val |= 0x1;
+ }
+ if (pstcAdtSwSyncStop->bAdTim5)
+ {
+ u32Val |= 0x2;
+ }
+ if (pstcAdtSwSyncStop->bAdTim6)
+ {
+ u32Val |= 0x4;
+ }
+
+ M0P_TIM4->SSTPR = u32Val;
+ return Ok;
+}
+
+/*****************************************************************
+ * \brief
+ * 软件同步清零
+ *
+ * \param [in] pstcAdtSwSyncClear 软件同步清零指针
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+en_result_t Adt_SwSyncClear(stc_adt_sw_sync_t* pstcAdtSwSyncClear)
+{
+ uint32_t u32Val = 0;
+
+ if (NULL == pstcAdtSwSyncClear)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (pstcAdtSwSyncClear->bAdTim4)
+ {
+ u32Val |= 0x1;
+ }
+ if (pstcAdtSwSyncClear->bAdTim5)
+ {
+ u32Val |= 0x2;
+ }
+ if (pstcAdtSwSyncClear->bAdTim6)
+ {
+ u32Val |= 0x4;
+ }
+
+ M0P_TIM4->SCLRR = u32Val;
+ return Ok;
+}
+
+/*******************************************************************
+ * \brief
+ * 获取软件同步运行状态
+ *
+ * \param [in] pstcAdtSwSyncState ADV Timer软件同步运行状态指针
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+en_result_t Adt_GetSwSyncState(stc_adt_sw_sync_t* pstcAdtSwSyncState)
+{
+ if (NULL == pstcAdtSwSyncState)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (M0P_TIM4->SSTAR & 0x1)
+ {
+ pstcAdtSwSyncState->bAdTim4 = TRUE;
+ }
+ else
+ {
+ pstcAdtSwSyncState->bAdTim4 = FALSE;
+ }
+ if (M0P_TIM4->SSTAR & 0x2)
+ {
+ pstcAdtSwSyncState->bAdTim5 = TRUE;
+ }
+ else
+ {
+ pstcAdtSwSyncState->bAdTim5 = FALSE;
+ }
+ if (M0P_TIM4->SSTAR & 0x4)
+ {
+ pstcAdtSwSyncState->bAdTim6 = TRUE;
+ }
+ else
+ {
+ pstcAdtSwSyncState->bAdTim6 = FALSE;
+ }
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * AOS触发配置
+ *
+ * \param [in] pstcAdtAosTrigCfg 触发配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ************************************************************************/
+en_result_t Adt_AosTrigConfig(stc_adt_aos_trig_cfg_t* pstcAdtAosTrigCfg)
+{
+ if (NULL == pstcAdtAosTrigCfg)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_TIM4->ITRIG_f.IAOS0S = pstcAdtAosTrigCfg->enAos0TrigSrc;
+ M0P_TIM4->ITRIG_f.IAOS1S = pstcAdtAosTrigCfg->enAos1TrigSrc;
+ M0P_TIM4->ITRIG_f.IAOS2S = pstcAdtAosTrigCfg->enAos2TrigSrc;
+ M0P_TIM4->ITRIG_f.IAOS3S = pstcAdtAosTrigCfg->enAos3TrigSrc;
+ return Ok;
+}
+
+/**********************************************************************
+ * \brief
+ * 中断触发配置
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] pstcAdtIrqTrigCfg 触发配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_IrqTrigConfig(en_adt_unit_t enAdtUnit,
+ stc_adt_irq_trig_cfg_t* pstcAdtIrqTrigCfg)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (NULL == pstcAdtIrqTrigCfg))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->CR_f.CMAE = pstcAdtIrqTrigCfg->bAdtCntMatchATrigEn;
+ pstcM0PAdt->CR_f.CMBE = pstcAdtIrqTrigCfg->bAdtCntMatchBTrigEn;
+ pstcM0PAdt->CR_f.CMCE = pstcAdtIrqTrigCfg->bAdtCntMatchCTrigEn;
+ pstcM0PAdt->CR_f.CMDE = pstcAdtIrqTrigCfg->bAdtCntMatchDTrigEn;
+ pstcM0PAdt->CR_f.OVFE = pstcAdtIrqTrigCfg->bAdtOverFlowTrigEn;
+ pstcM0PAdt->CR_f.UDFE = pstcAdtIrqTrigCfg->bAdtUnderFlowTrigEn;
+ pstcM0PAdt->CR_f.DMA_G_CMA = pstcAdtIrqTrigCfg->bAdtCntMatchATrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_G_CMB = pstcAdtIrqTrigCfg->bAdtCntMatchBTrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_G_CMC = pstcAdtIrqTrigCfg->bAdtCntMatchCTrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_G_CMD = pstcAdtIrqTrigCfg->bAdtCntMatchDTrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_G_OVF = pstcAdtIrqTrigCfg->bAdtOverFlowTrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_G_UDF = pstcAdtIrqTrigCfg->bAdtUnderFlowTrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_S_CMA = pstcAdtIrqTrigCfg->bAdtSpecilMatchATrigDmaEn;
+ pstcM0PAdt->CR_f.DMA_S_CMB = pstcAdtIrqTrigCfg->bAdtSpecilMatchBTrigDmaEn;
+
+ return Ok;
+}
+
+/*************************************************************************
+ * \brief
+ * 端口触发配置
+ *
+ * \param [in] enAdtTrigPort 触发端口
+ * \param [in] pstcAdtPortTrigCfg 触发配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_PortTrigConfig(en_adt_trig_port_t enAdtTrigPort,
+ stc_adt_port_trig_cfg_t* pstcAdtPortTrigCfg)
+{
+ if (NULL == pstcAdtPortTrigCfg)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ switch (enAdtTrigPort)
+ {
+ case AdtTrigA:
+ M0P_TIM4->TTRIG_f.TRIGAS = pstcAdtPortTrigCfg->enTrigSrc;
+ M0P_TIM4->FCONR_f.NOFIENTA = pstcAdtPortTrigCfg->bFltEn;
+ M0P_TIM4->FCONR_f.NOFICKTA = pstcAdtPortTrigCfg->enFltClk;
+ break;
+
+ case AdtTrigB:
+ M0P_TIM4->TTRIG_f.TRIGBS = pstcAdtPortTrigCfg->enTrigSrc;
+ M0P_TIM4->FCONR_f.NOFIENTB = pstcAdtPortTrigCfg->bFltEn;
+ M0P_TIM4->FCONR_f.NOFICKTB = pstcAdtPortTrigCfg->enFltClk;
+ break;
+
+ case AdtTrigC:
+ M0P_TIM4->TTRIG_f.TRIGCS = pstcAdtPortTrigCfg->enTrigSrc;
+ M0P_TIM4->FCONR_f.NOFIENTC = pstcAdtPortTrigCfg->bFltEn;
+ M0P_TIM4->FCONR_f.NOFICKTC = pstcAdtPortTrigCfg->enFltClk;
+ break;
+
+ case AdtTrigD:
+ M0P_TIM4->TTRIG_f.TRIGDS = pstcAdtPortTrigCfg->enTrigSrc;
+ M0P_TIM4->FCONR_f.NOFIENTD = pstcAdtPortTrigCfg->bFltEn;
+ M0P_TIM4->FCONR_f.NOFICKTD = pstcAdtPortTrigCfg->enFltClk;
+ break;
+
+ default:
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * CHxX端口配置
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtCHxXPort CHxX端口
+ * \param [in] pstcAdtCHxXCfg CHxX端口配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *********************************************************************/
+en_result_t Adt_CHxXPortConfig(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ stc_adt_CHxX_port_cfg_t* pstcAdtCHxXCfg)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (NULL == pstcAdtCHxXCfg))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ switch (enAdtCHxXPort)
+ {
+ case AdtCHxA:
+ pstcM0PAdt->PCONR_f.CAPCA = pstcAdtCHxXCfg->enCap;
+ pstcM0PAdt->PCONR_f.STACA = pstcAdtCHxXCfg->enStaOut;
+ pstcM0PAdt->PCONR_f.STPCA = pstcAdtCHxXCfg->enStpOut;
+ pstcM0PAdt->PCONR_f.STASTPSA = pstcAdtCHxXCfg->enStaStp;
+ pstcM0PAdt->PCONR_f.CMPCA = pstcAdtCHxXCfg->enCmpc;
+ pstcM0PAdt->PCONR_f.PERCA = pstcAdtCHxXCfg->enPerc;
+ pstcM0PAdt->PCONR_f.OUTENA = pstcAdtCHxXCfg->bOutEn;
+ pstcM0PAdt->PCONR_f.DISSELA = pstcAdtCHxXCfg->enDisSel;
+ pstcM0PAdt->PCONR_f.DISVALA = pstcAdtCHxXCfg->enDisVal;
+ pstcM0PAdt->FCONR_f.NOFIENGA = pstcAdtCHxXCfg->bFltEn;
+ pstcM0PAdt->FCONR_f.NOFICKGA = pstcAdtCHxXCfg->enFltClk;
+ break;
+
+ case AdtCHxB:
+ pstcM0PAdt->PCONR_f.CAPCB = pstcAdtCHxXCfg->enCap;
+ pstcM0PAdt->PCONR_f.STACB = pstcAdtCHxXCfg->enStaOut;
+ pstcM0PAdt->PCONR_f.STPCB = pstcAdtCHxXCfg->enStpOut;
+ pstcM0PAdt->PCONR_f.STASTPSB = pstcAdtCHxXCfg->enStaStp;
+ pstcM0PAdt->PCONR_f.CMPCB = pstcAdtCHxXCfg->enCmpc;
+ pstcM0PAdt->PCONR_f.PERCB = pstcAdtCHxXCfg->enPerc;
+ pstcM0PAdt->PCONR_f.OUTENB = pstcAdtCHxXCfg->bOutEn;
+ pstcM0PAdt->PCONR_f.DISSELB = pstcAdtCHxXCfg->enDisSel;
+ pstcM0PAdt->PCONR_f.DISVALB = pstcAdtCHxXCfg->enDisVal;
+ pstcM0PAdt->FCONR_f.NOFIENGB = pstcAdtCHxXCfg->bFltEn;
+ pstcM0PAdt->FCONR_f.NOFICKGB = pstcAdtCHxXCfg->enFltClk;
+ break;
+
+ default:
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * 使能端口刹车
+ *
+ * \param [in] port 端口
+ * \param [in] pstcAdtBrkPtCfg 端口刹车配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ************************************************************************/
+en_result_t Adt_EnableBrakePort(uint8_t port, stc_adt_break_port_cfg_t* pstcAdtBrkPtCfg)
+{
+ uint32_t u32Val;
+
+ if (NULL == pstcAdtBrkPtCfg)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u32Val = M0P_TIM4->PTBKP;
+ u32Val &= ~(1u<<port);
+ M0P_TIM4->PTBKP = u32Val | (pstcAdtBrkPtCfg->enPol<<port);
+
+ u32Val = M0P_TIM4->PTBKS;
+ M0P_TIM4->PTBKS = u32Val | (1u<<port);
+
+ return Ok;
+}
+
+/**********************************************************************
+ * \brief
+ * 清除端口刹车
+ *
+ * \param none
+ *
+ * \retval none
+ **********************************************************************/
+void Adt_ClearBrakePort(void)
+{
+ M0P_TIM4->PTBKS = 0;
+}
+
+/*********************************************************************
+ * \brief
+ * 无效条件3配置
+ *
+ * \param [in] pstcAdtDisable3 无效条件3配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ********************************************************************/
+en_result_t Adt_Disable3Cfg(stc_adt_disable_3_cfg_t* pstcAdtDisable3)
+{
+ uint8_t i;
+
+ if (NULL == pstcAdtDisable3)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ Adt_ClearBrakePort();
+ for (i = 0; i <= 15; i++)
+ {
+ if (TRUE == pstcAdtDisable3->stcBrkPtCfg[i].bPortEn)
+ {
+ Adt_EnableBrakePort(i, &pstcAdtDisable3->stcBrkPtCfg[i]);
+ }
+ }
+
+ M0P_TIM4->AOSSR_f.BFILTEN = pstcAdtDisable3->bFltEn;
+ M0P_TIM4->AOSSR_f.BFILTS = pstcAdtDisable3->enFltClk;
+ M0P_TIM4->AOSSR_f.SOFTBK = pstcAdtDisable3->bSwBrk;
+
+ return Ok;
+}
+
+/*******************************************************************
+ * \brief
+ * 获取端口刹车标志
+ *
+ * \param none
+ *
+ * \retval TRUE or FALSE
+ ******************************************************************/
+boolean_t Adt_GetPortBrakeFlag(void)
+{
+ return M0P_TIM4->AOSSR_f.FBRAKE;
+}
+
+/******************************************************************
+ * \brief
+ * 清除端口刹车标志
+ *
+ * \param none
+ *
+ * \retval none
+ ******************************************************************/
+void Adt_ClearPortBrakeFlag(void)
+{
+ M0P_TIM4->AOSCL_f.FBRAKE = 0;
+}
+
+/********************************************************************
+ * \brief
+ * 无效条件1配置
+ *
+ * \param [in] pstcAdtDisable1 无效条件1配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ********************************************************************/
+en_result_t Adt_Disable1Cfg(stc_adt_disable_1_cfg_t* pstcAdtDisable1)
+{
+
+ if (NULL == pstcAdtDisable1)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_TIM4->AOSSR_f.SMH2 = pstcAdtDisable1->bTim6OutSH;
+ M0P_TIM4->AOSSR_f.SMH1 = pstcAdtDisable1->bTim5OutSH;
+ M0P_TIM4->AOSSR_f.SMH0 = pstcAdtDisable1->bTim4OutSH;
+ M0P_TIM4->AOSSR_f.SML2 = pstcAdtDisable1->bTim6OutSL;
+ M0P_TIM4->AOSSR_f.SML1 = pstcAdtDisable1->bTim5OutSL;
+ M0P_TIM4->AOSSR_f.SML0 = pstcAdtDisable1->bTim4OutSL;
+
+ return Ok;
+}
+
+/********************************************************************
+ * \brief
+ * 获取同高同低刹车标志
+ *
+ * \param none
+ *
+ * \retval TRUE or FALSE
+ ********************************************************************/
+boolean_t Adt_GetSameBrakeFlag(void)
+{
+ return M0P_TIM4->AOSSR_f.FSAME;
+}
+
+/*********************************************************************
+ * \brief
+ * 清除同高同低刹车标志
+ *
+ * \param none
+ *
+ * \retval none
+ *********************************************************************/
+void Adt_ClearSameBrakeFlag(void)
+{
+ M0P_TIM4->AOSCL_f.FSAME = 0;
+}
+
+/********************************************************************
+ * \brief
+ * PWM展频配置
+ *
+ * \param [in] pstcAdtPwmDitherCfg PWM展频配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *********************************************************************/
+en_result_t Adt_PwmDitherConfig(en_adt_unit_t enAdtUnit, stc_adt_pwm_dither_cfg_t* pstcAdtPwmDitherCfg)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (NULL == pstcAdtPwmDitherCfg)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->CR_f.DITENS = pstcAdtPwmDitherCfg->enAdtPDType;
+ pstcM0PAdt->CR_f.DITENB = pstcAdtPwmDitherCfg->bTimxBPDEn;
+ pstcM0PAdt->CR_f.DITENA = pstcAdtPwmDitherCfg->bTimxAPDEn;
+
+ return Ok;
+}
+
+/**********************************************************************
+ * \brief
+ * ADT初始化
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] pstcAdtBaseCntCfg 计数配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************************/
+en_result_t Adt_Init(en_adt_unit_t enAdtUnit, stc_adt_basecnt_cfg_t* pstcAdtBaseCntCfg)
+{
+ int32_t i;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (NULL == pstcAdtBaseCntCfg))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtTriangleModeB < pstcAdtBaseCntCfg->enCntMode)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->GCONR_f.MODE = pstcAdtBaseCntCfg->enCntMode;
+ pstcM0PAdt->GCONR_f.DIR = pstcAdtBaseCntCfg->enCntDir;
+ pstcM0PAdt->GCONR_f.CKDIV = pstcAdtBaseCntCfg->enCntClkDiv;
+
+ for (i = 0; i < 16; i++)
+ {
+ pfnAdtIrqCbk[enAdtUnit][i] = NULL;
+ }
+
+ AdtEnableNvic((IRQn_Type)((int32_t)TIM4_IRQn + (int32_t)enAdtUnit));
+
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * ADT Deinit
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_DeInit(en_adt_unit_t enAdtUnit)
+{
+ int32_t i;
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->GCONR_f.START = 0;
+
+ AdtDisableNvic((IRQn_Type)((int32_t)TIM4_IRQn + (int32_t)enAdtUnit));
+
+ for (i = 0; i < 16; i++)
+ {
+ pfnAdtIrqCbk[enAdtUnit][i] = NULL;
+ }
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 开始计数
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_StartCount(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->GCONR_f.START = 1;
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 停止计数
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************************/
+en_result_t Adt_StopCount(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->GCONR_f.START = 0;
+
+ return Ok;
+}
+
+/********************************************************************
+ * \brief
+ * 设置计数值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16Value 计数值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+en_result_t Adt_SetCount(en_adt_unit_t enAdtUnit, uint16_t u16Value)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->CNTER_f.CNT = u16Value;
+ return Ok;
+}
+
+/********************************************************************
+ * \brief
+ * 获取计数值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16Value 计数值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * ErrorInvalidParameter: 无效参数
+ *******************************************************************/
+uint16_t Adt_GetCount(en_adt_unit_t enAdtUnit)
+{
+ uint16_t u16Value;
+
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u16Value = pstcM0PAdt->CNTER_f.CNT;
+
+ return u16Value;
+}
+
+/**************************************************************************
+ * \brief
+ * 清除计数值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16Value 计数值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **************************************************************************/
+en_result_t Adt_ClearCount(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->CNTER_f.CNT = 0;
+ return Ok;
+}
+
+/*************************************************************************
+ * \brief
+ * 获取计数状态
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] pstcAdtCntState 计数状态指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_GetCntState(en_adt_unit_t enAdtUnit, stc_adt_cntstate_cfg_t* pstcAdtCntState)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (NULL == pstcAdtCntState))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcAdtCntState->u16Counter = pstcM0PAdt->CNTER_f.CNT;
+ pstcAdtCntState->enCntDir = pstcM0PAdt->STFLR_f.DIRF;
+ pstcAdtCntState->u8ValidPeriod = pstcM0PAdt->STFLR_f.VPERNUM;
+ pstcAdtCntState->bCMSBDF = pstcM0PAdt->STFLR_f.CMSBDF;
+ pstcAdtCntState->bCMSBUF = pstcM0PAdt->STFLR_f.CMSBUF;
+ pstcAdtCntState->bCMSADF = pstcM0PAdt->STFLR_f.CMSADF;
+ pstcAdtCntState->bCMSAUF = pstcM0PAdt->STFLR_f.CMSAUF;
+ pstcAdtCntState->bDTEF = pstcM0PAdt->STFLR_f.DTEF;
+ pstcAdtCntState->bUDFF = pstcM0PAdt->STFLR_f.UDFF;
+ pstcAdtCntState->bOVFF = pstcM0PAdt->STFLR_f.OVFF;
+ pstcAdtCntState->bCMDF = pstcM0PAdt->STFLR_f.CMDF;
+ pstcAdtCntState->bCMCF = pstcM0PAdt->STFLR_f.CMCF;
+ pstcAdtCntState->bCMBF = pstcM0PAdt->STFLR_f.CMBF;
+ pstcAdtCntState->bCMAF = pstcM0PAdt->STFLR_f.CMAF;
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 配置计数周期
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16Period 计数周期值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_SetPeriod(en_adt_unit_t enAdtUnit, uint16_t u16Period)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->PERAR = u16Period;
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 配置计数周期缓冲
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16PeriodBuf 计数周期缓冲值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_SetPeriodBuf(en_adt_unit_t enAdtUnit, uint16_t u16PeriodBuf)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->PERBR = u16PeriodBuf;
+ pstcM0PAdt->BCONR_f.BENP = 1u;
+
+ return Ok;
+}
+
+/**********************************************************************
+ * \brief
+ * 清除计数周期缓冲
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************************/
+en_result_t Adt_ClearPeriodBuf(en_adt_unit_t enAdtUnit)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->BCONR_f.BENP = 0;
+ pstcM0PAdt->PERBR = 0;
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 配置有效计数周期
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] pstcAdtValidPerCfg 有效计数周期配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_SetValidPeriod(en_adt_unit_t enAdtUnit,
+ stc_adt_validper_cfg_t* pstcAdtValidPerCfg)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (NULL == pstcAdtValidPerCfg))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->VPERR_f.PCNTS = pstcAdtValidPerCfg->enValidCnt;
+ pstcM0PAdt->VPERR_f.PCNTE = pstcAdtValidPerCfg->enValidCdt;
+ pstcM0PAdt->VPERR_f.GEPERID = pstcAdtValidPerCfg->bPeriodD;
+ pstcM0PAdt->VPERR_f.GEPERIC = pstcAdtValidPerCfg->bPeriodC;
+ pstcM0PAdt->VPERR_f.GEPERIB = pstcAdtValidPerCfg->bPeriodB;
+ pstcM0PAdt->VPERR_f.GEPERIA = pstcAdtValidPerCfg->bPeriodA;
+
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * 配置比较输出计数基准值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtCompare 比较基准
+ * \param [in] u16Compare 比较基准值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_SetCompareValue(en_adt_unit_t enAdtUnit,
+ en_adt_compare_t enAdtCompare,
+ uint16_t u16Compare)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtCompareA == enAdtCompare)
+ {
+ pstcM0PAdt->GCMAR = u16Compare;
+ }
+ else if (AdtCompareB == enAdtCompare)
+ {
+ pstcM0PAdt->GCMBR = u16Compare;
+ }
+ else if (AdtCompareC == enAdtCompare)
+ {
+ pstcM0PAdt->GCMCR = u16Compare;
+ }
+ else if (AdtCompareD == enAdtCompare)
+ {
+ pstcM0PAdt->GCMDR = u16Compare;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/************************************************************************
+ * \brief
+ * 配置专用比较计数基准值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtSpclCmp 专用比较基准值寄存器
+ * \param [in] u16SpclCmp 比较基准值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_SetSpecilCompareValue(en_adt_unit_t enAdtUnit,
+ en_adt_special_compare_t enAdtSpclCmp,
+ uint16_t u16SpclCmp)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtSpclCompA == enAdtSpclCmp)
+ {
+ pstcM0PAdt->SCMAR_f.SCMA = u16SpclCmp;
+ }
+ else if (AdtSpclCompB == enAdtSpclCmp)
+ {
+ pstcM0PAdt->SCMBR_f.SCMB = u16SpclCmp;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**********************************************************************
+ * \brief
+ * 配置通用比较值/捕获值缓存传送
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtCHxXPort TIMxX端口
+ * \param [in] bCompareBufEn 通用比较值缓存传送使能
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************************/
+en_result_t Adt_EnableValueBuf(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ boolean_t bCompareBufEn)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtCHxA == enAdtCHxXPort)
+ {
+ pstcM0PAdt->BCONR_f.BENA = bCompareBufEn;
+ }
+ else if (AdtCHxB == enAdtCHxXPort)
+ {
+ pstcM0PAdt->BCONR_f.BENB = bCompareBufEn;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 清除比较输出计数值/捕获值缓存
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtCHxXPort TIMxX端口
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ **********************************************************************/
+en_result_t Adt_ClearValueBuf(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtCHxA == enAdtCHxXPort)
+ {
+ pstcM0PAdt->GCMCR = 0;
+ pstcM0PAdt->BCONR_f.BENA = 0;
+ }
+ else if (AdtCHxB == enAdtCHxXPort)
+ {
+ pstcM0PAdt->GCMDR = 0;
+ pstcM0PAdt->BCONR_f.BENB = 0;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 获取捕获值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtCHxXPort TIMxX端口
+ * \param [in] pu16Capture 捕获值指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_GetCaptureValue(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ uint16_t* pu16Capture)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtCHxA == enAdtCHxXPort)
+ {
+ *pu16Capture = pstcM0PAdt->GCMAR_f.GCMA;
+ }
+ else if (AdtCHxB == enAdtCHxXPort)
+ {
+ *pu16Capture = pstcM0PAdt->GCMBR_f.GCMB;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+
+/**********************************************************************
+ * \brief
+ * 获取捕获缓存值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] enAdtCHxXPort TIMxX端口
+ * \param [in] pu16CaptureBuf 捕获缓存值指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_GetCaptureBuf(en_adt_unit_t enAdtUnit,
+ en_adt_CHxX_port_t enAdtCHxXPort,
+ uint16_t* pu16CaptureBuf)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (AdtCHxA == enAdtCHxXPort)
+ {
+ *pu16CaptureBuf = pstcM0PAdt->GCMCR_f.GCMC;
+ }
+ else if (AdtCHxB == enAdtCHxXPort)
+ {
+ *pu16CaptureBuf = pstcM0PAdt->GCMDR_f.GCMD;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 设置死区时间上基准值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16Value 死区时间上基准值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ************************************************************************/
+en_result_t Adt_SetDTUA(en_adt_unit_t enAdtUnit,
+ uint16_t u16Value)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->DTUAR = u16Value;
+
+
+ return Ok;
+}
+
+/***********************************************************************
+ * \brief
+ * 设置死区时间下基准值
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] u16Value 死区时间下基准值
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ ***********************************************************************/
+en_result_t Adt_SetDTDA(en_adt_unit_t enAdtUnit,
+ uint16_t u16Value)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->DTDAR = u16Value;
+
+
+ return Ok;
+}
+
+/******************************************************************
+ * \brief
+ * 配置死区时间功能
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] bDTEn 死区功能使能
+ * \param [in] bEqual DTDAR的值和DTUAR的值自动相等
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *****************************************************************/
+en_result_t Adt_ConfigDT(en_adt_unit_t enAdtUnit,
+ boolean_t bDTEn,
+ boolean_t bEqual)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if (AdtTIM6 < enAdtUnit)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->DCONR_f.DTCEN = bDTEn;
+ pstcM0PAdt->DCONR_f.SEPA = bEqual;
+
+ return Ok;
+}
+
+/*************************************************************************
+ * \brief
+ * Z相输入屏蔽设置
+ *
+ * \param [in] enAdtUnit ADV Timer通道选择(TIM4、TIM5、TIM6)
+ * \param [in] pstcAdtZMaskCfg Z相输入屏蔽功能配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ *************************************************************************/
+en_result_t Adt_ConfigZMask(en_adt_unit_t enAdtUnit, stc_adt_zmask_cfg_t* pstcAdtZMaskCfg)
+{
+ volatile M0P_TIM4_TypeDef *pstcM0PAdt = (M0P_TIM4_TypeDef *)((uint32_t)M0P_TIM4+0x400*enAdtUnit);
+
+ if ((AdtTIM6 < enAdtUnit) || (NULL == pstcAdtZMaskCfg))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ pstcM0PAdt->GCONR_f.ZMSK = pstcAdtZMaskCfg->enZMaskCycle;
+ pstcM0PAdt->GCONR_f.ZMSKPOS = pstcAdtZMaskCfg->bFltPosCntMaksEn;
+ pstcM0PAdt->GCONR_f.ZMSKREV = pstcAdtZMaskCfg->bFltRevCntMaksEn;
+
+ return Ok;
+}
+
+//@} // AdtGroup
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/aes.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/aes.c
new file mode 100644
index 0000000000..e28a48275f
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/aes.c
@@ -0,0 +1,176 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file crc.c
+ **
+ ** Common API of crc.
+ ** @link crcGroup Some description @endlink
+ **
+ ** - 2017-05-16
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "aes.h"
+/**
+ *******************************************************************************
+ ** \addtogroup CrcGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+/**
+ * \brief
+ * ADC初始化
+ *
+ * \param [in] pu32Data 待加密数据
+ * \param [in] pu32Key 加密KEY
+ * \param [out] pu32Cipher 加密后数据
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t AES_Encrypt(uint32_t* pu32Data, uint32_t *pu32Key, uint32_t *pu32Cipher)
+{
+ if ((NULL == pu32Data)||(NULL == pu32Key)||(NULL == pu32Cipher))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ //Key config
+ M0P_AES->KEY0 = pu32Key[0];
+ M0P_AES->KEY1 = pu32Key[1];
+ M0P_AES->KEY2 = pu32Key[2];
+ M0P_AES->KEY3 = pu32Key[3];
+
+ //Data config
+ M0P_AES->DATA0 = pu32Data[0];
+ M0P_AES->DATA1 = pu32Data[1];
+ M0P_AES->DATA2 = pu32Data[2];
+ M0P_AES->DATA3 = pu32Data[3];
+
+ M0P_AES->CR_f.MODE = 0;//Encry
+ M0P_AES->CR_f.START = 1;
+ while(M0P_AES->CR_f.START == 1)
+ {
+ ;
+ }
+ pu32Cipher[0] = M0P_AES->DATA0;
+ pu32Cipher[1] = M0P_AES->DATA1;
+ pu32Cipher[2] = M0P_AES->DATA2;
+ pu32Cipher[3] = M0P_AES->DATA3;
+ return Ok;
+}
+
+
+/**
+ * \brief
+ * ADC初始化
+ *
+ * \param [in] pu32Cipher 待解密数据
+ * \param [in] pu32Key 加密KEY
+ * \param [out] pu32Data 解密后数据
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t AES_Decrypt(uint32_t *pu32Cipher,uint32_t *pu32Key, uint32_t* pu32Plaintext)
+{
+ if ((NULL == pu32Plaintext)||(NULL == pu32Key)||(NULL == pu32Cipher))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ //Key config
+ M0P_AES->KEY0 = pu32Key[0];
+ M0P_AES->KEY1 = pu32Key[1];
+ M0P_AES->KEY2 = pu32Key[2];
+ M0P_AES->KEY3 = pu32Key[3];
+
+ //Data config
+ M0P_AES->DATA0 = pu32Cipher[0];
+ M0P_AES->DATA1 = pu32Cipher[1];
+ M0P_AES->DATA2 = pu32Cipher[2];
+ M0P_AES->DATA3 = pu32Cipher[3];
+
+ M0P_AES->CR_f.MODE = 1;//UnEncry
+ M0P_AES->CR_f.START = 1;
+ while(M0P_AES->CR_f.START == 1)
+ {
+ ;
+ }
+ pu32Plaintext[0] = M0P_AES->DATA0;
+ pu32Plaintext[1] = M0P_AES->DATA1;
+ pu32Plaintext[2] = M0P_AES->DATA2;
+ pu32Plaintext[3] = M0P_AES->DATA3;
+ return Ok;
+}
+//@} // CrcGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bgr.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bgr.c
new file mode 100644
index 0000000000..87bab21ed6
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bgr.c
@@ -0,0 +1,155 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file bgr.c
+ **
+ ** Common API of bgr.
+ ** @link flashGroup Some description @endlink
+ **
+ ** - 2018-05-08
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "bgr.h"
+/**
+ *******************************************************************************
+ ** \addtogroup FlashGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief BGR 使能
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Bgr_BgrEnable(void)
+{
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralAdcBgr, TRUE);
+ M0P_BGR->CR_f.BGR_EN = TRUE;
+
+ delay10us(2);
+
+ return Ok;
+}
+
+/**
+ *****************************************************************************
+ ** \brief BGR 禁止
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Bgr_BgrDisable(void)
+{
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralAdcBgr, TRUE);
+ M0P_BGR->CR_f.BGR_EN = FALSE;
+
+ return Ok;
+}
+
+/**
+ *****************************************************************************
+ ** \brief BGR 温度传感器使能
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Bgr_TempSensorEnable(void)
+{
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralAdcBgr, TRUE);
+ M0P_BGR->CR_f.TS_EN = TRUE;
+
+ delay10us(2);
+
+ return Ok;
+}
+
+/**
+ *****************************************************************************
+ ** \brief BGR 温度传感器禁止
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Bgr_TempSensorDisable(void)
+{
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralAdcBgr, TRUE);
+ M0P_BGR->CR_f.TS_EN = FALSE;
+
+ return Ok;
+}
+
+
+//@} // BgrGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bt.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bt.c
new file mode 100644
index 0000000000..ea4014e088
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bt.c
@@ -0,0 +1,1608 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file bt.c
+ **
+ ** Common API of base timer.
+ ** @link btGroup Some description @endlink
+ **
+ ** - 2018-04-18 First Version
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "bt.h"
+/**
+ *******************************************************************************
+ ** \addtogroup BtGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+#define IS_VALID_TIM(x) (TIM0 == (x) ||\
+ TIM1 == (x) ||\
+ TIM2 == (x))
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static func_ptr_t pfnTim0Callback = NULL;
+static func_ptr_t pfnTim1Callback = NULL;
+static func_ptr_t pfnTim2Callback = NULL;
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断标志获取(模式0/1/23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Bt_GetIntFlag(en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
+{
+ boolean_t bRetVal = FALSE;
+ uint32_t u32Val;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ u32Val = pstcM0PBt->IFR;
+ bRetVal = (u32Val>>enBtIrq) & 0x1;
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断标志清除(模式0/1/23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_ClearIntFlag(en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->ICLR = ~(1u<<enBtIrq);
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断所有标志清除(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_ClearAllIntFlag(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->ICLR_f.UIF = 0;
+ pstcM0PBt->ICLR_f.CA0F = 0;
+ pstcM0PBt->ICLR_f.CB0F = 0;
+ pstcM0PBt->ICLR_f.BIF = 0;
+ pstcM0PBt->ICLR_f.TIF = 0;
+ pstcM0PBt->ICLR_f.CA0E = 0;
+ pstcM0PBt->ICLR_f.CB0E = 0;
+
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断使能(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode0_EnableIrq(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M0CR_f.UIE = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断禁止(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode0_DisableIrq(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M0CR_f.UIE = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断使能(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode1_EnableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enBtIrq)
+ {
+ case BtUevIrq:
+ pstcM0PBt->M1CR_f.UIE = TRUE;
+ break;
+ case BtCA0Irq:
+ pstcM0PBt->CR0_f.CIEA = TRUE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断禁止(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode1_DisableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+
+ switch (enBtIrq)
+ {
+ case BtUevIrq:
+ pstcM0PBt->M1CR_f.UIE = FALSE;
+ break;
+ case BtCA0Irq:
+ pstcM0PBt->CR0_f.CIEA = FALSE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断使能(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode23_EnableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+
+ switch (enBtIrq)
+ {
+ case BtUevIrq:
+ pstcM0PBt->M23CR_f.UIE = TRUE;
+ break;
+ case BtCA0Irq:
+ pstcM0PBt->CRCH0_f.CIEA = TRUE;
+ break;
+ case BtCB0Irq:
+ pstcM0PBt->CRCH0_f.CIEB = TRUE;
+ break;
+ case BtBkIrq:
+ pstcM0PBt->M23CR_f.BIE = TRUE;
+ break;
+ case BtTrigIrq:
+ pstcM0PBt->M23CR_f.TIE = TRUE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断禁止(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode23_DisableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+
+ switch (enBtIrq)
+ {
+ case BtUevIrq:
+ pstcM0PBt->M23CR_f.UIE = FALSE;
+ break;
+ case BtCA0Irq:
+ pstcM0PBt->CRCH0_f.CIEA = FALSE;
+ break;
+ case BtCB0Irq:
+ pstcM0PBt->CRCH0_f.CIEB = FALSE;
+ break;
+ case BtBkIrq:
+ pstcM0PBt->M23CR_f.BIE = FALSE;
+ break;
+ case BtTrigIrq:
+ pstcM0PBt->M23CR_f.TIE = FALSE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 中断服务函数
+ **
+ **
+ ** \param [in] u8Param Timer通道选择(0 - TIM0、1 - TIM1、2 - TIM2)
+ **
+ ** \retval NULL
+ *****************************************************************************/
+void Tim_IRQHandler(uint8_t u8Param)
+{
+ switch (u8Param)
+ {
+ case 0:
+ if(NULL != pfnTim0Callback)
+ {
+ pfnTim0Callback();
+ }
+ break;
+ case 1:
+ if(NULL != pfnTim1Callback)
+ {
+ pfnTim1Callback();
+ }
+ break;
+ case 2:
+ if(NULL != pfnTim2Callback)
+ {
+ pfnTim2Callback();
+ }
+ break;
+ default:
+ ;
+ break;
+ }
+}
+
+
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 初始化配置(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode0_Init(en_bt_unit_t enUnit, stc_bt_mode0_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ {
+ M0P_TIM0_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM0_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
+ M0P_TIM0_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
+ M0P_TIM0_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM0_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
+ M0P_TIM0_MODE0->M0CR_f.CT = pstcConfig->enCT;
+ M0P_TIM0_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
+
+ pfnTim0Callback = pstcConfig->pfnTim0Cb;
+ }
+ break;
+ case TIM1:
+ {
+ M0P_TIM1_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM1_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
+ M0P_TIM1_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
+ M0P_TIM1_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM1_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
+ M0P_TIM1_MODE0->M0CR_f.CT = pstcConfig->enCT;
+ M0P_TIM1_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
+
+ pfnTim1Callback = pstcConfig->pfnTim1Cb;
+ }
+ break;
+ case TIM2:
+ {
+ M0P_TIM2_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM2_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
+ M0P_TIM2_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
+ M0P_TIM2_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM2_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
+ M0P_TIM2_MODE0->M0CR_f.CT = pstcConfig->enCT;
+ M0P_TIM2_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
+
+ pfnTim2Callback = pstcConfig->pfnTim2Cb;
+
+ }
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 启动运行(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M0_Run(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M0CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 停止运行(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M0_Stop(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M0CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 翻转输出使能/禁止设定(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] bEnOutput 翻转输出设定 TRUE:使能, FALSE:禁止
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M0_EnTOG_Output(en_bt_unit_t enUnit, boolean_t bEnOutput)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->DTR_f.MOE = bEnOutput;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 16位计数器初值设置(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M0_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ M0P_TIM0_MODE0->CNT_f.CNT = u16Data;
+ break;
+ case TIM1:
+ M0P_TIM1_MODE0->CNT_f.CNT = u16Data;
+ break;
+ case TIM2:
+ M0P_TIM2_MODE0->CNT_f.CNT = u16Data;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 16位计数值获取(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Bt_M0_Cnt16Get(en_bt_unit_t enUnit)
+{
+ uint16_t u16CntData = 0;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ u16CntData = M0P_TIM0_MODE0->CNT_f.CNT;
+ break;
+ case TIM1:
+ u16CntData = M0P_TIM1_MODE0->CNT_f.CNT;
+ break;
+ case TIM2:
+ u16CntData = M0P_TIM2_MODE0->CNT_f.CNT;
+ break;
+ default:
+ u16CntData = 0;
+ break;
+ }
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 重载值设置(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u16Data 16bits重载值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M0_ARRSet(en_bt_unit_t enUnit, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ M0P_TIM0_MODE0->ARR_f.ARR = u16Data;
+ break;
+ case TIM1:
+ M0P_TIM1_MODE0->ARR_f.ARR = u16Data;
+ break;
+ case TIM2:
+ M0P_TIM2_MODE0->ARR_f.ARR = u16Data;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 32位计数器初值设置(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u32Data 32位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M0_Cnt32Set(en_bt_unit_t enUnit, uint32_t u32Data)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ M0P_TIM0_MODE0->CNT32_f.CNT32 = u32Data;
+ break;
+ case TIM1:
+ M0P_TIM1_MODE0->CNT32_f.CNT32 = u32Data;
+ break;
+ case TIM2:
+ M0P_TIM2_MODE0->CNT32_f.CNT32 = u32Data;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 32位计数值获取(模式0)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval 32bits计数值
+ *****************************************************************************/
+uint32_t Bt_M0_Cnt32Get(en_bt_unit_t enUnit)
+{
+ uint32_t u32CntData = 0;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ u32CntData = M0P_TIM0_MODE0->CNT32_f.CNT32;
+ break;
+ case TIM1:
+ u32CntData = M0P_TIM1_MODE0->CNT32_f.CNT32;
+ break;
+ case TIM2:
+ u32CntData = M0P_TIM2_MODE0->CNT32_f.CNT32;
+ break;
+ default:
+ u32CntData = 0;
+ break;
+ }
+
+ return u32CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 初始化配置(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode1_Init(en_bt_unit_t enUnit, stc_bt_mode1_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ {
+ M0P_TIM0_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM0_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM0_MODE1->M1CR_f.CT = pstcConfig->enCT;
+ M0P_TIM0_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
+
+ pfnTim0Callback = pstcConfig->pfnTim0Cb;
+ }
+ break;
+ case TIM1:
+ {
+ M0P_TIM1_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM1_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM1_MODE1->M1CR_f.CT = pstcConfig->enCT;
+ M0P_TIM1_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
+
+ pfnTim1Callback = pstcConfig->pfnTim1Cb;
+ }
+ break;
+ case TIM2:
+ {
+ M0P_TIM2_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM2_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM2_MODE1->M1CR_f.CT = pstcConfig->enCT;
+ M0P_TIM2_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
+
+ pfnTim2Callback = pstcConfig->pfnTim2Cb;
+ }
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer PWC 输入配置(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M1_Input_Config(en_bt_unit_t enUnit, stc_bt_pwc_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->MSCR_f.TS = pstcConfig->enTsSel;
+ pstcM0PBt->MSCR_f.IA0S = pstcConfig->enIA0Sel;
+ pstcM0PBt->MSCR_f.IB0S = pstcConfig->enIB0Sel;
+ pstcM0PBt->FLTR_f.ETP = pstcConfig->enETRPhase;
+ pstcM0PBt->FLTR_f.FLTET = pstcConfig->enFltETR;
+ pstcM0PBt->FLTR_f.FLTA0 = pstcConfig->enFltIA0;
+ pstcM0PBt->FLTR_f.FLTB0 = pstcConfig->enFltIB0;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer PWC测量边沿起始结束选择(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enEdgeSel pwc测量起始终止电平
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M1_PWC_Edge_Sel(en_bt_unit_t enUnit,en_bt_m1cr_Edge_t enEdgeSel)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enEdgeSel)
+ {
+ case 0: ///< 上升沿到上升沿(周期)
+ pstcM0PBt->M1CR_f.EDG1ST = 0; //上升沿
+ pstcM0PBt->M1CR_f.EDG2ND = 0; //上升沿
+ break;
+ case 1: ///< 下降沿到上升沿(低电平)
+ pstcM0PBt->M1CR_f.EDG1ST = 1; //下降沿
+ pstcM0PBt->M1CR_f.EDG2ND = 0; //上升沿
+ break;
+ case 2: ///< 上升沿到下降沿(高电平)
+ pstcM0PBt->M1CR_f.EDG1ST = 0; //上升沿
+ pstcM0PBt->M1CR_f.EDG2ND = 1; //下降沿
+ break;
+ case 3: ///< 下降沿到下降沿(周期)
+ pstcM0PBt->M1CR_f.EDG1ST = 1; //下降沿
+ pstcM0PBt->M1CR_f.EDG2ND = 1; //下降沿
+ break;
+ default:
+ ;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 启动运行(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M1_Run(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M1CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 停止运行(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M1_Stop(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M1CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 16位计数器初值设置(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M1_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ M0P_TIM0_MODE1->CNT_f.CNT = u16Data;
+ break;
+ case TIM1:
+ M0P_TIM1_MODE1->CNT_f.CNT = u16Data;
+ break;
+ case TIM2:
+ M0P_TIM2_MODE1->CNT_f.CNT = u16Data;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 16位计数值获取(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Bt_M1_Cnt16Get(en_bt_unit_t enUnit)
+{
+ uint16_t u16CntData = 0;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ u16CntData = M0P_TIM0_MODE1->CNT_f.CNT;
+ break;
+ case TIM1:
+ u16CntData = M0P_TIM1_MODE1->CNT_f.CNT;
+ break;
+ case TIM2:
+ u16CntData = M0P_TIM2_MODE1->CNT_f.CNT;
+ break;
+ default:
+ u16CntData = 0;
+ break;
+ }
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 脉冲宽度测量结果数值获取(模式1)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval 16bits脉冲宽度测量结果
+ *****************************************************************************/
+uint16_t Bt_M1_PWC_CapValueGet(en_bt_unit_t enUnit)
+{
+ uint16_t u16CapData = 0;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ u16CapData = M0P_TIM0_MODE1->CCR0A_f.CCR0A;
+ break;
+ case TIM1:
+ u16CapData = M0P_TIM1_MODE1->CCR0A_f.CCR0A;
+ break;
+ case TIM2:
+ u16CapData = M0P_TIM2_MODE1->CCR0A_f.CCR0A;
+ break;
+ default:
+ u16CapData = 0;
+ break;
+ }
+
+ return u16CapData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 初始化配置(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_Mode23_Init(en_bt_unit_t enUnit, stc_bt_mode23_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ switch (enUnit)
+ {
+ case TIM0:
+ {
+ M0P_TIM0_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
+
+ M0P_TIM0_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM0_MODE23->M23CR_f.CT = pstcConfig->enCT;
+ M0P_TIM0_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
+ M0P_TIM0_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
+ M0P_TIM0_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
+ M0P_TIM0_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
+ M0P_TIM0_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
+
+ pfnTim0Callback = pstcConfig->pfnTim0Cb;
+ }
+ break;
+ case TIM1:
+ {
+ M0P_TIM1_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
+
+ M0P_TIM1_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM1_MODE23->M23CR_f.CT = pstcConfig->enCT;
+ M0P_TIM1_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
+ M0P_TIM1_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
+ M0P_TIM1_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
+ M0P_TIM1_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
+ M0P_TIM1_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
+
+ pfnTim1Callback = pstcConfig->pfnTim1Cb;
+ }
+ break;
+ case TIM2:
+ {
+ M0P_TIM2_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
+
+ M0P_TIM2_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM2_MODE23->M23CR_f.CT = pstcConfig->enCT;
+ M0P_TIM2_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
+ M0P_TIM2_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
+ M0P_TIM2_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
+ M0P_TIM2_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
+ M0P_TIM2_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
+
+ pfnTim2Callback = pstcConfig->pfnTim2Cb;
+ }
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer PWM输出使能/禁止(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] bEnOutput PWM输出使能/禁止设定
+ ** \param [in] bEnAutoOutput PWM自动输出使能/禁止设定
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnPWM_Output(en_bt_unit_t enUnit, boolean_t bEnOutput, boolean_t bEnAutoOutput)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->DTR_f.MOE = bEnOutput;
+ pstcM0PBt->DTR_f.AOE = bEnAutoOutput;
+
+ return enResult;
+}
+
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 启动运行(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_Run(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 停止运行(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_Stop(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 重载值设置(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u16Data 16bits重载值
+ ** \param [in] bArrBufEn ARR重载缓存使能TRUE/禁止FALSE
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_ARRSet(en_bt_unit_t enUnit, uint16_t u16Data, boolean_t bArrBufEn)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->ARR_f.ARR = u16Data;
+ pstcM0PBt->M23CR_f.BUFPEN = bArrBufEn;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 16位计数器初值设置(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 16位计数值获取(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Bt_M23_Cnt16Get(en_bt_unit_t enUnit)
+{
+ uint16_t u16CntData = 0;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ u16CntData = pstcM0PBt->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 比较捕获寄存器CCR0A/CCR0B设置(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enCCRSel CCR0A/CCR0B设定
+ ** \param [in] u16Data CCR0A/CCR0B 16位初始值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_CCR_Set(en_bt_unit_t enUnit, en_bt_m23_ccrx_t enCCRSel, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ if(BtCCR0A == enCCRSel)
+ {
+ pstcM0PBt->CCR0A_f.CCR0A = u16Data;
+ }
+ else if(BtCCR0B == enCCRSel)
+ {
+ pstcM0PBt->CCR0B_f.CCR0B = u16Data;
+ }
+ else
+ {
+ enResult = Error;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 比较捕获寄存器CCR0A/CCR0B读取(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] enCCRSel CCR0A/CCR0B设定
+ **
+ ** \retval 16bitsCCR0A捕获值
+ *****************************************************************************/
+uint16_t Bt_M23_CCR_Get(en_bt_unit_t enUnit, en_bt_m23_ccrx_t enCCRSel)
+{
+ uint16_t u16Data = 0;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ if(BtCCR0A == enCCRSel)
+ {
+ u16Data = pstcM0PBt->CCR0A_f.CCR0A;
+ }
+ else if(BtCCR0B == enCCRSel)
+ {
+ u16Data = pstcM0PBt->CCR0B_f.CCR0B;
+ }
+ else
+ {
+ u16Data = 0;
+ }
+
+ return u16Data;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer PWM互补输出模式下,GATE功能选择(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_GateFuncSel(en_bt_unit_t enUnit,stc_bt_m23_gate_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.CSG = pstcConfig->enGateFuncSel;
+ pstcM0PBt->M23CR_f.CRG = pstcConfig->bGateRiseCap;
+ pstcM0PBt->M23CR_f.CFG = pstcConfig->bGateFallCap;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 主从模式配置(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_MasterSlave_Set(en_bt_unit_t enUnit, stc_bt_m23_master_slave_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->MSCR_f.MSM = pstcConfig->enMasterSlaveSel;
+ pstcM0PBt->MSCR_f.MMS = pstcConfig->enMasterSrc;
+ pstcM0PBt->MSCR_f.SMS = pstcConfig->enSlaveModeSel;
+ pstcM0PBt->MSCR_f.TS = pstcConfig->enTsSel;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer CH0A/CH0B比较通道输出控制(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_PortOutput_Config(en_bt_unit_t enUnit, stc_bt_m23_compare_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->CRCH0_f.CSA = 0;
+ pstcM0PBt->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCH0ACmpCtrl;
+ pstcM0PBt->FLTR_f.CCPA0 = pstcConfig->enCH0APolarity;
+ pstcM0PBt->CRCH0_f.BUFEA = pstcConfig->bCh0ACmpBufEn;
+ pstcM0PBt->M23CR_f.CIS = pstcConfig->enCh0ACmpIntSel;
+
+ pstcM0PBt->CRCH0_f.CSB = 0;
+ pstcM0PBt->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCH0BCmpCtrl;
+ pstcM0PBt->FLTR_f.CCPB0 = pstcConfig->enCH0BPolarity;
+ pstcM0PBt->CRCH0_f.BUFEB = pstcConfig->bCH0BCmpBufEn;
+ pstcM0PBt->CRCH0_f.CISB = pstcConfig->enCH0BCmpIntSel;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer CH0A/CH0B输入控制(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_PortInput_Config(en_bt_unit_t enUnit, stc_bt_m23_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->CRCH0_f.CSA = 1;
+ pstcM0PBt->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enCH0ACapSel;
+ pstcM0PBt->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCH0AInFlt;
+ pstcM0PBt->FLTR_f.CCPA0 = pstcConfig->enCH0APolarity;
+
+ pstcM0PBt->CRCH0_f.CSB = 1;
+ pstcM0PBt->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enCH0BCapSel;
+ pstcM0PBt->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCH0BInFlt;
+ pstcM0PBt->FLTR_f.CCPB0 = pstcConfig->enCH0BPolarity;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer ERT输入控制(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_ETRInput_Config(en_bt_unit_t enUnit, stc_bt_m23_etr_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->FLTR_f.ETP = pstcConfig->enETRPolarity;
+ pstcM0PBt->FLTR_f.FLTET = pstcConfig->enETRFlt;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 刹车BK输入控制(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_BrakeInput_Config(en_bt_unit_t enUnit, stc_bt_m23_bk_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->DTR_f.BKE = pstcConfig->bEnBrake;
+ pstcM0PBt->DTR_f.VC0E = pstcConfig->bEnVC0Brake;
+ pstcM0PBt->DTR_f.VC1E = pstcConfig->bEnVC1Brake;
+ pstcM0PBt->DTR_f.SAFEEN = pstcConfig->bEnSafetyBk;
+ pstcM0PBt->DTR_f.BKSEL = pstcConfig->bEnBKSync;
+ pstcM0PBt->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enBkCH0AStat;
+ pstcM0PBt->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enBkCH0BStat;
+ pstcM0PBt->FLTR_f.BKP = pstcConfig->enBrakePolarity;
+ pstcM0PBt->FLTR_f.FLTBK = pstcConfig->enBrakeFlt;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 触发ADC控制(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_TrigADC_Config(en_bt_unit_t enUnit, stc_bt_m23_adc_trig_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->ADTR_f.ADTE = pstcConfig->bEnTrigADC;
+ pstcM0PBt->ADTR_f.UEVE = pstcConfig->bEnUevTrigADC;
+ pstcM0PBt->ADTR_f.CMA0E = pstcConfig->bEnCH0ACmpTrigADC;
+ pstcM0PBt->ADTR_f.CMB0E = pstcConfig->bEnCH0BCmpTrigADC;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+** \brief Base Timer 死区功能(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_DT_Config(en_bt_unit_t enUnit, stc_bt_m23_dt_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->DTR_f.DTEN = pstcConfig->bEnDeadTime;
+ pstcM0PBt->DTR_f.DTR = pstcConfig->u8DeadTimeValue;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+** \brief Base Timer 重复周期设置(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] u8ValidPeriod 重复周期值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_SetValidPeriod(en_bt_unit_t enUnit, uint8_t u8ValidPeriod)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->RCR_f.RCR = u8ValidPeriod;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer OCREF清除功能(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_OCRefClr(en_bt_unit_t enUnit, stc_bt_m23_OCREF_Clr_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.OCCS = pstcConfig->enOCRefClrSrcSel;
+ pstcM0PBt->M23CR_f.OCCE = pstcConfig->bVCClrEn;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 使能DMA传输(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnDMA(en_bt_unit_t enUnit, stc_bt_m23_trig_dma_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.UDE = pstcConfig->bUevTrigDMA;
+ pstcM0PBt->M23CR_f.TDE = pstcConfig->bTITrigDMA;
+ pstcM0PBt->CRCH0_f.CDEA = pstcConfig->bCmpATrigDMA;
+ pstcM0PBt->CRCH0_f.CDEB = pstcConfig->bCmpBTrigDMA;
+ pstcM0PBt->MSCR_f.CCDS = pstcConfig->enCmpUevTrigDMA;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 捕获比较A软件触发(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnSwTrigCapCmpA(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->CRCH0_f.CCGA = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 捕获比较B软件触发(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnSwTrigCapCmpB(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->CRCH0_f.CCGB = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 软件更新使能(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnSwUev(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.UG = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 软件触发使能(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnSwTrig(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.TG = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer 软件刹车使能(模式23)
+ **
+ **
+ ** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Bt_M23_EnSwBk(en_bt_unit_t enUnit)
+{
+ en_result_t enResult = Ok;
+ volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
+ ASSERT(IS_VALID_TIM(enUnit));
+
+ pstcM0PBt->M23CR_f.BG = TRUE;
+
+ return enResult;
+}
+
+//@} // BtGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/crc.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/crc.c
new file mode 100644
index 0000000000..23b6b0bf69
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/crc.c
@@ -0,0 +1,438 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file crc.c
+ **
+ ** Common API of crc.
+ ** @link crcGroup Some description @endlink
+ **
+ ** - 2017-05-16
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "crc.h"
+/**
+ *******************************************************************************
+ ** \addtogroup CrcGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 编码(字节填充方式)
+ **
+ ** 该函数主要用于生成CRC16编码.
+ **
+ ** \param [in] pu8Data 待编码数据指针(字节方式输入)
+ ** \param [in] u32Len 待编码数据长度(字节数)
+ **
+ ** \retval CRC16 CRC16编码值.
+ *****************************************************************************/
+uint16_t CRC16_Get8(uint8_t* pu8Data, uint32_t u32Len)
+{
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 0;
+ M0P_CRC->RESULT = 0xFFFF;
+ for(u32Index = 0;u32Index<u32Len;u32Index++)
+ {
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = pu8Data[u32Index];
+ }
+
+ return (M0P_CRC->RESULT_f.RESULT);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 编码(半字填充方式)
+ **
+ ** 该函数主要用于生成CRC16编码.
+ **
+ ** \param [in] pu16Data 待编码数据指针(半字方式输入)
+ ** \param [in] u32Len 待编码数据长度(半字数)
+ **
+ ** \retval CRC16 CRC16编码值.
+ *****************************************************************************/
+uint16_t CRC16_Get16(uint16_t* pu16Data, uint32_t u32Len)
+{
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 0;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFF;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = pu16Data[u32Index];
+ }
+
+ return (M0P_CRC->RESULT_f.RESULT);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 编码(字填充方式)
+ **
+ ** 该函数主要用于生成CRC16编码.
+ **
+ ** \param [in] pu32Data 待编码数据指针(字方式输入)
+ ** \param [in] u32Len 待编码数据长度(字数)
+ **
+ ** \retval CRC16 CRC16编码值.
+ *****************************************************************************/
+uint16_t CRC16_Get32(uint32_t* pu32Data, uint32_t u32Len)
+{
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 0;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFF;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ M0P_CRC->DATA_f.DATA = pu32Data[u32Index];
+ }
+
+ return (M0P_CRC->RESULT_f.RESULT);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 校验(字节填充方式)
+ **
+ ** 该函数主要用于对数据及CRC16值进行校验.
+ **
+ ** \param [in] pu8Data 待校验数据指针(字节方式输入)
+ ** \param [in] u32Len 待校验数据长度(字节数)
+ ** \param [in] u16CRC 待校验CRC16值
+ **
+ ** \retval Ok CRC校验正确
+ ** \retval Error CRC校验错误
+ *****************************************************************************/
+en_result_t CRC16_Check8(uint8_t* pu8Data, uint32_t u32Len, uint16_t u16CRC)
+{
+ en_result_t enResult = Ok;
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 0;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFF;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = pu8Data[u32Index];
+ }
+
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = (uint8_t)((((uint32_t)u16CRC)>>0)&0xFF);
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = (uint8_t)(((uint32_t)u16CRC>>8)&0xFF);
+
+ enResult = M0P_CRC->CR_f.FLAG ? Ok : Error;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 校验(半字填充方式)
+ **
+ ** 该函数主要用于对数据及CRC16值进行校验.
+ **
+ ** \param [in] pu16Data 待校验数据指针(半字方式输入)
+ ** \param [in] u32Len 待校验数据长度(半字数)
+ ** \param [in] u16CRC 待校验CRC16值
+ **
+ ** \retval Ok CRC校验正确
+ ** \retval Error CRC校验错误
+ *****************************************************************************/
+en_result_t CRC16_Check16(uint16_t* pu16Data, uint32_t u32Len, uint16_t u16CRC)
+{
+ en_result_t enResult = Ok;
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 0;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFF;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = pu16Data[u32Index];
+ }
+
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = u16CRC;
+
+ enResult = M0P_CRC->CR_f.FLAG ? Ok : Error;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 校验(字填充方式)
+ **
+ ** 该函数主要用于对数据及CRC16值进行校验.
+ **
+ ** \param [in] pu32Data 待校验数据指针(字方式输入)
+ ** \param [in] u32Len 待校验数据长度(字数)
+ ** \param [in] u16CRC 待校验CRC16值
+ **
+ ** \retval Ok CRC校验正确
+ ** \retval Error CRC校验错误
+ *****************************************************************************/
+en_result_t CRC16_Check32(uint32_t* pu32Data, uint32_t u32Len, uint16_t u16CRC)
+{
+ en_result_t enResult = Ok;
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 0;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFFFFFFu;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint32_t*)(&(M0P_CRC->DATA))) = pu32Data[u32Index];
+ }
+
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = ((uint16_t)u16CRC);
+
+ enResult = M0P_CRC->CR_f.FLAG ? Ok : Error;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 编码(字节填充方式)
+ **
+ ** 该函数主要用于生成CRC16编码.
+ **
+ ** \param [in] pu8Data 待编码数据指针(字节方式输入)
+ ** \param [in] u32Len 待编码数据长度(字节数)
+ **
+ ** \retval CRC16 CRC16编码值.
+ *****************************************************************************/
+uint32_t CRC32_Get8(uint8_t* pu8Data, uint32_t u32Len)
+{
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 1;
+ M0P_CRC->RESULT = 0xFFFFFFFFu;
+ for(u32Index = 0;u32Index<u32Len;u32Index++)
+ {
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = pu8Data[u32Index];
+ }
+
+ return (M0P_CRC->RESULT_f.RESULT);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 编码(半字填充方式)
+ **
+ ** 该函数主要用于生成CRC16编码.
+ **
+ ** \param [in] pu16Data 待编码数据指针(半字方式输入)
+ ** \param [in] u32Len 待编码数据长度(半字数)
+ **
+ ** \retval CRC16 CRC16编码值.
+ *****************************************************************************/
+uint32_t CRC32_Get16(uint16_t* pu16Data, uint32_t u32Len)
+{
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 1;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFFFFFFu;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = pu16Data[u32Index];
+ }
+
+ return (M0P_CRC->RESULT_f.RESULT);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 编码(字填充方式)
+ **
+ ** 该函数主要用于生成CRC16编码.
+ **
+ ** \param [in] pu32Data 待编码数据指针(字方式输入)
+ ** \param [in] u32Len 待编码数据长度(字数)
+ **
+ ** \retval CRC16 CRC16编码值.
+ *****************************************************************************/
+uint32_t CRC32_Get32(uint32_t* pu32Data, uint32_t u32Len)
+{
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 1;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFFFFFFu;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ M0P_CRC->DATA_f.DATA = pu32Data[u32Index];
+ }
+
+ return (M0P_CRC->RESULT_f.RESULT);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 校验(字节填充方式)
+ **
+ ** 该函数主要用于对数据及CRC16值进行校验.
+ **
+ ** \param [in] pu8Data 待校验数据指针(字节方式输入)
+ ** \param [in] u32Len 待校验数据长度(字节数)
+ ** \param [in] u16CRC 待校验CRC16值
+ **
+ ** \retval Ok CRC校验正确
+ ** \retval Error CRC校验错误
+ *****************************************************************************/
+en_result_t CRC32_Check8(uint8_t* pu8Data, uint32_t u32Len, uint32_t u32CRC)
+{
+ en_result_t enResult = Ok;
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 1;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFFFFFFu;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = pu8Data[u32Index];
+ }
+
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = (uint8_t)((u32CRC>>0)&0xFF);
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = (uint8_t)((u32CRC>>8)&0xFF);
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = (uint8_t)((u32CRC>>16)&0xFF);
+ *((volatile uint8_t*)(&(M0P_CRC->DATA))) = (uint8_t)((u32CRC>>24)&0xFF);
+
+ enResult = M0P_CRC->CR_f.FLAG ? Ok : Error;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 校验(半字填充方式)
+ **
+ ** 该函数主要用于对数据及CRC16值进行校验.
+ **
+ ** \param [in] pu16Data 待校验数据指针(半字方式输入)
+ ** \param [in] u32Len 待校验数据长度(半字数)
+ ** \param [in] u16CRC 待校验CRC16值
+ **
+ ** \retval Ok CRC校验正确
+ ** \retval Error CRC校验错误
+ *****************************************************************************/
+en_result_t CRC32_Check16(uint16_t* pu16Data, uint32_t u32Len, uint32_t u32CRC)
+{
+ en_result_t enResult = Ok;
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 1;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFFFFFFu;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = pu16Data[u32Index];
+ }
+
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = (uint16_t)((u32CRC>>0)&0xFFFF);
+ *((volatile uint16_t*)(&(M0P_CRC->DATA))) = (uint16_t)((u32CRC>>16)&0xFFFF);
+
+
+ enResult = M0P_CRC->CR_f.FLAG ? Ok : Error;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief CRC16 校验(字填充方式)
+ **
+ ** 该函数主要用于对数据及CRC16值进行校验.
+ **
+ ** \param [in] pu32Data 待校验数据指针(字方式输入)
+ ** \param [in] u32Len 待校验数据长度(字数)
+ ** \param [in] u16CRC 待校验CRC16值
+ **
+ ** \retval Ok CRC校验正确
+ ** \retval Error CRC校验错误
+ *****************************************************************************/
+en_result_t CRC32_Check32(uint32_t* pu32Data, uint32_t u32Len, uint32_t u32CRC)
+{
+ en_result_t enResult = Ok;
+ uint32_t u32Index = 0;
+
+ M0P_CRC->CR_f.CR = 1;
+ M0P_CRC->RESULT_f.RESULT = 0xFFFFFFFFu;
+ for (u32Index=0; u32Index<u32Len; u32Index++)
+ {
+ *((volatile uint32_t*)(&(M0P_CRC->DATA))) = pu32Data[u32Index];
+ }
+
+ *((volatile uint32_t*)(&(M0P_CRC->DATA))) = u32CRC;
+
+ enResult = M0P_CRC->CR_f.FLAG ? Ok : Error;
+
+ return (enResult);
+}
+//@} // CrcGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/ddl.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/ddl.c
new file mode 100644
index 0000000000..13d1e25040
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/ddl.c
@@ -0,0 +1,292 @@
+/*******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file ddl.c
+ **
+ ** Common API of DDL.
+ ** @link ddlGroup Some description @endlink
+ **
+ ** - 2018-04-15
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "ddl.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup DDL Common Functions
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Local pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Global variable definitions (declared in header file with 'extern') */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Local type definitions ('typedef') */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Local variable definitions ('static') */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Function implementation - global ('extern') and local ('static') */
+/******************************************************************************/
+#ifndef __DEBUG
+#define __DEBUG
+//#define __CC_ARM
+#endif
+
+uint32_t Log2(uint32_t u32Val)
+{
+ uint32_t u32V1 = 0;
+
+ if(0u == u32Val)
+ {
+ return 0;
+ }
+
+ while(u32Val > 1u)
+ {
+ u32V1++;
+ u32Val /=2;
+ }
+
+ return u32V1;
+}
+
+
+/**
+ *******************************************************************************
+ ** \brief Memory clear function for DDL_ZERO_STRUCT()
+ ******************************************************************************/
+void ddl_memclr(void *pu8Address, uint32_t u32Count)
+{
+ uint8_t *pu8Addr = (uint8_t *)pu8Address;
+
+ if(NULL == pu8Addr)
+ {
+ return;
+ }
+
+ while (u32Count--)
+ {
+ *pu8Addr++ = 0;
+ }
+}
+
+/**
+ *****************************************************************************
+ ** \brief Hook function, which is called in polling loops
+ *****************************************************************************/
+void DDL_WAIT_LOOP_HOOK(void)
+{
+ // Place code for triggering Watchdog counters here, if needed
+}
+
+/**
+ *****************************************************************************
+ ** \brief debug printf function.
+ *****************************************************************************/
+void Debug_UartInit(void)
+{
+
+}
+
+void Debug_Output(uint8_t u8Data)
+{
+
+}
+
+extern void Debug_UartInit(void);
+extern void Debug_Output(uint8_t u8Data);
+
+#if defined (__CC_ARM) //KEIL
+#pragma import(__use_no_semihosting)
+void _sys_exit(int x)
+{
+ (void)x;
+}
+struct __FILE
+{
+ int handle;
+ /* Whatever you require here. If the only file you are using is */
+ /* standard output using printf() for debugging, no file handling */
+/* is required. */
+};
+/* FILE is typedef?d in stdio.h. */
+FILE __stdout;
+
+#endif
+
+#ifdef __DEBUG
+/**
+ ******************************************************************************
+ ** \brief Re-target putchar function
+ ******************************************************************************/
+int fputc(int ch, FILE *f)
+{
+
+ if (((uint8_t)ch) == '\n')
+ {
+ Debug_Output('\r');
+ }
+ Debug_Output(ch);
+
+ return ch;
+}
+#endif
+
+void _ttywrch(int c)
+{
+}
+
+
+int __backspace(void)
+{
+ return 0;
+}
+
+
+
+/**
+ * \brief delay1ms
+ * delay approximately 1ms.
+ * \param [in] u32Cnt
+ * \retval void
+ */
+void delay1ms(uint32_t u32Cnt)
+{
+ uint32_t u32end;
+
+ SysTick->LOAD = 0xFFFFFF;
+ SysTick->VAL = 0;
+ SysTick->CTRL = SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_CLKSOURCE_Msk;
+
+ while(u32Cnt-- > 0)
+ {
+ SysTick->VAL = 0;
+ u32end = 0x1000000 - SystemCoreClock/1000;
+ while(SysTick->VAL > u32end)
+ {
+ ;
+ }
+ }
+
+ SysTick->CTRL = (SysTick->CTRL & (~SysTick_CTRL_ENABLE_Msk));
+}
+
+/**
+ * \brief delay100us
+ * delay approximately 100us.
+ * \param [in] u32Cnt
+ * \retval void
+ */
+void delay100us(uint32_t u32Cnt)
+{
+ uint32_t u32end;
+
+ SysTick->LOAD = 0xFFFFFF;
+ SysTick->VAL = 0;
+ SysTick->CTRL = SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_CLKSOURCE_Msk;
+
+ while(u32Cnt-- > 0)
+ {
+ SysTick->VAL = 0;
+
+ u32end = 0x1000000 - SystemCoreClock/10000;
+ while(SysTick->VAL > u32end)
+ {
+ ;
+ }
+ }
+
+ SysTick->CTRL = (SysTick->CTRL & (~SysTick_CTRL_ENABLE_Msk));
+}
+
+/**
+ * \brief delay10us
+ * delay approximately 10us.
+ * \param [in] u32Cnt
+ * \retval void
+ */
+void delay10us(uint32_t u32Cnt)
+{
+ uint32_t u32end;
+
+ SysTick->LOAD = 0xFFFFFF;
+ SysTick->VAL = 0;
+ SysTick->CTRL = SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_CLKSOURCE_Msk;
+
+ while(u32Cnt-- > 0)
+ {
+ SysTick->VAL = 0;
+
+ u32end = 0x1000000 - SystemCoreClock/100000;
+ while(SysTick->VAL > u32end)
+ {
+ ;
+ }
+ }
+
+ SysTick->CTRL = (SysTick->CTRL & (~SysTick_CTRL_ENABLE_Msk));
+}
+
+
+//@} // DDL Functions
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/debug.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/debug.c
new file mode 100644
index 0000000000..3084bf3b83
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/debug.c
@@ -0,0 +1,119 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file debug.c
+ **
+ ** Common API of debug.
+ ** @link flashGroup Some description @endlink
+ **
+ ** - 2018-05-08
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "debug.h"
+/**
+ *******************************************************************************
+ ** \addtogroup FlashGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief 调试模式下模块功能使能
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Debug_ActiveEnable(en_debug_module_active_t enModule)
+{
+ M0P_DEBUG_ACTIVE->DEBUG_ACTIVE &= ~enModule;
+
+ return Ok;
+}
+
+/**
+ *****************************************************************************
+ ** \brief 调试模式下模块功能暂停
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Debug_ActiveDisable(en_debug_module_active_t enModule)
+{
+ M0P_DEBUG_ACTIVE->DEBUG_ACTIVE |= enModule;
+
+ return Ok;
+}
+
+
+//@} // BgrGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/dmac.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/dmac.c
new file mode 100644
index 0000000000..1003e61def
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/dmac.c
@@ -0,0 +1,1537 @@
+/******************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file dmac.c
+**
+** A detailed description is available at
+** @link DmacGroup Dmac description @endlink
+**
+** - 2018-03-09 1.0 Hongjh First version for Device Driver Library of Dmac.
+**
+******************************************************************************/
+
+/*******************************************************************************
+* Include files
+******************************************************************************/
+#include "dmac.h"
+
+/**
+*******************************************************************************
+** \addtogroup DmacGroup
+******************************************************************************/
+//@{
+
+/*******************************************************************************
+* Local type definitions ('typedef')
+******************************************************************************/
+
+/*******************************************************************************
+* Local pre-processor symbols/macros ('#define')
+******************************************************************************/
+
+/******************************************************************************/
+/* DMA */
+/******************************************************************************/
+/***************** Bits definition for DMA_INTSTAT0 register ****************/
+#define DMA_INTSTAT0_TRNERR_Pos (0U) /*!< DMA_INTSTAT0: TRNERR Position */
+#define DMA_INTSTAT0_REQERR_Pos (16U) /*!< DMA_INTSTAT0: REQERR Position */
+
+/***************** Bits definition for DMA_INTSTAT1 register ****************/
+#define DMA_INTSTAT1_TC_Pos (0U) /*!< DMA_INTSTAT1: TC Position */
+#define DMA_INTSTAT1_BTC_Pos (16U) /*!< DMA_INTSTAT1: BTC Position */
+
+/***************** Bits definition for DMA_INTMASK0 register ****************/
+#define DMA_INTMASK0_MSKTRNERR_Pos (0U) /*!< DMA_INTMASK0: MSKTRNERR Position */
+#define DMA_INTMASK0_MSKREQERR_Pos (16U) /*!< DMA_INTMASK0: MSKREQERR Position */
+
+/***************** Bits definition for DMA_INTMASK1 register ****************/
+#define DMA_INTMASK1_MSKTC_Pos (0U) /*!< DMA_INTMASK1: MSKTC Position */
+#define DMA_INTMASK1_MSKBTC_Pos (16U) /*!< DMA_INTMASK1: MSKBTC Position */
+
+/***************** Bits definition for DMA_INTCLR0 register *****************/
+#define DMA_INTCLR0_CLRTRNERR_Pos (0U) /*!< DMA_INTCLR0: CLRTRNERR Position */
+#define DMA_INTCLR0_CLRREQERR_Pos (16U) /*!< DMA_INTCLR0: CLRREQERR Position */
+
+/***************** Bits definition for DMA_INTCLR1 register *****************/
+#define DMA_INTCLR1_CLRTC_Pos (0U) /*!< DMA_INTCLR1: CLRTC Position */
+#define DMA_INTCLR1_CLRBTC_Pos (16U) /*!< DMA_INTCLR1: CLRBTC Position */
+
+/******************* Bits definition for DMA_CHEN register ******************/
+#define DMA_CHEN_CHEN_Pos (0U) /*!< DMA_CHEN: CHEN Position */
+
+/************** Bits definition for DMA_TRGSELx(x=0~7) register *************/
+#define DMA_TRGSEL_TRGSEL_Pos (0U) /*!< DMA_TRGSELx: TRGSEL Position */
+#define DMA_TRGSEL_TRGSEL_Msk (0x1FFU << DMA_TRGSEL_TRGSEL_Pos) /*!< DMA_TRGSELx: TRGSEL Mask 0x000001FF */
+#define DMA_TRGSEL_TRGSEL DMA_TRGSEL_TRGSEL_Msk
+/************** Bits definition for DMA_DTCTLx(x=0~7) register **************/
+#define DMA_DTCTL_BLKSIZE_Pos (0U) /*!< DMA_DTCTLx: BLKSIZE Position */
+#define DMA_DTCTL_BLKSIZE_Msk (0x3FFU << DMA_DTCTL_BLKSIZE_Pos) /*!< DMA_DTCTLx: BLKSIZE Mask 0x000003FF */
+#define DMA_DTCTL_BLKSIZE DMA_DTCTL_BLKSIZE_Msk
+
+#define DMA_DTCTL_CNT_Pos (16U) /*!< DMA_DTCTLx: CNT Position */
+#define DMA_DTCTL_CNT_Msk (0xFFFFU << DMA_DTCTL_CNT_Pos) /*!< DMA_DTCTLx: CNT Mask 0xFFFF0000 */
+#define DMA_DTCTL_CNT DMA_DTCTL_CNT_Msk
+
+/*************** Bits definition for DMA_RPTx(x=0~7) register ***************/
+#define DMA_RPT_SRPT_Pos (0U) /*!< DMA_RPTx: SRPT Position */
+#define DMA_RPT_SRPT_Msk (0x1FFU << DMA_RPT_SRPT_Pos) /*!< DMA_RPTx: SRPT Mask 0x000001FF */
+#define DMA_RPT_SRPT DMA_RPT_SRPT_Msk
+
+#define DMA_RPT_DRPT_Pos (16U) /*!< DMA_RPTx: DRPT Position */
+#define DMA_RPT_DRPT_Msk (0x1FFU << DMA_RPT_DRPT_Pos) /*!< DMA_RPTx: DRPT Mask 0x01FF0000 */
+#define DMA_RPT_DRPT DMA_RPT_DRPT_Msk
+
+/************* Bits definition for DMA_SNSEQCTLx(x=0~7) register ************/
+#define DMA_SNSEQCTL_SOFFSET_Pos (0U) /*!< DMA_SNSEQCTLx: SOFFSET Position */
+#define DMA_SNSEQCTL_SOFFSET_Msk (0xFFFFFU << DMA_SNSEQCTL_SOFFSET_Pos) /*!< DMA_SNSEQCTLx: SOFFSET Mask 0x000FFFFF */
+#define DMA_SNSEQCTL_SOFFSET DMA_SNSEQCTL_SOFFSET_Msk
+
+#define DMA_SNSEQCTL_SNSCNT_Pos (20U) /*!< DMA_SNSEQCTLx: SNSCNT Position */
+#define DMA_SNSEQCTL_SNSCNT_Msk (0xFFFU << DMA_SNSEQCTL_SNSCNT_Pos) /*!< DMA_SNSEQCTLx: SNSCNT Mask 0xFFF00000 */
+#define DMA_SNSEQCTL_SNSCNT DMA_SNSEQCTL_SNSCNT_Msk
+
+/************* Bits definition for DMA_DNSEQCTLx(x=0~7) register ************/
+#define DMA_DNSEQCTL_DOFFSET_Pos (0U) /*!< DMA_DNSEQCTLx: DOFFSET Position */
+#define DMA_DNSEQCTL_DOFFSET_Msk (0xFFFFFU << DMA_DNSEQCTL_DOFFSET_Pos) /*!< DMA_DNSEQCTLx: DOFFSET Mask 0x000FFFFF */
+#define DMA_DNSEQCTL_DOFFSET DMA_DNSEQCTL_DOFFSET_Msk
+
+#define DMA_DNSEQCTL_DNSCNT_Pos (20U) /*!< DMA_DNSEQCTLx: DNSCNT Position */
+#define DMA_DNSEQCTL_DNSCNT_Msk (0xFFFU << DMA_DNSEQCTL_DNSCNT_Pos) /*!< DMA_DNSEQCTLx: DNSCNT Mask 0xFFF00000 */
+#define DMA_DNSEQCTL_DNSCNT DMA_DNSEQCTL_DNSCNT_Msk
+
+/*************** Bits definition for DMA_CHxCTL(x=0~7) register *************/
+#define DMA_CHCTL_SINC_Pos (0U) /*!< DMA_CHxCTL: SINC Position */
+#define DMA_CHCTL_SINC_Msk (0x3u << DMA_CHCTL_SINC_Pos) /*!< DMA_CHxCTL: SINC Mask 0x00000003 */
+#define DMA_CHCTL_SINC DMA_CHCTL_SINC_Msk
+
+#define DMA_CHCTL_DINC_Pos (2U) /*!< DMA_CHxCTL: DINC Position */
+#define DMA_CHCTL_DINC_Msk (0x3U << DMA_CHCTL_DINC_Pos) /*!< DMA_CHxCTL: DINC Mask 0x0000000C */
+#define DMA_CHCTL_DINC DMA_CHCTL_DINC_Msk
+
+#define DMA_CHCTL_SRPTEN_Pos (4U) /*!< DMA_CHxCTL: SRPTEN Position */
+#define DMA_CHCTL_DRPTEN_Pos (5U) /*!< DMA_CHxCTL: DRPTEN Position */
+#define DMA_CHCTL_SNSEQEN_Pos (6U) /*!< DMA_CHxCTL: SNSEQEN Position */
+#define DMA_CHCTL_DNSEQEN_Pos (7U) /*!< DMA_CHxCTL: DNSEQEN Position */
+
+#define DMA_CHCTL_HSIZE_Pos (8U) /*!< DMA_CHxCTL: HSIZE Position */
+#define DMA_CHCTL_HSIZE_Msk (0x3U << DMA_CHCTL_HSIZE_Pos) /*!< DMA_CHxCTL: HSIZE Mask 0x00000300 */
+#define DMA_CHCTL_HSIZE DMA_CHCTL_HSIZE_Msk
+
+#define DMA_CHCTL_LLPEN_Pos (10U) /*!< DMA_CHxCTL: LLPEN Position */
+#define DMA_CHCTL_LLPRUN_Pos (11U) /*!< DMA_CHxCTL: LLPRUN Position */
+#define DMA_CHCTL_IE_Pos (12U) /*!< DMA_CHxCTL: IE Position */
+#define DMA_CHCTL_PROT_Pos (13U) /*!< DMA_CHxCTL: PROT Position */
+
+/************************ DMA_TRGSELx(x=0~7) register ***********************/
+#define DMA_TRGSEL_BASE (0x40010854U)
+#define DMA_TRGSEL(x) (*(volatile uint32_t *)((x) * 0x4U + DMA_TRGSEL_BASE))
+
+#define INTC_INTSFTTRG_BASE (0x40010800U)
+#define INTC_INTSFTTRG (*(volatile uint32_t *)INTC_INTSFTTRG_BASE)
+
+/*********************** DMA REGISTERx(x=0~7) register **********************/
+#define _DMA_CH_REG_OFFSET(ch) ((ch) * 0x40U)
+#define _DMA_CH_REG(reg_base, ch) (*(volatile uint32_t *)((reg_base) + _DMA_CH_REG_OFFSET(ch)))
+
+#define WRITE_DMA_CH_REG(reg_base, ch, val) (_DMA_CH_REG((reg_base), (ch)) = (val))
+#define READ_DMA_CH_REG(reg_base, ch) (_DMA_CH_REG((reg_base), (ch)))
+
+#define SET_DMA_CH_REG_BIT(reg_base, ch, pos) (_DMA_CH_REG((reg_base), (ch)) |= (1U << (pos)))
+#define CLR_DMA_CH_REG_BIT(reg_base, ch, pos) (_DMA_CH_REG((reg_base), (ch)) &= (~(1U << (pos))))
+
+
+/********************** SET DMA_TRGSELx(x=0~7) register *********************/
+
+#define SET_DMA_CHCTL_PROT(CH, PROT) SET_DMA_CHCTL_PROT((CH), (PROT))
+
+/************************** SET INTSFTTRG register **************************/
+#define SOFTWARE_TRIGGER_DMA() (INTC_INTSFTTRG = 1U)
+
+/*! Parameter valid check for Dmac Channel. */
+#define IS_VALID_CH(x) \
+( (DmaCh0 == (x)) || \
+ (DmaCh1 == (x)))
+
+/*! Parameter valid check for Dmac transfer data width. */
+#define IS_VALID_TRN_WIDTH(x) \
+( (Dma8Bit == (x)) || \
+ (Dma16Bit == (x)) || \
+ (Dma32Bit == (x)))
+
+/*! Parameter valid check for Dmac address mode. */
+#define IS_VALID_ADDR_MODE(x) \
+( (AddressFix == (x)) || \
+ (AddressIncrease == (x)))
+
+#define IS_VALID_PRIO_MODE(x) \
+( (DmaPriorityFix == (x)) || \
+ (DmaPriorityLoop == (x)))
+
+/*! Parameter valid check for Dmac transfer block size. */
+#define IS_VALID_BLKSIZE(x) (!((x) & ~(DMA_DTCTL_BLKSIZE_Msk >> DMA_DTCTL_BLKSIZE_Pos)))
+
+/*! Parameter valid check for Dmac transfer count. */
+#define IS_VALID_TRNCNT(x) (!((x) & ~(DMA_DTCTL_CNT_Msk >> DMA_DTCTL_CNT_Pos)))
+
+/*! Parameter valid check for Dmac destination repeat size. */
+#define IS_VALID_DRPT_SIZE(x) (!((x) & ~(DMA_RPT_DRPT_Msk >> DMA_RPT_DRPT_Pos)))
+
+/*! Parameter valid check for Dmac source no-sequence count. */
+#define IS_VALID_SNSCNT(x) (!((x) & ~(DMA_SNSEQCTL_SNSCNT_Msk >> DMA_SNSEQCTL_SNSCNT_Pos)))
+
+/*! Parameter valid check for Dmac source no-sequence offset. */
+#define IS_VALID_SNSOFFSET(x) (!((x) & ~(DMA_SNSEQCTL_SOFFSET_Msk >> DMA_SNSEQCTL_SOFFSET_Pos)))
+
+/*! Parameter valid check for Dmac destination no-sequence count. */
+#define IS_VALID_DNSCNT(x) (!((x) & ~(DMA_DNSEQCTL_DNSCNT_Msk >> DMA_DNSEQCTL_DNSCNT_Pos)))
+
+/*! Parameter valid check for Dmac destination no-sequence offset. */
+#define IS_VALID_DNSOFFSET(x) (!((x) & ~(DMA_DNSEQCTL_DOFFSET_Msk >> DMA_DNSEQCTL_DOFFSET_Pos)))
+
+/*******************************************************************************
+* Global variable definitions (declared in header file with 'extern')
+******************************************************************************/
+
+/*******************************************************************************
+* Local function prototypes ('static')
+******************************************************************************/
+
+/*******************************************************************************
+* Local variable definitions ('static')
+******************************************************************************/
+static stc_dma_irq_calbakfn_pt_t stcDmaIrqCalbaks = {NULL, NULL,NULL, NULL};
+/*******************************************************************************
+* Function implementation - global ('extern') and local ('static')
+******************************************************************************/
+
+/**
+*******************************************************************************
+** \brief Initializes a DMA channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] pstcConfig The structure pointer of DMA module configuration.
+**
+** \retval Ok Initializes successfully.
+** \retval ErrorInvalidParameter enCh is invalid or the pstcConfig is NULL.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_InitChannel(en_dma_channel_t enCh, stc_dma_config_t* pstcConfig)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(NULL != pstcConfig);
+ ASSERT(IS_VALID_BLKSIZE(pstcConfig->u16BlockSize));
+ ASSERT(IS_VALID_TRNCNT(pstcConfig->u16TransferCnt));
+ ASSERT(IS_VALID_TRN_WIDTH(pstcConfig->enTransferWidth));
+ ASSERT(IS_VALID_ADDR_MODE(pstcConfig->enSrcAddrMode));
+ ASSERT(IS_VALID_ADDR_MODE(pstcConfig->enDstAddrMode));
+
+ /* Check for channel and NULL pointer */
+ if (!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.FIS_IE = 0;
+ M0P_DMAC->CONFB0_f.ERR_IE = 0; /* Disable DMAC interrupt */
+
+ /******************* SET DMA MODE ******************/
+ M0P_DMAC->CONFB0_f.MODE = pstcConfig->enMode;
+ /******************* SET DMA_TRGSELx register ******************/
+ M0P_DMAC->CONFA0_f.TRI_SEL = pstcConfig->enRequestNum;
+ /******************* SET DMA_DTCTLx(x=0~7) register ******************/
+ /* Block size */
+ M0P_DMAC->CONFA0_f.BC = pstcConfig->u16BlockSize - 1;
+ /* Transfer count */
+ M0P_DMAC->CONFA0_f.TC = pstcConfig->u16TransferCnt - 1;
+
+ /******************* SET DMA_CHxCTL(x=0~7) register ******************/
+ /* Transfer width */
+ M0P_DMAC->CONFB0_f.WIDTH = pstcConfig->enTransferWidth;
+
+ /****************************** source address contrl *******************/
+ /* source address mode */
+ M0P_DMAC->CONFB0_f.FS = pstcConfig->enSrcAddrMode;
+ /* Source address */
+ M0P_DMAC->SRCADR0_f.SRCADR = pstcConfig->u32SrcAddress;
+
+ /*************************** destination address contrl *******************/
+ /* destination address mode */
+ M0P_DMAC->CONFB0_f.FD = pstcConfig->enDstAddrMode;
+ /* Destination address */
+ M0P_DMAC->DSTADR0_f.DSTADR = pstcConfig->u32DstAddress;
+ /********************* Source address reload control ********************/
+ M0P_DMAC ->CONFB0_f.RS = pstcConfig->bSrcAddrReloadCtl;
+
+ /******************* Destination address reload control *****************/
+ M0P_DMAC ->CONFB0_f.RD = pstcConfig->bDestAddrReloadCtl;
+
+ /******************* Destination bc/tc reload control *****************/
+ M0P_DMAC ->CONFB0_f.RC = pstcConfig->bSrcBcTcReloadCtl;
+
+ /******************* MSK control *****************/
+ M0P_DMAC->CONFB0_f.MSK = pstcConfig->bMsk;
+
+ }
+ else{
+ M0P_DMAC->CONFB1_f.FIS_IE = 0;
+ M0P_DMAC->CONFB1_f.ERR_IE = 0; /* Disable DMAC interrupt */
+ /******************* SET DMA MODE ******************/
+ M0P_DMAC->CONFB1_f.MODE = pstcConfig->enMode;
+ /******************* SET DMA_TRGSELx register ******************/
+ M0P_DMAC->CONFA1_f.TRI_SEL = pstcConfig->enRequestNum;
+ /******************* SET DMA_DTCTLx(x=0~7) register ******************/
+ /* Block size */
+ M0P_DMAC->CONFA1_f.BC = pstcConfig->u16BlockSize - 1;
+ /* Transfer count */
+ M0P_DMAC->CONFA1_f.TC = pstcConfig->u16TransferCnt - 1;
+
+ /******************* SET DMA_CHxCTL(x=0~7) register ******************/
+ /* Transfer width */
+ M0P_DMAC->CONFB1_f.WIDTH = pstcConfig->enTransferWidth;
+
+ /****************************** source address contrl *******************/
+ /* source address mode */
+ M0P_DMAC->CONFB1_f.FS = pstcConfig->enSrcAddrMode;
+ /* Source address */
+ M0P_DMAC->SRCADR1_f.SRCADR = pstcConfig->u32SrcAddress;
+
+ /*************************** destination address contrl *******************/
+ /* destination address mode */
+ M0P_DMAC->CONFB1_f.FD = pstcConfig->enDstAddrMode;
+ /* Destination address */
+ M0P_DMAC->DSTADR1_f.DSTADR = pstcConfig->u32DstAddress;
+
+ /********************* Source address reload control ********************/
+ M0P_DMAC ->CONFB1_f.RS = pstcConfig->bSrcAddrReloadCtl;
+
+ /******************* Destination address reload control *****************/
+ M0P_DMAC ->CONFB1_f.RD = pstcConfig->bDestAddrReloadCtl;
+
+ /******************* Destination bc/tc reload control *****************/
+ M0P_DMAC ->CONFB1_f.RC = pstcConfig->bSrcBcTcReloadCtl;
+
+ /******************* MSK control *****************/
+ M0P_DMAC->CONFB1_f.MSK = pstcConfig->bMsk;
+ }
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Trigger dma transfer by software.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval None
+**
+** \note None
+**
+******************************************************************************/
+void Dma_SwTrigger(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.TRI_SEL = 0x0000;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.TRI_SEL = 0x0000;
+ }
+}
+
+/**
+*******************************************************************************
+** \brief Enable dma function.
+**
+** \param None
+**
+** \retval None
+**
+** \note None
+**
+******************************************************************************/
+void Dma_Enable(void)
+{
+ M0P_DMAC->CONF_f.EN = 1;
+}
+
+/**
+*******************************************************************************
+** \brief Disable dma function.
+**
+** \param None
+**
+** \retval None
+**
+** \note None
+**
+******************************************************************************/
+void Dma_Disable(void)
+{
+ M0P_DMAC->CONF_f.EN = 0;
+}
+/**
+*******************************************************************************
+** \brief Start dma function.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval None
+**
+** \note None
+**
+******************************************************************************/
+void Dma_Start(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.ST = 1;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.ST = 1;
+ }
+}
+
+/**
+*******************************************************************************
+** \brief Disable dma function.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval None
+**
+** \note None
+**
+******************************************************************************/
+void Dma_Stop(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.ST = 0;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.ST = 0;
+ }
+}
+/**
+*******************************************************************************
+** \brief Enable the specified dma interrupt.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] enIrqSel The specified dma flag.
+** \arg TrnErrIrq The DMA transfer error interrupt.
+** \arg TrnReqErrIrq DMA transfer req over error interrupt.
+** \arg TrnCpltIrq DMA transfer completion interrupt.
+** \arg BlkTrnCpltIrq DMA block completion interrupt.
+**
+** \retval Ok Interrupt enabled normally.
+** \retval ErrorInvalidParameter enCh or enIrqSel is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableIrq(en_dma_channel_t enCh, stc_dma_irq_sel_t stcIrqSel)
+{
+ en_result_t enRet = Ok;
+
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (TRUE == stcIrqSel.TrnCpltIrq)
+ {
+ Dma_EnableChannelIrq(enCh);
+ }
+ if(TRUE == stcIrqSel.TrnErrIrq)
+ {
+ Dma_EnableChannelErrIrq(enCh);
+ }
+
+ return enRet;
+}
+
+/**
+*******************************************************************************
+** \brief Enable the specified dma interrupt.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] enIrqSel The specified dma flag.
+** \arg TrnErrIrq The DMA transfer error interrupt.
+** \arg TrnReqErrIrq DMA transfer req over error interrupt.
+** \arg TrnCpltIrq DMA transfer completion interrupt.
+** \arg BlkTrnCpltIrq DMA block completion interrupt.
+**
+** \retval Ok Interrupt disabled normally.
+** \retval ErrorInvalidParameter enCh or enIrqSel is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableIrq(en_dma_channel_t enCh, stc_dma_irq_sel_t stcIrqSel)
+{
+ en_result_t enRet = Ok;
+
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if (TRUE == stcIrqSel.TrnCpltIrq)
+ {
+ Dma_DisableChannelIrq(enCh);
+ }
+ if(TRUE == stcIrqSel.TrnErrIrq)
+ {
+ Dma_DisableChannelErrIrq(enCh);
+ }
+
+ return enRet;
+}
+
+/**
+*******************************************************************************
+** \brief Enable the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Enable channel successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableChannel(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.ENS = 1;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.ENS = 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Disable the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable channel successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableChannel(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.ENS = 0;;
+ }
+ else {
+ M0P_DMAC->CONFA1_f.ENS = 0;;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the specified dma trigger.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16TrgSel The trigger selection number.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16TrgSel is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetTriggerSel(en_dma_channel_t enCh, en_dma_trig_sel_t enTrgSel)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.TRI_SEL = enTrgSel;;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.TRI_SEL = enTrgSel;;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Setthe source address of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u32Address The source address.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetSourceAddress(en_dma_channel_t enCh, uint32_t u32Address)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->SRCADR0_f.SRCADR = u32Address;
+ }
+ else
+ {
+ M0P_DMAC->SRCADR1_f.SRCADR = u32Address;;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the destination address of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u32Address The destination address.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetDestinationAddress(en_dma_channel_t enCh, uint32_t u32Address)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->DSTADR0_f.DSTADR = u32Address;
+ }
+ else
+ {
+ M0P_DMAC->DSTADR1_f.DSTADR = u32Address;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the block size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u32Address The block size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16BlkSize is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetBlockSize(en_dma_channel_t enCh, uint16_t u16BlkSize)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(IS_VALID_BLKSIZE(u16BlkSize));
+
+ if((!IS_VALID_CH(enCh)) || (!IS_VALID_BLKSIZE(u16BlkSize)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.BC = u16BlkSize - 1;
+ }
+ else
+ {
+ M0P_DMAC->CONFA1_f.BC = u16BlkSize - 1;
+ }
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the transfer count of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u32Address The transfer count.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16TrnCnt is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetTransferCnt(en_dma_channel_t enCh, uint16_t u16TrnCnt)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(IS_VALID_TRNCNT(u16TrnCnt));
+
+ if((!IS_VALID_CH(enCh)) || (!IS_VALID_TRNCNT(u16TrnCnt)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.TC = u16TrnCnt - 1;
+ }
+ else
+ {
+ M0P_DMAC->CONFA1_f.TC = u16TrnCnt - 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the source repeat size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16Size The source repeat size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16Size is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableSourceRload(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if((!IS_VALID_CH(enCh)))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC ->CONFB0_f.RS = 1;
+ }
+ else
+ {
+ M0P_DMAC ->CONFB1_f.RS = 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the destination repeat size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16Size The destination repeat size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16Size is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableSourceRload(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC ->CONFB0_f.RS = 0;
+ }
+ else{
+ M0P_DMAC ->CONFB1_f.RS = 0;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the source repeat size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16Size The source repeat size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16Size is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableDestinationRload(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if((!IS_VALID_CH(enCh)))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC ->CONFB0_f.RD = 1;
+ }
+ else {
+ M0P_DMAC ->CONFB1_f.RD = 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the destination repeat size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16Size The destination repeat size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16Size is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableDestinationRload(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC ->CONFB0_f.RD = 0;
+ }
+ else{
+ M0P_DMAC ->CONFB1_f.RD = 0;
+ }
+
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Set the source repeat size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16Size The source repeat size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16Size is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableBcTcReload(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if((!IS_VALID_CH(enCh)))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC ->CONFB0_f.RC = 1;
+ }
+ else{
+ M0P_DMAC ->CONFB1_f.RC = 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the destination repeat size of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] u16Size The destination repeat size.
+**
+** \retval Ok Set successfully.
+** \retval ErrorInvalidParameter enCh or u16Size is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableBcTcReload(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC ->CONFB0_f.RC = 0;
+ }
+ else{
+ M0P_DMAC ->CONFB1_f.RC = 0;
+ }
+
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Set the source address mode of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] enMode The specified dma address mode.
+** \arg AddressFix Address fixed.
+** \arg AddressIncrease Address increased.
+** \arg AddressDecrease Address decreased.
+**
+** \retval Ok Set successfully
+** \retval ErrorInvalidParameter enCh or enMode is invalid
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetSourceIncMode(en_dma_channel_t enCh, en_address_mode_t enMode)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(IS_VALID_ADDR_MODE(enMode));
+
+ if((!IS_VALID_CH(enCh)) || (!IS_VALID_ADDR_MODE(enMode)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.FS = enMode;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.FS = enMode;
+ }
+
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Set the destination address mode of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] enMode The specified dma address mode.
+** \arg AddressFix Address fixed.
+** \arg AddressIncrease Address increased.
+** \arg AddressDecrease Address decreased.
+**
+** \retval Ok Set successfully
+** \retval ErrorInvalidParameter enCh or enMode is invalid
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetDestinationIncMode(en_dma_channel_t enCh, en_address_mode_t enMode)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(IS_VALID_ADDR_MODE(enMode));
+
+ if((!IS_VALID_CH(enCh)) || (!IS_VALID_ADDR_MODE(enMode)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.FD = enMode;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.FD = enMode;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Enable source repeat function of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Enable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableContinusTranfer(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.MSK = 1;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.MSK = 1;
+ }
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Disable source repeat function of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableContinusTranfer(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.MSK = 0;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.MSK = 0;
+ }
+
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Halt the all dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+void Dma_HaltTranfer(void)
+{
+ M0P_DMAC->CONF_f.HALT = 0x1;
+}
+/**
+*******************************************************************************
+** \brief Recover all dma channel from HALT.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+void Dma_RecoverTranfer(void)
+{
+ M0P_DMAC->CONF_f.HALT = 0x0;
+}
+/**
+*******************************************************************************
+** \brief Pause the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_PauseChannelTranfer(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if((!IS_VALID_CH(enCh)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.PAS = 1;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.PAS = 1;
+ }
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Recover the specified dma channel from PAUSE.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_RecoverChannelTranfer(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if((!IS_VALID_CH(enCh)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFA0_f.PAS = 0;
+ }
+ else{
+ M0P_DMAC->CONFA1_f.PAS = 0;
+ }
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Set transfer data width of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] enWidth The specified transfer data width.
+** \arg Dma8Bit The 8 bit transfer via DMA.
+** \arg Dma16Bit The 16 bit transfer via DMA.
+** \arg Dma32Bit The 32 bit transfer via DMA.
+**
+** \retval Ok Set successfully
+** \retval ErrorInvalidParameter enCh or enWidth is invalid
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetTransferWidth(en_dma_channel_t enCh, en_dma_transfer_width_t enWidth)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(IS_VALID_TRN_WIDTH(enWidth));
+
+ if((!IS_VALID_CH(enCh)) || (!IS_VALID_TRN_WIDTH(enWidth)))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.WIDTH = enWidth;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.WIDTH = enWidth;
+ }
+
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Set priority of dma channel.
+**
+** \param [in] enCh The specified dma channel.
+** \param [in] enWidth The specified transfer data width.
+** \arg Dma8Bit The 8 bit transfer via DMA.
+** \arg Dma16Bit The 16 bit transfer via DMA.
+** \arg Dma32Bit The 32 bit transfer via DMA.
+**
+** \retval Ok Set successfully
+** \retval ErrorInvalidParameter enCh or enWidth is invalid
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_SetChPriority(en_dma_priority_t enPrio)
+{
+ ASSERT(IS_VALID_PRIO_MODE(enPrio));
+
+ if(!IS_VALID_PRIO_MODE(enPrio))
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_DMAC->CONF_f.PRIO = enPrio;
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Enable interrupt of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Enable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableChannelIrq(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.FIS_IE = 1;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.FIS_IE = 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Disable interrupt of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableChannelIrq(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.FIS_IE = 0;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.FIS_IE = 0;
+ }
+
+ return Ok;
+}
+/**
+*******************************************************************************
+** \brief Enable error interrupt of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Enable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_EnableChannelErrIrq(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.ERR_IE = 1;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.ERR_IE = 1;
+ }
+
+ return Ok;
+}
+
+/**
+*******************************************************************************
+** \brief Disable error interrupt of the specified dma channel.
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval Ok Disable successfully.
+** \retval ErrorInvalidParameter enCh is invalid.
+**
+** \note None
+**
+******************************************************************************/
+en_result_t Dma_DisableChannelErrIrq(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.ERR_IE = 0;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.ERR_IE = 0;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * Dma中断服务程序
+ *
+ * \param [in] u8Param 未使用
+ *
+ * \retval 无
+ */
+
+void Dma_IRQHandler(uint8_t u8Param)
+{
+ if((DmaAddOverflow == M0P_DMAC->CONFB0_f.STAT)||(DmaHALT == M0P_DMAC->CONFB0_f.STAT)||(DmaAccSCRErr == M0P_DMAC->CONFB0_f.STAT) ||(DmaAccDestErr == M0P_DMAC->CONFB0_f.STAT))
+ {
+ if (NULL != stcDmaIrqCalbaks.pfnDma0TranferErrIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma0TranferCompleteIrq();
+ }
+ M0P_DMAC->CONFB0_f.STAT = 0u;
+ }
+ if((DmaAddOverflow == M0P_DMAC->CONFB1_f.STAT)||(DmaHALT == M0P_DMAC->CONFB1_f.STAT)||(DmaAccSCRErr == M0P_DMAC->CONFB1_f.STAT) ||(DmaAccDestErr == M0P_DMAC->CONFB1_f.STAT))
+ {
+ if (NULL != stcDmaIrqCalbaks.pfnDma1TranferErrIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma1TranferCompleteIrq();
+ }
+ M0P_DMAC->CONFB1_f.STAT = 0u;
+ }
+ if(DmaTransferComplete == M0P_DMAC->CONFB0_f.STAT)
+ {
+ if (NULL != stcDmaIrqCalbaks.pfnDma0TranferCompleteIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma0TranferCompleteIrq();
+ }
+ M0P_DMAC->CONFB0_f.STAT = 0u;
+ }
+ if(DmaTransferComplete == M0P_DMAC->CONFB1_f.STAT)
+ {
+ if (NULL != stcDmaIrqCalbaks.pfnDma1TranferCompleteIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma1TranferCompleteIrq();
+ }
+ M0P_DMAC->CONFB1_f.STAT = 0u;
+ }
+
+}
+/**
+ * \brief
+ * 配置ADC中断函数入口
+ *
+ * \param [in] pstcAdcIrqCfg ADC中断配置指针
+ * \param [in] pstcAdcIrqCalbaks ADC中断回调函数指针
+ *
+ * \retval 无
+ */
+en_result_t Dma_ConfigIrq(en_dma_channel_t enCh,stc_dma_irq_sel_t* stcDmaIrqCfg,stc_dma_irq_calbakfn_pt_t* pstcDmaIrqCalbaks)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return ErrorInvalidParameter;
+ }
+ if(DmaCh0 == enCh)
+ {
+ if (TRUE == stcDmaIrqCfg->TrnErrIrq)
+ {
+ if (NULL != pstcDmaIrqCalbaks->pfnDma0TranferCompleteIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma0TranferErrIrq = pstcDmaIrqCalbaks->pfnDma0TranferErrIrq;
+ }
+ }
+ if (TRUE == stcDmaIrqCfg->TrnCpltIrq)
+ {
+ if (NULL != pstcDmaIrqCalbaks->pfnDma0TranferCompleteIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma0TranferCompleteIrq = pstcDmaIrqCalbaks->pfnDma0TranferCompleteIrq;
+ }
+ }
+ }
+ else if(DmaCh1 == enCh)
+ {
+ if (TRUE == stcDmaIrqCfg->TrnErrIrq)
+ {
+ if (NULL != pstcDmaIrqCalbaks->pfnDma1TranferCompleteIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma1TranferErrIrq = pstcDmaIrqCalbaks->pfnDma1TranferErrIrq;
+ }
+ }
+ if (TRUE == stcDmaIrqCfg->TrnCpltIrq)
+ {
+ if (NULL != pstcDmaIrqCalbaks->pfnDma1TranferCompleteIrq)
+ {
+ stcDmaIrqCalbaks.pfnDma1TranferCompleteIrq = pstcDmaIrqCalbaks->pfnDma1TranferCompleteIrq;
+ }
+ }
+ }else
+ {}
+ return Ok;
+}
+/**
+** \brief
+** 获取DMA状态
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval en_dma_stat_t
+**
+**
+** \retval 无
+**/
+en_dma_stat_t Dma_GetStat(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(!IS_VALID_CH(enCh))
+ {
+ return DEFAULT;
+ }
+ if(enCh == DmaCh0)
+ {
+ return (en_dma_stat_t)M0P_DMAC->CONFB0_f.STAT ;
+ }
+ else{
+ return (en_dma_stat_t)M0P_DMAC->CONFB1_f.STAT ;
+ }
+}
+/**
+** \brief
+** 获取DMA状态
+**
+** \param [in] enCh The specified dma channel.
+**
+** \retval en_dma_stat_t
+**
+**
+** \retval 无
+**/
+void Dma_ClrStat(en_dma_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+
+ if(enCh == DmaCh0)
+ {
+ M0P_DMAC->CONFB0_f.STAT = 0x0;
+ }
+ else{
+ M0P_DMAC->CONFB1_f.STAT = 0x0;
+ }
+}
+
+//@} // DmacGroup
+
+/*******************************************************************************
+* EOF (not truncated)
+******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/flash.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/flash.c
new file mode 100644
index 0000000000..33b3f62b8f
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/flash.c
@@ -0,0 +1,688 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file flash.c
+ **
+ ** Common API of flash.
+ ** @link flashGroup Some description @endlink
+ **
+ ** - 2018-05-08
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "flash.h"
+/**
+ *******************************************************************************
+ ** \addtogroup FlashGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+#define FLASH_END_ADDR (0x0000FFFFu)
+#define FLASH_BYPASS() M0P_FLASH->BYPASS_f.BYSEQ = 0x5A5A;\
+ M0P_FLASH->BYPASS_f.BYSEQ = 0xA5A5;
+#define FLASH_IE_TRUE (0x03)
+#define FLASH_IE_FALSE (0x00)
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+/**
+ ******************************************************************************
+ ** \brief FLASH OP
+ **
+ ** Flash 操作控制数据类型重定义
+ ******************************************************************************/
+typedef enum en_flash_op
+{
+ Read = 0u, ///<读配置值
+ Program = 1u, ///<编程配置值
+ SectorErase = 2u, ///<扇区擦除配置值
+ ChipErase = 3u, ///<全片擦除配置值
+} en_flash_op_t;
+
+/**
+ ******************************************************************************
+ ** \brief FLASH LOCK
+ **
+ ** Flash 加解锁数据类型重定义
+ ******************************************************************************/
+typedef enum en_flash_lock
+{
+ LockAll = 0x00000000u, ///<全片加锁
+ UnlockAll = (int)0xFFFFFFFFu, ///<全片解锁
+} en_flash_lock_t;
+
+/**
+ ******************************************************************************
+ ** \brief FLASH 编程时间参数配置
+ **
+ ** FLASH编程时间参数配置数据类型重定义 (4MHz)
+ ******************************************************************************/
+typedef enum en_flash_prgtimer
+{
+ Tnvs = 0x20u,
+ Tpgs = 0x17u,
+ Tprog = 0x1Bu,
+ Tserase = 0x4650u,
+ Tmerase = 0x222E0u,
+ Tprcv = 0x18u,
+ Tsrcv = 0xF0u,
+ Tmrcv = 0x3E8u,
+} en_flash_prgtimer_t;
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+static func_ptr_t pfnFlashCallback = NULL;
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief Flash中断服务函数
+ **
+ **
+ ** \param [in] u8Param == 0
+ **
+ *****************************************************************************/
+void EfRam_IRQHandler(uint8_t u8Param)
+{
+ if(NULL != pfnFlashCallback)
+ {
+ pfnFlashCallback();
+ }
+}
+
+/**
+ *****************************************************************************
+ ** \brief Flash中断标志获取
+ **
+ **
+ ** \param [in] enFlashIntType Flash中断类型
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Flash_GetIntFlag(en_flash_int_type_t enFlashIntType)
+{
+ boolean_t bRetVal = FALSE;
+
+ switch (enFlashIntType)
+ {
+ case FlashPCInt:
+ bRetVal = M0P_FLASH->IFR_f.IF0 ? TRUE : FALSE;
+ break;
+ case FlashSlockInt:
+ bRetVal = M0P_FLASH->IFR_f.IF1 ? TRUE : FALSE;
+ break;
+ default:
+ bRetVal = FALSE;
+ break;
+ }
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Flash中断标志清除
+ **
+ **
+ ** \param [in] enFlashIntType Flash中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Flash_ClearIntFlag(en_flash_int_type_t enFlashIntType)
+{
+ en_result_t enResult = Error;
+
+ switch (enFlashIntType)
+ {
+ case FlashPCInt:
+ FLASH_BYPASS();
+ M0P_FLASH->ICLR_f.ICLR0 = FALSE;
+ enResult = Ok;
+ break;
+ case FlashSlockInt:
+ FLASH_BYPASS();
+ M0P_FLASH->ICLR_f.ICLR1 = FALSE;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Flash中断使能
+ **
+ **
+ ** \param [in] enFlashIntType Flash中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Flash_EnableIrq (en_flash_int_type_t enFlashIntType)
+{
+ en_result_t enResult = Error;
+
+ switch (enFlashIntType)
+ {
+ case FlashPCInt:
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.IE |= 0x01;
+ enResult = Ok;
+ break;
+ case FlashSlockInt:
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.IE |= 0x02;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Flash中断禁止
+ **
+ **
+ ** \param [in] enFlashIntType Flash中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Flash_DisableIrq(en_flash_int_type_t enFlashIntType)
+{
+ en_result_t enResult = Error;
+
+ switch (enFlashIntType)
+ {
+ case FlashSlockInt:
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.IE &= ~0x02u;
+ enResult = Ok;
+ break;
+ case FlashPCInt:
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.IE &= ~0x01u;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 初始化函数——中断服务程序、编程时间配置及低功耗模式
+ **
+ ** 该函数用于配置中断服务函数、低功耗模式、根据系统时钟配置FLASH编程时间相关寄存器.
+ **
+ ** \param [in] pfnFlashCb Flash中断服务回调函数[void function(void)]
+ ** \param [in] u8FreqCfg FLASH编程时钟频率配置(根据HCLK的频率选择配置值):
+ ** 1 - (0,4]MHz;
+ ** 2 - (4,8]MHz;
+ ** 4 - (8,16]MHz;
+ ** 6 - (16,24]MHz;
+ ** 8 - (24,32]MHz(该配置会设置插入1个FLASH等待周期);
+ ** 12 - (32,48]MHz(该配置会设置插入1个FLASH等待周期);
+ ** other - 无效值
+ ** \param [in] bDpstbEn TRUE - 当系统进入DeepSleep模式,FLASH进入低功耗模式;
+ ** FALSE - 当系统进入DeepSleep模式,FLASH不进入低功耗模式;
+ **
+ ** \retval Ok 操作成功.
+ ** \retval ErrorInvalidParameter 参数无效.
+ **
+ *****************************************************************************/
+en_result_t Flash_Init(func_ptr_t pfnFlashCb, uint8_t u8FreqCfg, boolean_t bDpstbEn)
+{
+ en_result_t enResult = Ok;
+
+ if ((1 != u8FreqCfg) &&
+ (2 != u8FreqCfg) &&
+ (4 != u8FreqCfg) &&
+ (6 != u8FreqCfg) &&
+ (8 != u8FreqCfg) &&
+ (12 != u8FreqCfg))
+ {
+ enResult = ErrorInvalidParameter;
+ return (enResult);
+ }
+
+ //当系统进入DeepSleep模式时,FLASH模式配置
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.DPSTB_EN = bDpstbEn;
+
+ //flash时间参数寄存器配置
+ FLASH_BYPASS();
+ M0P_FLASH->TNVS_f.TNVS = Tnvs * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TPGS_f.TPGS = Tpgs * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TPROG_f.TPROG = Tprog * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TSERASE_f.TSERASE = Tserase * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TMERASE_f.TMERASE = Tmerase * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TPRCV_f.TPRCV = Tprcv * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TSRCV_f.TSRCV = Tsrcv * u8FreqCfg;
+ FLASH_BYPASS();
+ M0P_FLASH->TMRCV_f.TMRCV = Tmrcv * u8FreqCfg;
+
+ //开启读FLASH等待周期
+ if (8 == u8FreqCfg)
+ {
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.WAIT = 0x01;
+ }
+ else if(12 == u8FreqCfg)
+ {
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.WAIT = 0x01;
+ }
+ else
+ {
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.WAIT = 0x00;
+ }
+
+ pfnFlashCallback = pfnFlashCb;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 字节写
+ **
+ ** 用于向FLASH写入1字节数据.
+ **
+ ** \param [in] u32Addr Flash地址
+ ** \param [in] u8Data 1字节数据
+ **
+ ** \retval Ok 写入成功.
+ ** \retval ErrorInvalidParameter FLASH地址无效
+ *****************************************************************************/
+en_result_t Flash_WriteByte(uint32_t u32Addr, uint8_t u8Data)
+{
+ en_result_t enResult = Ok;
+
+ if (FLASH_END_ADDR < u32Addr)
+ {
+ enResult = ErrorInvalidParameter;
+ return (enResult);
+ }
+
+ //unlock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)UnlockAll;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //set OP
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.OP = Program;
+
+ //write data
+ *((volatile uint8_t*)u32Addr) = u8Data;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //lock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)LockAll;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 半字写
+ **
+ ** 用于向FLASH写入半字(2字节)数据.
+ **
+ ** \param [in] u32Addr Flash地址
+ ** \param [in] u16Data 半字(2字节)数据
+ **
+ ** \retval Ok 写入成功.
+ ** \retval ErrorInvalidParameter FLASH地址无效
+ *****************************************************************************/
+en_result_t Flash_WriteHalfWord(uint32_t u32Addr, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ if ((FLASH_END_ADDR < u32Addr) || (u32Addr % 2))
+ {
+ enResult = ErrorInvalidParameter;
+ return (enResult);
+ }
+
+ //unlock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)UnlockAll;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //set OP
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.OP = Program;
+
+ //write data
+ *((volatile uint16_t*)u32Addr) = u16Data;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //lock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)LockAll;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 字写
+ **
+ ** 用于向FLASH写入1个字的数据.
+ **
+ ** \param [in] u32Addr Flash地址
+ ** \param [in] u32Data 1个字数据
+ **
+ ** \retval Ok 写入成功.
+ ** \retval ErrorInvalidParameter FLASH地址无效
+ *****************************************************************************/
+en_result_t Flash_WriteWord(uint32_t u32Addr, uint32_t u32Data)
+{
+ en_result_t enResult = Ok;
+
+ if ((FLASH_END_ADDR < u32Addr) || (u32Addr % 4))
+ {
+ enResult = ErrorInvalidParameter;
+ return (enResult);
+ }
+
+ //unlock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)UnlockAll;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //set OP
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.OP = Program;
+
+ //write data
+ *((volatile uint32_t*)u32Addr) = u32Data;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //lock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = LockAll;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 扇区擦除
+ **
+ ** FLASH 扇区擦除.
+ **
+ ** \param [in] u32SectorAddr 所擦除扇区内的地址
+ **
+ ** \retval Ok 擦除成功.
+ ** \retval ErrorInvalidParameter FLASH地址无效
+ *****************************************************************************/
+en_result_t Flash_SectorErase(uint32_t u32SectorAddr)
+{
+
+ en_result_t enResult = Ok;
+
+ if (FLASH_END_ADDR < u32SectorAddr)
+ {
+ enResult = ErrorInvalidParameter;
+ return (enResult);
+ }
+
+ //unlock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)UnlockAll;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //set OP
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.OP = SectorErase;
+
+ //write data
+ *((volatile uint8_t*)u32SectorAddr) = 0;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //lock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = LockAll;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 全片擦除
+ **
+ ** FLASH 全片擦除.
+ **
+ **
+ ** \retval Ok 擦除成功.
+ **
+ *****************************************************************************/
+en_result_t Flash_ChipErase(void)
+{
+
+ en_result_t enResult = Ok;
+
+ //unlock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = (uint32_t)UnlockAll;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //set OP
+ FLASH_BYPASS();
+ M0P_FLASH->CR_f.OP = ChipErase;
+
+ //write data
+ *((volatile uint8_t*)0) = 0;
+
+ //busy?
+ while (TRUE == M0P_FLASH->CR_f.BUSY)
+ {
+ ;
+ }
+
+ //lock flash
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK = LockAll;
+
+ return (enResult);
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 编程保护加锁
+ **
+ ** \param [in] enFlashSector 加锁范围选择枚举
+ **
+ ** \retval Ok 加锁成功
+ ** \retval ErrorInvalidParameter 参数错误
+ *****************************************************************************/
+en_result_t Flash_Lock(en_flash_sector_lock_t enFlashSector)
+{
+ en_result_t enResult = Ok;
+
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK |= (uint32_t)enFlashSector;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 编程保护解锁
+ **
+ ** \param [in] enFlashSector 解锁范围选择枚举
+ **
+ ** \retval Ok 解锁成功
+ ** \retval ErrorInvalidParameter 参数错误
+ *****************************************************************************/
+en_result_t Flash_Unlock(en_flash_sector_lock_t enFlashSector)
+{
+ en_result_t enResult = Ok;
+
+ FLASH_BYPASS();
+ M0P_FLASH->SLOCK_f.SLOCK &= ~(uint32_t)enFlashSector;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief FLASH 读等待周期设置
+ **
+ ** \param [in] enWaitCycle 插入FLASH读等待周期数枚举类型
+ **
+ ** \retval Ok 解锁成功
+ ** \retval ErrorInvalidParameter 参数错误
+ *****************************************************************************/
+en_result_t Flash_WaitCycle(en_flash_waitcycle_t enWaitCycle)
+{
+ en_result_t enResult = Ok;
+
+ //插入FLASH读等待周期
+ M0P_SYSCTRL->PERI_CLKEN_f.FLASH = 1;
+ M0P_FLASH->BYPASS_f.BYSEQ = 0x5A5A;
+ M0P_FLASH->BYPASS_f.BYSEQ = 0xA5A5;
+ if (0 == enWaitCycle)
+ {
+ M0P_FLASH->CR_f.WAIT = 0;
+ }
+ else if(1 == enWaitCycle)
+ {
+ M0P_FLASH->CR_f.WAIT = 1;
+ }
+ else
+ {
+ M0P_FLASH->CR_f.WAIT = 2;
+ }
+
+ return enResult;
+}
+
+
+//@} // FlashGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/gpio.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/gpio.c
new file mode 100644
index 0000000000..9e8c3690f9
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/gpio.c
@@ -0,0 +1,613 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file Gpio.c
+ **
+ ** GPIO driver API.
+ ** @link Driver Group Some description @endlink
+ **
+ ** - 2018-04-22 1.0 Lux First version
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "gpio.h"
+
+/**
+ *******************************************************************************
+ ** \addtogroup GpioGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+#define IS_VALID_PIN(port,pin) ( )
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern') *
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 初始化
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ ** \param [in] pstcGpioCfg IO 配置结构体指针
+ **
+ ** \retval Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_Init(en_gpio_port_t enPort, en_gpio_pin_t enPin, stc_gpio_config_t *pstcGpioCfg)
+{
+ //配置为默认值,GPIO功能
+ *((uint32_t*)(((uint32_t)(&(M0P_GPIO->PA00_SEL)) + enPort) + (((uint32_t)enPin)<<2))) = GpioAf0;
+
+ //方向配置
+ if(GpioDirIn == pstcGpioCfg->enDir)
+ {
+ setBit(((uint32_t)&M0P_GPIO->PADIR + enPort), enPin, TRUE);
+ }
+ else
+ {
+ setBit(((uint32_t)&M0P_GPIO->PADIR + enPort), enPin, FALSE);
+ }
+
+ //驱动能力配置
+ if(GpioDrvH == pstcGpioCfg->enDrv)
+ {
+ setBit(((uint32_t)&M0P_GPIO->PADR + enPort), enPin, FALSE);
+ }
+ else
+ {
+ setBit(((uint32_t)&M0P_GPIO->PADR + enPort), enPin, TRUE);
+ }
+
+ //上拉下拉配置
+ if(GpioPu == pstcGpioCfg->enPuPd)
+ {
+ setBit(((uint32_t)&M0P_GPIO->PAPU + enPort), enPin, TRUE);
+ setBit(((uint32_t)&M0P_GPIO->PAPD + enPort), enPin, FALSE);
+ }
+ else if(GpioPd == pstcGpioCfg->enPuPd)
+ {
+ setBit(((uint32_t)&M0P_GPIO->PAPU + enPort), enPin, FALSE);
+ setBit(((uint32_t)&M0P_GPIO->PAPD + enPort), enPin, TRUE);
+ }
+ else
+ {
+ setBit(((uint32_t)&M0P_GPIO->PAPU + enPort), enPin, FALSE);
+ setBit(((uint32_t)&M0P_GPIO->PAPD + enPort), enPin, FALSE);
+ }
+
+ //开漏输出功能
+ if(GpioOdDisable == pstcGpioCfg->enOD)
+ {
+ setBit(((uint32_t)&M0P_GPIO->PAOD + enPort), enPin, FALSE);
+ }
+ else
+ {
+ setBit(((uint32_t)&M0P_GPIO->PAOD + enPort), enPin, TRUE);
+ }
+
+ M0P_GPIO->CTRL2_f.AHB_SEL = pstcGpioCfg->enCtrlMode;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO输入值获取
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ **
+ ** \retval boolean_t IO电平高低
+ ******************************************************************************/
+boolean_t Gpio_GetInputIO(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ return getBit(((uint32_t)&M0P_GPIO->PAIN + enPort), enPin);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO Port输入数据获取
+ **
+ ** \param [in] enPort IO Port
+ **
+ ** \retval boolean_t IO Port数据
+ ******************************************************************************/
+uint16_t Gpio_GetInputData(en_gpio_port_t enPort)
+{
+ return (uint16_t)(*((uint32_t *)((uint32_t)&M0P_GPIO->PAIN + enPort)));
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO输出值写入
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ ** \param [out] bVal 输出值
+ **
+ ** \retval en_result_t Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_WriteOutputIO(en_gpio_port_t enPort, en_gpio_pin_t enPin, boolean_t bVal)
+{
+ setBit(((uint32_t)&M0P_GPIO->PAOUT + enPort), enPin, bVal);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO输出值获取
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ **
+ ** \retval boolean_t IO电平高低
+ ******************************************************************************/
+boolean_t Gpio_ReadOutputIO(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ return getBit(((uint32_t)&M0P_GPIO->PAOUT + enPort), enPin);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO Port设置,可同时设置一组Port中的多个PIN
+ **
+ ** \param [in] enPort IO Port
+ ** \param [in] u16ValMsk 该Port的16个PIN掩码值,将需要设置的PIN对应的bit写1有效
+ **
+ ** \retval boolean_t IO Port数据
+ ******************************************************************************/
+en_result_t Gpio_SetPort(en_gpio_port_t enPort, uint16_t u16ValMsk)
+{
+ *((uint16_t*)(((uint32_t)&(M0P_GPIO->PABSET)) + enPort)) = u16ValMsk;
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO设置
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ **
+ ** \retval en_result_t Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_SetIO(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ setBit(((uint32_t)&M0P_GPIO->PABSET + enPort), enPin, TRUE);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO Port清零,可同时清零一组Port中的多个PIN
+ **
+ ** \param [in] enPort IO Port
+ ** \param [in] u16ValMsk 该Port的16个PIN掩码值,将需要清零的PIN对应的bit写1有效
+ **
+ ** \retval boolean_t IO Port数据
+ ******************************************************************************/
+en_result_t Gpio_ClrPort(en_gpio_port_t enPort, uint16_t u16ValMsk)
+{
+ *((uint16_t*)(((uint32_t)&(M0P_GPIO->PABCLR)) + enPort)) = u16ValMsk;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO清零
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ **
+ ** \retval en_result_t Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_ClrIO(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ setBit(((uint32_t)&M0P_GPIO->PABCLR + enPort), enPin, TRUE);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO Port置位/清零,可同时置位/清零一组Port中的多个PIN
+ **
+ ** \param [in] enPort IO Port
+** \param [in] u32ValMsk 高16bits表示该Port的16个PIN置位掩码值,
+ ** 低16bits表示该Port的16个PIN清零掩码值,
+** 将需要设置的PIN对应的bit写1,同一个PIN的掩码同时为1,则该PIN清零。
+ **
+ ** \retval en_result_t Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_SetClrPort(en_gpio_port_t enPort, uint32_t u32ValMsk)
+{
+ *((uint32_t*)(((uint32_t)&(M0P_GPIO->PABSETCLR)) + enPort)) = u32ValMsk;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO配置为模拟功能模式
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ **
+ ** \retval Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_SetAnalogMode(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ setBit((uint32_t)&M0P_GPIO->PAADS + enPort, enPin, TRUE);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+** \brief GPIO IO复用功能设置
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ ** \param [in] enAf 复用功能枚举类型选择
+ ** \retval Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+en_result_t Gpio_SetAfMode(en_gpio_port_t enPort, en_gpio_pin_t enPin, en_gpio_af_t enAf)
+{
+ *((uint32_t*)(((uint32_t)(&(M0P_GPIO->PA00_SEL)) + enPort) + (((uint32_t)enPin)<<2))) = enAf;
+
+ return Ok;
+}
+
+
+static en_result_t _GpioEnableIrq(en_gpio_port_t enPort,
+ en_gpio_pin_t enPin,
+ en_gpio_irqtype_t enType,
+ boolean_t bEnable)
+{
+ //high level
+ if (enType & GpioIrqHigh)
+ {
+ setBit((uint32_t)&M0P_GPIO->PAHIE + enPort, enPin, bEnable);
+ }
+ //low level
+ if (enType & GpioIrqLow)
+ {
+ setBit((uint32_t)&M0P_GPIO->PALIE + enPort, enPin, bEnable);
+ }
+ //rising
+ if (enType & GpioIrqRising)
+ {
+ setBit((uint32_t)&M0P_GPIO->PARIE + enPort, enPin, bEnable);
+ }
+ //falling
+ if (enType & GpioIrqFalling)
+ {
+ setBit((uint32_t)&M0P_GPIO->PAFIE + enPort, enPin, bEnable);
+ }
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO中断使能
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ ** \param [in] enType 中断使能类型
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_EnableIrq(en_gpio_port_t enPort, en_gpio_pin_t enPin, en_gpio_irqtype_t enType)
+{
+ _GpioEnableIrq(enPort, enPin, enType, TRUE);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO IO中断关闭
+ **
+ ** \param [in] enPort IO Port口
+ ** \param [in] enPin IO Pin脚
+ ** \param [in] enType 中断使能类型
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_DisableIrq(en_gpio_port_t enPort, en_gpio_pin_t enPin, en_gpio_irqtype_t enType)
+{
+ _GpioEnableIrq(enPort, enPin, enType, FALSE);
+
+ return Ok;
+}
+
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 获得IO中断状态
+ **
+ ** \param [in] u8Port IO Port口
+ ** \param [in] u8Pin IO Pin脚
+ **
+ ** \retval IO中断状态开关
+ ******************************************************************************/
+boolean_t Gpio_GetIrqStatus(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ return getBit((uint32_t)&M0P_GPIO->PA_STAT + enPort, enPin);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 清除IO中断状态
+ **
+ ** \param [in] u8Port IO Port口
+ ** \param [in] u8Pin IO Pin脚
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_ClearIrq(en_gpio_port_t enPort, en_gpio_pin_t enPin)
+{
+ setBit((uint32_t)&M0P_GPIO->PA_ICLR + enPort, enPin, FALSE);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——中断模式配置
+ **
+ ** \param [in] enIrqMode 端口中断模式(深度休眠是否响应中断)
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfIrqModeConfig(en_gpio_sf_irqmode_t enIrqMode)
+{
+ M0P_GPIO->CTRL0_f.IESEL = enIrqMode;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——IR输出极性配置
+ **
+ ** \param [in] enIrPolMode IR输出极性配置枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfIrPolConfig(en_gpio_sf_irpol_t enIrPolMode)
+{
+ M0P_GPIO->CTRL1_f.IR_POL = enIrPolMode;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——HCLK输出配置
+ **
+ ** \param [in] enGate HCLK输出使能
+ ** \param [in] enDiv 输出分频枚举值
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfHClkOutputConfig(en_gpio_sf_hclkout_g_t enGate, en_gpio_sf_hclkout_div_t enDiv)
+{
+ M0P_GPIO->CTRL1_f.HCLK_EN = enGate;
+ M0P_GPIO->CTRL1_f.HCLK_SEL = enDiv;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——PCLK输出配置
+ **
+ ** \param [in] enGate PCLK输出使能
+ ** \param [in] enDiv 输出分频枚举值
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfPClkOutputConfig(en_gpio_sf_pclkout_g_t enGate, en_gpio_sf_pclkout_div_t enDiv)
+{
+ M0P_GPIO->CTRL1_f.PCLK_EN = enGate;
+ M0P_GPIO->CTRL1_f.PCLK_SEL = enDiv;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——外部时钟输入来源配置
+ **
+ ** \param [in] enExtClk 外部时钟信号来源选择枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfExtClkConfig(en_gpio_sf_ssn_extclk_t enExtClk)
+{
+ M0P_GPIO->CTRL1_f.EXT_CLK_SEL = enExtClk;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——SSN 通道信号来源配置
+ **
+ ** \param [in] enSpi SSN SPI通道选择枚举
+ ** \param [in] enSsn SSN 信号来源选择枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfSsnConfig(en_gpio_sf_ssnspi_t enSpi, en_gpio_sf_ssn_extclk_t enSsn)
+{
+ //SPI0
+ if(enSpi == GpioSpi0)
+ {
+ M0P_GPIO->CTRL1_f.SSN0_SEL = enSsn;
+ }
+ //SPI1
+ if(enSpi == GpioSpi1)
+ {
+ M0P_GPIO->CTRL2_f.SSN1_SEL = enSsn;
+ }
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——Timer 门控输入配置
+ **
+ ** \param [in] enTimG Timer类型选择枚举
+ ** \param [in] enSf Timer互联功能选择枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfTimGConfig(en_gpio_sf_tim_g_t enTimG, en_gpio_sf_t enSf)
+{
+ M0P_GPIO->TIMGS &= (uint32_t)(~(0x07U<<enTimG));
+ M0P_GPIO->TIMGS |= (uint32_t)(enSf<<enTimG);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——Timer ETR选择配置
+ **
+ ** \param [in] enTimE Timer类型选择枚举
+ ** \param [in] enSf Timer互联功能选择枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfTimEConfig(en_gpio_sf_tim_e_t enTimE, en_gpio_sf_t enSf)
+{
+ M0P_GPIO->TIMES &= (uint32_t)(~(0x07U<<enTimE));
+ M0P_GPIO->TIMES |= (uint32_t)(enSf<<enTimE);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——Timer 捕获输入选择配置
+ **
+ ** \param [in] enTimC Timer类型选择枚举
+ ** \param [in] enSf Timer互联功能选择枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfTimCConfig(en_gpio_sf_tim_c_t enTimC, en_gpio_sf_t enSf)
+{
+ M0P_GPIO->TIMCPS &= (uint32_t)(~(0x07u<<enTimC));
+ M0P_GPIO->TIMCPS |= (uint32_t)(enSf<<enTimC);
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO 端口辅助功能配置——PCA 捕获输入选择配置
+ **
+ ** \param [in] enPca PCA类型选择枚举
+ ** \param [in] enSf PCA互联功能选择枚举
+ **
+ ** \retval Ok 设置成功
+ ******************************************************************************/
+en_result_t Gpio_SfPcaConfig(en_gpio_sf_pca_t enPca, en_gpio_sf_t enSf)
+{
+ if(GpioSfPcaCH0 == enPca)
+ {
+ M0P_GPIO->PCAS_f.PCA_CH0 = enSf;
+ }
+
+ if(GpioSfPcaECI == enPca)
+ {
+ M0P_GPIO->PCAS_f.PCA_ECI = enSf;
+ }
+
+ return Ok;
+}
+
+
+//@} // GpioGroup
+
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/hdiv.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/hdiv.c
new file mode 100644
index 0000000000..825058189d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/hdiv.c
@@ -0,0 +1,176 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file crc.c
+**
+** Common API of crc.
+** @link crcGroup Some description @endlink
+**
+** - 2017-05-16
+**
+******************************************************************************/
+
+/*******************************************************************************
+* Include files
+******************************************************************************/
+#include "ddl.h"
+#include "hdiv.h"
+/**
+*******************************************************************************
+** \addtogroup CrcGroup
+******************************************************************************/
+//@{
+
+/*******************************************************************************
+* Local pre-processor symbols/macros ('#define')
+******************************************************************************/
+
+/*******************************************************************************
+* Global variable definitions (declared in header file with 'extern')
+******************************************************************************/
+
+/*******************************************************************************
+* Local type definitions ('typedef')
+******************************************************************************/
+
+/*******************************************************************************
+* Local variable definitions ('static')
+******************************************************************************/
+
+/*******************************************************************************
+* Local function prototypes ('static')
+******************************************************************************/
+
+
+/*******************************************************************************
+* Function implementation - global ('extern') and local ('static')
+******************************************************************************/
+/**
+* \brief
+* HDIV 有符号除法
+*
+* \param [in] Dividend 被除数
+* \param [in] Dividsor 除数
+* \param [out] stcDivResult 商和余数
+*
+* \retval en_result_t Ok: 配置成功
+* \retval en_result_t ErrorInvalidParameter: 无效参数
+*/
+en_result_t Hdiv_Unsigned(uint32_t Dividend,uint16_t Divisor,stc_div_unsigned_result_t* stcDivResult)
+{
+ M0P_HDIV->SIGN_f.SIGN = 0;
+ if(NULL == stcDivResult)
+ {
+ return ErrorInvalidParameter;
+ }
+ (M0P_HDIV ->DIVIDEND) = Dividend;
+ (M0P_HDIV ->DIVISOR) = Divisor;
+
+ if(Hdiv_GetZeroState() == TRUE)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ while(Hdiv_GetEndState() != TRUE)
+ {
+ ;
+ }
+
+ stcDivResult->Quotient = M0P_HDIV->QUOTIENT_f.QUOTIENT;
+ stcDivResult->Remainder = M0P_HDIV ->REMAINDER_f.REMAINDER;
+ return Ok;
+}
+
+
+/**
+* \brief
+* HDIV 无符号除法
+*
+* \param [in] Dividend 被除数
+* \param [in] Dividsor 除数
+* \param [out] stcDivResult 商和余数
+*
+* \retval en_result_t Ok: 配置成功
+* \retval en_result_t ErrorInvalidParameter: 无效参数
+*/
+en_result_t Hdiv_Signed(int32_t Dividend,int16_t Divisor,stc_div_signed_result_t* stcDivResult)
+{
+
+ __IO uint32_t * pDivdend = &(M0P_HDIV ->DIVIDEND);
+ __IO uint32_t * pDivsor = &(M0P_HDIV ->DIVISOR);
+ if(NULL == stcDivResult)
+ {
+ return ErrorInvalidParameter;
+ }
+ M0P_HDIV->SIGN_f.SIGN = 1;
+ *(__IO int32_t *)pDivdend = Dividend;
+ *(__IO int16_t *)pDivsor = Divisor;
+
+ if(Hdiv_GetZeroState() == TRUE)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ while(Hdiv_GetEndState() != TRUE)
+ {
+ ;
+ }
+
+ stcDivResult->Quotient = M0P_HDIV->QUOTIENT_f.QUOTIENT;
+ stcDivResult->Remainder = M0P_HDIV ->REMAINDER_f.REMAINDER;
+ return Ok;
+}
+
+boolean_t Hdiv_GetEndState(void)
+{
+ return M0P_HDIV->STAT_f.END;
+}
+
+boolean_t Hdiv_GetZeroState(void)
+{
+ return M0P_HDIV->STAT_f.ZERO;
+}
+//@} // CrcGroup
+
+/*******************************************************************************
+* EOF (not truncated)
+******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/i2c.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/i2c.c
new file mode 100644
index 0000000000..85a13463b6
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/i2c.c
@@ -0,0 +1,666 @@
+/*************************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file I2C.c
+ **
+ ** WDT function driver API.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-03-13 1.0 CJ First version for Device Driver Library of Module.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "i2c.h"
+
+/**
+ *******************************************************************************
+ ** \addtogroup I2cGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+static func_ptr_t pfnI2c0tCallback = NULL;
+static func_ptr_t pfnI2c1tCallback = NULL;
+/**
+ ******************************************************************************
+ ** \brief I2C设置波特率配置寄存器
+ **
+ ** \param [in] u8Tm 波特率配置值
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t I2C_SetBaud(en_i2c_channel_t enCh,uint8_t u8Tm)
+ {
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ M0P_I2C0->TM = u8Tm;
+ }
+ else
+ {
+ M0P_I2C1->TM = u8Tm;
+ }
+
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief I2C功能设置相关函数
+ **
+ ** \param [in] enFunc功能参数
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t I2C_SetFunc(en_i2c_channel_t enCh,en_i2c_func_t enFunc)
+{
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ switch(enFunc)
+ {
+ case I2cMode_En:
+ M0P_I2C0->CR_f.ENS = 1;
+ break;
+ case I2cStart_En:
+ M0P_I2C0->CR_f.STA = 1;
+ break;
+ case I2cStop_En:
+ M0P_I2C0->CR_f.STO = 1;
+ break;
+ case I2cAck_En:
+ M0P_I2C0->CR_f.AA = 1;
+ break;
+ case I2cHlm_En:
+ M0P_I2C0->CR_f.H1M = 1;
+ break;
+ case I2cBaud_En:
+ M0P_I2C0->TMRUN = 0x01;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ }
+ else
+ {
+ switch(enFunc)
+ {
+ case I2cMode_En:
+ M0P_I2C1->CR_f.ENS = 1;
+ break;
+ case I2cStart_En:
+ M0P_I2C1->CR_f.STA = 1;
+ break;
+ case I2cStop_En:
+ M0P_I2C1->CR_f.STO = 1;
+ break;
+ case I2cAck_En:
+ M0P_I2C1->CR_f.AA = 1;
+ break;
+ case I2cHlm_En:
+ M0P_I2C1->CR_f.H1M = 1;
+ break;
+ case I2cBaud_En:
+ M0P_I2C1->TMRUN = 0x01;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ }
+
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief I2C功能清除相关函数
+ **
+ ** \param [in] enFunc功能参数
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t I2C_ClearFunc(en_i2c_channel_t enCh,en_i2c_func_t enFunc)
+ {
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ switch(enFunc)
+ {
+ case I2cMode_En:
+ M0P_I2C0->CR_f.ENS = 0;
+ break;
+ case I2cStart_En:
+ M0P_I2C0->CR_f.STA = 0;
+ break;
+ case I2cStop_En:
+ M0P_I2C0->CR_f.STO = 0;
+ break;
+ case I2cAck_En:
+ M0P_I2C0->CR_f.AA = 0;
+ break;
+ case I2cHlm_En:
+ M0P_I2C0->CR_f.H1M = 0;
+ break;
+ case I2cBaud_En:
+ M0P_I2C0->TMRUN = 0x00;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ }
+ else
+ {
+ switch(enFunc)
+ {
+ case I2cMode_En:
+ M0P_I2C1->CR_f.ENS = 0;
+ break;
+ case I2cStart_En:
+ M0P_I2C1->CR_f.STA = 0;
+ break;
+ case I2cStop_En:
+ M0P_I2C1->CR_f.STO = 0;
+ break;
+ case I2cAck_En:
+ M0P_I2C1->CR_f.AA = 0;
+ break;
+ case I2cHlm_En:
+ M0P_I2C1->CR_f.H1M = 0;
+ break;
+ case I2cBaud_En:
+ M0P_I2C1->TMRUN = 0x00;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ }
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief I2C获取中断标记函数
+ **
+ ** \param 无
+ **
+ ** \retval bIrq中断标记
+ **
+ ******************************************************************************/
+boolean_t I2C_GetIrq(en_i2c_channel_t enCh)
+{
+ boolean_t bIrq = FALSE;
+ if(I2C0 == enCh)
+ {
+ bIrq = M0P_I2C0->CR_f.SI;
+ }
+ else
+ {
+ bIrq = M0P_I2C1->CR_f.SI;
+ }
+
+ return bIrq;
+}
+/**
+ ******************************************************************************
+ ** \brief I2C清除中断标记函数
+ **
+ ** \param 无
+ **
+ ** \retval bIrq中断标记
+ **
+ ******************************************************************************/
+en_result_t I2C_ClearIrq(en_i2c_channel_t enCh)
+{
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ M0P_I2C0->CR_f.SI = 0;
+ }
+ else
+ {
+ M0P_I2C1->CR_f.SI = 0;
+ }
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief I2C获取相关状态
+ **
+ ** \param 无
+ **
+ ** \retval I2C状态
+ **
+ ******************************************************************************/
+uint8_t I2C_GetState(en_i2c_channel_t enCh)
+{
+ uint8_t u8State = 0;
+ if(I2C0 == enCh)
+ {
+ u8State = M0P_I2C0->STAT;
+ }
+ else
+ {
+ u8State = M0P_I2C1->STAT;
+ }
+ return u8State;
+}
+/**
+ ******************************************************************************
+ ** \brief I2C写从机地址函数
+ **
+ ** \param u8SlaveAddr从机地址
+ **
+ ** \retval I2C写成功与否状态
+ **
+ ******************************************************************************/
+ en_result_t I2C_WriteSlaveAddr(en_i2c_channel_t enCh,stc_i2c_addr_t *pstcSlaveAddr)
+{
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ M0P_I2C0->ADDR_f.ADR = pstcSlaveAddr->Addr;
+ M0P_I2C0->ADDR_f.GC = pstcSlaveAddr->Gc;
+ }
+ else
+ {
+ M0P_I2C1->ADDR_f.ADR = pstcSlaveAddr->Addr;
+ M0P_I2C1->ADDR_f.GC = pstcSlaveAddr->Gc;
+ }
+
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief 字节写从机函数
+ **
+ ** \param u8Data写数据
+ **
+ ** \retval 写数据是否成功
+ **
+ ******************************************************************************/
+en_result_t I2C_WriteByte(en_i2c_channel_t enCh,uint8_t u8Data)
+{
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ M0P_I2C0->DATA = u8Data;
+ }
+ else
+ {
+ M0P_I2C1->DATA = u8Data;
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief 字节读从机函数
+ **
+ ** \param 无
+ **
+ ** \retval 读取数据
+ **
+ ******************************************************************************/
+uint8_t I2C_ReadByte(en_i2c_channel_t enCh)
+{
+ uint8_t u8Data = 0;
+ if(I2C0 == enCh)
+ {
+ u8Data = M0P_I2C0->DATA;
+ }
+ else
+ {
+ u8Data = M0P_I2C1->DATA;
+ }
+ return u8Data;
+}
+ /**
+ ******************************************************************************
+ ** \brief 主机发送函数
+ **
+ ** \param u8Addr从机内存地址,pu8Data写数据,u32Len写数据长度
+ **
+ ** \retval 写数据是否成功
+ **
+ ******************************************************************************/
+en_result_t I2C_MasterWriteData(en_i2c_channel_t enCh,uint8_t u8DevAddr,uint8_t u8Addr,uint8_t *pu8Data,uint32_t u32Len)
+{
+ en_result_t enRet = Error;
+ uint8_t u8i=0,u8State;
+
+ I2C_SetFunc(enCh,I2cStart_En);
+ while(1)
+ {
+ while(0 == I2C_GetIrq(enCh))
+ {}
+ u8State = I2C_GetState(enCh);
+ switch(u8State)
+ {
+ case 0x08:
+ I2C_ClearFunc(enCh,I2cStart_En);
+ I2C_WriteByte(enCh,u8DevAddr);//从设备地址发送
+ break;
+ case 0x18:
+ I2C_WriteByte(enCh,u8Addr);//从设备内存地址发送
+ break;
+ case 0x28:
+ I2C_WriteByte(enCh,pu8Data[u8i++]);
+ break;
+ case 0x20:
+ case 0x38:
+ I2C_SetFunc(enCh,I2cStart_En);
+ break;
+ case 0x30:
+ I2C_SetFunc(enCh,I2cStop_En);
+ break;
+ default:
+ break;
+ }
+ if(u8i>u32Len)
+ {
+ I2C_SetFunc(enCh,I2cStop_En);//此顺序不能调换,出停止条件
+ I2C_ClearIrq(enCh);
+ break;
+ }
+ I2C_ClearIrq(enCh);
+ }
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief 从机发送函数
+ **
+ ** \param pu8Data发送数据缓存,u32Len发送数据长度
+ **
+ ** \retval 发送数据是否成功
+ **
+ ******************************************************************************/
+ en_result_t I2C_SlaveWriteData(en_i2c_channel_t enCh,uint8_t *pu8Data,uint32_t *u32Len)
+ {
+ uint8_t u8i=0,u8State;
+ //
+ while(1)
+ {
+
+ while(0 == I2C_GetIrq(enCh))
+ {}
+ u8State = I2C_GetState(enCh);
+ switch(u8State)
+ {
+ case 0xA8:
+ case 0xB0:
+ I2C_WriteByte(enCh,pu8Data[u8i++]);
+ break;
+ case 0xB8:
+ case 0xC8:
+ I2C_WriteByte(enCh,pu8Data[u8i++]);
+ break;
+ case 0xF8:
+ *u32Len = u8i;
+ break;
+ default:
+
+ return ErrorInvalidParameter;
+ }
+ I2C_ClearIrq(enCh);
+ }
+ }
+ /**
+ ******************************************************************************
+ ** \brief 从机接收函数
+ **
+ ** \param pu8Data接收数据存放缓存,u32Len接收数据指针
+ **
+ ** \retval 接收数据是否成功
+ **
+ ******************************************************************************/
+en_result_t I2C_SlaveReadData(en_i2c_channel_t enCh,uint8_t *pu8Data,uint32_t *pu32Len)
+{
+ uint8_t u8i=0,u8State;
+ while(0 == I2C_GetIrq(enCh))
+ {}
+ while(1)
+ {
+ while(0 == I2C_GetIrq(enCh))
+ {}
+ u8State = I2C_GetState(enCh);
+ switch(u8State)
+ {
+ case 0x60:
+ case 0x68:
+ case 0x70:
+ case 0x78:
+ break;
+ case 0x80:
+ case 0x90:
+ pu8Data[u8i++] = I2C_ReadByte(enCh);
+ break;
+ case 0xA0:
+ *pu32Len = u8i;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ I2C_ClearIrq(enCh);
+ if(0xA0 == u8State)
+ {
+ return Ok;
+ }
+ }
+}
+
+/**
+ ******************************************************************************
+ ** \brief 主机接收函数
+ **
+ ** \param u8Addr从机内存地址,pu8Data读数据存放缓存,u32Len读数据长度
+ **
+ ** \retval 读数据是否成功
+ **
+ ******************************************************************************/
+ en_result_t I2C_MasterReadData(en_i2c_channel_t enCh,uint8_t u8DevAddr,uint8_t *pu8Data,uint8_t u8Addr,uint32_t u32Len)
+{
+ en_result_t enRet = Error;
+ uint8_t u8i=0,u8State;
+
+ I2C_SetFunc(enCh,I2cStart_En);
+
+ while(1)
+ {
+ while(0 == I2C_GetIrq(enCh))
+ {}
+ u8State = I2C_GetState(enCh);
+ switch(u8State)
+ {
+ case 0x08:
+ I2C_ClearFunc(enCh,I2cStart_En);
+ I2C_WriteByte(enCh,u8DevAddr);
+ break;
+ case 0x18:
+ I2C_WriteByte(enCh,u8Addr);
+ break;
+ case 0x28:
+ I2C_SetFunc(enCh,I2cStart_En);
+ break;
+ case 0x10:
+ I2C_ClearFunc(enCh,I2cStart_En);
+ I2C_WriteByte(enCh,u8DevAddr|0x01);//从机地址发送OK
+ break;
+ case 0x40:
+ if(u32Len>1)
+ {
+ I2C_SetFunc(enCh,I2cAck_En);
+ }
+ break;
+ case 0x50:
+ pu8Data[u8i++] = I2C_ReadByte(enCh);
+ if(u8i==u32Len-1)
+ {
+ I2C_ClearFunc(enCh,I2cAck_En);
+ }
+ break;
+ case 0x58:
+ pu8Data[u8i++] = I2C_ReadByte(enCh);
+ I2C_SetFunc(enCh,I2cStop_En);
+ break;
+ case 0x38:
+ I2C_SetFunc(enCh,I2cStart_En);
+ break;
+ case 0x48:
+ I2C_SetFunc(enCh,I2cStop_En);
+ I2C_SetFunc(enCh,I2cStart_En);
+ break;
+ default:
+ I2C_SetFunc(enCh,I2cStart_En);//其他错误状态,重新发送起始条件
+ break;
+ }
+ I2C_ClearIrq(enCh);
+ if(u8i==u32Len)
+ {
+ break;
+ }
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief I2C模块初始化
+ **
+ ** \param pstcI2CCfg初始化配置结构体
+ **
+ ** \retval 初始化是否成功
+ **
+ ******************************************************************************/
+en_result_t I2C_Init(en_i2c_channel_t enCh,stc_i2c_config_t *pstcI2CCfg)
+{
+ en_result_t enRet = Error;
+ enRet = I2C_SetFunc(enCh,pstcI2CCfg->enFunc);
+ enRet = I2C_SetBaud(enCh,pstcI2CCfg->u8Tm);
+ enRet = I2C_WriteSlaveAddr(enCh,&pstcI2CCfg->stcSlaveAddr);
+ if(pstcI2CCfg->u8Tm<9)
+ {
+ I2C_SetFunc(enCh,I2cHlm_En);
+ }
+ if(NULL!=pstcI2CCfg->pfnI2c0Cb)
+ {
+ pfnI2c0tCallback = pstcI2CCfg->pfnI2c0Cb;
+ }
+ if(NULL!=pstcI2CCfg->pfnI2c1Cb)
+ {
+ pfnI2c1tCallback = pstcI2CCfg->pfnI2c1Cb;
+ }
+ if(TRUE == pstcI2CCfg->bTouchNvic)
+ {
+ if(I2C0 == enCh)
+ {
+ EnableNvic(I2C0_IRQn,IrqLevel3,TRUE);
+ }
+ else
+ {
+ EnableNvic(I2C1_IRQn,IrqLevel3,TRUE);
+ }
+ }
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief I2C模块关闭初始化
+ **
+ ** \param 无
+ **
+ ** \retval 设置是否成功
+ **
+ ******************************************************************************/
+ en_result_t I2C_DeInit(en_i2c_channel_t enCh)
+ {
+ en_result_t enRet = Error;
+ if(I2C0 == enCh)
+ {
+ M0P_I2C0->CR = 0x00;
+ }
+ else
+ {
+ M0P_I2C1->CR = 0x00;
+ }
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief I2C模块中断处理函数
+ **
+ ** \param u8Param 无意义
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void I2c_IRQHandler(uint8_t u8Param)
+{
+ if(I2C0 == u8Param)
+ {
+ if(NULL != pfnI2c0tCallback)
+ {
+ pfnI2c0tCallback();
+ }
+ }
+ else
+ {
+ if(NULL != pfnI2c1tCallback)
+ {
+ pfnI2c1tCallback();
+ }
+ }
+}
+
+//@} // I2cGroup
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/interrupts_hc32l136.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/interrupts_hc32l136.c
new file mode 100644
index 0000000000..eb95c48ee1
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/interrupts_hc32l136.c
@@ -0,0 +1,477 @@
+/******************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file interrupts_hc32l136.c
+ **
+ ** Interrupt management
+ ** @link Driver Group Some description @endlink
+ **
+ ** - 2018-04-15 1.0 Lux First version.
+ **
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "ddl.h"
+#include "interrupts_hc32l136.h"
+__WEAKDEF void Gpio_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Dma_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Uart_IRQHandler(uint8_t u8Param);
+__WEAKDEF void LpUart_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Spi_IRQHandler(uint8_t u8Param);
+__WEAKDEF void I2c_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Tim_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Tim3_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Adt_IRQHandler(uint8_t u8Param);
+__WEAKDEF void LpTim_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Pca_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Wdt_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Vc_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Rtc_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Adc_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Pcnt_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Lvd_IRQHandler(uint8_t u8Param);
+__WEAKDEF void Lcd_IRQHandler(uint8_t u8Param);
+__WEAKDEF void EfRam_IRQHandler(uint8_t u8Param);
+__WEAKDEF void ClkTrim_IRQHandler(uint8_t u8Param);
+
+/**
+ *******************************************************************************
+ ** \brief NVIC 中断使能
+ **
+ ** \param [in] enIrq 中断号枚举类型
+ ** \param [in] enLevel 中断优先级枚举类型
+ ** \param [in] bEn 中断开关
+ ** \retval Ok 设置成功
+ ** 其他值 设置失败
+ ******************************************************************************/
+void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn)
+{
+ NVIC_ClearPendingIRQ(enIrq);
+ NVIC_SetPriority(enIrq, enLevel);
+ if (TRUE == bEn)
+ {
+ NVIC_EnableIRQ(enIrq);
+ }
+ else
+ {
+ NVIC_DisableIRQ(enIrq);
+ }
+}
+
+/**
+ *******************************************************************************
+ ** \brief NVIC hardware fault 中断实现
+ ** 用于单步调试功能
+ **
+ ** \retval
+ ******************************************************************************/
+void HardFault_Handler(void)
+{
+ volatile int a = 0;
+
+ while( 0 == a)
+ {
+ ;
+ }
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortA 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTA_IRQHandler(void)
+{
+ Gpio_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortB 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTB_IRQHandler(void)
+{
+ Gpio_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTC_IRQHandler(void)
+{
+ Gpio_IRQHandler(2);
+}
+
+/**
+ *******************************************************************************
+ ** \brief GPIO PortD 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PORTD_IRQHandler(void)
+{
+ Gpio_IRQHandler(3);
+}
+
+/**
+ *******************************************************************************
+ ** \brief DMAC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void DMAC_IRQHandler(void)
+{
+ Dma_IRQHandler(0);
+}
+
+
+/**
+ *******************************************************************************
+ ** \brief UART0 串口0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void UART0_IRQHandler(void)
+{
+ Uart_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief UART1 串口1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void UART1_IRQHandler(void)
+{
+ Uart_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LPUART0 低功耗串口0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LPUART0_IRQHandler(void)
+{
+ LpUart_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LPUART1 低功耗串口1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LPUART1_IRQHandler(void)
+{
+ LpUart_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief SPI0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void SPI0_IRQHandler(void)
+{
+ Spi_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief SPI1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void SPI1_IRQHandler(void)
+{
+ Spi_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief I2C0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void I2C0_IRQHandler(void)
+{
+ I2c_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief I2C1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void I2C1_IRQHandler(void)
+{
+ I2c_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM0 基础时钟0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM0_IRQHandler(void)
+{
+ Tim_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM1 基础时钟1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM1_IRQHandler(void)
+{
+ Tim_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM2 基础时钟2 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM2_IRQHandler(void)
+{
+ Tim_IRQHandler(2);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM3 基础时钟3 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM3_IRQHandler(void)
+{
+ Tim3_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LPTIM 低功耗时钟 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LPTIM_IRQHandler(void)
+{
+ LpTim_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM4 高级时钟4 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM4_IRQHandler(void)
+{
+ Adt_IRQHandler(4);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM5 高级时钟5 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM5_IRQHandler(void)
+{
+ Adt_IRQHandler(5);
+}
+
+/**
+ *******************************************************************************
+ ** \brief TIM6 高级时钟6 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void TIM6_IRQHandler(void)
+{
+ Adt_IRQHandler(6);
+}
+
+/**
+ *******************************************************************************
+ ** \brief PCA 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PCA_IRQHandler(void)
+{
+ Pca_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief WDT 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void WDT_IRQHandler(void)
+{
+ Wdt_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief RTC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void RTC_IRQHandler(void)
+{
+ Rtc_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief ADC 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void ADC_IRQHandler(void)
+{
+ Adc_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief PCNT 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void PCNT_IRQHandler(void)
+{
+ Pcnt_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 电压比较0 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void VC0_IRQHandler(void)
+{
+ Vc_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 电压比较1 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void VC1_IRQHandler(void)
+{
+ Vc_IRQHandler(1);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 低电压检测 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LVD_IRQHandler(void)
+{
+ Lvd_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief LCD 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void LCD_IRQHandler(void)
+{
+ Lcd_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief RAM 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void EF_RAM_IRQHandler(void)
+{
+ EfRam_IRQHandler(0);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 时钟校准 中断处理函数
+ **
+ ** \retval
+ ******************************************************************************/
+void CLKTRIM_IRQHandler(void)
+{
+ ClkTrim_IRQHandler(0);
+}
+
+
+
+/******************************************************************************/
+/* EOF (not truncated) */
+/******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lcd.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lcd.c
new file mode 100644
index 0000000000..65206068d2
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lcd.c
@@ -0,0 +1,579 @@
+/*************************************************************************************
+* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file lcd.c
+ **
+ ** WDT function driver API.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2018-5-3 1.0 CJ First version for Device Driver Library of Module.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "lcd.h"
+
+/**
+ *******************************************************************************
+ ** \addtogroup I2cGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+ en_result_t LCD_SetClkSrc(en_lcd_clk_t enLcdClk)
+ {
+ en_result_t enRet = Error;
+ M0P_LCD->CR1_f.CLKSRC = enLcdClk;
+ enRet = Ok;
+ return enRet;
+ }
+/**
+ ******************************************************************************
+ ** \brief LCD Bias源选择函数
+ **
+ ** \param [in] enBiasSrc偏置源选择
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_SelBiasSrc(en_lcd_biassrc_t enBiasSrc)
+ {
+ en_result_t enRet = Error;
+ switch(enBiasSrc)
+ {
+ case LcdInRes_High:
+ case LcdInRes_Low:
+ case LcdInRes_Mid:
+ case LcdExtCap:
+ case LcdExtRes:
+ M0P_LCD->CR0_f.BSEL = enBiasSrc;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+ }
+/**
+ ******************************************************************************
+ ** \brief LCD 占空比选择函数
+ **
+ ** \param [in] enDuty占空比
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t LCD_SetDuty(en_lcd_duty_t enDuty)
+{
+ en_result_t enRet = Error;
+ switch(enDuty)
+ {
+ case LcdStatic:
+ case LcdDuty2:
+ case LcdDuty3:
+ case LcdDuty4:
+ case LcdDuty6:
+ case LcdDuty8:
+ M0P_LCD->CR0_f.DUTY = enDuty;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief LCD bias设置函数
+ **
+ ** \param [in] enBias 偏置
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_SetBias(en_lcd_bias_t enBias)
+ {
+ en_result_t enRet = Error;
+ switch(enBias)
+ {
+ case LcdBias3:
+ case LcdBias2:
+ M0P_LCD->CR0_f.BIAS = enBias;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief LCD 电压泵时钟频率选择函数
+ **
+ ** \param [in] enCpClk 电压泵频率
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t LCD_SelCpClk(en_lcd_cpclk_t enCpClk)
+{
+ en_result_t enRet = Error;
+ switch(enCpClk)
+ {
+ case LcdClk2k:
+ case LcdClk4k:
+ case LcdClk8k:
+ case LcdClk16k:
+ M0P_LCD->CR0_f.CPCLK = enCpClk;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief LCD 扫描时钟频率选择函数
+ **
+ ** \param [in] enScanClk 扫描时钟频率
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t LCD_SelScanClk(en_lcd_scanclk_t enScanClk)
+{
+ en_result_t enRet = Error;
+ switch(enScanClk)
+ {
+ case LcdClk64hz:
+ case LcdClk128hz:
+ case LcdClk256hz:
+ case LcdClk512hz:
+ M0P_LCD->CR0_f.LCDCLK = enScanClk;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief LCD 模块使能或闪屏使能禁止函数
+ **
+ ** \param [in] enFunc功能,bFlag使能或禁止
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_EnFunc(en_lcd_func_t enFunc,boolean_t bFlag)
+ {
+ en_result_t enRet = Error;
+ switch(enFunc)
+ {
+ case LcdEn:
+ M0P_LCD->CR0_f.EN = bFlag;
+ break;
+ case LcdBlinkEn:
+ M0P_LCD->CR1_f.BLINKEN = bFlag;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief LCD 显示模式0/1设置
+ **
+ ** \param [in] enDispMode模式
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_SetDispMode(en_lcd_dispmode_t enDispMode)
+ {
+ en_result_t enRet = Error;
+ switch(enDispMode)
+ {
+ case LcdMode0:
+ case LcdMode1:
+ M0P_LCD->CR1_f.MODE = enDispMode;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief LCD 对比度设置
+ **
+ ** \param [in] u8Contrast对比度
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_SetContrast(uint8_t u8Contrast)
+ {
+ en_result_t enRet = Error;
+ M0P_LCD->CR0_f.CONTRAST = u8Contrast;
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief LCD 闪屏计数器设置
+ **
+ ** \param [in] u8BlinkCnt计数器
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_SetBlinkCnt(uint8_t u8BlinkCnt)
+ {
+ en_result_t enRet = Error;
+ M0P_LCD->CR1_f.BLINKCNT = u8BlinkCnt;
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief LCD 中断标记清除
+ **
+ ** \param [in] 无
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t LCD_ClrIntState(void)
+{
+ en_result_t enRet = Error;
+ M0P_LCD->INTCLR_f.INTF = 0;
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief 根据LCD显示模式获取端口配置
+ **
+ ** \param [in]enLcdRunMode:显示方式, stcSegCom获取端口参数
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_GetSegCom(stc_lcd_segcompara_t *pstcSegComPara,stc_lcd_segcom_t *pstcSegCom)
+{
+ en_result_t enRet = Error;
+ if(pstcSegComPara->u8MaxSeg>40)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(pstcSegComPara->enBiasSrc)//seg32_35
+ {
+ case LcdInRes_High:
+ case LcdInRes_Low:
+ case LcdInRes_Mid:
+ pstcSegCom->bMux = 1;
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom = 0xff;
+ break;
+ case LcdExtCap:
+ case LcdExtRes:
+ //VLCD模拟端口配置
+ if(pstcSegComPara->u8MaxSeg>36)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcSegCom->bMux = 0;
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom = 0x0f;//seg32_35置0
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ switch(pstcSegComPara->enDuty)//COM0_7
+ {
+ case LcdStatic:
+ pstcSegCom->u8Com0_3 = 0xfe;
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom &= 0xff;
+ break;
+ case LcdDuty2:
+ pstcSegCom->u8Com0_3 = 0xfc;//COM口配置,默认按顺序进行配置com0/com1
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom &= 0xff;
+ break;
+ case LcdDuty3:
+ pstcSegCom->u8Com0_3 = 0xf8;//只取低4bit
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom &= 0xff;
+ break;
+ case LcdDuty4:
+ pstcSegCom->u8Com0_3 = 0xf0;//只取低4bit
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom &= 0xff;
+ break;
+ case LcdDuty6:
+ if(pstcSegComPara->u8MaxSeg>38)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcSegCom->u8Com0_3 = 0xf0;//只取低4bit
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom &= 0xfc;
+ break;
+ case LcdDuty8:
+ if(pstcSegComPara->u8MaxSeg>36)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcSegCom->u8Com0_3 = 0xf0;//只取低4bit
+ pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom &= 0xf0;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief LCD COMSEG端口配置
+ **
+ ** \param [in] pstcSegCom端口配置结构体
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_SetSegCom(stc_lcd_segcom_t *pstcSegCom)
+ {
+ en_result_t enRet = Error;
+ M0P_LCD->POEN0 = pstcSegCom->u32Seg0_31;
+ M0P_LCD->POEN1 = (uint32_t)(pstcSegCom->Seg32_39VLcdCom7_4_t.SegVLcdCom);
+ M0P_LCD->POEN1_f.MUX = pstcSegCom->bMux;
+ M0P_LCD->POEN1_f.C0 = pstcSegCom->u8Com0_3&0x01;
+ M0P_LCD->POEN1_f.C1 = pstcSegCom->u8Com0_3&0x02;
+ M0P_LCD->POEN1_f.C2 = pstcSegCom->u8Com0_3&0x04;
+ M0P_LCD->POEN1_f.C3 = pstcSegCom->u8Com0_3&0x08;
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief 液晶全显
+ **
+ ** \param [in] 无
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_FullDisp(void)
+ {
+ en_result_t enRet=Error;
+ uint8_t i;
+ uint32_t volatile *p = NULL;
+ p = &M0P_LCD->RAM0;
+ for(i=0;i<8;i++)
+ {
+ *p = 0xffffffffu;
+ p++;
+ }
+ for(i=0;i<8;i++)
+ {
+ *p = 0xffu;
+ p++;
+ }
+ enRet = Ok;
+ return enRet;
+ }
+ /**
+ ******************************************************************************
+ ** \brief 液晶全清
+ **
+ ** \param [in] 无
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_ClearDisp(void)
+{
+ en_result_t enRet=Error;
+ uint8_t i;
+ uint32_t volatile *p = NULL;
+ p = &M0P_LCD->RAM0;
+ for(i=0;i<16;i++)
+ {
+ *p = 0x00;
+ p++;
+ }
+ enRet = Ok;
+ return enRet;
+}
+ /**
+ ******************************************************************************
+ ** \brief LCD RAM bit设置函数
+ **
+ ** \param [in] u16Row RAM地址索引,u32List bit位索引,bData写入0或1
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_WriteRam(uint16_t u16Row, uint32_t u32List, boolean_t bData)
+ {
+ en_result_t enRet = Error;
+ uint8_t RamListSize = 0;
+ volatile uint32_t *ptemp = NULL;
+ ptemp = (volatile uint32_t*)&M0P_LCD->RAM0;
+ if(u16Row>=8)
+ {
+ RamListSize = LCDRAM8_FSIZE;
+ }
+ else
+ {
+ RamListSize = LCDRAM0_7SIZE;
+ }
+ if ((u16Row > LCDRAMSIZE) || (u32List > RamListSize))
+ {
+ enRet = ErrorInvalidParameter;
+ return enRet;
+ }
+
+ ptemp += u16Row;
+
+ if (bData == TRUE)
+ {
+ *ptemp |= (uint32_t)(1 << u32List);
+ }
+ else
+ {
+ *ptemp &= (uint32_t)(0 << u32List);
+ }
+ enRet = Ok;
+ return enRet;
+ }
+/**
+ ******************************************************************************
+ ** \brief LCD RAM 0-7寄存器设置函数
+ **
+ ** \param [in] u8Row RAM地址索引,u32Data写入寄存器数值
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t LCD_WriteRam0_7Int32(uint8_t u8Row,uint32_t u32Data)
+{
+ en_result_t enRet = Error;
+ volatile uint32_t *ptemp = NULL;
+ ptemp = (volatile uint32_t*)&M0P_LCD->RAM0;
+
+ if (u8Row > LCDRAMSIZE)
+ {
+ enRet = ErrorInvalidParameter;
+ return enRet;
+ }
+
+ ptemp += u8Row;
+ *ptemp = u32Data;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief LCD RAM 8-f寄存器设置函数
+ **
+ ** \param [in] u8Row RAM地址索引,u8Data写入寄存器数值
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+en_result_t LCD_WriteRam8_FInt8(uint8_t u8Row,uint8_t u8Data)
+{
+ en_result_t enRet = Error;
+ volatile uint32_t *ptemp = NULL;
+ ptemp = (volatile uint32_t*)&M0P_LCD->RAM0;
+
+ if (u8Row > LCDRAMSIZE)
+ {
+ enRet = ErrorInvalidParameter;
+ return enRet;
+ }
+
+ ptemp += u8Row;
+ *ptemp = u8Data;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief LCD模块初始化函数
+ **
+ ** \param [in] stcLcdCfg配置结构体
+ **
+ ** \retval enRet 成功或失败
+ **
+ ******************************************************************************/
+ en_result_t LCD_Init(stc_lcd_config_t *pstcLcdCfg)
+ {
+ en_result_t enRet = Error;
+ enRet = LCD_SelBiasSrc(pstcLcdCfg->enBiasSrc);
+ enRet = LCD_SetDuty(pstcLcdCfg->enDuty);
+ enRet = LCD_SetBias(pstcLcdCfg->enBias);
+ enRet = LCD_SelCpClk(pstcLcdCfg->enCpClk);
+ enRet = LCD_SelScanClk(pstcLcdCfg->enScanClk);
+ enRet = LCD_SetDispMode(pstcLcdCfg->enDispMode);
+ enRet = LCD_SetClkSrc(pstcLcdCfg->enClk);
+ if(Ok!=enRet)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(pstcLcdCfg->bTouchNvic)
+ {
+ M0P_LCD->CR1_f.IE = 1;
+ EnableNvic(LCD_IRQn,IrqLevel3,TRUE);
+ }
+ else
+ {
+ EnableNvic(LCD_IRQn,IrqLevel3,FALSE);
+ }
+ return Ok;
+ }
+//@} // LCDGroup
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpm.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpm.c
new file mode 100644
index 0000000000..dbba75a8e3
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpm.c
@@ -0,0 +1,134 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file lpm.c
+ **
+ ** Common API of lpm.
+ ** @link LpmGroup Some description @endlink
+ **
+ ** - 2017-06-06
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "lpm.h"
+/**
+ *******************************************************************************
+ ** \addtogroup LpmGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+#define IS_VALID_SEVONPEND(x) (SevPndDisable == (x) ||\
+ SevPndEnable == (x))
+#define IS_VALID_SLEEPDEEP(x) (SlpDpDisable == (x) ||\
+ SlpDpEnable == (x))
+#define IS_VALID_SLEEPONEXIT(x) (SlpExtDisable == (x) ||\
+ SlpExtEnable == (x))
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+/**
+ *****************************************************************************
+ ** \brief 低功耗模式配置
+ **
+ **
+ ** \param [in] pstcConfig 低功耗模式配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpm_Config(stc_lpm_config_t* pstcConfig)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_SEVONPEND(pstcConfig->enSEVONPEND));
+ ASSERT(IS_VALID_SLEEPDEEP(pstcConfig->enSLEEPDEEP));
+ ASSERT(IS_VALID_SLEEPONEXIT(pstcConfig->enSLEEPONEXIT));
+
+ SCB->SCR = pstcConfig->enSEVONPEND ? (SCB->SCR | SCB_SCR_SEVONPEND_Msk) : (SCB->SCR & ~SCB_SCR_SEVONPEND_Msk);
+ SCB->SCR = pstcConfig->enSLEEPDEEP ? (SCB->SCR | SCB_SCR_SLEEPDEEP_Msk) : (SCB->SCR & ~SCB_SCR_SLEEPDEEP_Msk);
+ SCB->SCR = pstcConfig->enSLEEPONEXIT ? (SCB->SCR | SCB_SCR_SLEEPONEXIT_Msk) : (SCB->SCR & ~SCB_SCR_SLEEPONEXIT_Msk);
+
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief 进入睡眠模式
+ **
+ **
+ **
+ ** \retval NULL
+ *****************************************************************************/
+void Lpm_GotoLpmMode(void)
+{
+ __WFI();
+}
+
+//@} // LpmGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpt.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpt.c
new file mode 100644
index 0000000000..dcefd2e5e3
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpt.c
@@ -0,0 +1,289 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file lpt.c
+ **
+ ** Common API of Low Power timer.
+ ** @link lptGroup Some description @endlink
+ **
+ ** - 2018-04-16 Husj First version
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "lpt.h"
+/**
+ *******************************************************************************
+ ** \addtogroup LptGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+static func_ptr_t pfnLpTimCallback = NULL;
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 中断标志获取
+ **
+ **
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Lpt_GetIntFlag(void)
+{
+ boolean_t bRetVal = FALSE;
+
+ bRetVal = M0P_LPTIMER->IFR_f.TF ? TRUE : FALSE;
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 中断标志清除
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_ClearIntFlag(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_LPTIMER->ICLR_f.TFC = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 中断服务函数
+ **
+ **
+ ** \param [in] u8Param == 0
+ **
+ *****************************************************************************/
+void LpTim_IRQHandler(uint8_t u8Param)
+{
+ if(NULL != pfnLpTimCallback)
+ {
+ pfnLpTimCallback();
+ }
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 中断使能
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_EnableIrq (void)
+{
+ en_result_t enResult = Error;
+
+ M0P_LPTIMER->CR_f.IE = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 中断禁止
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_DisableIrq(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_LPTIMER->CR_f.IE = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 初始化配置
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_Init(stc_lpt_config_t* pstcConfig)
+{
+ en_result_t enResult = Error;
+
+ M0P_LPTIMER->CR_f.GATE_P = pstcConfig->enGateP;
+ M0P_LPTIMER->CR_f.GATE = pstcConfig->enGate;
+ M0P_LPTIMER->CR_f.TCK_SEL = pstcConfig->enTckSel;
+ M0P_LPTIMER->CR_f.TOG_EN = pstcConfig->enTog;
+ M0P_LPTIMER->CR_f.CT = pstcConfig->enCT;
+ M0P_LPTIMER->CR_f.MD = pstcConfig->enMD;
+
+ pfnLpTimCallback = pstcConfig->pfnLpTimCb;
+
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 启动运行
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_Run(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_LPTIMER->CR_f.TR = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 停止运行
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_Stop(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_LPTIMER->CR_f.TR = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 重载值设置
+ **
+ **
+ ** \param [in] u16Data 16bits重载值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Lpt_ARRSet(uint16_t u16Data)
+{
+ en_result_t enResult = Error;
+ boolean_t bRetVal = FALSE;
+
+ bRetVal = M0P_LPTIMER->CR_f.WT_FLAG ? TRUE : FALSE;
+ if(TRUE == bRetVal)
+ {
+ M0P_LPTIMER->ARR_f.ARR = u16Data;
+ enResult = Ok;
+ }
+ else
+ {
+ enResult = Error;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Low Power Timer 16位计数值获取
+ **
+ **
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Lpt_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_LPTIMER->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+//@} // LptGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpuart.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpuart.c
new file mode 100644
index 0000000000..986b7377b4
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lpuart.c
@@ -0,0 +1,966 @@
+/*************************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file lpuart.c
+ **
+ ** LPUART function driver API.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2017-05-17 1.0 CJ First version for Device Driver Library of Module.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "lpuart.h"
+/**
+ ******************************************************************************
+ ** \addtogroup LPUartGroup
+ ******************************************************************************/
+//@{
+/******************************************************************************/
+/* Local pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+#define IS_VALID_CH(x) ((LPUART0 == (x)) ||\
+ (LPUART1 == (x)))
+
+#define IS_VALID_CLK(x) ((LPUart_Pclk==(x))||\
+ (LPUart_Pclk_1==(x))||\
+ (LPUart_Xtl==(x))||\
+ (LPUart_Rcl==(x)))
+
+#define IS_VALID_IRQSEL(x) ((LPUartTxIrq == (x)) ||\
+ (LPUartRxIrq == (x)) ||\
+ (LPUartFEIrq == (x)) ||\
+ (LPUartCtsIrq == (x))||\
+ (LPUartPEIrq == (x)) ||\
+ (LPUartTxEIrq == (x)))
+
+#define IS_VALID_MODE(x) ((LPUartMode0==(x))||\
+ (LPUartMode1==(x))||\
+ (LPUartMode2==(x))||\
+ (LPUartMode3==(x)))
+
+#define IS_VALID_STATUS(x) ((LPUartCts == (x))||\
+ (LPUartRC == (x))||\
+ (LPUartTC == (x))||\
+ (LPUartPE == (x))||\
+ (LPUartCtsIf == (x))||\
+ (LPUartTxe == (x))||\
+ (LPUartFE == (x)))
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+static stc_lpuart_instance_data_t* LPUartGetInternDataPtr(uint8_t u8Idx);
+static void LPUartInitNvic(uint8_t u8Idx);
+static void LPUartDeInitNvic(uint8_t u8Idx);
+/******************************************************************************/
+/* Local variable definitions ('static') */
+/******************************************************************************/
+static stc_lpuart_instance_data_t m_astcLPUartInstanceDataLut[] =
+{
+ {
+ LPUART0,
+ M0P_LPUART0, /* pstcInstance */
+ {NULL,NULL,NULL,NULL,NULL},
+ },
+ {
+ LPUART1,
+ M0P_LPUART1, /* pstcInstance */
+ {NULL,NULL,NULL,NULL,NULL},
+ },
+};
+/**
+ ******************************************************************************
+ ** \brief LPUART0/1通道 相关地址获取
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 通道对应的地址结构
+ **
+ ******************************************************************************/
+static stc_lpuart_instance_data_t* LPUartGetInternDataPtr(uint8_t u8Idx)
+{
+ stc_lpuart_instance_data_t* pstcData = NULL;
+ uint8_t u8i = 0;
+ for (u8i = 0; u8i < ARRAY_SZ(m_astcLPUartInstanceDataLut); u8i++)
+ {
+ if (u8Idx == m_astcLPUartInstanceDataLut[u8i].u32Idx)
+ {
+ pstcData = &m_astcLPUartInstanceDataLut[u8i];
+ break;
+ }
+ }
+
+ return (pstcData);
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通信中断使能函数设置
+ **
+ ** \param [in] u8Idx通道号,enIrqSel发送or接收中断使能
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_EnableIrq(uint8_t u8Idx,
+ en_lpuart_irq_sel_t enIrqSel)
+{
+ stc_lpuart_instance_data_t* pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_IRQSEL(enIrqSel));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enIrqSel)
+ {
+ case LPUartTxIrq:
+ pstcData->pstcInstance->SCON_f.TCIE = 1u;
+ break;
+ case LPUartRxIrq:
+ pstcData->pstcInstance->SCON_f.RCIE = 1u;
+ break;
+ case LPUartFEIrq:
+ pstcData->pstcInstance->SCON_f.FEIE = 1u;
+ break;
+ case LPUartCtsIrq:
+ pstcData->pstcInstance->SCON_f.CTSIE = 1u;
+ break;
+ case LPUartPEIrq:
+ pstcData->pstcInstance->SCON_f.PEIE = 1u;
+ break;
+ case LPUartTxEIrq:
+ pstcData->pstcInstance->SCON_f.TXEIE = 1u;
+ break;
+ default:
+ return (ErrorInvalidParameter);
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通信中断禁止函数设置
+ **
+ ** \param [in] u8Idx通道号,enIrqSel发送or接收中断禁止
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_DisableIrq(uint8_t u8Idx,
+ en_lpuart_irq_sel_t enIrqSel)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_IRQSEL(enIrqSel));
+
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enIrqSel)
+ {
+ case LPUartTxIrq:
+ pstcData->pstcInstance->SCON_f.TCIE = 0u;
+ break;
+ case LPUartRxIrq:
+ pstcData->pstcInstance->SCON_f.RCIE = 0u;
+ break;
+ case LPUartFEIrq:
+ pstcData->pstcInstance->SCON_f.FEIE = 0u;
+ break;
+ case LPUartCtsIrq:
+ pstcData->pstcInstance->SCON_f.CTSIE = 0u;
+ break;
+ case LPUartPEIrq:
+ pstcData->pstcInstance->SCON_f.PEIE = 0u;
+ break;
+ case LPUartTxEIrq:
+ pstcData->pstcInstance->SCON_f.TXEIE = 0u;
+ break;
+ default:
+ return (ErrorInvalidParameter);
+ }
+
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief lpuart通信时钟源选择
+ **
+ ** \param [in] u8Idx通道号,enClk 时钟源选项
+ **
+ ** \retval Ok 设置成功
+ **\retval ErrorInvalidParameter设置失败
+ ******************************************************************************/
+en_result_t LPUart_SelSclk(uint8_t u8Idx,en_lpuart_sclksel_t enClk)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_CLK(enClk));
+ switch(enClk)
+ {
+ case LPUart_Pclk:
+ case LPUart_Pclk_1:
+ case LPUart_Xtl:
+ case LPUart_Rcl:
+ pstcData->pstcInstance->SCON_f.SCLKSEL = enClk;
+ break;
+ default:
+ return (ErrorInvalidParameter);
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief lpuart通信时钟源选择
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval Ok 设置成功
+ **\retval
+ ******************************************************************************/
+uint32_t LPUart_GetSclk(uint8_t u8Idx)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ uint8_t u8Sclksrc;
+ uint32_t u32Sclk;
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ ASSERT(IS_VALID_CH(u8Idx));
+ u8Sclksrc = pstcData->pstcInstance->SCON_f.SCLKSEL;
+ switch(u8Sclksrc)
+ {
+ case 0x00:
+ case 0x01:
+ u32Sclk = Sysctrl_GetPClkFreq();
+ break;
+ case 0x02:
+ u32Sclk = 32768;
+ break;
+ case 0x03:
+ u32Sclk = 38400;//此处必须使能内部38.4k
+ break;
+ default:
+ return 0;
+ }
+ return u32Sclk;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道4种模式配置
+ **
+ ** \param [in] u8Idx通道号,mode哪种模式
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_SetMode(uint8_t u8Idx,en_lpuart_mode_t enMode)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_MODE(enMode));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SCON_f.SM = enMode;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道多主机模式配置
+ **
+ ** \param [in] u8Idx通道号,stcMultiConfig多主机模式结构
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_SetMultiMode(uint8_t u8Idx,stc_lpuart_multimode_t* pstcMultiConfig)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(NULL != pstcMultiConfig)
+ {
+ pstcData->pstcInstance->SCON_f.ADRDET = pstcMultiConfig->enMulti_mode;
+ if(pstcMultiConfig->enMulti_mode == LPUartMulti)
+ {
+ pstcData->pstcInstance->SADDR = pstcMultiConfig->u8SlaveAddr;
+ pstcData->pstcInstance->SADEN = pstcMultiConfig->u8SaddEn;
+ }
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道多主机模式发送数据/地址帧或者奇偶校验配置TB8
+ **
+ ** \param [in] u8Idx通道号,tb8数据or地址帧或者奇偶校验
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_SetMMDOrCk(uint8_t u8Idx,en_lpuart_mmdorck_t enTb8)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SCON_f.B8CONT = enTb8;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief 获取RB8数值
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval RB8
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+boolean_t LPUart_GetRb8(uint8_t u8Idx)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ return ((pstcData->pstcInstance->SBUF>>8)&0x01);
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道多主机模式从机地址配置函数
+ **
+ ** \param [in] u8Idx通道号,addr地址
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_SetSaddr(uint8_t u8Idx,uint8_t u8Addr)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SADDR = u8Addr;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道多主机模式从机掩码配置函数
+ **
+ ** \param [in] u8Idx通道号,addren地址掩码
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_SetSaddrEn(uint8_t u8Idx,uint8_t u8Addren)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SADEN = u8Addren;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道停止位长度设置
+ **
+ ** \param [in] u8Idx通道号,u8Len停止位长度
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_SetStopBit(uint8_t u8Idx,uint8_t u8Len)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ switch(u8Len)
+ {
+ case LPUart1bit:
+ case LPUart15bit:
+ case LPUart2bit:
+ pstcData->pstcInstance->SCON_f.STOPBIT = u8Len;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART采样频率配置
+ **
+ ** \param [in] u8Idx通道号,u8Div采样频率
+ **
+ ** \retval OK配置成功
+ ******************************************************************************/
+en_result_t LPUart_SetClkDiv(uint8_t u8Idx,en_lpuart_clkdiv_t enClkDiv)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ pstcData->pstcInstance->SCON_f.OVER = enClkDiv;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART波特率计算值
+ **
+ ** \param [in] u8Idx通道号,stcBaud计算波特率值参数
+ **
+ ** \retval SCNT计算值
+ ******************************************************************************/
+uint16_t LPUart_CalScnt(uint8_t u8Idx,stc_lpuart_baud_t *pstcBaud)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ uint16_t u16Scnt = 0;
+ uint8_t u8Over = 0;
+ ASSERT(IS_VALID_CH(u8Idx));
+
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ u8Over = pstcData->pstcInstance->SCON_f.OVER;
+ if(u8Over == 3)
+ {
+ return 0;//test
+ }
+ if(LPUartMode0 == pstcBaud->enRunMode)
+ {
+ return 0;//test
+ }
+ if((LPUartMode1 == pstcBaud->enRunMode)||(LPUartMode3 == pstcBaud->enRunMode))
+ {
+ u8Over = 1<<(4-u8Over);
+ u16Scnt = pstcBaud->u32Sclk/(pstcBaud->u32Baud*u8Over);
+ }
+ else
+ {
+ u8Over = 1<<(5-u8Over);
+ u16Scnt = pstcBaud->u32Sclk/u8Over;
+ }
+ return u16Scnt;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道波特率配置
+ **
+ ** \param [in] u8Idx通道号,u32pclk时钟源,stcBaud波特率配置结构
+ **
+ ** \retval 定时器配置值
+ ** \retval 0,获取值失败
+ ******************************************************************************/
+en_result_t LPUart_SetBaud(uint8_t u8Idx,uint16_t u16Scnt)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ pstcData->pstcInstance->SCNT = u16Scnt;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道波特率获取
+ **
+ ** \param [in] u8Idx通道号,u8Mode工作模式
+ **
+ ** \retval 波特率
+ ******************************************************************************/
+uint32_t LPUart_GetBaud(uint8_t u8Idx,uint8_t u8Mode,uint32_t u32Pclk)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ uint32_t u32Baud = 0;
+ uint8_t u8Over = 0;
+ uint16_t u16Scnt = 0;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ u8Over = pstcData->pstcInstance->SCON_f.OVER;
+ switch(u8Mode)
+ {
+ case LPUartMode0:
+ u32Baud = u32Pclk/12;
+ break;
+ case LPUartMode1:
+ case LPUartMode3:
+ u16Scnt = pstcData->pstcInstance->SCNT;
+ u8Over = 1<<(4-u8Over);
+ u32Baud = u32Pclk/(u8Over*u16Scnt);
+ break;
+ case LPUartMode2:
+ u8Over = 1<<(5-u8Over);
+ u32Baud = u32Pclk/u8Over;
+ break;
+ default:
+ return 0;//test
+ }
+ return u32Baud;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道发送或接收等功能使能设置
+ **
+ ** \param [in] u8Idx通道号,enFunc功能
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_EnableFunc(uint8_t u8Idx, en_lpuart_func_t enFunc)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enFunc)
+ {
+ case LPUartTx:
+ case LPUartRx:
+ pstcData->pstcInstance->SCON_f.REN = 1u;
+ break;
+ case LPUartDmaTx:
+ pstcData->pstcInstance->SCON_f.DMATXEN = 1u;
+ break;
+ case LPUartDmaRx:
+ pstcData->pstcInstance->SCON_f.DMARXEN = 1u;
+ break;
+ case LPUartCtsRts:
+ pstcData->pstcInstance->SCON_f.CTSEN = 1u;
+ pstcData->pstcInstance->SCON_f.RTSEN = 1u;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道发送或接收等功能禁止设置
+ **
+ ** \param [in] u8Idx通道号,enFunc功能
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_DisableFunc(uint8_t u8Idx, en_lpuart_func_t enFunc)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enFunc)
+ {
+ case LPUartTx:
+ case LPUartRx:
+ pstcData->pstcInstance->SCON_f.REN = 0u;
+ break;
+ case LPUartDmaTx:
+ pstcData->pstcInstance->SCON_f.DMATXEN = 0u;
+ break;
+ case LPUartDmaRx:
+ pstcData->pstcInstance->SCON_f.DMARXEN = 0u;
+ break;
+ case LPUartCtsRts:
+ pstcData->pstcInstance->SCON_f.CTSEN = 0u;
+ pstcData->pstcInstance->SCON_f.RTSEN = 0u;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道通信状态获取
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 状态值isr
+ ******************************************************************************/
+uint8_t LPUart_GetIsr(uint8_t u8Idx)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ return(pstcData->pstcInstance->ISR);
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道通信状态全部清除
+ **
+ ** \param [in] u8Idx通道号
+ **
+ **\retval Ok
+ ******************************************************************************/
+en_result_t LPUart_ClrIsr(uint8_t u8Idx)
+{
+ en_result_t enRet = Error;
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ pstcData->pstcInstance->ICR = 0;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道通信状态获取
+ **
+ ** \param [in] u8Idx通道号,enStatus获取哪个状态
+ **
+ ** \retval 状态值
+ **\retval ErrorInvalidParameter获取失败
+ ******************************************************************************/
+boolean_t LPUart_GetStatus(uint8_t u8Idx,en_lpuart_status_t enStatus)
+{
+ boolean_t bStatus=FALSE;
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_STATUS(enStatus));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;//4,用户只需判断0或1
+ }
+ switch(enStatus)
+ {
+ case LPUartCts:
+ bStatus = (pstcData->pstcInstance->ISR_f.CTS == 1) ? TRUE : FALSE;
+ break;
+ case LPUartRC:
+ bStatus = (pstcData->pstcInstance->ISR_f.RC == 1) ? TRUE : FALSE;
+ break;
+ case LPUartTC:
+ bStatus = (pstcData->pstcInstance->ISR_f.TC == 1) ? TRUE : FALSE;
+ break;
+ case LPUartPE:
+ bStatus = (pstcData->pstcInstance->ISR_f.PE == 1) ? TRUE : FALSE;
+ break;
+ case LPUartFE:
+ bStatus = (pstcData->pstcInstance->ISR_f.FE == 1) ? TRUE : FALSE;
+ break;
+ case LPUartCtsIf:
+ bStatus = (pstcData->pstcInstance->ISR_f.CTSIF == 1) ? TRUE : FALSE;
+ break;
+ case LPUartTxe:
+ bStatus = (pstcData->pstcInstance->ISR_f.TXE == 1) ? TRUE : FALSE;
+ break;
+ default:
+ break;
+ }
+ return bStatus;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道通信状态清除
+ **
+ ** \param [in] u8Idx通道号,enStatus清除哪个状态
+ **
+ ** \retval 状态值
+ **\retval ErrorInvalidParameter清除失败
+ ******************************************************************************/
+en_result_t LPUart_ClrStatus(uint8_t u8Idx,en_lpuart_status_t enStatus)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_STATUS(enStatus));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enStatus)
+ {
+ case LPUartCts:
+ pstcData->pstcInstance->ICR_f.CTSIFCF = 0;
+ break;
+ case LPUartRC:
+ pstcData->pstcInstance->ICR_f.RCCF = 0;
+ break;
+ case LPUartTC:
+ pstcData->pstcInstance->ICR_f.TCCF = 0;
+ break;
+ case LPUartPE:
+ pstcData->pstcInstance->ICR_f.PECF = 0;
+ break;
+ case LPUartFE:
+ pstcData->pstcInstance->ICR_f.FECF = 0;
+ break;
+ default:
+ break;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道发送数据函数,查询方式调用此函数,中断方式发送不适用
+ **
+ ** \param [in] u8Idx通道号,Data发送数据
+ **
+ ** \retval Ok发送成功
+ **\retval ErrorInvalidParameter发送失败
+ ******************************************************************************/
+en_result_t LPUart_SendData(uint8_t u8Idx, uint8_t u8Data)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ LPUart_ClrStatus(u8Idx,LPUartTC);
+ pstcData->pstcInstance->SBUF_f.DATA = u8Data;
+ while(FALSE == LPUart_GetStatus(u8Idx,LPUartTC))
+ {}
+ LPUart_ClrStatus(u8Idx,LPUartTC);
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道接收数据函数
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 接收数据
+ **\retval ErrorInvalidParameter接收失败
+ ******************************************************************************/
+uint8_t LPUart_ReceiveData(uint8_t u8Idx)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ return (pstcData->pstcInstance->SBUF_f.DATA);
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道中断处理函数
+ **
+ ** \param [in] u8Param通道号
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void LpUart_IRQHandler(uint8_t u8Param)
+{
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ pstcData = LPUartGetInternDataPtr(u8Param);
+ if (NULL == pstcData)
+ {
+ return;
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.FE)
+ {
+ LPUart_ClrStatus(u8Param,LPUartFE);
+ if(NULL != pstcData->stcLPUartInternIrqCb.pfnRxFEIrqCb)
+ {
+ pstcData->stcLPUartInternIrqCb.pfnRxFEIrqCb();
+ }
+ return;//帧出错则不进行后续数据处理
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.PE)
+ {
+ LPUart_ClrStatus(u8Param,LPUartPE);
+ if(NULL != pstcData->stcLPUartInternIrqCb.pfnPEIrqCb)
+ {
+ pstcData->stcLPUartInternIrqCb.pfnPEIrqCb();
+ }
+ return;//若奇偶校验出错则不进行后续数据处理
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.CTSIF)
+ {
+ LPUart_ClrStatus(u8Param,LPUartCts);
+ if(NULL != pstcData->stcLPUartInternIrqCb.pfnCtsIrqCb)
+ {
+ pstcData->stcLPUartInternIrqCb.pfnCtsIrqCb();
+ }
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.RC)
+ {
+ LPUart_ClrStatus(u8Param,LPUartRC);
+ if(NULL != pstcData->stcLPUartInternIrqCb.pfnRxIrqCb)
+ {
+ pstcData->stcLPUartInternIrqCb.pfnRxIrqCb();
+ }
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.TC)
+ {
+ LPUart_ClrStatus(u8Param,LPUartTC);
+ if(NULL != pstcData->stcLPUartInternIrqCb.pfnTxIrqCb)
+ {
+ pstcData->stcLPUartInternIrqCb.pfnTxIrqCb();
+ }
+ }
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道使能内核NVIC中断
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+static void LPUartInitNvic(uint8_t u8Idx)
+{
+ IRQn_Type enIrqIndex;
+
+ ASSERT(IS_VALID_CH(u8Idx));;
+ enIrqIndex = (IRQn_Type)(LPUART0_IRQn + u8Idx);
+ NVIC_ClearPendingIRQ(enIrqIndex);
+ NVIC_SetPriority(enIrqIndex,IrqLevel3);
+ NVIC_EnableIRQ(enIrqIndex);
+
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道禁止内核NVIC中断
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+static void LPUartDeInitNvic(uint8_t u8Idx)
+{
+ IRQn_Type enIrqIndex;
+
+ ASSERT(IS_VALID_CH(u8Idx));
+ enIrqIndex = (IRQn_Type)(LPUART0_IRQn + u8Idx);
+ NVIC_ClearPendingIRQ(enIrqIndex);
+ NVIC_SetPriority(enIrqIndex,IrqLevel3);
+ NVIC_DisableIRQ(enIrqIndex);
+
+}
+/**
+ ******************************************************************************
+ ** \brief LPUART通道初始化函数
+ **
+ ** \param [in] u8Idx通道号,pstcConfig初始化结构体
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t LPUart_Init(uint8_t u8Idx,stc_lpuart_config_t* pstcConfig)
+{
+ en_result_t enRet = Error;
+ stc_lpuart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = LPUartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(NULL == pstcConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(NULL != pstcConfig->pstcLpuart_clk)
+ {
+ LPUart_SelSclk(u8Idx,pstcConfig->pstcLpuart_clk->enSclk_sel);
+ LPUart_SetClkDiv(u8Idx,pstcConfig->pstcLpuart_clk->enSclk_Prs);
+ }
+ enRet = LPUart_SetMode(u8Idx,pstcConfig->enRunMode);
+ enRet = LPUart_SetStopBit(u8Idx,pstcConfig->enStopBit);
+ if(NULL != pstcConfig->pstcMultiMode)
+ {
+ enRet = LPUart_SetMultiMode(u8Idx,pstcConfig->pstcMultiMode);
+ }
+ if(NULL != pstcConfig->pstcIrqCb)
+ {
+ pstcData->stcLPUartInternIrqCb.pfnRxFEIrqCb = pstcConfig->pstcIrqCb->pfnRxFEIrqCb;
+ pstcData->stcLPUartInternIrqCb.pfnRxIrqCb = pstcConfig->pstcIrqCb->pfnRxIrqCb;
+ pstcData->stcLPUartInternIrqCb.pfnTxIrqCb = pstcConfig->pstcIrqCb->pfnTxIrqCb;
+ pstcData->stcLPUartInternIrqCb.pfnCtsIrqCb = pstcConfig->pstcIrqCb->pfnCtsIrqCb;
+ pstcData->stcLPUartInternIrqCb.pfnPEIrqCb = pstcConfig->pstcIrqCb->pfnPEIrqCb;
+ }
+ if(pstcConfig->bTouchNvic == TRUE)
+ {
+ LPUartInitNvic(u8Idx);
+ }
+ else
+ {
+ LPUartDeInitNvic(u8Idx);
+ }
+ enRet = Ok;
+ return enRet;
+}
+//@} // LPUartGroup
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lvd.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lvd.c
new file mode 100644
index 0000000000..d8e669fbaf
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/lvd.c
@@ -0,0 +1,327 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file lvd.c
+ **
+ ** Low Voltage Detect driver API.
+ ** @link Lvd Group Some description @endlink
+ **
+ ** - 2017-06-28 Alex First Version
+ **
+ ******************************************************************************/
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "lvd.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup LvdGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+#define IS_VALID_INPUT(x) ( (x) <= LvdInputPB07 )
+
+#define IS_VALID_THRESHOLD(x) ( (x) <= LvdTH3p3V )
+
+#define IS_VALID_FILTER(x) ( (x) <= LvdFilter29ms )
+
+#define IS_VALID_IRQTYPE(x) ( (x) <= LvdIrqFall )
+
+
+/******************************************************************************
+ * Global variable definitions (declared in header file with 'extern') *
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+// static void LvdEnableNvic(void);
+// static void LvdDisableNvic(void);
+// static en_result_t LvdEnable(en_lvd_type_t enType, boolean_t bFlag);
+
+/******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static func_ptr_t pfnLvdIrqCbk = NULL;
+
+/*****************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ *****************************************************************************/
+
+ /**
+ * \brief
+ * LVD中断服务程序
+ *
+ * \param [in] u8Param 未使用
+ *
+ * \retval 无
+ */
+void Lvd_IRQHandler(uint8_t u8Param)
+{
+ M0P_LVD->IFR_f.INTF = 0u;
+ if (NULL != pfnLvdIrqCbk)
+ {
+ pfnLvdIrqCbk();
+ }
+}
+
+/**
+ * \brief
+ * 使能NVIC中LVD中断
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+static void LvdEnableNvic(void)
+{
+ NVIC_ClearPendingIRQ(LVD_IRQn);
+ NVIC_SetPriority(LVD_IRQn, IrqLevel3);
+ NVIC_EnableIRQ(LVD_IRQn);
+}
+
+/**
+ * \brief
+ * 除能NVIC中LVD中断
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+static void LvdDisableNvic(void)
+{
+ NVIC_ClearPendingIRQ(LVD_IRQn);
+ NVIC_DisableIRQ(LVD_IRQn);
+ NVIC_SetPriority(LVD_IRQn, IrqLevel3);
+}
+
+/**
+ * \brief
+ * 使能LVD中断
+ *
+ * \param [in] enType LVD中断类型
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效类型
+ */
+en_result_t Lvd_EnableIrq(en_lvd_irq_type_t enType)
+{
+ en_result_t enRet = Ok;
+
+ if (enType > LvdIrqFall)
+ {
+ return ErrorInvalidParameter;
+ }
+ else
+ { switch (enType)
+ {
+ case LvdIrqHigh:
+ M0P_LVD->CR_f.HTEN = 1u;
+ M0P_LVD->CR_f.RTEN = 0u;
+ M0P_LVD->CR_f.FTEN = 0u;
+ break;
+ case LvdIrqRise:
+ M0P_LVD->CR_f.HTEN = 0u;
+ M0P_LVD->CR_f.RTEN = 1u;
+ M0P_LVD->CR_f.FTEN = 0u;
+ break;
+ case LvdIrqFall:
+ M0P_LVD->CR_f.HTEN = 0u;
+ M0P_LVD->CR_f.RTEN = 0u;
+ M0P_LVD->CR_f.FTEN = 1u;
+ break;
+ default:
+ break;
+ }
+
+ M0P_LVD->CR_f.IE = 1u;
+ LvdEnableNvic();
+ }
+ return enRet;
+}
+
+/**
+ * \brief
+ * 除能LVD中断
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Lvd_DisableIrq(void)
+{
+ LvdDisableNvic();
+ M0P_LVD->CR_f.IE = 0u;
+ M0P_LVD->CR_f.HTEN = 0u;
+ M0P_LVD->CR_f.RTEN = 0u;
+ M0P_LVD->CR_f.FTEN = 0u;
+}
+
+/**
+ * \brief
+ * LVD初始化
+ *
+ * \param [in] pstcConfig LVD配置指针
+ *
+ * \retval 无
+ */
+void Lvd_Init(stc_lvd_config_t *pstcConfig)
+{
+ ASSERT(pstcConfig);
+ ASSERT(IS_VALID_INPUT(pstcConfig->enInput));
+ ASSERT(IS_VALID_THRESHOLD(pstcConfig->enThreshold));
+ ASSERT(IS_VALID_FILTER(pstcConfig->enFilterTime));
+ ASSERT(IS_VALID_IRQTYPE(pstcConfig->enIrqType));
+
+ //NEED to DISABLE first.
+ Lvd_Disable();
+ Lvd_DisableIrq();
+ LvdDisableNvic();
+
+ M0P_LVD->CR_f.DEBOUNCE_TIME = pstcConfig->enFilterTime;
+ M0P_LVD->CR_f.FLTEN = pstcConfig->bFilter;
+ M0P_LVD->CR_f.VTDS = pstcConfig->enThreshold;
+ M0P_LVD->CR_f.SOURCE_SEL = pstcConfig->enInput;
+ M0P_LVD->CR_f.ACT = pstcConfig->bLvdReset;
+
+ pfnLvdIrqCbk = pstcConfig->pfnIrqCbk;
+}
+
+/**
+ * \brief
+ * LVD deinit
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Lvd_DeInit(void)
+{
+ Lvd_DisableIrq();
+ LvdDisableNvic();
+
+ pfnLvdIrqCbk = NULL;
+ Lvd_Disable();
+}
+
+/**
+ * \brief
+ * 使能LVD
+ *
+ * \param 无
+ *
+ * \retval 无
+ *
+ */
+void Lvd_Enable(void)
+{
+ M0P_LVD->CR_f.LVDEN = 1u;
+}
+
+/**
+ * \brief
+ * 除能LVD
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Lvd_Disable(void)
+{
+ M0P_LVD->CR_f.LVDEN = 0u;
+}
+
+/**
+ * \brief
+ * 获取LVD中断标志
+ *
+ * \param 无
+ *
+ * \retval boolean_t 中断标志
+ */
+boolean_t Lvd_GetIrqStat(void)
+{
+ return M0P_LVD->IFR_f.INTF;
+
+}
+
+/**
+ * \brief
+ * 清除LVD中断标志
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Lvd_ClearIrq(void)
+{
+ M0P_LVD->IFR_f.INTF = 0u;
+}
+
+/**
+ * \brief
+ * 获取Filter结果
+ *
+ * \param 无
+ *
+ * \retval boolean_t Fliter结果
+ */
+boolean_t Lvd_GetFilterResult(void)
+{
+ return (boolean_t)M0P_LVD->IFR_f.FILTER;
+}
+//@} // LvdGroup
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/opa.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/opa.c
new file mode 100644
index 0000000000..38acfce544
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/opa.c
@@ -0,0 +1,438 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file opa.c
+ **
+ ** opa driver API.
+ ** @link opa Group Some description @endlink
+ **
+ ** - 2018-04-15 Devi First Version
+ **
+ ******************************************************************************/
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "opa.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup OPAGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+#define IS_VALID_pagagain(x) ( (x) <= 7 )
+
+#define IS_VALID_channel(x) ( (OPA0 == (x)) ||\
+ (OPA1 == (x)) ||\
+ (OPA2 == (x)) )
+
+#define IS_VALID_Mode(x) ( (OpaUintMode == (x)) ||\
+ (OpaForWardMode == (x)) ||\
+ (OpaOppositeMode == (x)) ||\
+ (OpaThreeOppMode == (x)) ||\
+ (OpaThreeForMode == (x)) ||\
+ (OpaDiffMode == (x)) ||\
+ (OpaMeterMode == (x)) ||\
+ (OpaGpMode == (x)) )
+
+#define IS_VALID_metergain(x) ( (OpaMeterGain3 == (x)) ||\
+ (OpaMeterGain1_3 == (x)) ||\
+ (OpaMeterGain1 == (x)) )
+
+#define IS_VALID_calsel(x) ( (OpaSoftMode == (x)) ||\
+ (OpaSoftTriggerMode == (x)) ||\
+ (OpaADCTriggerMode == (x)) )
+
+/******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*****************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ *****************************************************************************/
+
+/**
+ * \brief
+ * OPA 初始化
+ *
+ * \param 无
+ * \param 无
+ *
+ * \retval 无
+ * \retval 无
+ */
+en_result_t OPA_Init(void)
+{
+ uint16_t i;
+
+ M0P_SYSCTRL->PERI_CLKEN_f.ADC = 1;
+ M0P_BGR->CR_f.BGR_EN = 1;
+ for(i=0;i<2000;i++)
+ {
+ ;
+ }
+
+ M0P_OPA->CR0 = 0x120;
+ M0P_OPA->CR1 = 0x120;
+ M0P_OPA->CR2 = 0x120;
+ M0P_OPA->CR = 0x00;
+ return Ok;
+}
+
+/**
+ * \brief
+ * OPA 去初始化
+ *
+ * \param 无
+ * \param 无
+ *
+ * \retval 无
+ * \retval 无
+ */
+en_result_t OPA_DeInit(void)
+{
+
+ M0P_OPA->CR0 = 0x120;
+ M0P_OPA->CR1 = 0x120;
+ M0P_OPA->CR2 = 0x120;
+ M0P_OPA->CR = 0x00;
+ M0P_BGR->CR_f.BGR_EN = 0;
+ M0P_SYSCTRL->PERI_CLKEN_f.ADC = 0;
+ return Ok;
+}
+
+/**
+ * \brief
+ * OPA 基本功能设置
+ *
+ * \param [in] en_opa_channel_t 使用那个通道的OPA
+ * \param [in] en_opa_modesel_t OPA模式选择
+ * \param [in] stc_opa_gain_config_t OPA增益选择
+ *
+ * \retval 无
+ */
+en_result_t OPA_Operate(en_opa_channel_t enchannel ,en_opa_modesel_t enMode,stc_opa_gain_config_t *pstrGain)
+{
+ stc_opa_cr0_field_t *stcOpacr;
+
+ ASSERT( IS_VALID_Mode(enMode) );
+ ASSERT( IS_VALID_channel(enchannel) );
+
+ if (OPA0 == enchannel)
+ {
+ stcOpacr = (stc_opa_cr0_field_t*)&M0P_OPA->CR0_f;
+ }
+ if (OPA1 == enchannel)
+ {
+ stcOpacr = (stc_opa_cr0_field_t*)&M0P_OPA->CR1_f;
+ }
+ if (OPA2 == enchannel)
+ {
+ stcOpacr = (stc_opa_cr0_field_t*)&M0P_OPA->CR2_f;
+ }
+
+ if(enMode == OpaUintMode)
+ {
+ stcOpacr->NEGSEL = 0;
+ stcOpacr->POSSEL = 3;
+ stcOpacr->UBUFSEL = 1;
+ stcOpacr->POEN = 1;
+ }
+ else if(enMode == OpaForWardMode)
+ {
+ stcOpacr->NEGSEL = 1;
+ stcOpacr->POEN = 1;
+ stcOpacr->PGAGAIN = pstrGain->enNoInGain;
+ stcOpacr->POSSEL = 3;
+ stcOpacr->RESINMUX = 0;
+ stcOpacr->RESSEL = 1;
+ }
+ else if(enMode == OpaOppositeMode)
+ {
+ stcOpacr->NEGSEL = 1;
+ stcOpacr->POEN = 1;
+ stcOpacr->PGAGAIN = pstrGain->enInGain;
+ stcOpacr->POSSEL = 3;
+ stcOpacr->RESINMUX = 2;
+ stcOpacr->RESSEL = 1;
+ }
+ else if(enMode == OpaDiffMode)
+ {
+ M0P_OPA->CR0_f.POSSEL = 3;
+ M0P_OPA->CR1_f.POSSEL = 3;
+ M0P_OPA->CR2_f.POSSEL = 0;
+
+ M0P_OPA->CR0_f.NEGSEL = 0;
+ M0P_OPA->CR1_f.NEGSEL = 1;
+ M0P_OPA->CR2_f.NEGSEL = 1;
+
+ M0P_OPA->CR0_f.RESINMUX = 0;
+ M0P_OPA->CR1_f.RESINMUX = 1;
+ M0P_OPA->CR2_f.RESINMUX = 0;
+
+ M0P_OPA->CR0_f.UBUFSEL = 1;
+ M0P_OPA->CR1_f.UBUFSEL = 0;
+ M0P_OPA->CR2_f.UBUFSEL = 0;
+
+ M0P_OPA->CR0_f.RESSEL = 0;
+ M0P_OPA->CR1_f.RESSEL = 1;
+ M0P_OPA->CR2_f.RESSEL = 0;
+
+ M0P_OPA->CR0_f.POEN = 0;
+ M0P_OPA->CR1_f.POEN = 1;
+ M0P_OPA->CR2_f.POEN = 0;
+
+ M0P_OPA->CR0_f.PGAGAIN = 0;
+ M0P_OPA->CR1_f.PGAGAIN = pstrGain->enNoInGain;
+ M0P_OPA->CR2_f.PGAGAIN = 0;
+ }
+ else if(enMode == OpaGpMode)
+ {
+ stcOpacr->BIASSEL = 1;
+ stcOpacr->MODE = 1;
+ stcOpacr->NEGSEL = 3;
+ stcOpacr->POEN = 0;
+ stcOpacr->PGAGAIN = 5;
+ stcOpacr->POSSEL = 3;
+ stcOpacr->RESINMUX = 0;
+ stcOpacr->RESSEL = 0;
+ stcOpacr->UBUFSEL = 0;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+ M0P_OPA->CR0_f.EN = 1;
+ M0P_OPA->CR1_f.EN = 1;
+ M0P_OPA->CR2_f.EN = 1;
+ return Ok;
+}
+
+/**
+ * \brief
+ * OPA 基本功能设置 (级联正向和反向模式以及仪表模式)
+ * \param [in] en_opa_modesel_t OPA模式选择
+ * \param [in] stc_opa_gain_config_t OPA增益选择
+ *
+ * \retval 无
+ */
+en_result_t OPA_ThreeOperate(en_opa_modesel_t enMode,stc_opa_gain_config_t *pstrGain0,stc_opa_gain_config_t *pstrGain1,stc_opa_gain_config_t *pstrGain2)
+{
+
+ ASSERT( IS_VALID_Mode(enMode) );
+
+ if(enMode == OpaThreeOppMode)
+ {
+ M0P_OPA->CR0_f.POSSEL = 3;
+ M0P_OPA->CR1_f.POSSEL = 3;
+ M0P_OPA->CR2_f.POSSEL = 3;
+
+ M0P_OPA->CR0_f.NEGSEL = 1;
+ M0P_OPA->CR1_f.NEGSEL = 1;
+ M0P_OPA->CR2_f.NEGSEL = 1;
+
+ M0P_OPA->CR0_f.RESINMUX = 2;
+ M0P_OPA->CR1_f.RESINMUX = 1;
+ M0P_OPA->CR2_f.RESINMUX = 1;
+
+ M0P_OPA->CR0_f.RESSEL = 1;
+ M0P_OPA->CR1_f.RESSEL = 1;
+ M0P_OPA->CR2_f.RESSEL = 1;
+
+ M0P_OPA->CR0_f.POEN = 0;
+ M0P_OPA->CR1_f.POEN = 0;
+ M0P_OPA->CR2_f.POEN = 1;
+
+ M0P_OPA->CR0_f.PGAGAIN = pstrGain0->enInGain;
+ M0P_OPA->CR1_f.PGAGAIN = pstrGain1->enInGain;
+ M0P_OPA->CR2_f.PGAGAIN = pstrGain2->enInGain;
+ }
+ else if(enMode == OpaThreeForMode)
+ {
+ M0P_OPA->CR0_f.POSSEL = 3;
+ M0P_OPA->CR1_f.POSSEL = 2;
+ M0P_OPA->CR2_f.POSSEL = 2;
+
+ M0P_OPA->CR0_f.NEGSEL = 1;
+ M0P_OPA->CR1_f.NEGSEL = 1;
+ M0P_OPA->CR2_f.NEGSEL = 1;
+
+ M0P_OPA->CR0_f.RESINMUX = 0;
+ M0P_OPA->CR1_f.RESINMUX = 0;
+ M0P_OPA->CR2_f.RESINMUX = 0;
+
+ M0P_OPA->CR0_f.UBUFSEL = 0;
+ M0P_OPA->CR1_f.UBUFSEL = 0;
+ M0P_OPA->CR2_f.UBUFSEL = 0;
+
+ M0P_OPA->CR0_f.RESSEL = 1;
+ M0P_OPA->CR1_f.RESSEL = 1;
+ M0P_OPA->CR2_f.RESSEL = 1;
+
+ M0P_OPA->CR0_f.POEN = 0;
+ M0P_OPA->CR1_f.POEN = 0;
+ M0P_OPA->CR2_f.POEN = 1;
+
+ M0P_OPA->CR0_f.PGAGAIN = pstrGain0->enNoInGain;
+ M0P_OPA->CR1_f.PGAGAIN = pstrGain1->enNoInGain;
+ M0P_OPA->CR2_f.PGAGAIN = pstrGain2->enNoInGain;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+ M0P_OPA->CR0_f.EN = 1;
+ M0P_OPA->CR1_f.EN = 1;
+ M0P_OPA->CR2_f.EN = 1;
+ return Ok;
+}
+
+/**
+ * \brief
+ * OPA 仪表模式
+ * \param [in] en_opa_metergain_t OPA增益选择
+ *
+ * \retval 无
+ */
+en_result_t OPA_MeterOperate(en_opa_metergain_t enGainMode)
+{
+ ASSERT( IS_VALID_metergain(enGainMode) );
+
+ M0P_OPA->CR0_f.POSSEL = 3;
+ M0P_OPA->CR1_f.POSSEL = 3;
+ M0P_OPA->CR2_f.POSSEL = 1;
+
+ M0P_OPA->CR0_f.NEGSEL = 0;
+ M0P_OPA->CR1_f.NEGSEL = 0;
+ M0P_OPA->CR2_f.NEGSEL = 1;
+
+ M0P_OPA->CR0_f.RESINMUX = 0;
+ M0P_OPA->CR1_f.RESINMUX = 0;
+ M0P_OPA->CR2_f.RESINMUX = 1;
+
+ M0P_OPA->CR0_f.UBUFSEL = 1;
+ M0P_OPA->CR1_f.UBUFSEL = 1;
+ M0P_OPA->CR2_f.UBUFSEL = 0;
+
+ M0P_OPA->CR0_f.RESSEL = 1;
+ M0P_OPA->CR1_f.RESSEL = 0;
+ M0P_OPA->CR2_f.RESSEL = 1;
+
+ M0P_OPA->CR0_f.POEN = 0;
+ M0P_OPA->CR1_f.POEN = 0;
+ M0P_OPA->CR2_f.POEN = 1;
+
+ if(enGainMode == OpaMeterGain3)
+ {
+ M0P_OPA->CR0_f.PGAGAIN = 6;
+ M0P_OPA->CR2_f.PGAGAIN = 3;
+ }
+ if(enGainMode == OpaMeterGain1_3)
+ {
+ M0P_OPA->CR0_f.PGAGAIN = 3;
+ M0P_OPA->CR2_f.PGAGAIN = 6;
+ }
+ if(enGainMode == OpaMeterGain1)
+ {
+ M0P_OPA->CR0_f.PGAGAIN = 5;
+ M0P_OPA->CR2_f.PGAGAIN = 5;
+ }
+
+ M0P_OPA->CR0_f.EN = 1;
+ M0P_OPA->CR1_f.EN = 1;
+ M0P_OPA->CR2_f.EN = 1;
+ return Ok;
+}
+/**
+ * \brief
+ * OPA 校正模式
+ * \param [in] en_opa_calsel_t OPA校正模式选择
+ *
+ * \retval 无
+ */
+en_result_t OPA_Cal(en_opa_calsel_t enCalMode)
+{
+ ASSERT( IS_VALID_calsel(enCalMode) );
+
+ if(enCalMode == OpaSoftMode)
+ {
+
+ }
+ if(enCalMode == OpaSoftTriggerMode)
+ {
+
+ }
+ if (enCalMode == OpaADCTriggerMode)
+ {
+
+ }
+
+ M0P_OPA->CR0_f.EN = 1;
+ M0P_OPA->CR1_f.EN = 1;
+ M0P_OPA->CR2_f.EN = 1;
+ return Ok;
+}
+//@} // OPAGroup
+
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pca.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pca.c
new file mode 100644
index 0000000000..774e91c265
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pca.c
@@ -0,0 +1,834 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file pca.c
+ **
+ ** Common API of PCA.
+ ** @link pcaGroup Some description @endlink
+ **
+ ** - 2018-04-16 Husj First version
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "pca.h"
+/**
+ *******************************************************************************
+ ** \addtogroup PcaGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+#define IS_VALID_MODULE(x) (Module0 == (x) ||\
+ Module1 == (x) ||\
+ Module2 == (x) ||\
+ Module3 == (x) ||\
+ Module4 == (x))
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+static func_ptr_t pfnPcaCallback = NULL;
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+/**
+ *****************************************************************************
+ ** \brief PCA中断标志获取
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Pca_GetIntFlag(en_pca_module_t enModule)
+{
+ boolean_t bRetVal = FALSE;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ bRetVal = M0P_PCA->CCON_f.CCF0 ? TRUE : FALSE;
+ break;
+ case Module1:
+ bRetVal = M0P_PCA->CCON_f.CCF1 ? TRUE : FALSE;
+ break;
+ case Module2:
+ bRetVal = M0P_PCA->CCON_f.CCF2 ? TRUE : FALSE;
+ break;
+ case Module3:
+ bRetVal = M0P_PCA->CCON_f.CCF3 ? TRUE : FALSE;
+ break;
+ case Module4:
+ bRetVal = M0P_PCA->CCON_f.CCF4 ? TRUE : FALSE;
+ break;
+ default:
+ bRetVal = FALSE;
+ break;
+ }
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA计数中断标志获取
+ **
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Pca_GetCntIntFlag(void)
+{
+ boolean_t bRetVal = FALSE;
+
+ bRetVal = M0P_PCA->CCON_f.CF ? TRUE : FALSE;
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA中断标志清除
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_ClearIntFlag(en_pca_module_t enModule)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ M0P_PCA->ICLR_f.CCF0 = FALSE;
+ enResult = Ok;
+ break;
+ case Module1:
+ M0P_PCA->ICLR_f.CCF1 = FALSE;
+ enResult = Ok;
+ break;
+ case Module2:
+ M0P_PCA->ICLR_f.CCF2 = FALSE;
+ enResult = Ok;
+ break;
+ case Module3:
+ M0P_PCA->ICLR_f.CCF3 = FALSE;
+ enResult = Ok;
+ break;
+ case Module4:
+ M0P_PCA->ICLR_f.CCF4 = FALSE;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA计数中断标志清除
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_ClearCntIntFlag(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->ICLR_f.CF = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA中断服务程序
+ **
+ **
+ ** \param [in] u8Param == 0
+ **
+ *****************************************************************************/
+void Pca_IRQHandler(uint8_t u8Param)
+{
+ if(NULL != pfnPcaCallback)
+ {
+ pfnPcaCallback();
+ }
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA中断使能
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_EnableIrq(en_pca_module_t enModule)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ M0P_PCA->CCAPM0_f.CCIE = TRUE;
+ enResult = Ok;
+ break;
+ case Module1:
+ M0P_PCA->CCAPM1_f.CCIE = TRUE;
+ enResult = Ok;
+ break;
+ case Module2:
+ M0P_PCA->CCAPM2_f.CCIE = TRUE;
+ enResult = Ok;
+ break;
+ case Module3:
+ M0P_PCA->CCAPM3_f.CCIE = TRUE;
+ enResult = Ok;
+ break;
+ case Module4:
+ M0P_PCA->CCAPM4_f.CCIE = TRUE;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA计数中断使能
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_EnableCntIrq (void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CMOD_f.CFIE = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA中断禁止
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_DisableIrq(en_pca_module_t enModule)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ M0P_PCA->CCAPM0_f.CCIE = FALSE;
+ enResult = Ok;
+ break;
+ case Module1:
+ M0P_PCA->CCAPM1_f.CCIE = FALSE;
+ enResult = Ok;
+ break;
+ case Module2:
+ M0P_PCA->CCAPM2_f.CCIE = FALSE;
+ enResult = Ok;
+ break;
+ case Module3:
+ M0P_PCA->CCAPM3_f.CCIE = FALSE;
+ enResult = Ok;
+ break;
+ case Module4:
+ M0P_PCA->CCAPM4_f.CCIE = FALSE;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA计数中断禁止
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_DisableCntIrq(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CMOD_f.CFIE = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+
+/**
+ *****************************************************************************
+ ** \brief PCA初始化配置
+ **
+ **
+ ** \param [in] pstcConfig PCA模块配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_Init(stc_pca_config_t* pstcConfig)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CMOD_f.CIDL = pstcConfig->enCIDL;
+ M0P_PCA->CMOD_f.WDTE = pstcConfig->enWDTE;
+ M0P_PCA->CMOD_f.CPS = pstcConfig->enCPS;
+
+ pfnPcaCallback = pstcConfig->pfnPcaCb;
+
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA模式配置
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ ** \param [in] pstcCapMod PCA模式配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_CapModConfig(en_pca_module_t enModule, stc_pca_capmodconfig_t* pstcCapMod)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ {
+ M0P_PCA->CCAPM0_f.ECOM = pstcCapMod->enECOM;
+ M0P_PCA->CCAPM0_f.CAPP = pstcCapMod->enCAPP;
+ M0P_PCA->CCAPM0_f.CAPN = pstcCapMod->enCAPN;
+ M0P_PCA->CCAPM0_f.MAT = pstcCapMod->enMAT;
+ M0P_PCA->CCAPM0_f.TOG = pstcCapMod->enTOG;
+ M0P_PCA->CCAPM0_f.PWM = pstcCapMod->en8bitPWM;
+ enResult = Ok;
+ }
+ break;
+ case Module1:
+ {
+ M0P_PCA->CCAPM1_f.ECOM = pstcCapMod->enECOM;
+ M0P_PCA->CCAPM1_f.CAPP = pstcCapMod->enCAPP;
+ M0P_PCA->CCAPM1_f.CAPN = pstcCapMod->enCAPN;
+ M0P_PCA->CCAPM1_f.MAT = pstcCapMod->enMAT;
+ M0P_PCA->CCAPM1_f.TOG = pstcCapMod->enTOG;
+ M0P_PCA->CCAPM1_f.PWM = pstcCapMod->en8bitPWM;
+ enResult = Ok;
+ }
+ break;
+ case Module2:
+ {
+ M0P_PCA->CCAPM2_f.ECOM = pstcCapMod->enECOM;
+ M0P_PCA->CCAPM2_f.CAPP = pstcCapMod->enCAPP;
+ M0P_PCA->CCAPM2_f.CAPN = pstcCapMod->enCAPN;
+ M0P_PCA->CCAPM2_f.MAT = pstcCapMod->enMAT;
+ M0P_PCA->CCAPM2_f.TOG = pstcCapMod->enTOG;
+ M0P_PCA->CCAPM2_f.PWM = pstcCapMod->en8bitPWM;
+ enResult = Ok;
+ }
+ break;
+ case Module3:
+ {
+ M0P_PCA->CCAPM3_f.ECOM = pstcCapMod->enECOM;
+ M0P_PCA->CCAPM3_f.CAPP = pstcCapMod->enCAPP;
+ M0P_PCA->CCAPM3_f.CAPN = pstcCapMod->enCAPN;
+ M0P_PCA->CCAPM3_f.MAT = pstcCapMod->enMAT;
+ M0P_PCA->CCAPM3_f.TOG = pstcCapMod->enTOG;
+ M0P_PCA->CCAPM3_f.PWM = pstcCapMod->en8bitPWM;
+ enResult = Ok;
+ }
+ break;
+ case Module4:
+ {
+ M0P_PCA->CCAPM4_f.ECOM = pstcCapMod->enECOM;
+ M0P_PCA->CCAPM4_f.CAPP = pstcCapMod->enCAPP;
+ M0P_PCA->CCAPM4_f.CAPN = pstcCapMod->enCAPN;
+ M0P_PCA->CCAPM4_f.MAT = pstcCapMod->enMAT;
+ M0P_PCA->CCAPM4_f.TOG = pstcCapMod->enTOG;
+ M0P_PCA->CCAPM4_f.PWM = pstcCapMod->en8bitPWM;
+ enResult = Ok;
+ }
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA启动运行
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_Run(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CCON_f.CR = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA停止运行
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_Stop(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CCON_f.CR = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA16位比较数据设置
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ ** \param [in] u16Data PCA捕获数据
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_CmpData16Set(en_pca_module_t enModule, uint16_t u16Data)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ M0P_PCA->CCAP0_f.CCAP0 = u16Data;
+ enResult = Ok;
+ break;
+ case Module1:
+ M0P_PCA->CCAP1_f.CCAP1 = u16Data;
+ enResult = Ok;
+ break;
+ case Module2:
+ M0P_PCA->CCAP2_f.CCAP2 = u16Data;
+ enResult = Ok;
+ break;
+ case Module3:
+ M0P_PCA->CCAP3_f.CCAP3 = u16Data;
+ enResult = Ok;
+ break;
+ case Module4:
+ M0P_PCA->CCAP4_f.CCAP4 = u16Data;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+
+/**
+ *****************************************************************************
+ ** \brief PCA16位捕获数据获取
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ **
+ ** \retval u16Data
+ *****************************************************************************/
+uint16_t Pca_CapData16Get(en_pca_module_t enModule)
+{
+ uint16_t u16Data = 0;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ u16Data = M0P_PCA->CCAP0_f.CCAP0;
+ break;
+ case Module1:
+ u16Data = M0P_PCA->CCAP1_f.CCAP1;
+ break;
+ case Module2:
+ u16Data = M0P_PCA->CCAP2_f.CCAP2;
+ break;
+ case Module3:
+ u16Data = M0P_PCA->CCAP3_f.CCAP3;
+ break;
+ case Module4:
+ u16Data = M0P_PCA->CCAP4_f.CCAP4;
+ break;
+ default:
+ u16Data = 0;
+ break;
+ }
+
+ return u16Data;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA高8位比较数据设置
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ ** \param [in] u8Data PCA高8位捕获数据
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_CmpDataHSet(en_pca_module_t enModule, uint8_t u8Data)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ M0P_PCA->CCAP0H_f.CCAP0 = u8Data;
+ enResult = Ok;
+ break;
+ case Module1:
+ M0P_PCA->CCAP1H_f.CCAP1 = u8Data;
+ enResult = Ok;
+ break;
+ case Module2:
+ M0P_PCA->CCAP2H_f.CCAP2 = u8Data;
+ enResult = Ok;
+ break;
+ case Module3:
+ M0P_PCA->CCAP3H_f.CCAP3 = u8Data;
+ enResult = Ok;
+ break;
+ case Module4:
+ M0P_PCA->CCAP4H_f.CCAP4 = u8Data;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA低8位比较数据设置
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ ** \param [in] u8Data PCA低8位捕获数据
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_CmpDataLSet(en_pca_module_t enModule, uint8_t u8Data)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ M0P_PCA->CCAP0L_f.CCAP0 = u8Data;
+ enResult = Ok;
+ break;
+ case Module1:
+ M0P_PCA->CCAP1L_f.CCAP1 = u8Data;
+ enResult = Ok;
+ break;
+ case Module2:
+ M0P_PCA->CCAP2L_f.CCAP2 = u8Data;
+ enResult = Ok;
+ break;
+ case Module3:
+ M0P_PCA->CCAP3L_f.CCAP3 = u8Data;
+ enResult = Ok;
+ break;
+ case Module4:
+ M0P_PCA->CCAP4L_f.CCAP4 = u8Data;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA计数器初值设置
+ **
+ **
+ **
+ ** \param [in] u16Data PCA计数器初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CNT_f.CNT = u16Data;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA16位计数器值获取
+ **
+ **
+ **
+ ** \retval 16位计数器值
+ *****************************************************************************/
+uint16_t Pca_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_PCA->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA周期重载值设置
+ **
+ **
+ **
+ ** \param [in] u16Data PCA周期重载值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_CARRSet(uint16_t u16Data)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->CARR_f.CARR = u16Data;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA周期重载值获取
+ **
+ **
+ **
+ ** \retval PCA周期重载值
+ *****************************************************************************/
+uint16_t Pca_CARRGet(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_PCA->CARR_f.CARR;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA增强PWM 使能
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_Enable16bitPWM(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->EPWM_f.EPWM = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA增强PWM 禁止
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Pca_Disable16bitPWM(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_PCA->EPWM_f.EPWM = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief PCA比较高速输出标志获取
+ **
+ **
+ ** \param [in] enModule PCA模块选择(Module0、Module1、Module2、Module3、Module4)
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Pca_GetCmpHighFlag(en_pca_module_t enModule)
+{
+ boolean_t bRetVal = FALSE;
+
+ ASSERT(IS_VALID_MODULE(enModule));
+
+ switch (enModule)
+ {
+ case Module0:
+ bRetVal = M0P_PCA->CCAPO_f.CCAPO0 ? TRUE : FALSE;
+ break;
+ case Module1:
+ bRetVal = M0P_PCA->CCAPO_f.CCAPO1 ? TRUE : FALSE;
+ break;
+ case Module2:
+ bRetVal = M0P_PCA->CCAPO_f.CCAPO2 ? TRUE : FALSE;
+ break;
+ case Module3:
+ bRetVal = M0P_PCA->CCAPO_f.CCAPO3 ? TRUE : FALSE;
+ break;
+ case Module4:
+ bRetVal = M0P_PCA->CCAPO_f.CCAPO4 ? TRUE : FALSE;
+ break;
+ default:
+ bRetVal = FALSE;
+ break;
+ }
+
+ return bRetVal;
+}
+
+//@} // PcaGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pcnt.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pcnt.c
new file mode 100644
index 0000000000..bdf0561aeb
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/pcnt.c
@@ -0,0 +1,417 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file pcnt.c
+ **
+ ** pcnt driver API.
+ ** @link pcnt Group Some description @endlink
+ **
+ ** - 2018-04-15 Devi First Version
+ **
+ ******************************************************************************/
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "pcnt.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup PCNTGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+#define IS_VALID_pagagain(x) ( (x) <= 7 )
+
+#define IS_VALID_channel(x) ( (OPA0 == (x)) ||\
+ (OPA1 == (x)) ||\
+ (OPA2 == (x)) )
+
+#define IS_VALID_STAT(x) ( (PCNT_S1E == (x)) ||\
+ (PCNT_S0E == (x)) ||\
+ (PCNT_BB == (x)) ||\
+ (PCNT_FE == (x)) ||\
+ (PCNT_DIR == (x)) ||\
+ (PCNT_TO == (x)) ||\
+ (PCNT_OV == (x)) ||\
+ (PCNT_UF == (x)) )
+
+
+
+/******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+static func_ptr_t pfnPcntCallback = NULL; ///< callback function pointer for PCNT Irq
+/******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*****************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ *****************************************************************************/
+
+void Pcnt_IRQHandler(void)
+{
+ if(NULL != pfnPcntCallback)
+ {
+ pfnPcntCallback();
+ }
+}
+
+/**
+ * \brief
+ * PCNT 初始化
+ *
+ * \param 无
+ * \param 无
+ *
+ * \retval 无
+ * \retval 无
+ */
+en_result_t PCNT_Init(stc_pcnt_config_t* pstcPcntConfig)
+{
+
+
+ M0P_SYSCTRL->PERI_CLKEN_f.PCNT = 1;
+
+ M0P_PCNT->CR_f.S1P = pstcPcntConfig->bS1Sel;
+ M0P_PCNT->CR_f.S0P = pstcPcntConfig->bS0Sel;
+ M0P_PCNT->CR_f.DIR = pstcPcntConfig->u8Direc; //计数方式
+ M0P_PCNT->CR_f.CLKSEL = pstcPcntConfig->u8Clk;
+ M0P_PCNT->CR_f.MODE = pstcPcntConfig->u8Mode;
+
+ M0P_PCNT->FLT_f.CLKDIV = pstcPcntConfig->u8FLTClk;
+
+ if(pstcPcntConfig->bFLTEn)
+ {
+ if(pstcPcntConfig->u8FLTDep == 0)
+ {
+ M0P_PCNT->FLT_f.DEBTOP = 2;
+ }
+ else
+ {
+ M0P_PCNT->FLT_f.DEBTOP = pstcPcntConfig->u8FLTDep;
+ }
+ }
+ M0P_PCNT->FLT_f.EN = pstcPcntConfig->bFLTEn;
+
+ M0P_PCNT->TOCR_f.TH = pstcPcntConfig->u16TODep;
+ M0P_PCNT->TOCR_f.EN = pstcPcntConfig->bTOEn;
+
+ if (TRUE == pstcPcntConfig->bIrqEn)
+ {
+ M0P_PCNT->IEN = pstcPcntConfig->u8IrqStatus;
+ EnableNvic(PCNT_IRQn,IrqLevel3,TRUE);
+ }
+ else
+ {
+ M0P_PCNT->IEN = 0x00;
+ EnableNvic(PCNT_IRQn,IrqLevel3,FALSE);
+ }
+ if(NULL != pstcPcntConfig->pfnIrqCb)
+ {
+ pfnPcntCallback = pstcPcntConfig->pfnIrqCb;
+ }
+ return Ok;
+}
+
+/**
+ * \brief
+ * PCNT 去初始化
+ *
+ * \param 无
+ * \param 无
+ *
+ * \retval 无
+ * \retval 无
+ */
+void PCNT_DeInit(void)
+{
+ M0P_PCNT->CR = 0;
+ M0P_PCNT->RUN = 0;
+ M0P_SYSCTRL->PERI_CLKEN_f.PCNT = 0;
+
+}
+
+/**
+ * \brief
+ * PCNT 脉冲计数设置
+ *
+ * \param [in] start 开始计数设置
+ * \param [in] end 结束计数设置
+ *
+ * \retval 无
+ */
+en_result_t PCNT_Parameter(uint8_t start,uint8_t end)
+{
+ uint32_t u32TimeOut;
+
+ u32TimeOut = 1000;
+ M0P_PCNT->BUF = end; //加载结束溢出值
+ M0P_PCNT->CMD_f.B2T = 1;
+
+ while(u32TimeOut--)
+ {
+ if(FALSE == M0P_PCNT->SR2_f.B2T)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut == 0)
+ {
+ return ErrorTimeout;
+ }
+
+ u32TimeOut = 1000;
+ M0P_PCNT->BUF = start; //加载初始值
+ M0P_PCNT->CMD_f.B2C = 1;
+
+ while(u32TimeOut--)
+ {
+ if(FALSE == M0P_PCNT->SR2_f.B2C)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut == 0)
+ {
+ return ErrorTimeout;
+ }
+ return Ok;
+}
+
+/**
+ * \brief
+ * 获取PCNT计数方向
+ * \param [in]
+ *
+ * \retval 无
+ */
+en_pcnt_direcsel_t PCNT_Direction(void)
+{
+ return (en_pcnt_direcsel_t)M0P_PCNT->SR1_f.DIR;
+}
+
+/**
+ * \brief
+ * 获取PCNT计数值
+ * \param [in]
+ *
+ * \retval 无
+ */
+uint16_t PCNT_Count(void)
+{
+ return M0P_PCNT->CNT;
+}
+
+/**
+ * \brief
+ * 获取PCNT溢出值
+ * \param [in]
+ *
+ * \retval 无
+ */
+uint16_t PCNT_TopCount(void)
+{
+ return M0P_PCNT->TOP;
+}
+
+/**
+ * \brief
+ * PCNT使能
+ * \param [in]
+ *
+ * \retval 无
+ */
+void PCNT_Run(boolean_t work)
+{
+ M0P_PCNT->RUN_f.RUN = work;
+}
+
+/**
+ * \brief
+ * PCNT 读取状态
+ * \param [in] en_pcnt_status_t PCNT状态
+ *
+ * \retval 无
+ */
+boolean_t PCNT_GetStatus(en_pcnt_status_t enStatus)
+{
+ boolean_t bFlag = FALSE;
+
+ ASSERT(IS_VALID_STAT(enStatus));
+
+ switch (enStatus)
+ {
+ case PCNT_S1E:
+ bFlag = M0P_PCNT->IFR_f.S1E;
+ break;
+ case PCNT_S0E:
+ bFlag = M0P_PCNT->IFR_f.S0E;
+ break;
+ case PCNT_BB:
+ bFlag = M0P_PCNT->IFR_f.BB;
+ break;
+ case PCNT_FE:
+ bFlag = M0P_PCNT->IFR_f.FE;
+ break;
+ case PCNT_DIR:
+ bFlag = M0P_PCNT->IFR_f.DIR;
+ break;
+ case PCNT_TO:
+ bFlag = M0P_PCNT->IFR_f.TO;
+ break;
+ case PCNT_OV:
+ bFlag = M0P_PCNT->IFR_f.OV;
+ break;
+ case PCNT_UF:
+ bFlag = M0P_PCNT->IFR_f.UF;
+ break;
+ default:
+ break;
+ }
+ return bFlag;
+}
+/**
+ * \brief
+ * PCNT 清除状态
+ * \param [in] en_pcnt_status_t PCNT状态
+ *
+ * \retval 无
+ */
+void PCNT_ClrStatus(en_pcnt_status_t enStatus)
+{
+
+ ASSERT(IS_VALID_STAT(enStatus));
+
+ switch (enStatus)
+ {
+ case PCNT_S1E:
+ M0P_PCNT->ICR_f.S1E = 0;
+ break;
+ case PCNT_S0E:
+ M0P_PCNT->ICR_f.S0E = 0;
+ break;
+ case PCNT_BB:
+ M0P_PCNT->ICR_f.BB = 0;
+ break;
+ case PCNT_FE:
+ M0P_PCNT->ICR_f.FE = 0;
+ break;
+ case PCNT_DIR:
+ M0P_PCNT->ICR_f.DIR = 0;
+ break;
+ case PCNT_TO:
+ M0P_PCNT->ICR_f.TO = 0;
+ break;
+ case PCNT_OV:
+ M0P_PCNT->ICR_f.OV = 0;
+ break;
+ case PCNT_UF:
+ M0P_PCNT->ICR_f.UF = 0;
+ break;
+ default:
+ break;
+ }
+}
+/**
+ * \brief
+ * PCNT 中断设置
+ * \param [in] en_pcnt_status_t PCNT状态
+ *
+ * \retval 无
+ */
+void PCNT_SetIrqStatus(en_pcnt_status_t enStatus)
+{
+
+ ASSERT(IS_VALID_STAT(enStatus));
+
+ switch (enStatus)
+ {
+ case PCNT_S1E:
+ M0P_PCNT->IEN_f.S1E = 1;
+ break;
+ case PCNT_S0E:
+ M0P_PCNT->IEN_f.S0E = 1;
+ break;
+ case PCNT_BB:
+ M0P_PCNT->IEN_f.BB = 1;
+ break;
+ case PCNT_FE:
+ M0P_PCNT->IEN_f.FE = 1;
+ break;
+ case PCNT_DIR:
+ M0P_PCNT->IEN_f.DIR = 1;
+ break;
+ case PCNT_TO:
+ M0P_PCNT->IEN_f.TO = 1;
+ break;
+ case PCNT_OV:
+ M0P_PCNT->IEN_f.OV = 1;
+ break;
+ case PCNT_UF:
+ M0P_PCNT->IEN_f.UF = 1;
+ break;
+ default:
+ break;
+ }
+}
+//@} // OPAGroup
+
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/reset.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/reset.c
new file mode 100644
index 0000000000..8dd5ca06d7
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/reset.c
@@ -0,0 +1,163 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file reset.c
+ **
+ ** Common API of reset.
+ ** @link resetGroup Some description @endlink
+ **
+ ** - 2017-05-04
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "reset.h"
+
+/**
+ *******************************************************************************
+ ** \addtogroup ResetGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *******************************************************************************
+ ** \brief 获取复位源类型.
+ **
+ ** \param [out] pstcOut 复位源类型列表
+ **
+ ** \retval Ok 操作成功
+ ** 其他 操作失败
+ ******************************************************************************/
+en_result_t Reset_GetCause(stc_reset_cause_t *pstcOut)
+{
+ uint8_t u8val = 0;
+ if (NULL == pstcOut)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ u8val = M0P_RESET->RESET_FLAG;
+
+ *pstcOut = *((stc_reset_cause_t*)&u8val);
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 清除复位源类型.
+ **
+ ** \param [in] stcval 复位源类型列表,每种类型对应的比特位写“0”清除,写“1”无效
+ **
+ ** \retval Ok 操作成功
+ ** 其他 操作失败
+ ******************************************************************************/
+en_result_t Reset_Clear(stc_reset_cause_t stcval)
+{
+ uint8_t u8val = *((uint8_t*)&stcval);
+
+ M0P_RESET->RESET_FLAG = u8val;
+
+ return Ok;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 设置外设复位源开关.
+ **
+ ** \param [in] enPeri 复位源类型列表
+ ** \param [in] bFlag 复位开关
+ **
+ ** \retval Ok 操作成功
+ ** 其他 操作失败
+ ******************************************************************************/
+en_result_t Reset_SetPeripheralReset(en_reset_peripheral_t enPeri, boolean_t bFlag)
+{
+
+ bFlag = !!bFlag;
+
+ if(TRUE == bFlag)
+ {
+ M0P_RESET->PREI_RESET |= (uint32_t)enPeri;
+ }
+ else
+ {
+ M0P_RESET->PREI_RESET &= ~(uint32_t)enPeri;
+ }
+
+ return Ok;
+}
+
+//@} // ResetGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rng.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rng.c
new file mode 100644
index 0000000000..8ec6c08531
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rng.c
@@ -0,0 +1,191 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file rng.c
+ **
+ ** Common API of rng.
+ ** @link flashGroup Some description @endlink
+ **
+ ** - 2018-05-08
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "rng.h"
+/**
+ *******************************************************************************
+ ** \addtogroup FlashGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief 随机数初始化(上电第一次生成随机数)
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Rng_Init(void)
+{
+ //==>>生成64bits随机数(上电第一次)
+ M0P_RNG->CR_f.RNGCIR_EN = 1;
+ //模式配置0
+ M0P_RNG->MODE_f.LOAD = 1;
+ M0P_RNG->MODE_f.FDBK = 1;
+ M0P_RNG->MODE_f.CNT = 6;
+ //生成随机数0
+ M0P_RNG->CR_f.RNG_RUN = 1;
+ while(M0P_RNG->CR_f.RNG_RUN)
+ {
+ ;
+ }
+
+ //模式配置1
+ M0P_RNG->MODE_f.LOAD = 0;
+ M0P_RNG->MODE_f.FDBK = 0;
+ M0P_RNG->MODE_f.CNT = 4;
+ //生成随机数1
+ M0P_RNG->CR_f.RNG_RUN = 1;
+ while(M0P_RNG->CR_f.RNG_RUN)
+ {
+ ;
+ }
+
+ //关闭随机源电路,节省功耗
+ M0P_RNG->CR_f.RNGCIR_EN = 0;
+
+ return Ok;
+}
+
+/**
+ *****************************************************************************
+ ** \brief 生成随机数(非上电第一次生成随机数)
+ **
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+en_result_t Rng_Generate(void)
+{
+ //==>>生成64bits随机数(非上电第一次生成)
+ M0P_RNG->CR_f.RNGCIR_EN = 1;
+
+ //模式配置0
+ M0P_RNG->MODE_f.LOAD = 0;
+ M0P_RNG->MODE_f.FDBK = 1;
+ M0P_RNG->MODE_f.CNT = 6;
+ //生成随机数0
+ M0P_RNG->CR_f.RNG_RUN = 1;
+ while(M0P_RNG->CR_f.RNG_RUN)
+ {
+ ;
+ }
+
+ //模式配置1
+ M0P_RNG->MODE_f.FDBK = 0;
+ M0P_RNG->MODE_f.CNT = 4;
+ M0P_RNG->MODE_f.CNT = 4;
+ //生成随机数1
+ M0P_RNG->CR_f.RNG_RUN = 1;
+ while(M0P_RNG->CR_f.RNG_RUN)
+ {
+ ;
+ }
+
+ //关闭随机源电路,节省功耗
+ M0P_RNG->CR_f.RNGCIR_EN = 0;
+
+ return Ok;
+}
+
+/**
+ *****************************************************************************
+ ** \brief 随机数获取
+ **
+ ** \retval data0
+ *****************************************************************************/
+uint32_t Rng_GetData0(void)
+{
+ return M0P_RNG->DATA0;
+}
+
+/**
+ *****************************************************************************
+ ** \brief 随机数获取
+ **
+ ** \retval data1
+ *****************************************************************************/
+uint32_t Rng_GetData1(void)
+{
+ return M0P_RNG->DATA1;
+}
+
+//@} // RngGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rtc.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rtc.c
new file mode 100644
index 0000000000..f6e1025edd
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/rtc.c
@@ -0,0 +1,875 @@
+/*************************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file rtc.c
+ **
+ ** RTC function driver API.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2017-05-17 1.0 CJ First version for Device Driver Library of Module.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "rtc.h"
+/**
+ ******************************************************************************
+ ** \addtogroup RtcGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Local pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+#define IS_VALID_CLK(x) (RtcClk32768 == (x)||\
+ RtcClk32768_1== (x)||\
+ RtcClk32 == (x)||\
+ RtcClk32_1 == (x)||\
+ RtcClkHxt128 == (x)||\
+ RtcClkHxt256 == (x)||\
+ RtcClkHxt512 == (x)||\
+ RtcClkHxt1024 == (x))
+
+#define IS_VALID_CYCSEL(x) (RtcPrads == (x)||\
+ RtcPradx==(x))
+
+#define IS_VALID_PRDS(x) (Rtc_None == (x)||\
+ Rtc_05S == (x)||\
+ Rtc_1S == (x)||\
+ Rtc_1Min == (x)||\
+ Rtc_1H == (x)||\
+ Rtc_1Day == (x)||\
+ Rtc_1Mon == (x)||\
+ Rtc_1Mon_1 == (x))
+
+#define IS_VALID_IRQ_SEL(x) (RtcPrdf == (x) ||\
+ RtcAlmf == (x))
+
+#define IS_VALID_FUNC(x) ((RtcCount==(x))||\
+ (RtcAlarmEn==(x))||\
+ (Rtc_ComenEn==(x))||\
+ (Rtc1HzOutEn==(x)))
+#define CkDateTime 0x7F
+#define CkDate 0x78
+#define CkTime 0x07
+
+//#define DecToBcd(x) ((((x)/10)<<4) + ((x)%10))
+//#define BcdToDec(x) ((((x)>>4)*10) + ((x)&0x0F))
+
+#define RTC_TIMEOUT 1000//test 1s
+
+/******************************************************************************/
+/* Local function prototypes ('const') */
+/******************************************************************************/
+const uint8_t Leap_Month_Base[] = {3,6,0,3,5,1,3,6,2,4,0,2};
+const uint8_t NonLeap_Month_Base[] = {4,0,0,3,5,1,3,6,2,4,0,2};
+const uint8_t Cnst_Month_Tbl[12]={0x31,0x28,0x31,0x30,0x31,0x30,0x31,0x31,0x30,0x31,0x30,0x31};
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+static stc_rtc_intern_cb_t* RtcGetInternDataCb(void);
+/******************************************************************************/
+/* Local variable prototypes ('static') */
+/******************************************************************************/
+static stc_rtc_intern_cb_t stcRtcIrqCb = {NULL, NULL};
+/**
+ ******************************************************************************
+ ** \brief RTC计数时钟选择
+ **
+ ** \param [in] enClk时钟源
+ **
+ ** \retval Ok
+ **
+ ******************************************************************************/
+en_result_t Rtc_SelClk(en_rtc_clk_t enClk)
+{
+ en_result_t enRet = Error;
+ ASSERT(IS_VALID_CLK(enClk));
+ M0P_RTC->CR1_f.CKSEL = enClk;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC周期中断方式选择
+ **
+ ** \param [in] pstccCyc周期中断方式及周期间隔选择
+ **
+ ** \retval Ok
+ **
+ ******************************************************************************/
+en_result_t Rtc_SetCyc(stc_rtc_cyc_sel_t* pstcCyc)
+{
+ en_result_t enRet = Error;
+ ASSERT(IS_VALID_CYCSEL(pstcCyc->enCyc_sel));
+ ASSERT(IS_VALID_PRDS(pstcCyc->enPrds_sel));
+ M0P_RTC->CR0_f.PRDSEL = pstcCyc->enCyc_sel;
+ if(pstcCyc->enCyc_sel)
+ {
+ M0P_RTC->CR0_f.PRDX = pstcCyc->u8Prdx;
+ }
+ else
+ {
+ M0P_RTC->CR0_f.PRDS = pstcCyc->enPrds_sel;
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC时制选择
+ **
+ ** \param [in] bmode是12时制or24时制
+ **
+ ** \retval Ok 设置正常
+ ** \retval ErrorInvalidParameter 设置异常
+ ******************************************************************************/
+en_result_t Rtc_SetAmPm(en_rtc_ampm_t enMode)
+{
+ en_result_t enRet = Error;
+ switch(enMode)
+ {
+ case 0:
+ case 1:
+ M0P_RTC->CR0_f.AMPM = enMode;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC时制获取
+ **
+ ** \param [in] 无
+ **
+ ** \retval 时制
+ ******************************************************************************/
+boolean_t Rtc_GetHourMode(void)
+{
+ return(M0P_RTC->CR0_f.AMPM);
+}
+/**
+ ******************************************************************************
+ ** \brief RTC闹钟中断设置
+ **
+ ** \param [in] pstcAlarmTime闹钟时间时、分、周
+ **
+ ** \retval Ok 设置正常
+ **
+ ******************************************************************************/
+en_result_t Rtc_SetAlarmTime(stc_rtc_alarmset_t* pstcAlarmTime)
+{
+ en_result_t enRet = Ok;
+ ASSERT(NULL != pstcAlarmTime);
+ if(Rtc12h == M0P_RTC->CR0_f.AMPM)
+ {
+ enRet = Check_BCD_Format(pstcAlarmTime->u8Hour,0x00,0x12);
+ }
+ else
+ {
+ enRet = Check_BCD_Format(pstcAlarmTime->u8Hour,0x00,0x24);
+ }
+ if(enRet != Ok)
+ {
+ return enRet;
+ }
+ enRet = Check_BCD_Format(pstcAlarmTime->u8Minute,0x00,0x59);
+ if(enRet != Ok)
+ {
+ return enRet;
+ }
+ // enRet = Check_BCD_Format(pstcAlarmTime->u8Week,0x00,0x06);
+ if(enRet != Ok)
+ {
+ return enRet;
+ }
+ M0P_RTC->ALMHOUR = pstcAlarmTime->u8Hour;
+ M0P_RTC->ALMMIN = pstcAlarmTime->u8Minute;
+ M0P_RTC->ALMWEEK = pstcAlarmTime->u8Week;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC闹钟中断时间获取
+ **
+ ** \param [in] pstcAlarmTime闹钟时间时、分、周
+ **
+ ** \retval Ok 设置正常
+ **
+ ******************************************************************************/
+en_result_t Rtc_GetAlarmTime(stc_rtc_alarmset_t* pstcAlarmTime)
+{
+ en_result_t enRet = Error;
+ ASSERT(NULL != pstcAlarmTime);
+ pstcAlarmTime->u8Minute = M0P_RTC->ALMMIN;
+ pstcAlarmTime->u8Hour = M0P_RTC->ALMHOUR;
+ pstcAlarmTime->u8Week = M0P_RTC->ALMWEEK;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC 1hz模式选择
+ **
+ ** \param [in] bmode 高精度和普通精度
+ **
+ ** \retval Ok 设置正常
+ **
+ ******************************************************************************/
+en_result_t Rtc_Set1HzMode(boolean_t bMode)
+{
+ en_result_t enRet = Error;
+ M0P_RTC->CR0_f.HZ1SEL = bMode;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC 1hz补偿值设置
+ **
+ ** \param [in] u16Cr 补偿值
+ **
+ ** \retval Ok 设置正常
+ **
+ ******************************************************************************/
+en_result_t Rtc_SetCompCr(uint16_t u16Cr)
+{
+ en_result_t enRet = Error;
+ M0P_RTC->COMPEN_f.CR = u16Cr;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC 功能使能设置
+ **
+ ** \param [in] enFunc 功能选择
+ **
+ ** \retval Ok 设置正常
+ ** \retval ErrorInvalidParameter 设置异常
+ ******************************************************************************/
+en_result_t Rtc_EnableFunc(en_rtc_func_t enFunc)
+{
+ ASSERT(IS_VALID_FUNC(enFunc));
+ switch(enFunc)
+ {
+ case RtcCount:
+ M0P_RTC->CR0_f.START = 1u;
+ break;
+ case RtcAlarmEn:
+ M0P_RTC->CR1_f.ALMEN = 1u;
+ break;
+ case Rtc_ComenEn:
+ M0P_RTC->COMPEN_f.EN = 1u;
+ break;
+ case Rtc1HzOutEn:
+ M0P_RTC->CR0_f.HZ1OE = 1u;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC 功能禁止设置
+ **
+ ** \param [in] enFunc 功能选择
+ **
+ ** \retval Ok 设置正常
+ ** \retval ErrorInvalidParameter 设置异常
+ ******************************************************************************/
+en_result_t Rtc_DisableFunc(en_rtc_func_t enFunc)
+{
+ ASSERT(IS_VALID_FUNC(enFunc));
+ switch(enFunc)
+ {
+ case RtcCount:
+ M0P_RTC->CR0_f.START = 0u;
+ break;
+ case RtcAlarmEn:
+ M0P_RTC->CR1_f.ALMEN = 0u;
+ break;
+ case Rtc_ComenEn:
+ M0P_RTC->COMPEN_f.EN = 0u;
+ break;
+ case Rtc1HzOutEn:
+ M0P_RTC->CR0_f.HZ1OE = 0u;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+uint8_t Change_DateTimeFormat(uint8_t u8sr)
+{
+ uint8_t u8de=0;
+ while(u8sr>=0x10)
+ {
+ u8de +=10;
+ u8sr -=0x10;
+ }
+ u8de += u8sr;
+ return(u8de);
+}
+/**
+ ******************************************************************************
+ ** \brief RTC 平、闰年检测
+ **
+ ** \param [in] u8year 年十进制低两位
+ **
+ ** \retval 1 闰年
+ ** \retval 0 平年
+ ******************************************************************************/
+uint8_t Rtc_CheckLeapYear(uint8_t u8year)
+{
+ uint8_t u8year_shl,u8year_shr;
+ u8year_shl = u8year>>2;
+ u8year_shr = u8year_shl<<2;
+ if(u8year== u8year_shr)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+/**
+ ******************************************************************************
+ ** \brief RTC根据日期计算周数
+ **
+ ** \param [in] pu8Date日期
+ **
+ ** \retval week 周数
+ **
+ ******************************************************************************/
+uint8_t Rtc_CalWeek(uint8_t* pu8Date)
+{
+ uint8_t u8week;
+ if((Rtc_CheckLeapYear(Change_DateTimeFormat(*(pu8Date+2)))==1))
+ {
+ u8week = (Change_DateTimeFormat(*(pu8Date+2))+Change_DateTimeFormat(*(pu8Date+2))/4+Leap_Month_Base[Change_DateTimeFormat(*(pu8Date+1))-1]+Change_DateTimeFormat(*(pu8Date))+2)%7;
+ }
+ else
+ {
+ u8week = (Change_DateTimeFormat(*(pu8Date+2))+Change_DateTimeFormat(*(pu8Date+2))/4+NonLeap_Month_Base[Change_DateTimeFormat(*(pu8Date+1))-1]+Change_DateTimeFormat(*(pu8Date))+2)%7;
+ }
+ return u8week;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC根据年月获取天数
+ **
+ ** \param [in] u8month月份,u8year年份
+ **
+ ** \retval u8day天数
+ **
+ ******************************************************************************/
+uint8_t Get_Month_Max_Day(uint8_t u8month, uint8_t u8year)
+{
+ uint8_t u8day = 0;
+
+ u8day = Cnst_Month_Tbl[u8month - 1];
+ if((u8month == 2) && ((u8year % 4) == 0))
+ {
+ u8day++;
+ }
+ return(u8day);//day的格式是bcd码,例如;日为31天,day=0x31
+}
+/**
+ ******************************************************************************
+ ** \brief RTC根据日期计算周数
+ **
+ ** \param [in] pu8buf日期时间数据,u8len检查数据长度,u8limit_min最小值,u8limit_max最大值
+ **
+ ** \retval Error 错误,Ok校验正确
+ **
+ ******************************************************************************/
+en_result_t Check_BCD_Format(uint8_t u8data,uint8_t u8limit_min, uint8_t u8limit_max)
+{
+
+ if (((u8data & 0x0F) > 0x09) || ((u8data & 0xF0) > 0x90)
+ ||(u8data > u8limit_max) || (u8data < u8limit_min))
+ {
+ return Error;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC时间格式检测
+ **
+ ** \param [in] pu8TimeDate日期时间数据,u8Mode检测模式
+ **
+ ** \retval enRet校验结果
+ **
+ ******************************************************************************/
+en_result_t Rtc_CheckDateTimeFormat(uint8_t* pu8TimeDate,uint8_t u8Mode)
+{
+ uint8_t u8i=0;
+ uint8_t u8mon_max_day = 0x28;
+ uint8_t u8date[3];
+ uint8_t u8Hour = 0;
+ en_result_t enRet=Error;
+ while(u8i<7)
+ {
+ if(u8Mode&&(1<<u8i))
+ {
+ switch(u8i)
+ {
+ case 0:
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x59);//秒
+ break;
+ case 1:
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x59);//分
+ break;
+ case 2:
+ if(Rtc12h == M0P_RTC->CR0_f.AMPM)
+ {
+ u8Hour = *pu8TimeDate&0x1f;
+ enRet = Check_BCD_Format(u8Hour,0x00,0x12);//时
+ }
+ else
+ {
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x24);
+ }
+ break;
+ case 3:
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x06);
+ break;
+ case 4:
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x31);
+ u8date[0] = *pu8TimeDate;
+ break;
+ case 5:
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x12);
+ u8date[1] = *pu8TimeDate;
+ break;
+ case 6:
+ enRet = Check_BCD_Format(*pu8TimeDate,0x00,0x99);
+ u8date[2] = *pu8TimeDate;
+ break;
+ default:
+ break;
+ }
+ pu8TimeDate++;
+ }
+ if(enRet!=Ok)
+ {
+ return enRet;
+ }
+ u8i++;
+ }
+ if((u8Mode&0x10)&&(u8Mode&0x20))
+ {
+ if(u8Mode&0x40)
+ {
+ u8mon_max_day = Get_Month_Max_Day(Change_DateTimeFormat(u8date[1]), Change_DateTimeFormat(u8date[2]));
+ }
+ else
+ {
+ u8mon_max_day = Get_Month_Max_Day(Change_DateTimeFormat(u8date[1]), 1);
+ }
+ if(u8date[0]>u8mon_max_day)
+ {
+ return Error;
+ }
+ }
+ if((u8Mode&0x10)&&(!(u8Mode&0x20)))
+ {
+ if(u8date[0]>0x28)
+ {
+ return Error;
+ }
+ }
+ enRet = Ok;
+ return(enRet);
+}
+/**
+ ******************************************************************************
+ ** \brief RTC设置时间函数
+ **
+ ** \param [in] pstcTimeDate日期时间数据、bUpdateTime是否更改时间、bUpdateDate是否更改日期
+ **
+ ** \retval Ok 设置正常
+ ** \retval ErrorTimeout 时间溢出错误
+ ******************************************************************************/
+en_result_t Rtc_WriteDateTime(stc_rtc_time_t* pstcTimeDate,boolean_t bUpdateTime,
+ boolean_t bUpdateDate)
+{
+ int32_t u32TimeOut;
+ uint8_t* pu8TimeDate;
+ en_result_t enRet = Ok;
+ u32TimeOut = RTC_TIMEOUT;
+ pu8TimeDate = &pstcTimeDate->u8Second;
+ ASSERT(NULL != pstcTimeDate);
+ if(1 == M0P_RTC->CR0_f.START)
+ {
+ M0P_RTC->CR1_f.WAIT = 1;
+ while(--u32TimeOut)
+ {
+ if(M0P_RTC->CR1_f.WAITF)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut==0)
+ {
+ return ErrorTimeout;
+ }
+ }
+ if(TRUE == bUpdateTime)
+ {
+ enRet = Rtc_CheckDateTimeFormat(pu8TimeDate,CkTime);
+ if(enRet != Ok)
+ {
+ return enRet;
+ }
+ M0P_RTC->SEC = pstcTimeDate->u8Second;
+ M0P_RTC->MIN = pstcTimeDate->u8Minute;
+ M0P_RTC->HOUR = pstcTimeDate->u8Hour;
+ }
+ if(TRUE == bUpdateDate)
+ {
+ enRet = Rtc_CheckDateTimeFormat(pu8TimeDate,CkDate);
+ if(enRet != Ok)
+ {
+ return enRet;
+ }
+ M0P_RTC->DAY = pstcTimeDate->u8Day;
+ M0P_RTC->MON = pstcTimeDate->u8Month;
+ M0P_RTC->YEAR = pstcTimeDate->u8Year;
+ M0P_RTC->WEEK = pstcTimeDate->u8DayOfWeek;
+ }
+ M0P_RTC->CR1_f.WAIT = 0;
+ if(1 == M0P_RTC->CR0_f.START)
+ {
+ while(M0P_RTC->CR1_f.WAITF)
+ {}
+ }
+ return enRet;
+}
+/**
+ ******************************************************************************
+** \brief RTC 12小时上午或下午获取
+ **
+ ** \param [in] 无
+ **
+** \retval 上午或下午
+ ******************************************************************************/
+boolean_t Rtc_RDAmPm(void)
+{
+ boolean_t bRet;
+
+ bRet = M0P_RTC->HOUR&0x20;
+ bRet>>=5;
+ return bRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC获取时间函数
+ **
+ ** \param [in] pstcTimeDate日期时间数据
+ **
+ ** \retval Ok 获取正常
+ ** \retval ErrorTimeout 时间溢出错误
+ ******************************************************************************/
+en_result_t Rtc_ReadDateTime(stc_rtc_time_t* pstcTimeDate)
+{
+ uint32_t u32TimeOut;
+ uint8_t u8DayOfWeek, u8BcdSec, u8BcdMin, u8BcdHour, u8Day, u8Month, u8Year;
+
+ ASSERT(NULL != pstcTimeDate);
+ u32TimeOut = RTC_TIMEOUT;
+ if(1 == M0P_RTC->CR0_f.START)
+ {
+ M0P_RTC->CR1_f.WAIT = 1;
+ while(u32TimeOut--)
+ {
+ if(M0P_RTC->CR1_f.WAITF)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut==0)
+ {
+ return ErrorTimeout;
+ }
+ }
+ u8BcdSec = M0P_RTC->SEC;
+ u8BcdMin = M0P_RTC->MIN;
+ u8BcdHour = M0P_RTC->HOUR;
+ u8Day = M0P_RTC->DAY;
+ u8Month = M0P_RTC->MON;
+ u8Year = M0P_RTC->YEAR;
+ u8DayOfWeek = M0P_RTC->WEEK;
+
+ pstcTimeDate->u8Second = u8BcdSec;
+ pstcTimeDate->u8Minute = u8BcdMin;
+ if(1 == M0P_RTC->CR0_f.AMPM)
+ {
+ pstcTimeDate->u8Hour = u8BcdHour;
+ }
+ else
+ {
+ pstcTimeDate->u8Hour = u8BcdHour&0x1f;
+ }
+ pstcTimeDate->u8Day = u8Day;
+ pstcTimeDate->u8Month = u8Month;
+ pstcTimeDate->u8Year = u8Year;
+ pstcTimeDate->u8DayOfWeek = u8DayOfWeek;
+
+ M0P_RTC->CR1_f.WAIT = 0;
+ if(1 == M0P_RTC->CR0_f.START)
+ {
+ while(M0P_RTC->CR1_f.WAITF)
+ {}
+ }
+
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC计数or读写状态获取
+ **
+ ** \param [in] 无
+ **
+ ** \retval 计数or读写状态
+ **
+ ******************************************************************************/
+boolean_t Rtc_RDStatus(void)
+{
+ boolean_t bRet;
+ bRet = M0P_RTC->CR1_f.WAITF;
+ return bRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC闹钟中断使能
+ **
+ ** \param [in] enordis中断使能or禁止
+ **
+ ** \retval Ok设置成功
+ **
+ ******************************************************************************/
+en_result_t Rtc_EnAlarmIrq(en_rtc_alarmirq_t enIrqEn)
+{
+ en_result_t enRet = Error;
+ M0P_RTC->CR1_f.ALMIE = enIrqEn;
+ Rtc_ClrIrqStatus(RtcAlmf);//使能中断后清除中断请求标记
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC中断请求状态获取
+ **
+ ** \param [in] enIrqSel获取哪种中断请求
+ **
+ ** \retval 中断请求状态
+ **
+ ******************************************************************************/
+boolean_t Rtc_GetIrqStatus(en_rtc_status_irq_t enIrqSel)
+{
+ boolean_t bRet = FALSE;
+ ASSERT(IS_VALID_IRQ_SEL(enIrqSel));
+ switch(enIrqSel)
+ {
+ case RtcPrdf:
+ (M0P_RTC->CR1_f.PRDF == 1)?(bRet = TRUE) : (bRet = FALSE);
+ break;
+ case RtcAlmf :
+ (M0P_RTC->CR1_f.ALMF == 1)?(bRet = TRUE) : (bRet = FALSE);
+ break;
+ default:
+ break;
+ }
+ return bRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC中断请求清除
+ **
+ ** \param [in] enIrqSel清除哪种中断请求
+ **
+ ** \retval Ok 清除成功
+ ** \retval ErrorInvalidParameter 清除失败
+ ******************************************************************************/
+en_result_t Rtc_ClrIrqStatus(en_rtc_status_irq_t enIrqSel)
+{
+ ASSERT(IS_VALID_IRQ_SEL(enIrqSel));
+ switch(enIrqSel)
+ {
+ case RtcPrdf:
+ M0P_RTC->CR1_f.PRDF = 0;
+ break;
+ case RtcAlmf:
+ M0P_RTC->CR1_f.ALMF = 0;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+
+/**
+ ******************************************************************************
+ ** \brief RTC中断处理函数接口获取
+ **
+ ** \param [in] 无
+ **
+ ** \retval 接口函数地址
+ **
+ ******************************************************************************/
+static stc_rtc_intern_cb_t* RtcGetInternDataCb(void)
+{
+ return &stcRtcIrqCb;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC总体初始化函数
+ **
+ ** \param [in] pstcRtcConfig初始化结构
+ **
+ ** \retval Ok初始化成功
+ ** \retval ErrorInvalidParameter 初始化错误
+ ******************************************************************************/
+en_result_t Rtc_Init(stc_rtc_config_t* pstcRtcConfig)
+{
+ en_result_t enRet = Error;
+ stc_rtc_intern_cb_t* pstcRtcInternCb;
+ if(NULL == pstcRtcConfig)
+ {
+ return Error;
+ }
+ pstcRtcInternCb = RtcGetInternDataCb();
+ enRet = Rtc_SelClk(pstcRtcConfig->enClkSel);
+ enRet = Rtc_SetAmPm(pstcRtcConfig->enAmpmSel);
+ if(enRet != Ok)
+ {
+ return enRet;
+ }
+ if(NULL != pstcRtcConfig->pstcCycSel)
+ {
+ if(Ok != Rtc_SetCyc(pstcRtcConfig->pstcCycSel))
+ {
+ return Error;
+ }
+ }
+ if(NULL != pstcRtcConfig->pstcTimeDate)
+ {
+ if(Ok != Rtc_WriteDateTime(pstcRtcConfig->pstcTimeDate,TRUE,TRUE))
+ {
+ return Error;
+ }
+ }
+ if(NULL != pstcRtcConfig->pstcIrqCb)
+ {
+ pstcRtcInternCb->pfnAlarmIrqCb = pstcRtcConfig->pstcIrqCb->pfnAlarmIrqCb;
+ pstcRtcInternCb->pfnTimerIrqCb = pstcRtcConfig->pstcIrqCb->pfnTimerIrqCb;
+ }
+ if(TRUE == pstcRtcConfig->bTouchNvic)
+ {
+ EnableNvic(RTC_IRQn,IrqLevel3,TRUE);
+ }
+ else
+ {
+ EnableNvic(RTC_IRQn,IrqLevel3,FALSE);
+ }
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC计数禁止函数
+ **
+ ** \param [in] 无
+ **
+ ** \retval Ok禁止设置成功
+ **
+ ******************************************************************************/
+en_result_t Rtc_DeInit(void)
+{
+ EnableNvic(RTC_IRQn,IrqLevel3,FALSE);
+ Rtc_DisableFunc(RtcCount);
+ Rtc_DisableFunc(RtcAlarmEn);
+ Rtc_DisableFunc(Rtc_ComenEn);
+ Rtc_DisableFunc(Rtc1HzOutEn);
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief RTC中断处理函数
+ **
+ ** \param [in] 无
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void Rtc_IRQHandler(void)
+{
+ stc_rtc_intern_cb_t* pstcRtcInternCb;
+ pstcRtcInternCb = RtcGetInternDataCb() ;
+ if(TRUE == M0P_RTC->CR1_f.ALMF)
+ {
+ M0P_RTC->CR1_f.ALMF = 0u;
+ if(NULL != pstcRtcInternCb->pfnAlarmIrqCb)
+ {
+ pstcRtcInternCb->pfnAlarmIrqCb();
+ }
+ }
+ if(TRUE == M0P_RTC->CR1_f.PRDF)
+ {
+ M0P_RTC->CR1_f.PRDF = 0;
+ if(NULL != pstcRtcInternCb->pfnTimerIrqCb)
+ {
+ pstcRtcInternCb->pfnTimerIrqCb();
+ }
+ }
+}
+//@} // RtcGroup
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/spi.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/spi.c
new file mode 100644
index 0000000000..8b9e8e6626
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/spi.c
@@ -0,0 +1,526 @@
+/******************************************************************************
+* Copyright (C) 2016, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with eaenCh copy of this software, whether used in part or whole,
+* at all times.
+*/
+/*****************************************************************************/
+/** \file spi.c
+ **
+ ** SPI driver API.
+ ** @link Driver Group Some description @endlink
+ **
+ ** - 2018-05-17 1.0 Devi First version for Device Driver Library of
+ ** Module.
+ **
+ *****************************************************************************/
+
+/******************************************************************************
+ * Include files
+ *****************************************************************************/
+#include "spi.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup SpiGroup
+ *****************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ *****************************************************************************/
+
+#define IS_VALID_STAT(x) ( SpiIf == (x)||\
+ SpiSserr == (x)||\
+ SpiBusy == (x)||\
+ SpiMdf == (x)||\
+ SpiTxe == (x)||\
+ SpiRxne == (x))
+#define IS_VALID_CH(x) ( Spi0 == (x)||\
+ Spi1 == (x))
+
+
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Local variable prototypes ('static') */
+/******************************************************************************/
+static func_ptr_t pfnSpi0Callback = NULL; ///< callback function pointer for SPI Irq
+static func_ptr_t pfnSpi1Callback = NULL; ///< callback function pointer for SPI Irq
+/**
+ ******************************************************************************
+ ** \brief SPI 中断处理函数
+ **
+ ** \param [in] enCh通道
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void Spi_IRQHandler(en_spi_channel_t enCh)
+{
+ if(Spi0 == enCh)
+ {
+ if(NULL != pfnSpi0Callback)
+ {
+ pfnSpi0Callback();
+ }
+ }
+ else
+ {
+ if(NULL != pfnSpi1Callback)
+ {
+ pfnSpi1Callback();
+ }
+
+ }
+}
+/**
+ ******************************************************************************
+ ** \brief SPI 请求状态获取
+ **
+ ** \param [in]enCh 通道
+ **
+ ** \retval 请求状态
+ **
+ ******************************************************************************/
+uint8_t Spi_GetState(en_spi_channel_t enCh)
+{
+ uint8_t u8State = 0;
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ u8State = M0P_SPI0->STAT;
+ }
+ else
+ {
+ u8State = M0P_SPI1->STAT;
+ }
+ return u8State;
+}
+/**
+ ******************************************************************************
+ ** \brief SPI 请求状态获取
+ **
+ ** \param [in]enCh 通道, enStatus 获取请求
+ **
+ ** \retval 请求状态
+ **
+ ******************************************************************************/
+boolean_t Spi_GetStatus(en_spi_channel_t enCh,en_spi_status_t enStatus)
+{
+ boolean_t bFlag = FALSE;
+ ASSERT(IS_VALID_CH(enCh));
+ ASSERT(IS_VALID_STAT(enStatus));
+ if(Spi0 == enCh)
+ {
+ switch (enStatus)
+ {
+ case SpiIf:
+ bFlag = M0P_SPI0->STAT_f.SPIF;
+ break;
+ case SpiSserr:
+ bFlag = M0P_SPI0->STAT_f.SSERR;
+ break;
+ case SpiMdf:
+ bFlag = M0P_SPI0->STAT_f.MDF;
+ break;
+ case SpiBusy:
+ bFlag = M0P_SPI0->STAT_f.BUSY;
+ break;
+ case SpiTxe:
+ bFlag = M0P_SPI0->STAT_f.TXE;
+ break;
+ case SpiRxne:
+ bFlag = M0P_SPI0->STAT_f.RXNE;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (enStatus)
+ {
+ case SpiIf:
+ bFlag = M0P_SPI1->STAT_f.SPIF;
+ break;
+ case SpiSserr:
+ bFlag = M0P_SPI1->STAT_f.SSERR;
+ break;
+ case SpiMdf:
+ bFlag = M0P_SPI1->STAT_f.MDF;
+ break;
+ case SpiBusy:
+ bFlag = M0P_SPI1->STAT_f.BUSY;
+ break;
+ case SpiTxe:
+ bFlag = M0P_SPI1->STAT_f.TXE;
+ break;
+ case SpiRxne:
+ bFlag = M0P_SPI1->STAT_f.RXNE;
+ break;
+ default:
+ break;
+ }
+ }
+ return bFlag;
+}
+/**
+ ******************************************************************************
+ ** \brief SPI中断清除
+ **
+ ** \param [in]enCh 通道, enStatus 获取请求
+ **
+ ** \retval 请求状态
+ **
+ ******************************************************************************/
+en_result_t Spi_ClearStatus(en_spi_channel_t enCh)
+{
+ en_result_t enRet = Error;
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ M0P_SPI0->ICLR_f.INT_CLR = 0;
+ }
+ else
+ {
+ M0P_SPI1->ICLR_f.INT_CLR = 0;
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief SPI 功能使能禁止函数
+ **
+ ** \param [in] enCh通道,enFunc功能,bFlag 0/1使能或禁止
+ **
+ ** \retval Ok初始化成功
+ ** \retval ErrorInvalidParameter 初始化错误
+ ******************************************************************************/
+en_result_t Spi_FuncEn(en_spi_channel_t enCh,en_spi_func_t enFunc,boolean_t bFlag)
+{
+ en_result_t enRet = Error;
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ switch(enFunc)
+ {
+ case SpiRxNeIe:
+ M0P_SPI0->CR2_f.RXNEIE = bFlag;
+ break;
+ case SpiTxEIe:
+ M0P_SPI0->CR2_f.TXEIE = bFlag;
+ break;
+ case SpiDmaTxEn:
+ M0P_SPI0->CR2_f.HDMA_TX = bFlag;
+ break;
+ case SpiDmaRxEn:
+ M0P_SPI0->CR2_f.HDMA_RX = bFlag;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ }
+ else
+ {
+ switch(enFunc)
+ {
+ case SpiRxNeIe:
+ M0P_SPI1->CR2_f.RXNEIE = bFlag;
+ break;
+ case SpiTxEIe:
+ M0P_SPI1->CR2_f.TXEIE = bFlag;
+ break;
+ case SpiDmaTxEn:
+ M0P_SPI1->CR2_f.HDMA_TX = bFlag;
+ break;
+ case SpiDmaRxEn:
+ M0P_SPI1->CR2_f.HDMA_RX = bFlag;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief SPI 总体初始化函数
+ **
+ ** \param [in]
+ enCh通道
+ pstcSpiConfig初始化结构
+ **
+ ** \retval Ok初始化成功
+ ** \retval ErrorInvalidParameter 初始化错误
+ ******************************************************************************/
+en_result_t Spi_Init(en_spi_channel_t enCh,stc_spi_config_t *pstcSpiConfig)
+{
+ ASSERT(NULL != pstcSpiConfig);
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ M0P_SPI0->CR = 0x00;
+
+ M0P_SPI0->CR_f.MSTR = pstcSpiConfig->bMasterMode;
+ M0P_SPI0->CR_f.CPOL = pstcSpiConfig->bCPOL;
+ M0P_SPI0->CR_f.CPHA = pstcSpiConfig->bCPHA;
+ if(pstcSpiConfig->u8BaudRate > SpiClkDiv16)
+ {
+ M0P_SPI0->CR_f.SPR2 = 1;
+ }
+ M0P_SPI0->CR |= (pstcSpiConfig->u8BaudRate&0x03u);
+
+ M0P_SPI0->STAT = 0x00;
+
+ M0P_SPI0->CR_f.SPEN = TRUE;
+ if (TRUE == pstcSpiConfig->bIrqEn)
+ {
+ M0P_SPI0->CR2_f.INT_EN = 1;
+ EnableNvic(SPI0_IRQn,IrqLevel3,TRUE);
+ }
+ else
+ {
+ EnableNvic(SPI0_IRQn,IrqLevel3,FALSE);
+ }
+ if(NULL != pstcSpiConfig->pfnSpi0IrqCb)
+ {
+ pfnSpi0Callback = pstcSpiConfig->pfnSpi0IrqCb;
+ }
+ }
+ else
+ {
+ M0P_SPI1->CR = 0x00;
+
+ M0P_SPI1->CR_f.MSTR = pstcSpiConfig->bMasterMode;
+ M0P_SPI1->CR_f.CPOL = pstcSpiConfig->bCPOL;
+ M0P_SPI1->CR_f.CPHA = pstcSpiConfig->bCPHA;
+ if(pstcSpiConfig->u8BaudRate > SpiClkDiv16)
+ {
+ M0P_SPI1->CR_f.SPR2 = 1;
+ }
+ M0P_SPI1->CR |= (pstcSpiConfig->u8BaudRate&0x03u);
+
+ M0P_SPI1->STAT = 0x00;
+
+ M0P_SPI1->CR_f.SPEN = TRUE;
+ if (TRUE == pstcSpiConfig->bIrqEn)
+ {
+ M0P_SPI1->CR2_f.INT_EN = 1;
+ EnableNvic(SPI1_IRQn,IrqLevel3,TRUE);
+ }
+ else
+ {
+ EnableNvic(SPI1_IRQn,IrqLevel3,FALSE);
+ }
+ if(NULL != pstcSpiConfig->pfnSpi1IrqCb)
+ {
+ pfnSpi1Callback = pstcSpiConfig->pfnSpi1IrqCb;
+ }
+ }
+ return Ok;
+}
+
+/**
+ ******************************************************************************
+ ** \brief SPI 禁止函数
+ **
+ ** \param [in] enCh通道
+ **
+ ** \retval Ok禁止设置成功
+ **
+ ******************************************************************************/
+en_result_t Spi_DeInit(en_spi_channel_t enCh)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ M0P_SPI0->DATA = 0x00;
+ M0P_SPI0->STAT = 0x00;
+ M0P_SPI0->CR = 0x00;
+ pfnSpi0Callback = NULL;
+ EnableNvic(SPI0_IRQn,IrqLevel3,FALSE);
+ }
+ else
+ {
+ M0P_SPI1->DATA = 0x00;
+ M0P_SPI1->STAT = 0x00;
+ M0P_SPI1->CR = 0x00;
+ pfnSpi1Callback = NULL;
+ EnableNvic(SPI1_IRQn,IrqLevel3,FALSE);
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief SPI 配置主发送的电平
+ **
+ ** \param [in] 高低电平
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void Spi_SetCS(en_spi_channel_t enCh,boolean_t bFlag)
+{
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ M0P_SPI0->SSN = bFlag;
+ }
+ else
+ {
+ M0P_SPI1->SSN = bFlag;
+ }
+}
+/**
+ ******************************************************************************
+ ** \brief SPI 发送一字节函数
+ **
+ ** \param [in] enCh通道,u8Data发送字节
+ **
+ ** \retval Ok发送成功
+ **
+ ******************************************************************************/
+en_result_t Spi_SendData(en_spi_channel_t enCh,uint8_t u8Data)
+{
+ uint32_t u32TimeOut;
+ ASSERT(IS_VALID_CH(enCh));
+ u32TimeOut = 1000;
+ if(Spi0 == enCh)
+ {
+ while(--u32TimeOut)
+ {
+ if(TRUE == M0P_SPI0->STAT_f.TXE)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut == 0)
+ {
+ return ErrorTimeout;
+ }
+ M0P_SPI0->DATA = u8Data;
+ u32TimeOut = 1000;
+ while(--u32TimeOut)
+ {
+ if(TRUE == M0P_SPI0->STAT_f.RXNE)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut == 0)
+ {
+ return ErrorTimeout;
+ }
+ u8Data = M0P_SPI0->DATA;
+ }
+ else
+ {
+ while(--u32TimeOut)
+ {
+ if(TRUE == M0P_SPI1->STAT_f.TXE)
+
+ {
+ break;
+ }
+ }
+ if(u32TimeOut == 0)
+ {
+ return ErrorTimeout;
+ }
+ M0P_SPI1->DATA = u8Data;
+ u32TimeOut = 1000;
+ while(--u32TimeOut)
+ {
+ if(TRUE == M0P_SPI1->STAT_f.RXNE)
+ {
+ break;
+ }
+ }
+ if(u32TimeOut == 0)
+ {
+ return ErrorTimeout;
+ }
+ u8Data = M0P_SPI1->DATA;
+ }
+ return Ok;
+}
+
+/**
+ ******************************************************************************
+ ** \brief SPI 接收一字节函数
+ **
+ ** \param [in] enCh接收通道
+ **
+ ** \retval 接收一字节数据
+ **
+ ******************************************************************************/
+uint8_t Spi_ReceiveData(en_spi_channel_t enCh,boolean_t bMasterOrSlave)
+{
+ uint8_t temp;
+ ASSERT(IS_VALID_CH(enCh));
+ if(Spi0 == enCh)
+ {
+ if(1 == bMasterOrSlave)
+ {
+ M0P_SPI0->DATA = 0x00;
+ }
+ while(0 == M0P_SPI0->STAT_f.RXNE){;}
+ temp = M0P_SPI0->DATA;
+ }
+ else
+ {
+ if(1 == bMasterOrSlave)
+ {
+ M0P_SPI1->DATA = 0x00;
+ }
+ while(0 == M0P_SPI1->STAT_f.RXNE){;}
+ temp = M0P_SPI1->DATA;
+ }
+ return temp;
+}
+
+//@} // SpiGroup
+/******************************************************************************
+ * EOF (not truncated)
+ *****************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/sysctrl.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/sysctrl.c
new file mode 100644
index 0000000000..c6f02cce9d
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/sysctrl.c
@@ -0,0 +1,776 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file sysctrl.c
+ **
+ ** Common API of sysctrl.
+ ** @link SysctrlGroup Some description @endlink
+ **
+ ** - 2018-04-22 Lux
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "sysctrl.h"
+
+/**
+ *******************************************************************************
+ ** \addtogroup SysctrlGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+#define CLK_TIMEOUT (1000000u)
+
+#define IS_VALID_SRC(x) ( ClkRCH == (x)||\
+ ClkXTH == (x)||\
+ ClkRCL == (x)||\
+ ClkXTL == (x) )
+
+
+#define IS_VALID_FUNC(x) ( ClkFuncWkupRCH == (x)||\
+ ClkFuncXTHEn == (x)||\
+ ClkFuncXTLEn == (x)||\
+ ClkFuncXTLAWSON == (x)||\
+ ClkFuncFaultEn == (x)||\
+ ClkFuncRtcLPWEn == (x)||\
+ ClkFuncLockUpEn == (x)||\
+ ClkFuncRstPinIOEn == (x)||\
+ ClkFuncSwdPinIOEn == (x) )
+
+#define RCH_CR_TRIM_24M_VAL (*((volatile uint16_t*) (0x00100C00ul)))
+#define RCH_CR_TRIM_22_12M_VAL (*((volatile uint16_t*) (0x00100C02ul)))
+#define RCH_CR_TRIM_16M_VAL (*((volatile uint16_t*) (0x00100C04ul)))
+#define RCH_CR_TRIM_8M_VAL (*((volatile uint16_t*) (0x00100C06ul)))
+#define RCH_CR_TRIM_4M_VAL (*((volatile uint16_t*) (0x00100C08ul)))
+
+#define RCL_CR_TRIM_38400_VAL (*((volatile uint16_t*) (0x00100C20ul)))
+#define RCL_CR_TRIM_32768_VAL (*((volatile uint16_t*) (0x00100C22ul)))
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+extern uint32_t SystemCoreClock;
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *******************************************************************************
+ ** \brief SYSCTRL0\SYSCTRL1寄存器操作解锁
+ **
+ ** \retval None
+ ******************************************************************************/
+static void _SysctrlUnlock(void)
+{
+ M0P_SYSCTRL->SYSCTRL2 = 0x5A5A;
+ M0P_SYSCTRL->SYSCTRL2 = 0xA5A5;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 系统时钟源使能
+ ** \param [in] enSource 目标时钟源
+ ** \param [in] bFlag 使能1-开/0-关
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_ClkSourceEnable(en_sysctrl_clk_source_t enSource, boolean_t bFlag)
+{
+ en_result_t enRet = Ok;
+
+ _SysctrlUnlock();
+ bFlag = !!bFlag;
+
+ switch (enSource)
+ {
+ case SysctrlClkRCH:
+ M0P_SYSCTRL->SYSCTRL0_f.RCH_EN = bFlag;
+ while(bFlag && (1 != M0P_SYSCTRL->RCH_CR_f.STABLE))
+ {
+ ;
+ }
+ break;
+
+ case SysctrlClkXTH:
+ M0P_GPIO->PDADS_f.PD00 = 1;
+ M0P_GPIO->PDADS_f.PD01 = 1;
+ M0P_SYSCTRL->SYSCTRL0_f.XTH_EN = bFlag;
+ while(bFlag && (1 != M0P_SYSCTRL->XTH_CR_f.STABLE))
+ {
+ ;
+ }
+ break;
+
+ case SysctrlClkRCL:
+ M0P_SYSCTRL->SYSCTRL0_f.RCL_EN = bFlag;
+ while(bFlag && (1 != M0P_SYSCTRL->RCL_CR_f.STABLE))
+ {
+ ;
+ }
+ break;
+
+ case SysctrlClkXTL:
+ M0P_GPIO->PCADS_f.PC14 = 1;
+ M0P_GPIO->PCADS_f.PC15 = 1;
+ M0P_SYSCTRL->SYSCTRL0_f.XTL_EN = bFlag;
+ while(bFlag && (1 != M0P_SYSCTRL->XTL_CR_f.STABLE))
+ {
+ ;
+ }
+ break;
+
+ case SysctrlClkPLL:
+ M0P_SYSCTRL->SYSCTRL0_f.PLL_EN = bFlag;
+ while(bFlag && (1 != M0P_SYSCTRL->PLL_CR_f.STABLE))
+ {
+ ;
+ }
+ break;
+
+ default:
+ enRet = ErrorInvalidParameter;
+ break;
+ }
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 外部高速晶振驱动配置
+ ** \param [in] enFreq 外部高速晶振频率范围选择
+ ** \param [in] enDriver 外部高速晶振驱动能力选择
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_XTHDriverConfig(en_sysctrl_xtal_driver_t enDriver)
+{
+ en_result_t enRet = Ok;
+
+ M0P_SYSCTRL->XTH_CR_f.DRIVER = enDriver;
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 外部低速晶振驱动配置
+ ** \param [in] enFreq 外部低速晶振频率范围选择
+ ** \param [in] enDriver 外部低速晶振驱动能力选择
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_XTLDriverConfig(en_sysctrl_xtl_amp_t enAmp, en_sysctrl_xtal_driver_t enDriver)
+{
+ en_result_t enRet = Ok;
+
+ M0P_SYSCTRL->XTL_CR_f.AMP_SEL = enAmp;
+ M0P_SYSCTRL->XTL_CR_f.DRIVER = enDriver;
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 外部高速时钟稳定周期配置
+ ** \param [in] enCycle 外部高速时钟稳定周期设置
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetXTHStableTime(en_sysctrl_xth_cycle_t enCycle)
+{
+ en_result_t enRet = Ok;
+ M0P_SYSCTRL->XTH_CR_f.STARTUP = enCycle;
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 内部低速时钟稳定周期配置
+ ** \param [in] enCycle 内部低速时钟稳定周期设置
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetRCLStableTime(en_sysctrl_rcl_cycle_t enCycle)
+{
+ en_result_t enRet = Ok;
+ M0P_SYSCTRL->RCL_CR_f.STARTUP = enCycle;
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 外部低速时钟稳定周期配置
+ ** \param [in] enCycle 外部低速时钟稳定周期设置
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetXTLStableTime(en_sysctrl_xtl_cycle_t enCycle)
+{
+ en_result_t enRet = Ok;
+ M0P_SYSCTRL->XTL_CR_f.STARTUP = enCycle;
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief PLL稳定周期配置
+ ** \param [in] enCycle PLL稳定周期设置
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetPLLStableTime(en_sysctrl_pll_cycle_t enCycle)
+{
+ en_result_t enRet = Ok;
+ M0P_SYSCTRL->PLL_CR_f.STARTUP = enCycle;
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 时钟源切换,该函数执行后会开启新时钟源
+ ** \note 选择时钟源之前,需根据需要配置目标时钟源的频率/驱动参数/使能时钟源等
+ ** \param [in] enSource 新时钟源
+ **
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SysClkSwitch(en_sysctrl_clk_source_t enSource)
+{
+ en_result_t enRet = Ok;
+
+ en_sysctrl_clk_source_t ClkNew = enSource;
+
+ _SysctrlUnlock();
+ M0P_SYSCTRL->SYSCTRL0_f.CLK_SW5_SEL = ClkNew;
+
+ //更新Core时钟(HCLK)
+ SystemCoreClockUpdate();
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 获得系统时钟(HCLK)频率值
+ ** \retval uint32_t HCLK频率值
+ **
+ ******************************************************************************/
+uint32_t Sysctrl_GetHClkFreq(void)
+{
+ uint32_t u32Val = 0;
+ const uint32_t u32hcr_tbl[] = { 4000000, 8000000, 16000000, 22120000, 24000000};
+ const uint16_t u32lcr_tbl[] = { 32768, 38400};
+ en_sysctrl_clk_source_t enSrc;
+ uint16_t u16Trim[5] = {0};
+ u16Trim[4] = RCH_CR_TRIM_24M_VAL;
+ u16Trim[3] = RCH_CR_TRIM_22_12M_VAL;
+ u16Trim[2] = RCH_CR_TRIM_16M_VAL;
+ u16Trim[1] = RCH_CR_TRIM_8M_VAL;
+ u16Trim[0] = RCL_CR_TRIM_38400_VAL;
+
+ //获取当前系统时钟
+ enSrc = (en_sysctrl_clk_source_t)(M0P_SYSCTRL->SYSCTRL0_f.CLK_SW5_SEL);
+
+ switch (enSrc)
+ {
+ case SysctrlClkRCH:
+ {
+
+ if((M0P_SYSCTRL->RCH_CR_f.TRIM) == (u16Trim[4]))
+ {
+ u32Val = u32hcr_tbl[4];
+ }
+ else if((M0P_SYSCTRL->RCH_CR_f.TRIM) == (u16Trim[3]))
+ {
+ u32Val = u32hcr_tbl[3];
+ }
+ else if((M0P_SYSCTRL->RCH_CR_f.TRIM) == (u16Trim[2]))
+ {
+ u32Val = u32hcr_tbl[2];
+ }
+ else if((M0P_SYSCTRL->RCH_CR_f.TRIM) == (u16Trim[1]))
+ {
+ u32Val = u32hcr_tbl[1];
+ }
+ else
+ {
+ u32Val = u32hcr_tbl[0];
+ }
+ }
+ break;
+ case SysctrlClkXTH:
+ u32Val = SYSTEM_XTH;
+ break;
+ case SysctrlClkRCL:
+ {
+ if(u16Trim[0] == (M0P_SYSCTRL->RCL_CR_f.TRIM))
+ {
+ u32Val = u32lcr_tbl[1];
+ }
+ else
+ {
+ u32Val = u32lcr_tbl[0];
+ }
+ }
+ break;
+ case SysctrlClkXTL:
+ u32Val = SYSTEM_XTL;
+ break;
+ case SysctrlClkPLL:
+ {
+ if (SysctrlPllRch == M0P_SYSCTRL->PLL_CR_f.REFSEL)
+ {
+ if(u16Trim[4] == M0P_SYSCTRL->RCH_CR_f.TRIM)
+ {
+ u32Val = u32hcr_tbl[4];
+ }
+ else if(u16Trim[3] == M0P_SYSCTRL->RCH_CR_f.TRIM)
+ {
+ u32Val = u32hcr_tbl[3];
+ }
+ else if(u16Trim[2] == M0P_SYSCTRL->RCH_CR_f.TRIM)
+ {
+ u32Val = u32hcr_tbl[2];
+ }
+ else if(u16Trim[1] == M0P_SYSCTRL->RCH_CR_f.TRIM)
+ {
+ u32Val = u32hcr_tbl[1];
+ }
+ else
+ {
+ u32Val = u32hcr_tbl[0];
+ }
+ }
+ else
+ {
+ u32Val = SYSTEM_XTH;
+ }
+
+ u32Val = (u32Val * M0P_SYSCTRL->PLL_CR_f.DIVN);
+ }
+ break;
+ default:
+ u32Val = 0u;
+ break;
+ }
+
+ u32Val = (u32Val >> M0P_SYSCTRL->SYSCTRL0_f.HCLK_PRS);
+
+ return u32Val;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 获得外设时钟(PCLK)频率值
+ ** \retval uint32_t PCLK频率值(Hz)
+ **
+ ******************************************************************************/
+uint32_t Sysctrl_GetPClkFreq(void)
+{
+ uint32_t u32Val = 0;
+
+ u32Val = Sysctrl_GetHClkFreq();
+ u32Val = (u32Val >> (M0P_SYSCTRL->SYSCTRL0_f.PCLK_PRS));
+
+ return u32Val;
+}
+
+
+/**
+ *******************************************************************************
+ ** \brief 时钟初始化函数
+ ** \param [in] pstcCfg 初始化配置参数
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_ClkInit(stc_sysctrl_clk_config_t *pstcCfg)
+{
+ en_result_t enRet = Ok;
+
+ //系统时钟参数配置
+ switch(pstcCfg->enClkSrc)
+ {
+ case SysctrlClkRCH:
+
+ break;
+ case SysctrlClkXTH:
+ Sysctrl_XTHDriverConfig(SysctrlXtalDriver3);
+ Sysctrl_SetXTHStableTime(SysctrlXthStableCycle16384);
+ break;
+ case SysctrlClkRCL:
+ Sysctrl_SetRCLStableTime(SysctrlRclStableCycle256);
+ break;
+ case SysctrlClkXTL:
+ Sysctrl_XTLDriverConfig(SysctrlXtlAmp3, SysctrlXtalDriver3);
+ Sysctrl_SetXTLStableTime(SysctrlXtlStableCycle16384);
+ break;
+ case SysctrlClkPLL:
+ Sysctrl_SetPLLStableTime(SysctrlPllStableCycle16384);
+ break;
+ default:
+ enRet = ErrorInvalidParameter;
+ break;
+ }
+
+ //时钟源使能
+ Sysctrl_ClkSourceEnable(pstcCfg->enClkSrc, TRUE);
+
+ //时钟源切换
+ Sysctrl_SysClkSwitch(pstcCfg->enClkSrc);
+
+ //时钟分频设置
+ Sysctrl_SetHCLKDiv(pstcCfg->enHClkDiv);
+ Sysctrl_SetPCLKDiv(pstcCfg->enPClkDiv);
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 时钟去初始化函数
+ ** \param [in]
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_ClkDeInit(void)
+{
+ en_result_t enRet = Ok;
+
+ //配置RCH为内部4Hz
+ Sysctrl_SetRCHTrim(SysctrlRchFreq4MHz);
+
+ //时钟源使能
+ Sysctrl_ClkSourceEnable(SysctrlClkRCH, TRUE);
+
+ //时钟源切换
+ Sysctrl_SysClkSwitch(SysctrlClkRCH);
+
+ //其它时钟源使能关闭
+ Sysctrl_ClkSourceEnable(SysctrlClkXTH, FALSE);
+ Sysctrl_ClkSourceEnable(SysctrlClkRCL, FALSE);
+ Sysctrl_ClkSourceEnable(SysctrlClkXTL, FALSE);
+ Sysctrl_ClkSourceEnable(SysctrlClkPLL, FALSE);
+
+ //时钟分频设置
+ Sysctrl_SetHCLKDiv(SysctrlHclkDiv1);
+ Sysctrl_SetPCLKDiv(SysctrlPclkDiv1);
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 内部高速时钟频率TRIM值加载
+ ** \param [in] enRCHFreq 设定的RCH目标频率值
+ ** \retval Ok 设定成功
+ ** 其他 设定失败或时钟未稳定
+ ******************************************************************************/
+en_result_t Sysctrl_SetRCHTrim(en_sysctrl_rch_freq_t enRCHFreq)
+{
+ en_result_t enRet = Ok;
+
+ //加载RCH Trim值
+ switch (enRCHFreq)
+ {
+ case SysctrlRchFreq4MHz:
+ M0P_SYSCTRL->RCH_CR_f.TRIM = RCH_CR_TRIM_4M_VAL;
+ break;
+ case SysctrlRchFreq8MHz:
+ M0P_SYSCTRL->RCH_CR_f.TRIM = RCH_CR_TRIM_8M_VAL;
+ break;
+ case SysctrlRchFreq16MHz:
+ M0P_SYSCTRL->RCH_CR_f.TRIM = RCH_CR_TRIM_16M_VAL;
+ break;
+ case SysctrlRchFreq22_12MHz:
+ M0P_SYSCTRL->RCH_CR_f.TRIM = RCH_CR_TRIM_22_12M_VAL;
+ break;
+ case SysctrlRchFreq24MHz:
+ M0P_SYSCTRL->RCH_CR_f.TRIM = RCH_CR_TRIM_24M_VAL;
+ break;
+ default:
+ enRet = ErrorInvalidParameter;
+ break;
+ }
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 外部高速时钟频率范围设定
+ ** \param [in] enXTHFreq 设定的频率值
+ ** \retval Ok 设定成功
+ ** 其他 设定失败或时钟未稳定
+ ******************************************************************************/
+en_result_t Sysctrl_SetXTHFreq(en_sysctrl_xth_freq_t enXTHFreq)
+{
+ en_result_t enRet = Ok;
+
+ M0P_SYSCTRL->XTH_CR_f.XTH_FSEL = enXTHFreq;
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief PLL时钟配置
+ ** \param [in] pstcPLLCfg PLL配置结构体指针
+ ** \retval Ok 设定成功
+ ** 其他 设定失败或参数值不匹配
+ ******************************************************************************/
+en_result_t Sysctrl_SetPLLFreq(stc_sysctrl_pll_config_t *pstcPLLCfg)
+{
+ en_result_t enRet = Ok;
+
+ uint16_t u16Trim[5] = {0};
+ u16Trim[4] = RCH_CR_TRIM_24M_VAL;
+ u16Trim[3] = RCH_CR_TRIM_22_12M_VAL;
+ u16Trim[2] = RCH_CR_TRIM_16M_VAL;
+ u16Trim[1] = RCH_CR_TRIM_8M_VAL;
+
+ ////PLL最高时钟不能超过48MHz
+ //RCH作为PLL输入
+ if (SysctrlPllRch == pstcPLLCfg->enPllClkSrc)
+ {
+ if( ((u16Trim[4] == M0P_SYSCTRL->RCH_CR_f.TRIM) && (pstcPLLCfg->enPllMul > 2)) ||
+ ((u16Trim[3] == M0P_SYSCTRL->RCH_CR_f.TRIM) && (pstcPLLCfg->enPllMul > 2)) ||
+ ((u16Trim[2] == M0P_SYSCTRL->RCH_CR_f.TRIM) && (pstcPLLCfg->enPllMul > 3)) ||
+ ((u16Trim[1] == M0P_SYSCTRL->RCH_CR_f.TRIM) && (pstcPLLCfg->enPllMul > 6)))
+ {
+ return ErrorInvalidMode;
+ }
+ }
+ else //XTH作为PLL输入
+ {
+ if ((SYSTEM_XTH * pstcPLLCfg->enPllMul) > 48*1000*1000)
+ {
+ return ErrorInvalidMode;
+ }
+ }
+
+ M0P_SYSCTRL->PLL_CR_f.FRSEL = pstcPLLCfg->enInFreq;
+ M0P_SYSCTRL->PLL_CR_f.FOSC = pstcPLLCfg->enOutFreq;
+ M0P_SYSCTRL->PLL_CR_f.DIVN = pstcPLLCfg->enPllMul;
+ M0P_SYSCTRL->PLL_CR_f.REFSEL = pstcPLLCfg->enPllClkSrc;
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 内部低速时钟频率TRIM值加载
+ ** \param [in] enRCLFreq 设定的RCL目标频率值
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetRCLTrim(en_sysctrl_rcl_freq_t enRCLFreq)
+{
+ en_result_t enRet = Ok;
+
+ switch (enRCLFreq)
+ {
+ case SysctrlRclFreq32768:
+ M0P_SYSCTRL->RCL_CR_f.TRIM = RCL_CR_TRIM_32768_VAL;
+ break;
+ case SysctrlRclFreq38400:
+ M0P_SYSCTRL->RCL_CR_f.TRIM = RCL_CR_TRIM_38400_VAL;
+ break;
+ default:
+ enRet = ErrorInvalidParameter;
+ break;
+ }
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 系统时钟(HCLK)分频设定
+ ** \param [in] enHCLKDiv 分频设定值
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetHCLKDiv(en_sysctrl_hclk_div_t enHCLKDiv)
+{
+ en_result_t enRet = Ok;
+
+ _SysctrlUnlock();
+ M0P_SYSCTRL->SYSCTRL0_f.HCLK_PRS = enHCLKDiv;
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 外设时钟(PCLK)分频设定
+ ** \param [in] enPCLKDiv 分频设定值
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetPCLKDiv(en_sysctrl_pclk_div_t enPCLKDiv)
+{
+ en_result_t enRet = Ok;
+
+ _SysctrlUnlock();
+ M0P_SYSCTRL->SYSCTRL0_f.PCLK_PRS = enPCLKDiv;
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 设置外设时钟门控开关
+ ** \param [in] enPeripheral 目标外设
+ ** \param [in] bFlag 使能开关
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetPeripheralGate(en_sysctrl_peripheral_gate_t enPeripheral, boolean_t bFlag)
+{
+ en_result_t enRet = Ok;
+
+ bFlag = !!bFlag;
+
+ setBit(&(M0P_SYSCTRL->PERI_CLKEN), enPeripheral, bFlag);
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 获得外设时钟门控开关状态
+ ** \param [in] enPeripheral 目标外设
+ ** \retval TRUE 开
+ ** FALSE 关
+ ******************************************************************************/
+boolean_t Sysctrl_GetPeripheralGate(en_sysctrl_peripheral_gate_t enPeripheral)
+{
+ return getBit(&(M0P_SYSCTRL->PERI_CLKEN), enPeripheral);
+}
+
+/**
+ *******************************************************************************
+ ** \brief 系统功能设定
+ ** \param [in] enFunc 系统功能枚举类型
+ ** \param [in] bFlag 1-开/0-关
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetFunc(en_sysctrl_func_t enFunc, boolean_t bFlag)
+{
+ en_result_t enRet = Ok;
+
+ _SysctrlUnlock();
+ bFlag = !!bFlag;
+
+ switch (enFunc)
+ {
+ case SysctrlWkupByRCHEn:
+ M0P_SYSCTRL->SYSCTRL0_f.WAKEUP_BYRCH = bFlag;
+ break;
+ case SysctrlEXTHEn:
+ M0P_SYSCTRL->SYSCTRL1_f.EXTH_EN = bFlag;
+ break;
+ case SysctrlEXTLEn:
+ M0P_SYSCTRL->SYSCTRL1_f.EXTL_EN = bFlag;
+ break;
+ case SysctrlXTLAlwaysOnEn:
+ M0P_SYSCTRL->SYSCTRL1_f.XTL_ALWAYS_ON = bFlag;
+ break;
+ case SysctrlClkFuncRTCLpmEn:
+ M0P_SYSCTRL->SYSCTRL1_f.RTC_LPW = bFlag;
+ break;
+ case SysctrlCMLockUpEn:
+ M0P_SYSCTRL->SYSCTRL1_f.LOCKUP_EN = bFlag;
+ break;
+ case SysctrlSWDUseIOEn:
+ M0P_SYSCTRL->SYSCTRL1_f.SWD_USE_IO = bFlag;
+ break;
+ default:
+ enRet = ErrorInvalidParameter;
+ break;
+ }
+
+ return enRet;
+}
+
+/**
+ *******************************************************************************
+ ** \brief 设定RTC校准时钟频率
+ ** \param [in] enRtcAdj 校准频率值
+ ** \retval Ok 设定成功
+ ** 其他 设定失败
+ ******************************************************************************/
+en_result_t Sysctrl_SetRTCAdjustClkFreq(en_sysctrl_rtc_adjust_t enRtcAdj)
+{
+ en_result_t enRet = Ok;
+
+ _SysctrlUnlock();
+ M0P_SYSCTRL->SYSCTRL1_f.RTC_FREQ_ADJUST = enRtcAdj;
+
+ return enRet;
+}
+
+//@} // SysctrlGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer0.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer0.c
new file mode 100644
index 0000000000..7210d18116
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer0.c
@@ -0,0 +1,1390 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file timer3.c
+ **
+ ** Common API of base timer.
+ ** @link BT Tiemr3 Group Some description @endlink
+ **
+ ** - 2018-04-18 First Version
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "timer0.h"
+/**
+ *******************************************************************************
+ ** \addtogroup Tim0Group
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+//#define IS_VALID_TIM(x) (TIM0 == (x) || TIM1 == (x) || TIM2 == (x))
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static func_ptr_t pfnTim0Callback = NULL;
+
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断标志获取(模式0/1/23)
+ **
+ **
+ ** \param [in] enTim0Irq 中断类型
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Tim0_GetIntFlag(en_tim0_irq_type_t enTim0Irq)
+{
+ boolean_t bRetVal = FALSE;
+ uint32_t u32Val;
+
+ u32Val = M0P_TIM0_MODE23->IFR;
+ bRetVal = (u32Val>>enTim0Irq) & 0x1;
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断标志清除(模式0/1/23)
+ **
+ **
+ ** \param [in] enTim0Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_ClearIntFlag(en_tim0_irq_type_t enTim0Irq)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->ICLR = ~(1u<<enTim0Irq);
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断所有标志清除(模式23)
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_ClearAllIntFlag(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->ICLR_f.BIF = 0;
+ M0P_TIM0_MODE23->ICLR_f.CA0E = 0;
+ M0P_TIM0_MODE23->ICLR_f.CA0F = 0;
+ M0P_TIM0_MODE23->ICLR_f.CB0E = 0;
+ M0P_TIM0_MODE23->ICLR_f.CB0F = 0;
+ M0P_TIM0_MODE23->ICLR_f.TIF = 0;
+ M0P_TIM0_MODE23->ICLR_f.UIF = 0;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断使能(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode0_EnableIrq(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->M0CR_f.UIE = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断禁止(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode0_DisableIrq(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->M0CR_f.UIE = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断使能(模式1)
+ **
+ **
+ ** \param [in] enTim0Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode1_EnableIrq (en_tim0_irq_type_t enTim0Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim0Irq)
+ {
+ case Tim0UevIrq:
+ M0P_TIM0_MODE1->M1CR_f.UIE = TRUE;
+ break;
+ case Tim0CA0Irq:
+ M0P_TIM0_MODE1->CR0_f.CIEA = TRUE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断禁止(模式1)
+ **
+ **
+ ** \param [in] enTim0Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode1_DisableIrq (en_tim0_irq_type_t enTim0Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim0Irq)
+ {
+ case Tim0UevIrq:
+ M0P_TIM0_MODE1->M1CR_f.UIE = FALSE;
+ break;
+ case Tim0CA0Irq:
+ M0P_TIM0_MODE1->CR0_f.CIEA = FALSE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断使能(模式23)
+ **
+ **
+ ** \param [in] enTim0Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode23_EnableIrq (en_tim0_irq_type_t enTim0Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim0Irq)
+ {
+ case Tim0UevIrq:
+ M0P_TIM0_MODE23->M23CR_f.UIE = TRUE;
+ break;
+ case Tim0CA0Irq:
+ M0P_TIM0_MODE23->CRCH0_f.CIEA = TRUE;
+ break;
+ case Tim0CB0Irq:
+ M0P_TIM0_MODE23->CRCH0_f.CIEB = TRUE;
+ break;
+// case Tim0CA1Irq:
+// M0P_TIM0_MODE23->CRCH1_f.CIEA = TRUE;
+// break;
+// case Tim0CB1Irq:
+// M0P_TIM0_MODE23->CRCH1_f.CIEB = TRUE;
+// break;
+// case Tim0CA2Irq:
+// M0P_TIM0_MODE23->CRCH2_f.CIEA = TRUE;
+// break;
+// case Tim0CB2Irq:
+// M0P_TIM0_MODE23->CRCH2_f.CIEB = TRUE;
+// break;
+ case Tim0BkIrq:
+ M0P_TIM0_MODE23->M23CR_f.BIE = TRUE;
+ break;
+ case Tim0TrigIrq:
+ M0P_TIM0_MODE23->M23CR_f.TIE = TRUE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断禁止(模式23)
+ **
+ **
+ ** \param [in] enTim0Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode23_DisableIrq (en_tim0_irq_type_t enTim0Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim0Irq)
+ {
+ case Tim0UevIrq:
+ M0P_TIM0_MODE23->M23CR_f.UIE = FALSE;
+ break;
+ case Tim0CA0Irq:
+ M0P_TIM0_MODE23->CRCH0_f.CIEA = FALSE;
+ break;
+ case Tim0CB0Irq:
+ M0P_TIM0_MODE23->CRCH0_f.CIEB = FALSE;
+ break;
+// case Tim0CA1Irq:
+// M0P_TIM0_MODE23->CRCH1_f.CIEA = FALSE;
+// break;
+// case Tim0CB1Irq:
+// M0P_TIM0_MODE23->CRCH1_f.CIEB = FALSE;
+// break;
+// case Tim0CA2Irq:
+// M0P_TIM0_MODE23->CRCH2_f.CIEA = FALSE;
+// break;
+// case Tim0CB2Irq:
+// M0P_TIM0_MODE23->CRCH2_f.CIEB = FALSE;
+// break;
+ case Tim0BkIrq:
+ M0P_TIM0_MODE23->M23CR_f.BIE = FALSE;
+ break;
+ case Tim0TrigIrq:
+ M0P_TIM0_MODE23->M23CR_f.TIE = FALSE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断服务函数
+ **
+ **
+ ** \param [in] u8Param Timer0通道选择(0 - TIM0)
+ **
+ ** \retval NULL
+ *****************************************************************************/
+void Tim0_IRQHandler(uint8_t u8Param)
+{
+ switch (u8Param)
+ {
+ case 0:
+ if(NULL != pfnTim0Callback)
+ {
+ pfnTim0Callback();
+ }
+ break;
+ default:
+ ;
+ break;
+ }
+}
+
+
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 初始化配置(模式0)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode0_Init(stc_tim0_mode0_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM0_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
+ M0P_TIM0_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
+ M0P_TIM0_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM0_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
+ M0P_TIM0_MODE0->M0CR_f.CT = pstcConfig->enCT;
+ M0P_TIM0_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
+
+ pfnTim0Callback = pstcConfig->pfnTim0Cb;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 启动运行(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M0_Run(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->M0CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 停止运行(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M0_Stop(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->M0CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 翻转输出使能/禁止设定(模式0)
+ **
+ **
+ ** \param [in] bEnOutput 翻转输出设定 TRUE:使能, FALSE:禁止
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M0_EnTOG_Output(boolean_t bEnOutput)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->DTR_f.MOE = bEnOutput;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数器初值设置(模式0)
+ **
+ **
+ ** \param [in] u16Data CNT 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M0_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数值获取(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Tim0_M0_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_TIM0_MODE0->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 重载值设置(模式0)
+ **
+ **
+ ** \param [in] u16Data 16bits重载值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M0_ARRSet(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->ARR_f.ARR = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 32位计数器初值设置(模式0)
+ **
+ **
+ ** \param [in] u32Data 32位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M0_Cnt32Set(uint32_t u32Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->CNT32_f.CNT32 = u32Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 32位计数值获取(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 32bits计数值
+ *****************************************************************************/
+uint32_t Tim0_M0_Cnt32Get(void)
+{
+ uint32_t u32CntData = 0;
+
+ u32CntData = M0P_TIM0_MODE0->CNT32_f.CNT32;
+
+ return u32CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer0 初始化配置(模式1)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode1_Init(stc_tim0_mode1_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+// M0P_TIM0_MODE0->M1CR_f.MODE = pstcConfig->enWorkMode;
+// M0P_TIM0_MODE0->M1CR_f.PRS = pstcConfig->enPRS;
+// M0P_TIM0_MODE0->M1CR_f.CT = pstcConfig->enCT;
+// M0P_TIM0_MODE0->M1CR_f.ONESHOT = pstcConfig->enOneShot;
+//
+// pfnTim0Callback = pstcConfig->pfnTim0Cb;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWC 输入配置(模式1)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M1_Input_Config(stc_tim0_pwc_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+// M0P_TIM0_MODE0->MSCR_f.TS = pstcConfig->enTsSel;
+// M0P_TIM0_MODE0->MSCR_f.IA0S = pstcConfig->enIA0Sel;
+// M0P_TIM0_MODE0->MSCR_f.IB0S = pstcConfig->enIB0Sel;
+// M0P_TIM0_MODE0->FLTR_f.ETP = pstcConfig->enETRPhase;
+// M0P_TIM0_MODE0->FLTR_f.FLTET = pstcConfig->enFltETR;
+// M0P_TIM0_MODE0->FLTR_f.FLTA0 = pstcConfig->enFltIA0;
+// M0P_TIM0_MODE0->FLTR_f.FLTB0 = pstcConfig->enFltIB0;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWC测量边沿起始结束选择(模式1)
+ **
+ **
+ ** \param [in] enEdgeSel pwc测量起始终止电平
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M1_PWC_Edge_Sel(en_tim0_m1cr_Edge_t enEdgeSel)
+{
+ en_result_t enResult = Ok;
+
+// switch (enEdgeSel)
+// {
+// case 0: ///< 上升沿到上升沿(周期)
+// M0P_TIM0_MODE0->M1CR_f.EDG1ST = 0; //上升沿
+// M0P_TIM0_MODE0->M1CR_f.EDG2ND = 0; //上升沿
+// break;
+// case 1: ///< 下降沿到上升沿(低电平)
+// M0P_TIM0_MODE0->M1CR_f.EDG1ST = 1; //下降沿
+// M0P_TIM0_MODE0->M1CR_f.EDG2ND = 0; //上升沿
+// break;
+// case 2: ///< 上升沿到下降沿(高电平)
+// M0P_TIM0_MODE0->M1CR_f.EDG1ST = 0; //上升沿
+// M0P_TIM0_MODE0->M1CR_f.EDG2ND = 1; //下降沿
+// break;
+// case 3: ///< 下降沿到下降沿(周期)
+// M0P_TIM0_MODE0->M1CR_f.EDG1ST = 1; //下降沿
+// M0P_TIM0_MODE0->M1CR_f.EDG2ND = 1; //下降沿
+// break;
+// default:
+// ;
+// break;
+// }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 启动运行(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M1_Run(void)
+{
+ en_result_t enResult = Ok;
+
+// M0P_TIM0_MODE0->M1CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 停止运行(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M1_Stop(void)
+{
+ en_result_t enResult = Ok;
+
+// M0P_TIM0_MODE0->M1CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数器初值设置(模式1)
+ **
+ **
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M1_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE0->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数值获取(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Tim0_M1_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_TIM0_MODE0->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 脉冲宽度测量结果数值获取(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits脉冲宽度测量结果
+ *****************************************************************************/
+uint16_t Tim0_M1_PWC_CapValueGet(void)
+{
+ uint16_t u16CapData = 0;
+
+// u16CapData = M0P_TIM0_MODE0->CCR0A_f.CCR0A;
+
+ return u16CapData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 初始化配置(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_Mode23_Init(stc_tim0_mode23_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
+
+ M0P_TIM0_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM0_MODE23->M23CR_f.CT = pstcConfig->enCT;
+ M0P_TIM0_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
+ M0P_TIM0_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
+ M0P_TIM0_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
+ M0P_TIM0_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
+ M0P_TIM0_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
+
+ pfnTim0Callback = pstcConfig->pfnTim0Cb;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWM输出使能(模式23)
+ **
+ **
+ ** \param [in] bEnOutput PWM输出使能/禁止设定
+ ** \param [in] bEnAutoOutput PWM自动输出使能/禁止设定
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnPWM_Output(boolean_t bEnOutput, boolean_t bEnAutoOutput)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->DTR_f.MOE = bEnOutput;
+ M0P_TIM0_MODE23->DTR_f.AOE = bEnAutoOutput;
+
+ return enResult;
+}
+
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 启动运行(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_Run(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 停止运行(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_Stop(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 重载值设置(模式23)
+ **
+ **
+ ** \param [in] u16Data 16bits重载值
+ ** \param [in] bArrBufEn ARR重载缓存使能TRUE/禁止FALSE
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_ARRSet(uint16_t u16Data, boolean_t bArrBufEn)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->ARR_f.ARR = u16Data;
+ M0P_TIM0_MODE23->M23CR_f.BUFPEN = bArrBufEn;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数器初值设置(模式23)
+ **
+ **
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数值获取(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Tim0_M23_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_TIM0_MODE23->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 比较捕获寄存器CCRxA/CCRxB设置(模式23)
+ **
+ **
+ ** \param [in] enCCRSel CCRxA/CCRxB设定
+ ** \param [in] u16Data CCRxA/CCRxB 16位初始值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_CCR_Set(en_tim0_m23_ccrx_t enCCRSel, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ if(Tim0CCR0A == enCCRSel)
+ {
+ M0P_TIM0_MODE23->CCR0A_f.CCR0A = u16Data;
+ }
+ else if(Tim0CCR0B == enCCRSel)
+ {
+ M0P_TIM0_MODE23->CCR0B_f.CCR0B = u16Data;
+ }
+// else if(Tim0CCR1A == enCCRSel)
+// {
+// M0P_TIM0_MODE23->CCR1A_f.CCR1A = u16Data;
+// }
+// else if(Tim0CCR1B == enCCRSel)
+// {
+// M0P_TIM0_MODE23->CCR1B_f.CCR1B = u16Data;
+// }
+// else if(Tim0CCR2A == enCCRSel)
+// {
+// M0P_TIM0_MODE23->CCR2A_f.CCR2A = u16Data;
+// }
+// else if(Tim0CCR2B == enCCRSel)
+// {
+// M0P_TIM0_MODE23->CCR2B_f.CCR2B = u16Data;
+// }
+ else
+ {
+ enResult = Error;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 比较捕获寄存器CCRxA/CCRxB读取(模式23)
+ **
+ **
+ ** \param [in] enCCRSel CCRxA/CCRxB设定
+ **
+ ** \retval 16bitsCCRxA/CCRxB捕获值
+ *****************************************************************************/
+uint16_t Tim0_M23_CCR_Get(en_tim0_m23_ccrx_t enCCRSel)
+{
+ uint16_t u16Data = 0;
+
+ if(Tim0CCR0A == enCCRSel)
+ {
+ u16Data = M0P_TIM0_MODE23->CCR0A_f.CCR0A;
+ }
+ else if(Tim0CCR0B == enCCRSel)
+ {
+ u16Data = M0P_TIM0_MODE23->CCR0B_f.CCR0B;
+ }
+// else if(Tim0CCR1A == enCCRSel)
+// {
+// u16Data = M0P_TIM0_MODE23->CCR1A_f.CCR1A;
+// }
+// else if(Tim0CCR1B == enCCRSel)
+// {
+// u16Data = M0P_TIM0_MODE23->CCR1B_f.CCR1B;
+// }
+// else if(Tim0CCR2A == enCCRSel)
+// {
+// u16Data = M0P_TIM0_MODE23->CCR2A_f.CCR2A;
+// }
+// else if(Tim0CCR2B == enCCRSel)
+// {
+// u16Data = M0P_TIM0_MODE23->CCR2B_f.CCR2B;
+// }
+ else
+ {
+ u16Data = 0;
+ }
+
+ return u16Data;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWM互补输出模式下,GATE功能选择(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_GateFuncSel(stc_tim0_m23_gate_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.CSG = pstcConfig->enGateFuncSel;
+ M0P_TIM0_MODE23->M23CR_f.CRG = pstcConfig->bGateRiseCap;
+ M0P_TIM0_MODE23->M23CR_f.CFG = pstcConfig->bGateFallCap;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 主从模式配置(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_MasterSlave_Set(stc_tim0_m23_master_slave_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->MSCR_f.MSM = pstcConfig->enMasterSlaveSel;
+ M0P_TIM0_MODE23->MSCR_f.MMS = pstcConfig->enMasterSrc;
+ M0P_TIM0_MODE23->MSCR_f.SMS = pstcConfig->enSlaveModeSel;
+ M0P_TIM0_MODE23->MSCR_f.TS = pstcConfig->enTsSel;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 CHxA/CHxB比较通道控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ ** \param [in] enTim0Chx Timer3通道(Tim0CH0, Tim0CH1, Tim0CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_PortOutput_Config(en_tim0_channel_t enTim0Chx, stc_tim0_m23_compare_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ switch (enTim0Chx)
+ {
+ case Tim0CH0:
+ M0P_TIM0_MODE23->CRCH0_f.CSA = 0;
+ M0P_TIM0_MODE23->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCHxACmpCtrl;
+ M0P_TIM0_MODE23->FLTR_f.CCPA0 = pstcConfig->enCHxAPolarity;
+ M0P_TIM0_MODE23->CRCH0_f.BUFEA = pstcConfig->bCHxACmpBufEn;
+ M0P_TIM0_MODE23->M23CR_f.CIS = pstcConfig->enCHxACmpIntSel;
+
+ M0P_TIM0_MODE23->CRCH0_f.CSB = 0;
+ M0P_TIM0_MODE23->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCHxBCmpCtrl;
+ M0P_TIM0_MODE23->FLTR_f.CCPB0 = pstcConfig->enCHxBPolarity;
+ M0P_TIM0_MODE23->CRCH0_f.BUFEB = pstcConfig->bCHxBCmpBufEn;
+ M0P_TIM0_MODE23->CRCH0_f.CISB = pstcConfig->enCHxBCmpIntSel;
+ break;
+// case Tim0CH1:
+// M0P_TIM0_MODE23->CRCH1_f.CSA = 0;
+// M0P_TIM0_MODE23->FLTR_f.OCMA1_FLTA1 = pstcConfig->enCHxACmpCtrl;
+// M0P_TIM0_MODE23->FLTR_f.CCPA1 = pstcConfig->enCHxAPolarity;
+// M0P_TIM0_MODE23->CRCH1_f.BUFEA = pstcConfig->bCHxACmpBufEn;
+// M0P_TIM0_MODE23->M23CR_f.CIS = pstcConfig->enCHxACmpIntSel;
+//
+// M0P_TIM0_MODE23->CRCH1_f.CSB = 0;
+// M0P_TIM0_MODE23->FLTR_f.OCMB1_FLTB1 = pstcConfig->enCHxBCmpCtrl;
+// M0P_TIM0_MODE23->FLTR_f.CCPB1 = pstcConfig->enCHxBPolarity;
+// M0P_TIM0_MODE23->CRCH1_f.BUFEB = pstcConfig->bCHxBCmpBufEn;
+// M0P_TIM0_MODE23->CRCH1_f.CISB = pstcConfig->enCHxBCmpIntSel;
+// break;
+// case Tim0CH2:
+// M0P_TIM0_MODE23->CRCH2_f.CSA = 0;
+// M0P_TIM0_MODE23->FLTR_f.OCMA2_FLTA2 = pstcConfig->enCHxACmpCtrl;
+// M0P_TIM0_MODE23->FLTR_f.CCPA2 = pstcConfig->enCHxAPolarity;
+// M0P_TIM0_MODE23->CRCH2_f.BUFEA = pstcConfig->bCHxACmpBufEn;
+// M0P_TIM0_MODE23->M23CR_f.CIS = pstcConfig->enCHxACmpIntSel;
+//
+// M0P_TIM0_MODE23->CRCH2_f.CSB = 0;
+// M0P_TIM0_MODE23->FLTR_f.OCMB2_FLTB2 = pstcConfig->enCHxBCmpCtrl;
+// M0P_TIM0_MODE23->FLTR_f.CCPB2 = pstcConfig->enCHxBPolarity;
+// M0P_TIM0_MODE23->CRCH2_f.BUFEB = pstcConfig->bCHxBCmpBufEn;
+// M0P_TIM0_MODE23->CRCH2_f.CISB = pstcConfig->enCHxBCmpIntSel;
+// break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 CHxA/CHxB输入控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ ** \param [in] enTim0Chx Timer3通道(Tim0CH0, Tim0CH1, Tim0CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_PortInput_Config(en_tim0_channel_t enTim0Chx, stc_tim0_m23_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ switch (enTim0Chx)
+ {
+ case Tim0CH0:
+ M0P_TIM0_MODE23->CRCH0_f.CSA = 1;
+ M0P_TIM0_MODE23->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enCHxACapSel;
+ M0P_TIM0_MODE23->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCHxAInFlt;
+ M0P_TIM0_MODE23->FLTR_f.CCPA0 = pstcConfig->enCHxAPolarity;
+
+ M0P_TIM0_MODE23->CRCH0_f.CSB = 1;
+ M0P_TIM0_MODE23->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enCHxBCapSel;
+ M0P_TIM0_MODE23->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCHxBInFlt;
+ M0P_TIM0_MODE23->FLTR_f.CCPB0 = pstcConfig->enCHxBPolarity;
+ break;
+// case Tim0CH1:
+// M0P_TIM0_MODE23->CRCH1_f.CSA = 1;
+// M0P_TIM0_MODE23->CRCH1_f.CFA_CRA_BKSA = pstcConfig->enCHxACapSel;
+// M0P_TIM0_MODE23->FLTR_f.OCMA1_FLTA1 = pstcConfig->enCHxAInFlt;
+// M0P_TIM0_MODE23->FLTR_f.CCPA1 = pstcConfig->enCHxAPolarity;
+//
+// M0P_TIM0_MODE23->CRCH1_f.CSB = 1;
+// M0P_TIM0_MODE23->CRCH1_f.CFB_CRB_BKSB = pstcConfig->enCHxBCapSel;
+// M0P_TIM0_MODE23->FLTR_f.OCMB1_FLTB1 = pstcConfig->enCHxBInFlt;
+// M0P_TIM0_MODE23->FLTR_f.CCPB1 = pstcConfig->enCHxBPolarity;
+// break;
+// case Tim0CH2:
+// M0P_TIM0_MODE23->CRCH2_f.CSA = 1;
+// M0P_TIM0_MODE23->CRCH2_f.CFA_CRA_BKSA = pstcConfig->enCHxACapSel;
+// M0P_TIM0_MODE23->FLTR_f.OCMA2_FLTA2 = pstcConfig->enCHxAInFlt;
+// M0P_TIM0_MODE23->FLTR_f.CCPA2 = pstcConfig->enCHxAPolarity;
+//
+// M0P_TIM0_MODE23->CRCH2_f.CSB = 1;
+// M0P_TIM0_MODE23->CRCH2_f.CFB_CRB_BKSB = pstcConfig->enCHxBCapSel;
+// M0P_TIM0_MODE23->FLTR_f.OCMB2_FLTB2 = pstcConfig->enCHxBInFlt;
+// M0P_TIM0_MODE23->FLTR_f.CCPB2 = pstcConfig->enCHxBPolarity;
+// break;
+ default:
+ enResult = Error;
+ break;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 ERT输入控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_ETRInput_Config(stc_tim0_m23_etr_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->FLTR_f.ETP = pstcConfig->enETRPolarity;
+ M0P_TIM0_MODE23->FLTR_f.FLTET = pstcConfig->enETRFlt;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 刹车BK输入控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_BrakeInput_Config(stc_tim0_m23_bk_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->DTR_f.BKE = pstcConfig->bEnBrake;
+ M0P_TIM0_MODE23->DTR_f.VC0E = pstcConfig->bEnVC0Brake;
+ M0P_TIM0_MODE23->DTR_f.VC1E = pstcConfig->bEnVC1Brake;
+ M0P_TIM0_MODE23->DTR_f.SAFEEN = pstcConfig->bEnSafetyBk;
+ M0P_TIM0_MODE23->DTR_f.BKSEL = pstcConfig->bEnBKSync;
+ M0P_TIM0_MODE23->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enBkCH0AStat;
+ M0P_TIM0_MODE23->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enBkCH0BStat;
+// M0P_TIM0_MODE23->CRCH1_f.CFA_CRA_BKSA = pstcConfig->enBkCH1AStat;
+// M0P_TIM0_MODE23->CRCH1_f.CFB_CRB_BKSB = pstcConfig->enBkCH1BStat;
+// M0P_TIM0_MODE23->CRCH2_f.CFA_CRA_BKSA = pstcConfig->enBkCH2AStat;
+// M0P_TIM0_MODE23->CRCH2_f.CFB_CRB_BKSB = pstcConfig->enBkCH2BStat;
+ M0P_TIM0_MODE23->FLTR_f.BKP = pstcConfig->enBrakePolarity;
+ M0P_TIM0_MODE23->FLTR_f.FLTBK = pstcConfig->enBrakeFlt;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 触发ADC控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_TrigADC_Config(stc_tim0_m23_adc_trig_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->ADTR_f.ADTE = pstcConfig->bEnTrigADC;
+ M0P_TIM0_MODE23->ADTR_f.UEVE = pstcConfig->bEnUevTrigADC;
+ M0P_TIM0_MODE23->ADTR_f.CMA0E = pstcConfig->bEnCH0ACmpTrigADC;
+ M0P_TIM0_MODE23->ADTR_f.CMB0E = pstcConfig->bEnCH0BCmpTrigADC;
+// M0P_TIM0_MODE23->ADTR_f.CMA1E = pstcConfig->bEnCH1ACmpTrigADC;
+// M0P_TIM0_MODE23->ADTR_f.CMB1E = pstcConfig->bEnCH1BCmpTrigADC;
+// M0P_TIM0_MODE23->ADTR_f.CMA2E = pstcConfig->bEnCH2ACmpTrigADC;
+// M0P_TIM0_MODE23->ADTR_f.CMB2E = pstcConfig->bEnCH2BCmpTrigADC;
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+** \brief Base Timer3 死区功能(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_DT_Config(stc_tim0_m23_dt_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->DTR_f.DTEN = pstcConfig->bEnDeadTime;
+ M0P_TIM0_MODE23->DTR_f.DTR = pstcConfig->u8DeadTimeValue;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+** \brief Base Timer3 重复周期设置(模式23)
+ **
+ **
+ ** \param [in] u8ValidPeriod 重复周期值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_SetValidPeriod(uint8_t u8ValidPeriod)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->RCR_f.RCR = u8ValidPeriod;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 OCREF清除功能(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_OCRefClr(stc_tim0_m23_OCREF_Clr_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.OCCS = pstcConfig->enOCRefClrSrcSel;
+ M0P_TIM0_MODE23->M23CR_f.OCCE = pstcConfig->bVCClrEn;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 使能DMA传输(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnDMA(stc_tim0_m23_trig_dma_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.UDE = pstcConfig->bUevTrigDMA;
+ M0P_TIM0_MODE23->M23CR_f.TDE = pstcConfig->bTITrigDMA;
+ M0P_TIM0_MODE23->CRCH0_f.CDEA = pstcConfig->bCmpA0TrigDMA;
+ M0P_TIM0_MODE23->CRCH0_f.CDEB = pstcConfig->bCmpB0TrigDMA;
+// M0P_TIM0_MODE23->CRCH1_f.CDEA = pstcConfig->bCmpA1TrigDMA;
+// M0P_TIM0_MODE23->CRCH1_f.CDEB = pstcConfig->bCmpB1TrigDMA;
+// M0P_TIM0_MODE23->CRCH2_f.CDEA = pstcConfig->bCmpA2TrigDMA;
+// M0P_TIM0_MODE23->CRCH2_f.CDEB = pstcConfig->bCmpB2TrigDMA;
+ M0P_TIM0_MODE23->MSCR_f.CCDS = pstcConfig->enCmpUevTrigDMA;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 捕获比较A软件触发(模式23)
+ **
+ **
+ ** \param [in] enTim0Chx Timer3通道(Tim0CH0, Tim0CH1, Tim0CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnSwTrigCapCmpA(en_tim0_channel_t enTim0Chx)
+{
+ en_result_t enResult = Ok;
+ if(Tim0CH0 == enTim0Chx)
+ {
+ M0P_TIM0_MODE23->CRCH0_f.CCGA = TRUE;
+ }
+// else if(Tim0CH1 == enTim0Chx)
+// {
+// M0P_TIM0_MODE23->CRCH1_f.CCGA = TRUE;
+// }
+// else if(Tim0CH2 == enTim0Chx)
+// {
+// M0P_TIM0_MODE23->CRCH2_f.CCGA = TRUE;
+// }
+ else
+ {
+ enResult = Error;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 捕获比较B软件触发(模式23)
+ **
+ **
+ ** \param [in] enTim0Chx Timer3通道(Tim0CH0, Tim0CH1, Tim0CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnSwTrigCapCmpB(en_tim0_channel_t enTim0Chx)
+{
+ en_result_t enResult = Ok;
+ if(Tim0CH0 == enTim0Chx)
+ {
+ M0P_TIM0_MODE23->CRCH0_f.CCGB = TRUE;
+ }
+// else if(Tim0CH1 == enTim0Chx)
+// {
+// M0P_TIM0_MODE23->CRCH1_f.CCGB = TRUE;
+// }
+// else if(Tim0CH2 == enTim0Chx)
+// {
+// M0P_TIM0_MODE23->CRCH2_f.CCGB = TRUE;
+// }
+ else
+ {
+ enResult = Error;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 软件更新使能(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnSwUev(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.UG = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 软件触发使能(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnSwTrig(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.TG = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 软件刹车使能(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim0_M23_EnSwBk(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM0_MODE23->M23CR_f.BG = TRUE;
+
+ return enResult;
+}
+
+//@} // Tim0Group
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer3.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer3.c
new file mode 100644
index 0000000000..983062704c
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/timer3.c
@@ -0,0 +1,1399 @@
+/******************************************************************************
+*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file timer3.c
+ **
+ ** Common API of base timer.
+ ** @link BT Tiemr3 Group Some description @endlink
+ **
+ ** - 2018-04-18 First Version
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "timer3.h"
+/**
+ *******************************************************************************
+ ** \addtogroup Tim3Group
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+//#define IS_VALID_TIM(x) (TIM0 == (x) || TIM1 == (x) || TIM2 == (x))
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static func_ptr_t pfnTim3Callback = NULL;
+
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断标志获取(模式0/1/23)
+ **
+ **
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Tim3_GetIntFlag(en_tim3_irq_type_t enTim3Irq)
+{
+ boolean_t bRetVal = FALSE;
+ uint32_t u32Val;
+
+ u32Val = M0P_TIM3_MODE23->IFR;
+ bRetVal = (u32Val>>enTim3Irq) & 0x1;
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断标志清除(模式0/1/23)
+ **
+ **
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_ClearIntFlag(en_tim3_irq_type_t enTim3Irq)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->ICLR = ~(1u<<enTim3Irq);
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断所有标志清除(模式23)
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_ClearAllIntFlag(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->ICLR_f.UIF = 0;
+ M0P_TIM3_MODE23->ICLR_f.CA0F = 0;
+ M0P_TIM3_MODE23->ICLR_f.CA1F = 0;
+ M0P_TIM3_MODE23->ICLR_f.CA2F = 0;
+ M0P_TIM3_MODE23->ICLR_f.CB0F = 0;
+ M0P_TIM3_MODE23->ICLR_f.CB1F = 0;
+ M0P_TIM3_MODE23->ICLR_f.CB2F = 0;
+ M0P_TIM3_MODE23->ICLR_f.BIF = 0;
+ M0P_TIM3_MODE23->ICLR_f.TIF = 0;
+ M0P_TIM3_MODE23->ICLR_f.CA0E = 0;
+ M0P_TIM3_MODE23->ICLR_f.CA1E = 0;
+ M0P_TIM3_MODE23->ICLR_f.CA2E = 0;
+ M0P_TIM3_MODE23->ICLR_f.CB0E = 0;
+ M0P_TIM3_MODE23->ICLR_f.CB1E = 0;
+ M0P_TIM3_MODE23->ICLR_f.CB2E = 0;
+
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断使能(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode0_EnableIrq(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->M0CR_f.UIE = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断禁止(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode0_DisableIrq(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->M0CR_f.UIE = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断使能(模式1)
+ **
+ **
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode1_EnableIrq (en_tim3_irq_type_t enTim3Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim3Irq)
+ {
+ case Tim3UevIrq:
+ M0P_TIM3_MODE1->M1CR_f.UIE = TRUE;
+ break;
+ case Tim3CA0Irq:
+ M0P_TIM3_MODE1->CR0_f.CIEA = TRUE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断禁止(模式1)
+ **
+ **
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode1_DisableIrq (en_tim3_irq_type_t enTim3Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim3Irq)
+ {
+ case Tim3UevIrq:
+ M0P_TIM3_MODE1->M1CR_f.UIE = FALSE;
+ break;
+ case Tim3CA0Irq:
+ M0P_TIM3_MODE1->CR0_f.CIEA = FALSE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断使能(模式23)
+ **
+ **
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode23_EnableIrq (en_tim3_irq_type_t enTim3Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim3Irq)
+ {
+ case Tim3UevIrq:
+ M0P_TIM3_MODE23->M23CR_f.UIE = TRUE;
+ break;
+ case Tim3CA0Irq:
+ M0P_TIM3_MODE23->CRCH0_f.CIEA = TRUE;
+ break;
+ case Tim3CB0Irq:
+ M0P_TIM3_MODE23->CRCH0_f.CIEB = TRUE;
+ break;
+ case Tim3CA1Irq:
+ M0P_TIM3_MODE23->CRCH1_f.CIEA = TRUE;
+ break;
+ case Tim3CB1Irq:
+ M0P_TIM3_MODE23->CRCH1_f.CIEB = TRUE;
+ break;
+ case Tim3CA2Irq:
+ M0P_TIM3_MODE23->CRCH2_f.CIEA = TRUE;
+ break;
+ case Tim3CB2Irq:
+ M0P_TIM3_MODE23->CRCH2_f.CIEB = TRUE;
+ break;
+ case Tim3BkIrq:
+ M0P_TIM3_MODE23->M23CR_f.BIE = TRUE;
+ break;
+ case Tim3TrigIrq:
+ M0P_TIM3_MODE23->M23CR_f.TIE = TRUE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断禁止(模式23)
+ **
+ **
+ ** \param [in] enTim3Irq 中断类型
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode23_DisableIrq (en_tim3_irq_type_t enTim3Irq)
+{
+ en_result_t enResult = Ok;
+
+
+ switch (enTim3Irq)
+ {
+ case Tim3UevIrq:
+ M0P_TIM3_MODE23->M23CR_f.UIE = FALSE;
+ break;
+ case Tim3CA0Irq:
+ M0P_TIM3_MODE23->CRCH0_f.CIEA = FALSE;
+ break;
+ case Tim3CB0Irq:
+ M0P_TIM3_MODE23->CRCH0_f.CIEB = FALSE;
+ break;
+ case Tim3CA1Irq:
+ M0P_TIM3_MODE23->CRCH1_f.CIEA = FALSE;
+ break;
+ case Tim3CB1Irq:
+ M0P_TIM3_MODE23->CRCH1_f.CIEB = FALSE;
+ break;
+ case Tim3CA2Irq:
+ M0P_TIM3_MODE23->CRCH2_f.CIEA = FALSE;
+ break;
+ case Tim3CB2Irq:
+ M0P_TIM3_MODE23->CRCH2_f.CIEB = FALSE;
+ break;
+ case Tim3BkIrq:
+ M0P_TIM3_MODE23->M23CR_f.BIE = FALSE;
+ break;
+ case Tim3TrigIrq:
+ M0P_TIM3_MODE23->M23CR_f.TIE = FALSE;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 中断服务函数
+ **
+ **
+ ** \param [in] u8Param Timer3通道选择(3 - TIM3)
+ **
+ ** \retval NULL
+ *****************************************************************************/
+void Tim3_IRQHandler(uint8_t u8Param)
+{
+ switch (u8Param)
+ {
+ case 0:
+ if(NULL != pfnTim3Callback)
+ {
+ pfnTim3Callback();
+ }
+ break;
+ default:
+ ;
+ break;
+ }
+}
+
+
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 初始化配置(模式0)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode0_Init(stc_tim3_mode0_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM3_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
+ M0P_TIM3_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
+ M0P_TIM3_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM3_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
+ M0P_TIM3_MODE0->M0CR_f.CT = pstcConfig->enCT;
+ M0P_TIM3_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
+
+ pfnTim3Callback = pstcConfig->pfnTim3Cb;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 启动运行(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M0_Run(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->M0CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 停止运行(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M0_Stop(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->M0CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 翻转输出使能/禁止设定(模式0)
+ **
+ **
+ ** \param [in] bEnOutput 翻转输出设定 TRUE:使能, FALSE:禁止
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M0_EnTOG_Output(boolean_t bEnOutput)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->DTR_f.MOE = bEnOutput;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数器初值设置(模式0)
+ **
+ **
+ ** \param [in] u16Data CNT 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M0_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数值获取(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Tim3_M0_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_TIM3_MODE0->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 重载值设置(模式0)
+ **
+ **
+ ** \param [in] u16Data 16bits重载值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M0_ARRSet(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->ARR_f.ARR = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 32位计数器初值设置(模式0)
+ **
+ **
+ ** \param [in] u32Data 32位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M0_Cnt32Set(uint32_t u32Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE0->CNT32_f.CNT32 = u32Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 32位计数值获取(模式0)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 32bits计数值
+ *****************************************************************************/
+uint32_t Tim3_M0_Cnt32Get(void)
+{
+ uint32_t u32CntData = 0;
+
+ u32CntData = M0P_TIM3_MODE0->CNT32_f.CNT32;
+
+ return u32CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 初始化配置(模式1)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode1_Init(stc_tim3_mode1_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
+ M0P_TIM3_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM3_MODE1->M1CR_f.CT = pstcConfig->enCT;
+ M0P_TIM3_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
+
+ pfnTim3Callback = pstcConfig->pfnTim3Cb;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWC 输入配置(模式1)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M1_Input_Config(stc_tim3_pwc_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE1->MSCR_f.TS = pstcConfig->enTsSel;
+ M0P_TIM3_MODE1->MSCR_f.IA0S = pstcConfig->enIA0Sel;
+ M0P_TIM3_MODE1->MSCR_f.IB0S = pstcConfig->enIB0Sel;
+ M0P_TIM3_MODE1->FLTR_f.ETP = pstcConfig->enETRPhase;
+ M0P_TIM3_MODE1->FLTR_f.FLTET = pstcConfig->enFltETR;
+ M0P_TIM3_MODE1->FLTR_f.FLTA0 = pstcConfig->enFltIA0;
+ M0P_TIM3_MODE1->FLTR_f.FLTB0 = pstcConfig->enFltIB0;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWC测量边沿起始结束选择(模式1)
+ **
+ **
+ ** \param [in] enEdgeSel pwc测量起始终止电平
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M1_PWC_Edge_Sel(en_tim3_m1cr_Edge_t enEdgeSel)
+{
+ en_result_t enResult = Ok;
+
+ switch (enEdgeSel)
+ {
+ case 0: ///< 上升沿到上升沿(周期)
+ M0P_TIM3_MODE1->M1CR_f.EDG1ST = 0; //上升沿
+ M0P_TIM3_MODE1->M1CR_f.EDG2ND = 0; //上升沿
+ break;
+ case 1: ///< 下降沿到上升沿(低电平)
+ M0P_TIM3_MODE1->M1CR_f.EDG1ST = 1; //下降沿
+ M0P_TIM3_MODE1->M1CR_f.EDG2ND = 0; //上升沿
+ break;
+ case 2: ///< 上升沿到下降沿(高电平)
+ M0P_TIM3_MODE1->M1CR_f.EDG1ST = 0; //上升沿
+ M0P_TIM3_MODE1->M1CR_f.EDG2ND = 1; //下降沿
+ break;
+ case 3: ///< 下降沿到下降沿(周期)
+ M0P_TIM3_MODE1->M1CR_f.EDG1ST = 1; //下降沿
+ M0P_TIM3_MODE1->M1CR_f.EDG2ND = 1; //下降沿
+ break;
+ default:
+ ;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 启动运行(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M1_Run(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE1->M1CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 停止运行(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M1_Stop(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE1->M1CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数器初值设置(模式1)
+ **
+ **
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M1_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE1->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数值获取(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Tim3_M1_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_TIM3_MODE1->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 脉冲宽度测量结果数值获取(模式1)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits脉冲宽度测量结果
+ *****************************************************************************/
+uint16_t Tim3_M1_PWC_CapValueGet(void)
+{
+ uint16_t u16CapData = 0;
+
+ u16CapData = M0P_TIM3_MODE1->CCR0A_f.CCR0A;
+
+ return u16CapData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 初始化配置(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_Mode23_Init(stc_tim3_mode23_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
+
+ M0P_TIM3_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
+ M0P_TIM3_MODE23->M23CR_f.CT = pstcConfig->enCT;
+ M0P_TIM3_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
+ M0P_TIM3_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
+ M0P_TIM3_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
+ M0P_TIM3_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
+ M0P_TIM3_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
+
+ pfnTim3Callback = pstcConfig->pfnTim3Cb;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWM输出使能(模式23)
+ **
+ **
+ ** \param [in] bEnOutput PWM输出使能/禁止设定
+ ** \param [in] bEnAutoOutput PWM自动输出使能/禁止设定
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnPWM_Output(boolean_t bEnOutput, boolean_t bEnAutoOutput)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->DTR_f.MOE = bEnOutput;
+ M0P_TIM3_MODE23->DTR_f.AOE = bEnAutoOutput;
+
+ return enResult;
+}
+
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 启动运行(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_Run(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.CTEN = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 停止运行(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_Stop(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.CTEN = FALSE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 重载值设置(模式23)
+ **
+ **
+ ** \param [in] u16Data 16bits重载值
+ ** \param [in] bArrBufEn ARR重载缓存使能TRUE/禁止FALSE
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_ARRSet(uint16_t u16Data, boolean_t bArrBufEn)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->ARR_f.ARR = u16Data;
+ M0P_TIM3_MODE23->M23CR_f.BUFPEN = bArrBufEn;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数器初值设置(模式23)
+ **
+ **
+ ** \param [in] u16Data 16位初值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_Cnt16Set(uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->CNT_f.CNT = u16Data;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 16位计数值获取(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval 16bits计数值
+ *****************************************************************************/
+uint16_t Tim3_M23_Cnt16Get(void)
+{
+ uint16_t u16CntData = 0;
+
+ u16CntData = M0P_TIM3_MODE23->CNT_f.CNT;
+
+ return u16CntData;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 比较捕获寄存器CCRxA/CCRxB设置(模式23)
+ **
+ **
+ ** \param [in] enCCRSel CCRxA/CCRxB设定
+ ** \param [in] u16Data CCRxA/CCRxB 16位初始值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_CCR_Set(en_tim3_m23_ccrx_t enCCRSel, uint16_t u16Data)
+{
+ en_result_t enResult = Ok;
+
+ if(Tim3CCR0A == enCCRSel)
+ {
+ M0P_TIM3_MODE23->CCR0A_f.CCR0A = u16Data;
+ }
+ else if(Tim3CCR0B == enCCRSel)
+ {
+ M0P_TIM3_MODE23->CCR0B_f.CCR0B = u16Data;
+ }
+ else if(Tim3CCR1A == enCCRSel)
+ {
+ M0P_TIM3_MODE23->CCR1A_f.CCR1A = u16Data;
+ }
+ else if(Tim3CCR1B == enCCRSel)
+ {
+ M0P_TIM3_MODE23->CCR1B_f.CCR1B = u16Data;
+ }
+ else if(Tim3CCR2A == enCCRSel)
+ {
+ M0P_TIM3_MODE23->CCR2A_f.CCR2A = u16Data;
+ }
+ else if(Tim3CCR2B == enCCRSel)
+ {
+ M0P_TIM3_MODE23->CCR2B_f.CCR2B = u16Data;
+ }
+ else
+ {
+ enResult = Error;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 比较捕获寄存器CCRxA/CCRxB读取(模式23)
+ **
+ **
+ ** \param [in] enCCRSel CCRxA/CCRxB设定
+ **
+ ** \retval 16bitsCCRxA/CCRxB捕获值
+ *****************************************************************************/
+uint16_t Tim3_M23_CCR_Get(en_tim3_m23_ccrx_t enCCRSel)
+{
+ uint16_t u16Data = 0;
+
+ if(Tim3CCR0A == enCCRSel)
+ {
+ u16Data = M0P_TIM3_MODE23->CCR0A_f.CCR0A;
+ }
+ else if(Tim3CCR0B == enCCRSel)
+ {
+ u16Data = M0P_TIM3_MODE23->CCR0B_f.CCR0B;
+ }
+ else if(Tim3CCR1A == enCCRSel)
+ {
+ u16Data = M0P_TIM3_MODE23->CCR1A_f.CCR1A;
+ }
+ else if(Tim3CCR1B == enCCRSel)
+ {
+ u16Data = M0P_TIM3_MODE23->CCR1B_f.CCR1B;
+ }
+ else if(Tim3CCR2A == enCCRSel)
+ {
+ u16Data = M0P_TIM3_MODE23->CCR2A_f.CCR2A;
+ }
+ else if(Tim3CCR2B == enCCRSel)
+ {
+ u16Data = M0P_TIM3_MODE23->CCR2B_f.CCR2B;
+ }
+ else
+ {
+ u16Data = 0;
+ }
+
+ return u16Data;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 PWM互补输出模式下,GATE功能选择(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_GateFuncSel(stc_tim3_m23_gate_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.CSG = pstcConfig->enGateFuncSel;
+ M0P_TIM3_MODE23->M23CR_f.CRG = pstcConfig->bGateRiseCap;
+ M0P_TIM3_MODE23->M23CR_f.CFG = pstcConfig->bGateFallCap;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 主从模式配置(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_MasterSlave_Set(stc_tim3_m23_master_slave_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->MSCR_f.MSM = pstcConfig->enMasterSlaveSel;
+ M0P_TIM3_MODE23->MSCR_f.MMS = pstcConfig->enMasterSrc;
+ M0P_TIM3_MODE23->MSCR_f.SMS = pstcConfig->enSlaveModeSel;
+ M0P_TIM3_MODE23->MSCR_f.TS = pstcConfig->enTsSel;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 CHxA/CHxB比较通道控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ ** \param [in] enTim3Chx Timer3通道(Tim3CH0, Tim3CH1, Tim3CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_PortOutput_Config(en_tim3_channel_t enTim3Chx, stc_tim3_m23_compare_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ switch (enTim3Chx)
+ {
+ case Tim3CH0:
+ M0P_TIM3_MODE23->CRCH0_f.CSA = 0;
+ M0P_TIM3_MODE23->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCHxACmpCtrl;
+ M0P_TIM3_MODE23->FLTR_f.CCPA0 = pstcConfig->enCHxAPolarity;
+ M0P_TIM3_MODE23->CRCH0_f.BUFEA = pstcConfig->bCHxACmpBufEn;
+ M0P_TIM3_MODE23->M23CR_f.CIS = pstcConfig->enCHxACmpIntSel;
+
+ M0P_TIM3_MODE23->CRCH0_f.CSB = 0;
+ M0P_TIM3_MODE23->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCHxBCmpCtrl;
+ M0P_TIM3_MODE23->FLTR_f.CCPB0 = pstcConfig->enCHxBPolarity;
+ M0P_TIM3_MODE23->CRCH0_f.BUFEB = pstcConfig->bCHxBCmpBufEn;
+ M0P_TIM3_MODE23->CRCH0_f.CISB = pstcConfig->enCHxBCmpIntSel;
+ break;
+ case Tim3CH1:
+ M0P_TIM3_MODE23->CRCH1_f.CSA = 0;
+ M0P_TIM3_MODE23->FLTR_f.OCMA1_FLTA1 = pstcConfig->enCHxACmpCtrl;
+ M0P_TIM3_MODE23->FLTR_f.CCPA1 = pstcConfig->enCHxAPolarity;
+ M0P_TIM3_MODE23->CRCH1_f.BUFEA = pstcConfig->bCHxACmpBufEn;
+ M0P_TIM3_MODE23->M23CR_f.CIS = pstcConfig->enCHxACmpIntSel;
+
+ M0P_TIM3_MODE23->CRCH1_f.CSB = 0;
+ M0P_TIM3_MODE23->FLTR_f.OCMB1_FLTB1 = pstcConfig->enCHxBCmpCtrl;
+ M0P_TIM3_MODE23->FLTR_f.CCPB1 = pstcConfig->enCHxBPolarity;
+ M0P_TIM3_MODE23->CRCH1_f.BUFEB = pstcConfig->bCHxBCmpBufEn;
+ M0P_TIM3_MODE23->CRCH1_f.CISB = pstcConfig->enCHxBCmpIntSel;
+ break;
+ case Tim3CH2:
+ M0P_TIM3_MODE23->CRCH2_f.CSA = 0;
+ M0P_TIM3_MODE23->FLTR_f.OCMA2_FLTA2 = pstcConfig->enCHxACmpCtrl;
+ M0P_TIM3_MODE23->FLTR_f.CCPA2 = pstcConfig->enCHxAPolarity;
+ M0P_TIM3_MODE23->CRCH2_f.BUFEA = pstcConfig->bCHxACmpBufEn;
+ M0P_TIM3_MODE23->M23CR_f.CIS = pstcConfig->enCHxACmpIntSel;
+
+ M0P_TIM3_MODE23->CRCH2_f.CSB = 0;
+ M0P_TIM3_MODE23->FLTR_f.OCMB2_FLTB2 = pstcConfig->enCHxBCmpCtrl;
+ M0P_TIM3_MODE23->FLTR_f.CCPB2 = pstcConfig->enCHxBPolarity;
+ M0P_TIM3_MODE23->CRCH2_f.BUFEB = pstcConfig->bCHxBCmpBufEn;
+ M0P_TIM3_MODE23->CRCH2_f.CISB = pstcConfig->enCHxBCmpIntSel;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 CHxA/CHxB输入控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ ** \param [in] enTim3Chx Timer3通道(Tim3CH0, Tim3CH1, Tim3CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_PortInput_Config(en_tim3_channel_t enTim3Chx, stc_tim3_m23_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ switch (enTim3Chx)
+ {
+ case Tim3CH0:
+ M0P_TIM3_MODE23->CRCH0_f.CSA = 1;
+ M0P_TIM3_MODE23->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enCHxACapSel;
+ M0P_TIM3_MODE23->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCHxAInFlt;
+ M0P_TIM3_MODE23->FLTR_f.CCPA0 = pstcConfig->enCHxAPolarity;
+
+ M0P_TIM3_MODE23->CRCH0_f.CSB = 1;
+ M0P_TIM3_MODE23->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enCHxBCapSel;
+ M0P_TIM3_MODE23->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCHxBInFlt;
+ M0P_TIM3_MODE23->FLTR_f.CCPB0 = pstcConfig->enCHxBPolarity;
+ break;
+ case Tim3CH1:
+ M0P_TIM3_MODE23->CRCH1_f.CSA = 1;
+ M0P_TIM3_MODE23->CRCH1_f.CFA_CRA_BKSA = pstcConfig->enCHxACapSel;
+ M0P_TIM3_MODE23->FLTR_f.OCMA1_FLTA1 = pstcConfig->enCHxAInFlt;
+ M0P_TIM3_MODE23->FLTR_f.CCPA1 = pstcConfig->enCHxAPolarity;
+
+ M0P_TIM3_MODE23->CRCH1_f.CSB = 1;
+ M0P_TIM3_MODE23->CRCH1_f.CFB_CRB_BKSB = pstcConfig->enCHxBCapSel;
+ M0P_TIM3_MODE23->FLTR_f.OCMB1_FLTB1 = pstcConfig->enCHxBInFlt;
+ M0P_TIM3_MODE23->FLTR_f.CCPB1 = pstcConfig->enCHxBPolarity;
+ break;
+ case Tim3CH2:
+ M0P_TIM3_MODE23->CRCH2_f.CSA = 1;
+ M0P_TIM3_MODE23->CRCH2_f.CFA_CRA_BKSA = pstcConfig->enCHxACapSel;
+ M0P_TIM3_MODE23->FLTR_f.OCMA2_FLTA2 = pstcConfig->enCHxAInFlt;
+ M0P_TIM3_MODE23->FLTR_f.CCPA2 = pstcConfig->enCHxAPolarity;
+
+ M0P_TIM3_MODE23->CRCH2_f.CSB = 1;
+ M0P_TIM3_MODE23->CRCH2_f.CFB_CRB_BKSB = pstcConfig->enCHxBCapSel;
+ M0P_TIM3_MODE23->FLTR_f.OCMB2_FLTB2 = pstcConfig->enCHxBInFlt;
+ M0P_TIM3_MODE23->FLTR_f.CCPB2 = pstcConfig->enCHxBPolarity;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 ERT输入控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_ETRInput_Config(stc_tim3_m23_etr_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->FLTR_f.ETP = pstcConfig->enETRPolarity;
+ M0P_TIM3_MODE23->FLTR_f.FLTET = pstcConfig->enETRFlt;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 刹车BK输入控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_BrakeInput_Config(stc_tim3_m23_bk_input_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->DTR_f.BKE = pstcConfig->bEnBrake;
+ M0P_TIM3_MODE23->DTR_f.VC0E = pstcConfig->bEnVC0Brake;
+ M0P_TIM3_MODE23->DTR_f.VC1E = pstcConfig->bEnVC1Brake;
+ M0P_TIM3_MODE23->DTR_f.SAFEEN = pstcConfig->bEnSafetyBk;
+ M0P_TIM3_MODE23->DTR_f.BKSEL = pstcConfig->bEnBKSync;
+ M0P_TIM3_MODE23->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enBkCH0AStat;
+ M0P_TIM3_MODE23->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enBkCH0BStat;
+ M0P_TIM3_MODE23->CRCH1_f.CFA_CRA_BKSA = pstcConfig->enBkCH1AStat;
+ M0P_TIM3_MODE23->CRCH1_f.CFB_CRB_BKSB = pstcConfig->enBkCH1BStat;
+ M0P_TIM3_MODE23->CRCH2_f.CFA_CRA_BKSA = pstcConfig->enBkCH2AStat;
+ M0P_TIM3_MODE23->CRCH2_f.CFB_CRB_BKSB = pstcConfig->enBkCH2BStat;
+ M0P_TIM3_MODE23->FLTR_f.BKP = pstcConfig->enBrakePolarity;
+ M0P_TIM3_MODE23->FLTR_f.FLTBK = pstcConfig->enBrakeFlt;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 触发ADC控制(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_TrigADC_Config(stc_tim3_m23_adc_trig_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->ADTR_f.ADTE = pstcConfig->bEnTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.UEVE = pstcConfig->bEnUevTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.CMA0E = pstcConfig->bEnCH0ACmpTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.CMB0E = pstcConfig->bEnCH0BCmpTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.CMA1E = pstcConfig->bEnCH1ACmpTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.CMB1E = pstcConfig->bEnCH1BCmpTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.CMA2E = pstcConfig->bEnCH2ACmpTrigADC;
+ M0P_TIM3_MODE23->ADTR_f.CMB2E = pstcConfig->bEnCH2BCmpTrigADC;
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+** \brief Base Timer3 死区功能(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_DT_Config(stc_tim3_m23_dt_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->DTR_f.DTEN = pstcConfig->bEnDeadTime;
+ M0P_TIM3_MODE23->DTR_f.DTR = pstcConfig->u8DeadTimeValue;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+** \brief Base Timer3 重复周期设置(模式23)
+ **
+ **
+ ** \param [in] u8ValidPeriod 重复周期值
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_SetValidPeriod(uint8_t u8ValidPeriod)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->RCR_f.RCR = u8ValidPeriod;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 OCREF清除功能(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_OCRefClr(stc_tim3_m23_OCREF_Clr_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.OCCS = pstcConfig->enOCRefClrSrcSel;
+ M0P_TIM3_MODE23->M23CR_f.OCCE = pstcConfig->bVCClrEn;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 使能DMA传输(模式23)
+ **
+ **
+ ** \param [in] pstcConfig 初始化配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnDMA(stc_tim3_m23_trig_dma_config_t* pstcConfig)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.UDE = pstcConfig->bUevTrigDMA;
+ M0P_TIM3_MODE23->M23CR_f.TDE = pstcConfig->bTITrigDMA;
+ M0P_TIM3_MODE23->CRCH0_f.CDEA = pstcConfig->bCmpA0TrigDMA;
+ M0P_TIM3_MODE23->CRCH0_f.CDEB = pstcConfig->bCmpB0TrigDMA;
+ M0P_TIM3_MODE23->CRCH1_f.CDEA = pstcConfig->bCmpA1TrigDMA;
+ M0P_TIM3_MODE23->CRCH1_f.CDEB = pstcConfig->bCmpB1TrigDMA;
+ M0P_TIM3_MODE23->CRCH2_f.CDEA = pstcConfig->bCmpA2TrigDMA;
+ M0P_TIM3_MODE23->CRCH2_f.CDEB = pstcConfig->bCmpB2TrigDMA;
+ M0P_TIM3_MODE23->MSCR_f.CCDS = pstcConfig->enCmpUevTrigDMA;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 捕获比较A软件触发(模式23)
+ **
+ **
+ ** \param [in] enTim3Chx Timer3通道(Tim3CH0, Tim3CH1, Tim3CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnSwTrigCapCmpA(en_tim3_channel_t enTim3Chx)
+{
+ en_result_t enResult = Ok;
+ if(Tim3CH0 == enTim3Chx)
+ {
+ M0P_TIM3_MODE23->CRCH0_f.CCGA = TRUE;
+ }
+ else if(Tim3CH1 == enTim3Chx)
+ {
+ M0P_TIM3_MODE23->CRCH1_f.CCGA = TRUE;
+ }
+ else if(Tim3CH2 == enTim3Chx)
+ {
+ M0P_TIM3_MODE23->CRCH2_f.CCGA = TRUE;
+ }
+ else
+ {
+ enResult = Error;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 捕获比较B软件触发(模式23)
+ **
+ **
+ ** \param [in] enTim3Chx Timer3通道(Tim3CH0, Tim3CH1, Tim3CH2)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnSwTrigCapCmpB(en_tim3_channel_t enTim3Chx)
+{
+ en_result_t enResult = Ok;
+ if(Tim3CH0 == enTim3Chx)
+ {
+ M0P_TIM3_MODE23->CRCH0_f.CCGB = TRUE;
+ }
+ else if(Tim3CH1 == enTim3Chx)
+ {
+ M0P_TIM3_MODE23->CRCH1_f.CCGB = TRUE;
+ }
+ else if(Tim3CH2 == enTim3Chx)
+ {
+ M0P_TIM3_MODE23->CRCH2_f.CCGB = TRUE;
+ }
+ else
+ {
+ enResult = Error;
+ }
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 软件更新使能(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnSwUev(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.UG = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 软件触发使能(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnSwTrig(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.TG = TRUE;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Base Timer3 软件刹车使能(模式23)
+ **
+ **
+ ** \param [in] none
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Tim3_M23_EnSwBk(void)
+{
+ en_result_t enResult = Ok;
+
+ M0P_TIM3_MODE23->M23CR_f.BG = TRUE;
+
+ return enResult;
+}
+
+//@} // Tim3Group
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/trim.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/trim.c
new file mode 100644
index 0000000000..413a8fc248
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/trim.c
@@ -0,0 +1,348 @@
+/******************************************************************************
+*Copyright(C)2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+
+/** \file trim.c
+ **
+ ** Common API of trim.
+ ** @link trimGroup Some description @endlink
+ **
+ ** - 2017-05-16
+ **
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "trim.h"
+/**
+ *******************************************************************************
+ ** \addtogroup TrimGroup
+ ******************************************************************************/
+//@{
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+#define IS_VALID_TRIMINT(x) (TrimStop == (x) ||\
+ TrimCalCntOf == (x) ||\
+ TrimXTLFault == (x) ||\
+ TrimXTHFault == (x) ||\
+ TrimPLLFault == (x))
+
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+static func_ptr_t pfnTrimCallback = NULL;
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+/**
+ *****************************************************************************
+ ** \brief Trim中断标志获取
+ **
+ **
+ ** \param [in] enIntType 中断类型(RefStop、CalCntOf、XTAL32KFault、XTAL32MFault)
+ **
+ ** \retval TRUE or FALSE
+ *****************************************************************************/
+boolean_t Trim_GetIntFlag(en_trim_inttype_t enIntType)
+{
+ boolean_t bRetVal = FALSE;
+
+ ASSERT(IS_VALID_TRIMINT(enIntType));
+
+ switch (enIntType)
+ {
+ case TrimStop:
+ bRetVal = M0P_CLK_TRIM->IFR_f.STOP ? TRUE : FALSE;
+ break;
+ case TrimCalCntOf:
+ bRetVal = M0P_CLK_TRIM->IFR_f.CALCNT_OF ? TRUE : FALSE;
+ break;
+ case TrimXTLFault:
+ bRetVal = M0P_CLK_TRIM->IFR_f.XTL_FAULT ? TRUE : FALSE;
+ break;
+ case TrimXTHFault:
+ bRetVal = M0P_CLK_TRIM->IFR_f.XTH_FAULT ? TRUE : FALSE;
+ break;
+ case TrimPLLFault:
+ bRetVal = M0P_CLK_TRIM->IFR_f.PLL_FAULT ? TRUE : FALSE;
+ break;
+ default:
+ bRetVal = FALSE;
+ break;
+ }
+
+ return bRetVal;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim中断标志清除
+ **
+ **
+ ** \param [in] enIntType 中断类型(RefStop、CalCntOf、XTAL32KFault、XTAL32MFault)
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Trim_ClearIntFlag(en_trim_inttype_t enIntType)
+{
+ en_result_t enResult = Error;
+
+ ASSERT(IS_VALID_TRIMINT(enIntType));
+
+ switch (enIntType)
+ {
+ case TrimStop:
+ M0P_CLK_TRIM->CR_f.TRIM_START = FALSE;
+ enResult = Ok;
+ break;
+ case TrimCalCntOf:
+ M0P_CLK_TRIM->CR_f.TRIM_START = FALSE;
+ enResult = Ok;
+ break;
+ case TrimXTLFault:
+ M0P_CLK_TRIM->ICLR_f.XTL_FAULT_CLR = FALSE;
+ enResult = Ok;
+ break;
+ case TrimXTHFault:
+ M0P_CLK_TRIM->ICLR_f.XTH_FAULT_CLR = FALSE;
+ enResult = Ok;
+ break;
+ case TrimPLLFault:
+ M0P_CLK_TRIM->ICLR_f.PLL_FAULT_CLR = FALSE;
+ enResult = Ok;
+ break;
+ default:
+ enResult = Error;
+ break;
+ }
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim中断服务函数
+ **
+ **
+ ** \param [in] u8Param == 0
+ **
+ ** \retval NULL
+ *****************************************************************************/
+void ClkTrim_IRQHandler(uint8_t u8Param)
+{
+ if(NULL != pfnTrimCallback)
+ {
+ pfnTrimCallback();
+ }
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim中断使能
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Trim_EnableIrq (void)
+{
+ en_result_t enResult = Error;
+
+ M0P_CLK_TRIM->CR_f.IE = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim中断禁止
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Trim_DisableIrq(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_CLK_TRIM->CR_f.IE = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim初始化配置
+ **
+ **
+ ** \param [in] pstcConfig Trim配置结构体指针
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Trim_Init(stc_trim_config_t* pstcConfig)
+{
+ en_result_t enResult = Error;
+
+ M0P_CLK_TRIM->CR_f.MON_EN = pstcConfig->enMON;
+
+ if (TrimCalPLL == pstcConfig->enCALCLK)
+ {
+ M0P_CLK_TRIM->CR_f.CALCLK_SEL2 = TRUE;
+ M0P_CLK_TRIM->CR_f.CALCLK_SEL = pstcConfig->enCALCLK;
+ }
+ else
+ {
+ M0P_CLK_TRIM->CR_f.CALCLK_SEL2 = FALSE;
+ M0P_CLK_TRIM->CR_f.CALCLK_SEL = pstcConfig->enCALCLK;
+ }
+
+ M0P_CLK_TRIM->CR_f.REFCLK_SEL = pstcConfig->enREFCLK;
+
+ M0P_CLK_TRIM->REFCON_f.RCNTVAL = pstcConfig->u32RefCon;
+ if(TrimMonEnable == pstcConfig->enMON)
+ {
+ M0P_CLK_TRIM->CALCON_f.CCNTVAL = pstcConfig->u32CalCon;
+ }
+
+
+ pfnTrimCallback = pstcConfig->pfnTrimCb;
+
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim校准/监测启动运行
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Trim_Run(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_CLK_TRIM->CR_f.TRIM_START = TRUE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim校准/监测停止
+ **
+ **
+ **
+ **
+ ** \retval Ok or Error
+ *****************************************************************************/
+en_result_t Trim_Stop(void)
+{
+ en_result_t enResult = Error;
+
+ M0P_CLK_TRIM->CR_f.TRIM_START = FALSE;
+ enResult = Ok;
+
+ return enResult;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim参考计数器计数值获取
+ **
+ **
+ ** \retval u32Data 参考计数器计数值
+ *****************************************************************************/
+uint32_t Trim_RefCntGet(void)
+{
+ uint32_t u32Data = 0;
+
+ u32Data = M0P_CLK_TRIM->REFCNT_f.REFCNT;
+
+ return u32Data;
+}
+
+/**
+ *****************************************************************************
+ ** \brief Trim校准计数器计数值获取
+ **
+ **
+ **
+ **
+ ** \retval u32Data 校准计数器计数值
+ *****************************************************************************/
+uint32_t Trim_CalCntGet(void)
+{
+ uint32_t u32Data = 0;
+
+ u32Data = M0P_CLK_TRIM->CALCNT_f.CALCNT;
+
+ return u32Data;
+}
+
+//@} // TrimGroup
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/uart.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/uart.c
new file mode 100644
index 0000000000..f17a7ccc61
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/uart.c
@@ -0,0 +1,910 @@
+/*************************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file uart.c
+ **
+ ** UART function driver API.
+ ** @link SampleGroup Some description @endlink
+ **
+ ** - 2017-05-17 1.0 CJ First version for Device Driver Library of Module.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "uart.h"
+/**
+ ******************************************************************************
+ ** \addtogroup UartGroup
+ ******************************************************************************/
+//@{
+/******************************************************************************/
+/* Local pre-processor symbols/macros ('#define') */
+/******************************************************************************/
+
+#define IS_VALID_CH(x) ((UARTCH0 == (x)) ||\
+ (UARTCH1 == (x)))
+
+#define IS_VALID_IRQSEL(x) ((UartTxIrq == (x)) ||\
+ (UartRxIrq == (x)) ||\
+ (UartFEIrq == (x)) ||\
+ (UartCtsIrq == (x))||\
+ (UartPEIrq == (x)) ||\
+ (UartTxEIrq == (x)))
+
+#define IS_VALID_MODE(x) ((UartMode0==(x))||\
+ (UartMode1==(x))||\
+ (UartMode2==(x))||\
+ (UartMode3==(x)))
+
+#define IS_VALID_STATUS(x) ((UartCts == (x))||\
+ (UartRC == (x))||\
+ (UartTC == (x))||\
+ (UartPE == (x))||\
+ (UartCtsIf == (x))||\
+ (UartTxe == (x))||\
+ (UartFE == (x)))
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+static stc_uart_instance_data_t* UartGetInternDataPtr(uint8_t u8Idx);
+static void UartInitNvic(uint8_t u8Idx);
+static void UartDeInitNvic(uint8_t u8Idx);
+/******************************************************************************/
+/* Local variable definitions ('static') */
+/******************************************************************************/
+static stc_uart_instance_data_t m_astcUartInstanceDataLut[] =
+{
+ {
+ UARTCH0,
+ M0P_UART0, /* pstcInstance */
+ {NULL,NULL,NULL,NULL,NULL},
+ },
+ {
+ UARTCH1,
+ M0P_UART1, /* pstcInstance */
+ {NULL,NULL,NULL,NULL,NULL},
+ },
+};
+/**
+ ******************************************************************************
+ ** \brief UART0/1通道 相关地址获取
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 通道对应的地址结构
+ **
+ ******************************************************************************/
+static stc_uart_instance_data_t* UartGetInternDataPtr(uint8_t u8Idx)
+{
+ stc_uart_instance_data_t* pstcData = NULL;
+ uint8_t u8i = 0;
+ for (u8i = 0; u8i < ARRAY_SZ(m_astcUartInstanceDataLut); u8i++)
+ {
+ if (u8Idx == m_astcUartInstanceDataLut[u8i].u32Idx)
+ {
+ pstcData = &m_astcUartInstanceDataLut[u8i];
+ break;
+ }
+ }
+
+ return (pstcData);
+}
+/**
+ ******************************************************************************
+ ** \brief UART通信中断使能函数设置
+ **
+ ** \param [in] u8Idx通道号,enIrqSel发送or接收中断使能
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_EnableIrq(uint8_t u8Idx,
+ en_uart_irq_sel_t enIrqSel)
+{
+ stc_uart_instance_data_t* pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_IRQSEL(enIrqSel));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enIrqSel)
+ {
+ case UartTxIrq:
+ pstcData->pstcInstance->SCON_f.TCIE = 1u;
+ break;
+ case UartRxIrq:
+ pstcData->pstcInstance->SCON_f.RCIE = 1u;
+ break;
+ case UartFEIrq:
+ pstcData->pstcInstance->SCON_f.FEIE = 1u;
+ break;
+ case UartCtsIrq:
+ pstcData->pstcInstance->SCON_f.CTSIE = 1u;
+ break;
+ case UartPEIrq:
+ pstcData->pstcInstance->SCON_f.PEIE = 1u;
+ break;
+ case UartTxEIrq:
+ pstcData->pstcInstance->SCON_f.TXEIE = 1u;
+ break;
+ default:
+ return (ErrorInvalidParameter);
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通信中断禁止函数设置
+ **
+ ** \param [in] u8Idx通道号,enIrqSel发送or接收中断禁止
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_DisableIrq(uint8_t u8Idx,
+ en_uart_irq_sel_t enIrqSel)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_IRQSEL(enIrqSel));
+
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enIrqSel)
+ {
+ case UartTxIrq:
+ pstcData->pstcInstance->SCON_f.TCIE = 0u;
+ break;
+ case UartRxIrq:
+ pstcData->pstcInstance->SCON_f.RCIE = 0u;
+ break;
+ case UartFEIrq:
+ pstcData->pstcInstance->SCON_f.FEIE = 0u;
+ break;
+ case UartCtsIrq:
+ pstcData->pstcInstance->SCON_f.CTSIE = 0u;
+ break;
+ case UartPEIrq:
+ pstcData->pstcInstance->SCON_f.PEIE = 0u;
+ break;
+ case UartTxEIrq:
+ pstcData->pstcInstance->SCON_f.TXEIE = 0u;
+ break;
+ default:
+ return (ErrorInvalidParameter);
+ }
+
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道4种模式配置
+ **
+ ** \param [in] u8Idx通道号,mode哪种模式
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_SetMode(uint8_t u8Idx,en_uart_mode_t enMode)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_MODE(enMode));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SCON_f.SM = enMode;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道多主机模式配置
+ **
+ ** \param [in] u8Idx通道号,stcMultiConfig多主机模式结构
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_SetMultiMode(uint8_t u8Idx,stc_uart_multimode_t* pstcMultiConfig)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(NULL != pstcMultiConfig)
+ {
+ pstcData->pstcInstance->SCON_f.ADRDET = pstcMultiConfig->enMulti_mode;
+ if(pstcMultiConfig->enMulti_mode == UartMulti)
+ {
+ pstcData->pstcInstance->SADDR = pstcMultiConfig->u8SlaveAddr;
+ pstcData->pstcInstance->SADEN = pstcMultiConfig->u8SaddEn;
+ }
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道多主机模式发送数据/地址帧或者奇偶校验配置TB8
+ **
+ ** \param [in] u8Idx通道号,tb8数据or地址帧或者奇偶校验
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_SetMMDOrCk(uint8_t u8Idx,en_uart_mmdorck_t enTb8)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SCON_f.B8CONT = enTb8;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief 获取RB8数值
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval RB8
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+boolean_t Uart_GetRb8(uint8_t u8Idx)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ return (pstcData->pstcInstance->SBUF_f.DATA8);
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道多主机模式从机地址配置函数
+ **
+ ** \param [in] u8Idx通道号,addr地址
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_SetSaddr(uint8_t u8Idx,uint8_t u8Addr)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SADDR = u8Addr;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道多主机模式从机掩码配置函数
+ **
+ ** \param [in] u8Idx通道号,addren地址掩码
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_SetSaddrEn(uint8_t u8Idx,uint8_t u8Addren)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ pstcData->pstcInstance->SADEN = u8Addren;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道停止位长度设置
+ **
+ ** \param [in] u8Idx通道号,u8Len停止位长度
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_SetStopBit(uint8_t u8Idx,uint8_t u8Len)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ switch(u8Len)
+ {
+ case Uart1bit:
+ case Uart15bit:
+ case Uart2bit:
+ pstcData->pstcInstance->SCON_f.STOPBIT = u8Len;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART采样频率配置
+ **
+ ** \param [in] u8Idx通道号,u8Div采样频率
+ **
+ ** \retval OK配置成功
+ ******************************************************************************/
+en_result_t Uart_SetClkDiv(uint8_t u8Idx,en_uart_clkdiv_t enClkDiv)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ pstcData->pstcInstance->SCON_f.OVER = enClkDiv;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道波特率配置值计算
+ **
+ ** \param [in] u8Idx通道号,pstcBaud波特率,
+ **
+ ** \retval 定时器配置值
+ ** \retval 0,获取值失败,u16Scnt波特率设置值
+ ******************************************************************************/
+uint16_t Uart_CalScnt(uint8_t u8Idx,stc_uart_baud_t *pstcBaud)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ uint16_t u16Scnt = 0;
+ uint8_t u8Over = 0;
+ ASSERT(IS_VALID_CH(u8Idx));
+
+ pstcData = UartGetInternDataPtr(u8Idx);
+ u8Over = pstcData->pstcInstance->SCON_f.OVER;
+ if(UartMode0 == pstcBaud->enRunMode)
+ {
+ return 0;//test
+ }
+ if((UartMode1 == pstcBaud->enRunMode)||(UartMode3 == pstcBaud->enRunMode))
+ {
+ if(0 == u8Over)
+ {
+ u8Over = 16;
+ }
+ else
+ {
+ u8Over = 8;
+ }
+
+ u16Scnt = pstcBaud->u32Pclk/(pstcBaud->u32Baud*u8Over);
+ }
+ else
+ {
+ if(0 == u8Over)
+ {
+ u8Over = 32;
+ }
+ else
+ {
+ u8Over = 16;
+ }
+ u16Scnt = pstcBaud->u32Pclk/u8Over;
+ }
+ return u16Scnt;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道波特率配置
+ **
+ ** \param [in] u8Idx通道号,u16Scnt波特率设置
+ **
+ ** \retval 定时器配置值
+ ** \retval 0,获取值失败
+ ******************************************************************************/
+en_result_t Uart_SetBaud(uint8_t u8Idx,uint16_t u16Scnt)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ pstcData->pstcInstance->SCNT = u16Scnt;
+ return Ok;
+}
+
+/**
+ ******************************************************************************
+ ** \brief UART通道波特率获取
+ **
+ ** \param [in] u8Idx通道号,u8Mode工作模式
+ **
+ ** \retval 波特率
+ ******************************************************************************/
+uint32_t Uart_GetBaud(uint8_t u8Idx,uint8_t u8Mode,uint32_t u32Pclk)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ uint32_t u32Baud = 0;
+ uint8_t u8Over = 0;
+ uint16_t u16Scnt = 0;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ u16Scnt = pstcData->pstcInstance->SCNT;
+
+ switch(u8Mode)
+ {
+ case UartMode0:
+ u32Baud = u32Pclk/12;
+ break;
+ case UartMode1:
+ case UartMode3:
+ if(0 == pstcData->pstcInstance->SCON_f.OVER)
+ {
+ u8Over = 16;
+ }
+ else
+ {
+ u8Over = 8;
+ }
+ u32Baud = u32Pclk/(u8Over*u16Scnt);
+ break;
+ case UartMode2:
+ if(0 == pstcData->pstcInstance->SCON_f.OVER)
+ {
+ u8Over = 32;
+ }
+ else
+ {
+ u8Over = 16;
+ }
+ u32Baud = u32Pclk/u8Over;
+ break;
+ default :
+ return 0;//test
+ }
+ return u32Baud;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道发送或接收等功能使能设置
+ **
+ ** \param [in] u8Idx通道号,enFunc功能
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_EnableFunc(uint8_t u8Idx, en_uart_func_t enFunc)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enFunc)
+ {
+ case UartTx:
+ case UartRx:
+ pstcData->pstcInstance->SCON_f.REN = 1u;
+ break;
+ case UartDmaTx:
+ pstcData->pstcInstance->SCON_f.DMATXEN = 1u;
+ break;
+ case UartDmaRx:
+ pstcData->pstcInstance->SCON_f.DMARXEN = 1u;
+ break;
+ case UartCtsRts:
+ pstcData->pstcInstance->SCON_f.CTSEN = 1u;
+ pstcData->pstcInstance->SCON_f.RTSEN = 1u;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道发送或接收等功能禁止设置
+ **
+ ** \param [in] u8Idx通道号,enFunc功能
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_DisableFunc(uint8_t u8Idx, en_uart_func_t enFunc)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enFunc)
+ {
+ case UartTx:
+ case UartRx:
+ pstcData->pstcInstance->SCON_f.REN = 0u;
+ break;
+ case UartDmaTx:
+ pstcData->pstcInstance->SCON_f.DMATXEN = 0u;
+ break;
+ case UartDmaRx:
+ pstcData->pstcInstance->SCON_f.DMARXEN = 0u;
+ break;
+ case UartCtsRts:
+ pstcData->pstcInstance->SCON_f.CTSEN = 0u;
+ pstcData->pstcInstance->SCON_f.RTSEN = 0u;
+ break;
+ default:
+ return ErrorInvalidParameter;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道通信状态获取
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 状态值
+ ******************************************************************************/
+uint8_t Uart_GetIsr(uint8_t u8Idx)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ return (pstcData->pstcInstance->ISR);
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道通信状态获取
+ **
+ ** \param [in] u8Idx通道号,enStatus获取哪个状态
+ **
+ ** \retval 状态值
+ **\retval ErrorInvalidParameter获取失败
+ ******************************************************************************/
+boolean_t Uart_GetStatus(uint8_t u8Idx,en_uart_status_t enStatus)
+{
+ boolean_t bStatus=FALSE;
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_STATUS(enStatus));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;//4,用户只需判断0或1
+ }
+ switch(enStatus)
+ {
+ case UartCts:
+ bStatus = (pstcData->pstcInstance->ISR_f.CTS == 1) ? TRUE : FALSE;
+ break;
+ case UartRC:
+ bStatus = (pstcData->pstcInstance->ISR_f.RC == 1) ? TRUE : FALSE;
+ break;
+ case UartTC:
+ bStatus = (pstcData->pstcInstance->ISR_f.TC == 1) ? TRUE : FALSE;
+ break;
+ case UartPE:
+ bStatus = (pstcData->pstcInstance->ISR_f.PE == 1) ? TRUE : FALSE;
+ break;
+ case UartFE:
+ bStatus = (pstcData->pstcInstance->ISR_f.FE == 1) ? TRUE : FALSE;
+ break;
+ case UartCtsIf:
+ bStatus = (pstcData->pstcInstance->ISR_f.CTSIF == 1) ? TRUE : FALSE;
+ break;
+ case UartTxe:
+ bStatus = (pstcData->pstcInstance->ISR_f.TXE == 1) ? TRUE : FALSE;
+ break;
+ default:
+ break;
+ }
+ return bStatus;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道通信状态清除
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval OK
+ ******************************************************************************/
+en_result_t Uart_ClrIsr(uint8_t u8Idx)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ pstcData->pstcInstance->ICR = 0u;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道通信状态清除
+ **
+ ** \param [in] u8Idx通道号,enStatus清除哪个状态
+ **
+ ** \retval 状态值
+ **\retval ErrorInvalidParameter清除失败
+ ******************************************************************************/
+en_result_t Uart_ClrStatus(uint8_t u8Idx,en_uart_status_t enStatus)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ ASSERT(IS_VALID_STATUS(enStatus));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ switch(enStatus)
+ {
+ case UartCts:
+ pstcData->pstcInstance->ICR_f.CTSIFCF = 0;
+ break;
+ case UartRC:
+ pstcData->pstcInstance->ICR_f.RCCF = 0;
+ break;
+ case UartTC:
+ pstcData->pstcInstance->ICR_f.TCCF = 0;
+ break;
+ case UartPE:
+ pstcData->pstcInstance->ICR_f.PECF = 0;
+ break;
+ case UartFE:
+ pstcData->pstcInstance->ICR_f.FECF = 0;
+ break;
+ default:
+ break;
+ }
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道发送数据函数,查询方式调用此函数,中断方式发送不适用
+ **
+ ** \param [in] u8Idx通道号,Data发送数据
+ **
+ ** \retval Ok发送成功
+ **\retval ErrorInvalidParameter发送失败
+ ******************************************************************************/
+en_result_t Uart_SendData(uint8_t u8Idx, uint8_t u8Data)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ while(FALSE == Uart_GetStatus(u8Idx, UartTxe))
+ {}
+ pstcData->pstcInstance->SBUF_f.DATA = u8Data;
+ return Ok;
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道接收数据函数
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 接收数据
+ **\retval ErrorInvalidParameter接收失败
+ ******************************************************************************/
+int Uart_ReceiveData(uint8_t u8Idx)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return -1;
+ }
+ return (pstcData->pstcInstance->SBUF_f.DATA);
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道中断处理函数
+ **
+ ** \param [in] u8Param通道号
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void Uart_IRQHandler(uint8_t u8Param)
+{
+ stc_uart_instance_data_t *pstcData = NULL;
+ pstcData = UartGetInternDataPtr(u8Param);
+ if (NULL == pstcData)
+ {
+ return;
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.FE)
+ {
+ Uart_ClrStatus(u8Param,UartFE);
+ if(NULL != pstcData->stcUartInternIrqCb.pfnRxFEIrqCb)
+ {
+ pstcData->stcUartInternIrqCb.pfnRxFEIrqCb();
+ }
+ return;//帧出错则不进行后续数据处理
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.PE)
+ {
+ Uart_ClrStatus(u8Param,UartPE);
+ if(NULL != pstcData->stcUartInternIrqCb.pfnPEIrqCb)
+ {
+ pstcData->stcUartInternIrqCb.pfnPEIrqCb();
+ }
+ return;//若奇偶校验出错则不进行后续数据处理
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.CTSIF)
+ {
+ Uart_ClrStatus(u8Param,UartCts);
+ if(NULL != pstcData->stcUartInternIrqCb.pfnCtsIrqCb)
+ {
+ pstcData->stcUartInternIrqCb.pfnCtsIrqCb();
+ }
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.RC)
+ {
+ Uart_ClrStatus(u8Param,UartRC);
+ if(NULL != pstcData->stcUartInternIrqCb.pfnRxIrqCb)
+ {
+ pstcData->stcUartInternIrqCb.pfnRxIrqCb();
+ }
+ }
+ if(1 == pstcData->pstcInstance->ISR_f.TC)
+ {
+ Uart_ClrStatus(u8Param,UartTC);
+ if(NULL != pstcData->stcUartInternIrqCb.pfnTxIrqCb)
+ {
+ pstcData->stcUartInternIrqCb.pfnTxIrqCb();
+ }
+ }
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道使能内核NVIC中断
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+static void UartInitNvic(uint8_t u8Idx)
+{
+ IRQn_Type enIrqIndex;
+
+ ASSERT(IS_VALID_CH(u8Idx));;
+ enIrqIndex = (IRQn_Type)(UART0_IRQn + u8Idx);
+ NVIC_ClearPendingIRQ(enIrqIndex);
+ NVIC_SetPriority(enIrqIndex,IrqLevel3);
+ NVIC_EnableIRQ(enIrqIndex);
+
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道禁止内核NVIC中断
+ **
+ ** \param [in] u8Idx通道号
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+static void UartDeInitNvic(uint8_t u8Idx)
+{
+ IRQn_Type enIrqIndex;
+
+ ASSERT(IS_VALID_CH(u8Idx));
+ enIrqIndex = (IRQn_Type)(UART0_IRQn + u8Idx);
+ NVIC_ClearPendingIRQ(enIrqIndex);
+ NVIC_SetPriority(enIrqIndex,IrqLevel3);
+ NVIC_DisableIRQ(enIrqIndex);
+
+}
+/**
+ ******************************************************************************
+ ** \brief UART通道初始化函数
+ **
+ ** \param [in] u8Idx通道号,pstcConfig初始化结构体
+ **
+ ** \retval OK配置成功
+ **\retval ErrorInvalidParameter配置失败
+ ******************************************************************************/
+en_result_t Uart_Init(uint8_t u8Idx,
+ stc_uart_config_t* pstcConfig)
+{
+ en_result_t enRet = Error;
+ stc_uart_instance_data_t *pstcData = NULL;
+ ASSERT(IS_VALID_CH(u8Idx));
+ pstcData = UartGetInternDataPtr(u8Idx);
+ if (NULL == pstcData)
+ {
+ return ErrorInvalidParameter;
+ }
+ if(NULL == pstcConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+ enRet = Uart_SetMode(u8Idx,pstcConfig->enRunMode);
+ enRet = Uart_SetStopBit(u8Idx,pstcConfig->enStopBit);
+ if(NULL != pstcConfig->pstcMultiMode)
+ {
+ enRet = Uart_SetMultiMode(u8Idx,pstcConfig->pstcMultiMode);
+ }
+ if(NULL != pstcConfig->pstcIrqCb)
+ {
+ pstcData->stcUartInternIrqCb.pfnRxFEIrqCb = pstcConfig->pstcIrqCb->pfnRxFEIrqCb;
+ pstcData->stcUartInternIrqCb.pfnRxIrqCb = pstcConfig->pstcIrqCb->pfnRxIrqCb;
+ pstcData->stcUartInternIrqCb.pfnTxIrqCb = pstcConfig->pstcIrqCb->pfnTxIrqCb;
+ pstcData->stcUartInternIrqCb.pfnCtsIrqCb = pstcConfig->pstcIrqCb->pfnCtsIrqCb;
+ pstcData->stcUartInternIrqCb.pfnPEIrqCb = pstcConfig->pstcIrqCb->pfnPEIrqCb;
+ }
+ if(pstcConfig->bTouchNvic == TRUE)
+ {
+ UartInitNvic(u8Idx);
+ }
+ else
+ {
+ UartDeInitNvic(u8Idx);
+ }
+ enRet = Ok;
+ return enRet;
+}
+//@} // UartGroup
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/vc.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/vc.c
new file mode 100644
index 0000000000..fbb14ed4a6
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/vc.c
@@ -0,0 +1,674 @@
+/******************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file vc.c
+ **
+ ** voltage comparator driver API.
+ ** @link VC Group Some description @endlink
+ **
+ ** - 2017-06-28 Alex First Version
+ **
+ ******************************************************************************/
+
+/******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "vc.h"
+
+/**
+ ******************************************************************************
+ ** \addtogroup VcGroup
+ ******************************************************************************/
+//@{
+
+/******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+#define IS_VALID_CHANNEL(x) ( VcChannel0==(x) || VcChannel1 == (x))
+#define IS_VALID_STAT(x) ( VcCmpResult==(x) || VcIntrResult == (x))
+#define IS_VALID_DIV(x) ( (x) <= 64u )
+
+#define IS_VALID_INPUT_P(x) ( (x) <= VcInPCh15 )
+
+#define IS_VALID_INPUT_N(x) ( (x) <= AiLdo )
+
+#define IS_VALID_DLY(x) ( (VcDelay30mv == (x)) ||\
+ (VcDelay20mv == (x)) ||\
+ (VcDelay10mv == (x)) ||\
+ (VcDelayoff == (x)) )
+
+#define IS_VALID_BIAS(x) ( (VcBias300na == (x)) ||\
+ (VcBias1200na == (x)) ||\
+ (VcBias10ua == (x)) ||\
+ (VcBias20ua == (x)) )
+
+#define IS_VALID_FILTER(x) ( (x) <= VcFilter28800us )
+
+
+
+/******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+
+/******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+static en_result_t VcEnableIrq(en_vc_channel_t enChannel, boolean_t bFlag);
+static void VcEnableNvic(IRQn_Type enIrqn);
+static void VcDisableNvic(IRQn_Type enIrqn);
+
+/******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+static func_ptr_t pfnVc0IrqCb = NULL;
+static func_ptr_t pfnVc1IrqCb = NULL;
+
+/*****************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ *****************************************************************************/
+
+/**
+ * \brief
+ * 指定VC通道中断使能/除能
+ *
+ * \param [in] enChannel VC通道号
+ * \param [in] bFlag 使能/除能标志
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+static en_result_t VcEnableIrq(en_vc_channel_t enChannel, boolean_t bFlag)
+{
+ if (VcChannel0 == enChannel)
+ {
+ if (bFlag)
+ {
+ VcEnableNvic(VC0_IRQn);
+ M0P_VC->VC0_CR_f.IE = 1u;
+ }
+ else
+ {
+ M0P_VC->VC0_CR_f.IE = 0u;
+ VcDisableNvic(VC0_IRQn);
+ }
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ if (bFlag)
+ {
+ VcEnableNvic(VC1_IRQn);
+ M0P_VC->VC1_CR_f.IE = 1u;
+ }
+ else
+ {
+ M0P_VC->VC1_CR_f.IE = 0u;
+ VcDisableNvic(VC1_IRQn);
+ }
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * 使能NVIC中VC中断
+ *
+ * \param [in] enIrqn 中断号
+ *
+ * \retval 无
+ */
+static void VcEnableNvic(IRQn_Type enIrqn)
+{
+ NVIC_ClearPendingIRQ(enIrqn);
+ NVIC_EnableIRQ(enIrqn);
+ NVIC_SetPriority(enIrqn, IrqLevel3);
+}
+
+/**
+ * \brief
+ * 除能NVIC中VC中断
+ *
+ * \param [in] enIrqn 中断号
+ *
+ * \retval 无
+ */
+static void VcDisableNvic(IRQn_Type enIrqn)
+{
+ NVIC_ClearPendingIRQ(enIrqn);
+ NVIC_DisableIRQ(enIrqn);
+ NVIC_SetPriority(enIrqn, IrqLevel3);
+}
+
+/**
+ * \brief
+ * VC中断服务程序
+ *
+ * \param [in] u8Param VC通道号
+ *
+ * \retval 无
+ */
+void Vc_IRQHandler(uint8_t u8Param)
+{
+ if (0 == u8Param)
+ {
+ if (TRUE == M0P_VC->IFR_f.VC0_INTF)
+ {
+ if (NULL != pfnVc0IrqCb)
+ {
+ pfnVc0IrqCb();
+ }
+ M0P_VC->IFR_f.VC0_INTF = 0;
+ }
+ }
+ else if (1 == u8Param)
+ {
+ if (TRUE == M0P_VC->IFR_f.VC1_INTF)
+ {
+ if (NULL != pfnVc1IrqCb)
+ {
+ pfnVc1IrqCb();
+ }
+ M0P_VC->IFR_f.VC1_INTF = 0;
+ }
+ }
+ else
+ {
+ ; // just return
+ }
+}
+
+/**
+ * \brief
+ * 配置VC中断触发方式
+ *
+ * \param [in] enChannel VC通道号
+ * \param [in] enSel 中断触发方式选择
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_ConfigIrq(en_vc_channel_t enChannel, en_vc_irq_sel_t enSel)
+{
+ stc_vc_vc0_cr_field_t *stcVcnCr;
+ en_result_t enRet = Ok;
+
+ if (VcChannel0 == enChannel)
+ {
+ stcVcnCr = (stc_vc_vc0_cr_field_t*)&M0P_VC->VC0_CR_f;
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ stcVcnCr = (stc_vc_vc0_cr_field_t*)&M0P_VC->VC1_CR_f;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ switch (enSel)
+ {
+ case VcIrqRise:
+ stcVcnCr->RISING = 1u;
+ break;
+ case VcIrqFall:
+ stcVcnCr->FALLING = 1u;
+ break;
+ case VcIrqHigh:
+ stcVcnCr->LEVEL = 1u;
+ break;
+
+ default:
+ enRet= ErrorInvalidParameter;
+ break;
+ }
+
+ return enRet;
+}
+
+/**
+ * \brief
+ * 获取VC状态
+ *
+ * \param [in] enChannel VC通道号
+ * \param [in] enStat VC状态类型
+ *
+ * \retval boolean_t TRUE: 状态为高
+ * \retval boolean_t FALSE: 状态为低
+ */
+boolean_t Vc_GetStat(en_vc_channel_t enChannel, en_vc_stat_t enStat)
+{
+ boolean_t bFlag = FALSE;
+
+ ASSERT( IS_VALID_CHANNEL(enChannel) );
+ ASSERT( IS_VALID_STAT(enStat) );
+
+ if (VcChannel0 == enChannel)
+ {
+ switch (enStat)
+ {
+ case VcCmpResult:
+ bFlag = M0P_VC->IFR_f.VC0_FILTER;
+ break;
+ case VcIntrResult:
+ bFlag = M0P_VC->IFR_f.VC0_INTF;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (enStat)
+ {
+ case VcCmpResult:
+ bFlag = M0P_VC->IFR_f.VC1_FILTER;
+ break;
+ case VcIntrResult:
+ bFlag = M0P_VC->IFR_f.VC1_INTF;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return bFlag;
+}
+
+/**
+ * \brief
+ * 清除VC中断标志
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval 无
+ */
+void Vc_ClearIrq(en_vc_channel_t enChannel)
+{
+ ASSERT( IS_VALID_CHANNEL(enChannel) );
+
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->IFR_f.VC0_INTF = 0u;
+ }
+ else
+ {
+ M0P_VC->IFR_f.VC1_INTF = 0u;
+ }
+}
+
+/**
+ * \brief
+ * 指定VC通道中断使能
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 设置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_EnableIrq(en_vc_channel_t enChannel)
+{
+ return VcEnableIrq(enChannel, TRUE);
+}
+
+/**
+ * \brief
+ * 指定VC通道中断除能
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 设置成功
+ * ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_DisableIrq(en_vc_channel_t enChannel)
+{
+ return VcEnableIrq(enChannel, FALSE);
+}
+
+/**
+ * \brief
+ * VC模块初始化
+ *
+ * \param [in] pstcGeneralConfig VC模块配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_DACInit(stc_vc_dac_config_t *pstcDacConfig)
+{
+ if (NULL == pstcDacConfig)
+ {
+ return ErrorInvalidParameter;
+ }
+
+ M0P_VC->CR_f.DIV_EN = pstcDacConfig->bDivEn;
+ M0P_VC->CR_f.REF2P5_SEL = pstcDacConfig->enDivVref;
+
+ if (pstcDacConfig->u8DivVal < 0x40)
+ {
+ M0P_VC->CR_f.DIV = pstcDacConfig->u8DivVal;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * VC模块deinit
+ *
+ * \param 无
+ *
+ * \retval 无
+ */
+void Vc_DACDeInit(void)
+{
+ M0P_VC->CR_f.DIV_EN = 0u;
+ M0P_VC->CR_f.DIV = 0x20u;
+ M0P_VC->CR_f.REF2P5_SEL = 0u;
+}
+
+/**
+ * \brief
+ * VC通道初始化
+ *
+ * \param [in] enChannel VC通道号
+ * \param [in] pstcChannelConfig VC通道配置指针
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_ChannelInit(en_vc_channel_t enChannel,
+ stc_vc_channel_config_t *pstcChannelConfig)
+{
+ //en_result_t enRet = Ok;
+
+ ASSERT(NULL != pstcChannelConfig);
+ ASSERT(IS_VALID_INPUT_P(pstcChannelConfig->enVcInPin_P));
+ ASSERT(IS_VALID_INPUT_N(pstcChannelConfig->enVcInPin_N));
+ ASSERT(IS_VALID_DLY(pstcChannelConfig->enVcCmpDly));
+ ASSERT(IS_VALID_BIAS(pstcChannelConfig->enVcBiasCurrent));
+ ASSERT(IS_VALID_FILTER(pstcChannelConfig->enVcFilterTime));
+
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->CR_f.VC0_HYS_SEL = pstcChannelConfig->enVcCmpDly;
+ M0P_VC->CR_f.VC0_BIAS_SEL = pstcChannelConfig->enVcBiasCurrent;
+ M0P_VC->VC0_CR_f.DEBOUNCE_TIME = pstcChannelConfig->enVcFilterTime;
+ M0P_VC->VC0_CR_f.P_SEL = pstcChannelConfig->enVcInPin_P;
+ M0P_VC->VC0_CR_f.N_SEL = pstcChannelConfig->enVcInPin_N;
+ M0P_VC->VC0_OUT_CFG = 1<<pstcChannelConfig->enVcOutConfig;
+
+ switch(pstcChannelConfig->enVcIrqSel)
+ {
+ case VcIrqRise:
+ M0P_VC->VC0_CR_f.RISING = 1u;
+ break;
+ case VcIrqFall:
+ M0P_VC->VC0_CR_f.FALLING = 1u;
+ break;
+ case VcIrqHigh:
+ M0P_VC->VC0_CR_f.LEVEL = 1u;
+ break;
+ default:
+ M0P_VC->VC0_CR_f.LEVEL = 0u;
+ M0P_VC->VC0_CR_f.RISING = 0u;
+ M0P_VC->VC0_CR_f.FALLING = 0u;
+ break;
+ }
+
+ pfnVc0IrqCb = pstcChannelConfig->pfnAnalogCmpCb;
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ M0P_VC->CR_f.VC1_HYS_SEL = pstcChannelConfig->enVcCmpDly;
+ M0P_VC->CR_f.VC1_BIAS_SEL = pstcChannelConfig->enVcBiasCurrent;
+ M0P_VC->VC1_CR_f.DEBOUNCE_TIME = pstcChannelConfig->enVcFilterTime;
+ M0P_VC->VC1_CR_f.P_SEL = pstcChannelConfig->enVcInPin_P;
+ M0P_VC->VC1_CR_f.N_SEL = pstcChannelConfig->enVcInPin_N;
+ M0P_VC->VC1_OUT_CFG = 1<<pstcChannelConfig->enVcOutConfig;
+
+ switch(pstcChannelConfig->enVcIrqSel)
+ {
+ case VcIrqRise:
+ M0P_VC->VC1_CR_f.RISING = 1u;
+ break;
+ case VcIrqFall:
+ M0P_VC->VC1_CR_f.FALLING = 1u;
+ break;
+ case VcIrqHigh:
+ M0P_VC->VC1_CR_f.LEVEL = 1u;
+ break;
+ default:
+ M0P_VC->VC1_CR_f.LEVEL = 0u;
+ M0P_VC->VC1_CR_f.RISING = 0u;
+ M0P_VC->VC1_CR_f.FALLING = 0u;
+ break;
+ }
+
+ pfnVc1IrqCb = pstcChannelConfig->pfnAnalogCmpCb;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * VC通道Deinit
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_ChannelDeInit(en_vc_channel_t enChannel)
+{
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->VC0_CR_f.EN = 0u;
+ M0P_VC->CR_f.VC0_HYS_SEL = 0;
+ M0P_VC->CR_f.VC0_BIAS_SEL = 0;
+ M0P_VC->VC0_CR_f.DEBOUNCE_TIME = 0;
+ M0P_VC->VC0_CR_f.P_SEL = 0;
+ M0P_VC->VC0_CR_f.N_SEL = 0;
+ M0P_VC->VC0_OUT_CFG = 0;
+ M0P_VC->VC0_CR_f.LEVEL = 0u;
+ M0P_VC->VC0_CR_f.RISING = 0u;
+ M0P_VC->VC0_CR_f.FALLING = 0u;
+ pfnVc0IrqCb = NULL;
+ M0P_VC->VC0_CR_f.IE = 0u;
+ VcDisableNvic(VC0_IRQn);
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ M0P_VC->VC1_CR_f.EN = 0u;
+ M0P_VC->CR_f.VC1_HYS_SEL = 0;
+ M0P_VC->CR_f.VC1_BIAS_SEL = 0;
+ M0P_VC->VC1_CR_f.DEBOUNCE_TIME = 0;
+ M0P_VC->VC1_CR_f.P_SEL = 0;
+ M0P_VC->VC1_CR_f.N_SEL = 0;
+ M0P_VC->VC1_OUT_CFG = 0;
+ M0P_VC->VC1_CR_f.LEVEL = 0u;
+ M0P_VC->VC1_CR_f.RISING = 0u;
+ M0P_VC->VC1_CR_f.FALLING = 0u;
+ pfnVc1IrqCb = NULL;
+ M0P_VC->VC1_CR_f.IE = 0u;
+ VcDisableNvic(VC1_IRQn);
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * VC通道使能
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_EnableChannel(en_vc_channel_t enChannel)
+{
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->VC0_CR_f.EN = 1u;
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ M0P_VC->VC1_CR_f.EN = 1u;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * VC通道除能
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_DisableChannel(en_vc_channel_t enChannel)
+{
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->VC0_CR_f.EN = 0u;
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ M0P_VC->VC1_CR_f.EN = 0u;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * VC输出滤波使能
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_EnableFilter(en_vc_channel_t enChannel)
+{
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->VC0_CR_f.FLTEN = 1u;
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ M0P_VC->VC1_CR_f.FLTEN = 1u;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+/**
+ * \brief
+ * VC输出滤波除能
+ *
+ * \param [in] enChannel VC通道号
+ *
+ * \retval en_result_t Ok: 配置成功
+ * \retval en_result_t ErrorInvalidParameter: 无效参数
+ */
+en_result_t Vc_DisableFilter(en_vc_channel_t enChannel)
+{
+ if (VcChannel0 == enChannel)
+ {
+ M0P_VC->VC0_CR_f.FLTEN = 0u;
+ }
+ else if (VcChannel1 == enChannel)
+ {
+ M0P_VC->VC1_CR_f.FLTEN = 0u;
+ }
+ else
+ {
+ return ErrorInvalidParameter;
+ }
+
+ return Ok;
+}
+
+//@} // VcGroup
+
+
+/******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
+
diff --git a/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/wdt.c b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/wdt.c
new file mode 100644
index 0000000000..0a3ea826dc
--- /dev/null
+++ b/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/wdt.c
@@ -0,0 +1,184 @@
+/*************************************************************************************
+* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
+*
+* This software is owned and published by:
+* Huada Semiconductor Co.,Ltd ("HDSC").
+*
+* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
+* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+*
+* This software contains source code for use with HDSC
+* components. This software is licensed by HDSC to be adapted only
+* for use in systems utilizing HDSC components. HDSC shall not be
+* responsible for misuse or illegal use of this software for devices not
+* supported herein. HDSC is providing this software "AS IS" and will
+* not be responsible for issues arising from incorrect user implementation
+* of the software.
+*
+* Disclaimer:
+* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
+* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
+* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
+* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
+* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
+* WARRANTY OF NONINFRINGEMENT.
+* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
+* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
+* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
+* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
+* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
+* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
+* SAVINGS OR PROFITS,
+* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
+* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
+* FROM, THE SOFTWARE.
+*
+* This software may be replicated in part or whole for the licensed use,
+* with the restriction that this Disclaimer and Copyright notice must be
+* included with each copy of this software, whether used in part or whole,
+* at all times.
+*/
+/******************************************************************************/
+/** \file wdt.c
+ **
+ ** WDT function driver API.
+ ** @link WdtGroup Some description @endlink
+ **
+ ** - 2017-05-17 1.0 CJ First version for Device Driver Library of Module.
+ **
+ ******************************************************************************/
+
+/******************************************************************************/
+/* Include files */
+/******************************************************************************/
+#include "wdt.h"
+
+/**
+ ******************************************************************************
+ ** \defgroup WdtGroup
+ **
+ ******************************************************************************/
+//@{
+
+/******************************************************************************/
+/* Local function prototypes ('static') */
+/******************************************************************************/
+static func_ptr_t pfnWdtCallback = NULL;
+/**
+ ******************************************************************************
+ ** \brief WDT溢出时间设置函数
+ **
+ ** \param [in] u8LoadValue 溢出时间
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void Wdt_WriteWdtLoad(uint8_t u8LoadValue)
+{
+ M0P_WDT->CON_f.WOV = u8LoadValue;
+}
+/**
+ ******************************************************************************
+ ** \brief WDT初始化函数
+ **
+ ** \param [in] stcConfig 初始化结构
+ **
+ ** \retval Ok
+ **
+ ******************************************************************************/
+en_result_t Wdt_Init(stc_wdt_config_t* pstcConfig)
+{
+ en_result_t enRet = Error;
+ ASSERT(NULL != pstcConfig);
+ Wdt_WriteWdtLoad(pstcConfig->u8LoadValue);
+ pfnWdtCallback = pstcConfig->pfnWdtIrqCb;
+ M0P_WDT->CON_f.WINT_EN = pstcConfig->enResetEnable;
+ if(pstcConfig->enResetEnable)
+ {
+ EnableNvic(WDT_IRQn,IrqLevel3,TRUE);
+ }
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief WDT复位及启动函数
+ **
+ ** \param [in] 无
+ **
+ ** \retval Ok
+ **
+ ******************************************************************************/
+en_result_t Wdt_Start(void)
+{
+ en_result_t enRet = Error;
+ M0P_WDT->RST = 0x1E;
+ M0P_WDT->RST = 0xE1;
+ enRet = Ok;
+ return enRet;
+}
+/**
+ ******************************************************************************
+ ** \brief WDT复位及启动函数
+ **
+ ** \param [in] 无
+ **
+ ** \retval Ok
+ **
+ ******************************************************************************/
+void Wdt_Feed(void)
+{
+ M0P_WDT->RST = 0x1E;
+ M0P_WDT->RST = 0xE1;
+}
+/**
+ ******************************************************************************
+ ** \brief WDT读取当前计数值函数
+ **
+ ** \param [in] 无
+ **
+ ** \retval 计数值
+ **
+ ******************************************************************************/
+uint8_t Wdt_ReadWdtValue(void)
+{
+ uint8_t u8Count;
+ u8Count = M0P_WDT->CON_f.WCNTL;
+ return u8Count;
+}
+/**
+ ******************************************************************************
+ ** \brief WDT读取当前运行状态
+ **
+ ** \param [in] 无
+ **
+ ** \retval 状态值
+ **
+ ******************************************************************************/
+uint8_t Wdt_ReadwdtStatus(void)
+{
+ return M0P_WDT->CON_f.WDTR;
+}
+/**
+ ******************************************************************************
+ ** \brief WDT中断处理函数
+ **
+ ** \param [in] 无
+ **
+ ** \retval 无
+ **
+ ******************************************************************************/
+void Wdt_IRQHandler(void)
+{
+ if(M0P_WDT->CON_f.WDINT)
+ {
+ Wdt_Start();//clr wdt 标记
+ if(NULL != pfnWdtCallback)
+ {
+ pfnWdtCallback();
+ }
+ }
+}
+
+//@} // WdtGroup
diff --git a/bsp/hc32l136/Libraries/LICENSE b/bsp/hc32l136/Libraries/LICENSE
new file mode 100644
index 0000000000..72823826b8
--- /dev/null
+++ b/bsp/hc32l136/Libraries/LICENSE
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2020, Huada Semiconductor Co., Ltd ("HDSC")
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/bsp/hc32l136/Libraries/SConscript b/bsp/hc32l136/Libraries/SConscript
new file mode 100644
index 0000000000..f8e856e883
--- /dev/null
+++ b/bsp/hc32l136/Libraries/SConscript
@@ -0,0 +1,48 @@
+# RT-Thread building script for bridge
+
+import rtconfig
+Import('RTT_ROOT')
+from building import *
+
+# get current directory
+cwd = GetCurrentDir()
+
+# The set of source files associated with this SConscript file.
+src = Split("""
+HC32L136_StdPeriph_Driver/src/adc.c
+HC32L136_StdPeriph_Driver/src/gpio.c
+HC32L136_StdPeriph_Driver/src/uart.c
+HC32L136_StdPeriph_Driver/src/lpuart.c
+HC32L136_StdPeriph_Driver/src/rtc.c
+HC32L136_StdPeriph_Driver/src/sysctrl.c
+HC32L136_StdPeriph_Driver/src/timer3.c
+HC32L136_StdPeriph_Driver/src/trim.c
+HC32L136_StdPeriph_Driver/src/flash.c
+HC32L136_StdPeriph_Driver/src/ddl.c
+CMSIS/Device/HDSC/HC32L136/Source/system_hc32l13x.c
+CMSIS/Device/HDSC/HC32L136/Source/interrupts_hc32l136.c
+""")
+
+#src += Glob('HC32F4A0_StdPeriph_Driver/src/*.c')
+
+if GetDepend(['RT_USING_WDT']):
+ src += ['HC32L136_StdPeriph_Driver/src/wdt.c']
+
+#add for startup script
+if rtconfig.CROSS_TOOL == 'gcc':
+ src = src + ['CMSIS/Device/HDSC/HC32L136/Source/GCC/startup_hc32l136.S']
+elif rtconfig.CROSS_TOOL == 'keil':
+ src = src + ['CMSIS/Device/HDSC/HC32L136/Source/ARM/startup_hc32l136.s']
+elif rtconfig.CROSS_TOOL == 'iar':
+ src = src + ['CMSIS/Device/HDSC/HC32L136/Source/IAR/startup_hc32l136.s']
+
+#add headfile script
+path = [cwd + '/CMSIS/Include',
+ cwd + '/CMSIS/Device/HDSC/HC32L136/Include',
+ cwd + '/HC32L136_StdPeriph_Driver/inc']
+
+CPPDEFINES = ['USE_DDL_DRIVER', rtconfig.MCU_TYPE, '__DEBUG']
+
+group = DefineGroup('HC32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
+
+Return('group')
diff --git a/bsp/hc32l136/README.md b/bsp/hc32l136/README.md
new file mode 100644
index 0000000000..5367aacbad
--- /dev/null
+++ b/bsp/hc32l136/README.md
@@ -0,0 +1,100 @@
+# HDSC HC32LFx3x-STK-V2.0 开发板 BSP 说明
+
+## 简介
+
+本文档为华大半导体为 HC32LFx3x-STK-V2.0 开发板提供的 BSP (板级支持包) 说明。
+
+主要内容如下:
+
+- 开发板资源介绍
+- BSP 快速上手
+- 进阶使用方法
+
+通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
+
+## 开发板介绍
+
+HC32LFx3x-STK-V2.0 是 HDSC 官方推出的开发板,搭载 HC32L136 芯片,基于 ARM Cortex-M0 内核,最高主频 48 MHz,具有丰富的板载资源。
+
+开发板外观如下图所示:
+
+![board](figures/board.png)
+
+HC32LFx3x-STK-V2.0 开发板常用 **板载资源** 如下:
+
+- MCU:HC32L136,主频 48MHz,64KB FLASH ,8KB RAM
+- 常用外设
+- 常用接口:
+- 调试接口:板载DAP调试器、标准 JTAG/SWD。
+
+## 外设支持
+
+本 BSP 目前对外设的支持情况如下:
+
+| **片上外设** | **支持情况** | **备注** |
+| :------------ | :-----------: | :-----------------------------------: |
+| GPIO | 支持 | PA0, PA1... PI15 ---> PIN: 0, 1...63 |
+| UART | 支持 | UART0~1 |
+| LED | 支持 | LED |
+
+
+## 使用说明
+
+使用说明分为如下两个章节:
+
+- 快速上手
+
+ 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
+
+- 进阶使用
+
+ 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
+
+
+### 快速上手
+
+本 BSP 为开发者提供 MDK4、MDK5、IAR工程,暂不支持GCC开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。
+
+#### 硬件连接
+
+
+
+#### 编译下载
+
+双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
+
+> 工程默认配置使用 J-LINK 下载程序,点击下载按钮即可下载程序到开发板。
+
+#### 运行结果
+
+下载程序成功之后,系统会自动运行,观察开发板上 LED 的运行效果,绿色会周期性闪烁。
+
+连接PA2、PA3串口,在终端工具里打开相应的串口,复位设备后,可以看到 RT-Thread 的输出信息:
+
+```
+ \ | /
+- RT - Thread Operating System
+ / | \ 4.0.3 build Aug 20 2021
+ 2006 - 2021 Copyright by rt-thread team
+msh >
+```
+
+### 进阶使用
+
+此 BSP 默认只开启了 GPIO 和 串口 1 的功能,更多高级功能需要利用 env 工具对 BSP 进行配置,步骤如下:
+
+1. 在 bsp 下打开 env 工具。
+
+2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
+
+3. 输入`pkgs --update`命令更新软件包。
+
+4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
+
+## 注意事项
+
+## 联系人信息
+
+维护人:
+
+- [Ching], 邮箱:<[email protected]> \ No newline at end of file
diff --git a/bsp/hc32l136/SConscript b/bsp/hc32l136/SConscript
new file mode 100644
index 0000000000..24bb4646ab
--- /dev/null
+++ b/bsp/hc32l136/SConscript
@@ -0,0 +1,15 @@
+# for module compiling
+import os
+Import('RTT_ROOT')
+from building import *
+
+cwd = GetCurrentDir()
+objs = []
+list = os.listdir(cwd)
+
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
+
+Return('objs')
diff --git a/bsp/hc32l136/SConstruct b/bsp/hc32l136/SConstruct
new file mode 100644
index 0000000000..ae37ec6a48
--- /dev/null
+++ b/bsp/hc32l136/SConstruct
@@ -0,0 +1,45 @@
+import os
+import sys
+import rtconfig
+
+print "############sconstruct##############"
+if os.getenv('RTT_ROOT'):
+ RTT_ROOT = os.getenv('RTT_ROOT')
+else:
+ RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
+
+print "RTT_ROOT: " + RTT_ROOT
+
+sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+try:
+ from building import *
+except:
+ print('Cannot found RT-Thread root directory, please check RTT_ROOT')
+ print(RTT_ROOT)
+ exit(-1)
+
+TARGET = 'hc32L136.' + rtconfig.TARGET_EXT
+
+DefaultEnvironment(tools=[])
+env = Environment(tools = ['mingw'],
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
+env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+if rtconfig.PLATFORM == 'iar':
+ env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
+ env.Replace(ARFLAGS = [''])
+ env.Replace(LINKCOM = env["LINKCOM"] + ' --map project.map')
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+# prepare building environment
+print "######################env:"
+print env
+objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
+
+# make a building
+DoBuilding(TARGET, objs)
diff --git a/bsp/hc32l136/applications/SConscript b/bsp/hc32l136/applications/SConscript
new file mode 100644
index 0000000000..6f66f7ab73
--- /dev/null
+++ b/bsp/hc32l136/applications/SConscript
@@ -0,0 +1,12 @@
+import rtconfig
+from building import *
+
+cwd = GetCurrentDir()
+CPPPATH = [cwd, str(Dir('#'))]
+src = Split("""
+main.c
+""")
+
+group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/hc32l136/applications/main.c b/bsp/hc32l136/applications/main.c
new file mode 100644
index 0000000000..699e24a524
--- /dev/null
+++ b/bsp/hc32l136/applications/main.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-09-07 PJQ first version
+ */
+
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include "board.h"
+
+#include <rtthread.h>
+#include <rtdevice.h>
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/* defined the LED pin: PC9 */
+#define LED_PIN GET_PIN(D, 5)
+#define KEY_PIN GET_PIN(B, 9)
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+ uint8_t flag;
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+void key_handler(void *param)
+{
+ flag = ~flag;
+}
+
+/**
+ *******************************************************************************
+ ** \brief Main function of GPIO output
+ **
+ ** \param None
+ **
+ ** \retval int32_t Return value, if needed
+ **
+ ******************************************************************************/
+int32_t main(void)
+{
+ rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
+ rt_pin_attach_irq(KEY_PIN, PIN_IRQ_MODE_FALLING, key_handler, RT_NULL);
+ rt_pin_irq_enable(KEY_PIN, PIN_IRQ_ENABLE);
+
+ while(1)
+ {
+ if (flag == 0)
+ {
+ rt_pin_write(LED_PIN, PIN_HIGH);
+ rt_thread_delay(500);
+ rt_pin_write(LED_PIN, PIN_LOW);
+ rt_thread_delay(500);
+ }
+ else
+ {
+ rt_pin_write(LED_PIN, PIN_HIGH);
+ rt_thread_delay(2000);
+ rt_pin_write(LED_PIN, PIN_LOW);
+ rt_thread_delay(2000);
+ }
+ }
+}
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/board/Kconfig b/bsp/hc32l136/board/Kconfig
new file mode 100644
index 0000000000..35ecfe181b
--- /dev/null
+++ b/bsp/hc32l136/board/Kconfig
@@ -0,0 +1,57 @@
+menu "Hardware Drivers Config"
+
+config MCU_HC32L136
+ bool
+ select ARCH_ARM_CORTEX_M0
+ select RT_USING_COMPONENTS_INIT
+ select RT_USING_USER_MAIN
+ default y
+
+menu "Onboard Peripheral Drivers"
+
+endmenu
+
+menu "On-chip Peripheral Drivers"
+ config BSP_USING_GPIO
+ bool "Enable GPIO"
+ select RT_USING_PIN
+ default y
+
+ menuconfig BSP_USING_UART
+ bool "Enable UART"
+ default y
+ select RT_USING_SERIAL
+ if BSP_USING_UART
+ config BSP_USING_UART0
+ bool "Enable UART0"
+ default n
+
+ config BSP_USING_UART1
+ bool "Enable UART1"
+ default y
+ endif
+
+ menuconfig BSP_USING_I2C1
+ bool "Enable I2C1 BUS (software simulation)"
+ default y
+ select RT_USING_I2C
+ select RT_USING_I2C_BITOPS
+ select RT_USING_PIN
+ if BSP_USING_I2C1
+ config BSP_I2C1_SCL_PIN
+ int "i2c1 scl pin number"
+ range 1 176
+ default 51
+ config BSP_I2C1_SDA_PIN
+ int "I2C1 sda pin number"
+ range 1 176
+ default 90
+ endif
+
+endmenu
+
+menu "Board extended module Drivers"
+
+endmenu
+
+endmenu
diff --git a/bsp/hc32l136/board/SConscript b/bsp/hc32l136/board/SConscript
new file mode 100644
index 0000000000..589332a741
--- /dev/null
+++ b/bsp/hc32l136/board/SConscript
@@ -0,0 +1,14 @@
+from building import *
+
+cwd = GetCurrentDir()
+
+CPPPATH = [cwd]
+
+# add general drivers
+src = Split('''
+board.c
+''')
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/hc32l136/board/board.c b/bsp/hc32l136/board/board.c
new file mode 100644
index 0000000000..d39b09be9a
--- /dev/null
+++ b/bsp/hc32l136/board/board.c
@@ -0,0 +1,101 @@
+ /*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-08-19 pjq first version
+ */
+
+
+
+#include <rthw.h>
+#include <rtthread.h>
+
+#include "board.h"
+
+/**
+ * @addtogroup HC32
+ */
+
+/*@{*/
+
+/**
+ * @brief BSP clock initialize.
+ * Set board system clock 24Mhz
+ * @param None
+ * @retval None
+ */
+void rt_hw_board_clock_init(void)
+{
+ Sysctrl_SetRCHTrim(SysctrlRchFreq24MHz);
+ Sysctrl_ClkSourceEnable(SysctrlClkRCH, TRUE);
+}
+
+/*******************************************************************************
+ * Function Name : SysTick_Configuration
+ * Description : Configures the SysTick for OS tick.
+ * Input : None
+ * Output : None
+ * Return : None
+ *******************************************************************************/
+void SysTick_Configuration(void)
+{
+ SystemCoreClockUpdate();
+ SysTick_Config(SystemCoreClock/RT_TICK_PER_SECOND);
+}
+
+/**
+ * This is the timer interrupt service routine.
+ *
+ */
+void SysTick_Handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ rt_tick_increase();
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+/**
+ * This function will initialize HC32 board.
+ */
+void rt_hw_board_init()
+{
+ /* Configure the System clock */
+ rt_hw_board_clock_init();
+
+ /* Configure the SysTick */
+ SysTick_Configuration();
+
+#ifdef RT_USING_HEAP
+ rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
+#endif
+
+#ifdef RT_USING_COMPONENTS_INIT
+ rt_components_board_init();
+#endif
+
+#ifdef RT_USING_CONSOLE
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+#endif
+}
+
+void rt_hw_us_delay(rt_uint32_t us)
+{
+ uint32_t start, now, delta, reload, us_tick;
+ start = SysTick->VAL;
+ reload = SysTick->LOAD;
+ us_tick = SystemCoreClock / 1000000UL;
+
+ do{
+ now = SysTick->VAL;
+ delta = start > now ? start - now : reload + start - now;
+ }
+ while(delta < us_tick * us);
+}
+/*@}*/
diff --git a/bsp/hc32l136/board/board.h b/bsp/hc32l136/board/board.h
new file mode 100644
index 0000000000..6d256c3d2c
--- /dev/null
+++ b/bsp/hc32l136/board/board.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-08-19 pjq first version
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
+
+#include <rtthread.h>
+#include "ddl.h"
+#include "gpio.h"
+#include "drv_gpio.h"
+
+/* board configuration */
+#define SRAM_BASE 0x20000000
+#define SRAM_SIZE 0x2000
+#define SRAM_END (SRAM_BASE + SRAM_SIZE)
+
+/* High speed sram. */
+#ifdef __CC_ARM
+extern int Image$$RW_IRAM1$$ZI$$Limit;
+#define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
+#elif __ICCARM__
+#pragma section="CSTACK"
+#define HEAP_BEGIN (__segment_end("CSTACK"))
+#else
+extern int __bss_end;
+#define HEAP_BEGIN (&__bss_end)
+#endif
+
+#ifdef __ICCARM__
+#define HEAP_END SRAM_END
+#else
+#define HEAP_END SRAM_END
+#endif
+
+void rt_hw_board_init(void);
+void rt_hw_us_delay(rt_uint32_t us);
+
+#endif
+
+// <<< Use Configuration Wizard in Context Menu >>>
diff --git a/bsp/hc32l136/board/linker_scripts/link.icf b/bsp/hc32l136/board/linker_scripts/link.icf
new file mode 100644
index 0000000000..719e8b673c
--- /dev/null
+++ b/bsp/hc32l136/board/linker_scripts/link.icf
@@ -0,0 +1,28 @@
+/*###ICF### Section handled by ICF editor, don't touch! ****/
+/*-Editor annotation file-*/
+/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
+/*-Specials-*/
+define symbol __ICFEDIT_intvec_start__ = 0x00000000;
+/*-Memory Regions-*/
+define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
+define symbol __ICFEDIT_region_ROM_end__ = 0x0000FFFF;
+define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
+define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
+/*-Sizes-*/
+define symbol __ICFEDIT_size_cstack__ = 0x0400;
+define symbol __ICFEDIT_size_heap__ = 0x0100;
+/**** End of ICF editor section. ###ICF###*/
+
+define memory mem with size = 4G;
+define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
+define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
+
+define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
+
+place in ROM_region { readonly };
+place in RAM_region { readwrite, last block CSTACK}; \ No newline at end of file
diff --git a/bsp/hc32l136/board/linker_scripts/link.lds b/bsp/hc32l136/board/linker_scripts/link.lds
new file mode 100644
index 0000000000..af109a6da6
--- /dev/null
+++ b/bsp/hc32l136/board/linker_scripts/link.lds
@@ -0,0 +1,203 @@
+ /**
+ *******************************************************************************
+ * @file hc32f4a0_flash.lds
+ * @brief Linker script for HC32F4A0 Device with 2MByte FLASH, 512KByte RAM.
+ @verbatim
+ Change Logs:
+ Date Author Notes
+ 2020-09-15 Chengy First version
+ @endverbatim
+ *******************************************************************************
+ * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
+ *
+ * This software component is licensed by HDSC under BSD 3-Clause license
+ * (the "License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ *******************************************************************************
+ */
+
+/* Use contiguous memory regions for simple. */
+MEMORY
+{
+ FLASH (rx): ORIGIN = 0x00000000, LENGTH = 2M
+ OTP (rx): ORIGIN = 0x03000000, LENGTH = 6876
+ RAM (rwx): ORIGIN = 0x1FFE0000, LENGTH = 512K
+ RAMB (rwx): ORIGIN = 0x200F0000, LENGTH = 4K
+}
+
+ENTRY(Reset_Handler)
+
+SECTIONS
+{
+ .vectors :
+ {
+ . = ALIGN(4);
+ KEEP(*(.vectors))
+ . = ALIGN(4);
+ } >FLASH
+
+ .icg_sec 0x00000400 :
+ {
+ KEEP(*(.icg_sec))
+ } >FLASH
+
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text)
+ *(.text*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.eh_frame)
+
+ KEEP(*(.init))
+ KEEP(*(.fini))
+ . = ALIGN(4);
+ } >FLASH
+
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata)
+ *(.rodata*)
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab :
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } >FLASH
+
+ __exidx_start = .;
+ .ARM.exidx :
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } >FLASH
+ __exidx_end = .;
+
+ .preinit_array :
+ {
+ . = ALIGN(4);
+ /* preinit data */
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP(*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ . = ALIGN(4);
+ } >FLASH
+
+ .init_array :
+ {
+ . = ALIGN(4);
+ /* init data */
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ . = ALIGN(4);
+ } >FLASH
+
+ .fini_array :
+ {
+ . = ALIGN(4);
+ /* finit data */
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP(*(SORT(.fini_array.*)))
+ KEEP(*(.fini_array))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ . = ALIGN(4);
+ } >FLASH
+
+ __etext = ALIGN(4);
+
+ .otp_sec :
+ {
+ KEEP(*(.otp_sec))
+ } >OTP
+
+ .otp_lock_sec 0x03001800 :
+ {
+ KEEP(*(.otp_lock_sec))
+ } >OTP
+
+ .data : AT (__etext)
+ {
+ . = ALIGN(4);
+ __data_start__ = .;
+ *(vtable)
+ *(.data)
+ *(.data*)
+ . = ALIGN(4);
+ *(.ramfunc)
+ *(.ramfunc*)
+ . = ALIGN(4);
+ __data_end__ = .;
+ } >RAM
+
+ __etext_ramb = __etext + ALIGN (SIZEOF(.data), 4);
+ .ramb_data : AT (__etext_ramb)
+ {
+ . = ALIGN(4);
+ __data_start_ramb__ = .;
+ *(.ramb_data)
+ *(.ramb_data*)
+ . = ALIGN(4);
+ __data_end_ramb__ = .;
+ } >RAMB
+
+ .bss :
+ {
+ . = ALIGN(4);
+ _sbss = .;
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4);
+ _ebss = .;
+ __bss_end__ = _ebss;
+ } >RAM
+
+ .ramb_bss :
+ {
+ . = ALIGN(4);
+ __bss_start_ramb__ = .;
+ *(.ramb_bss)
+ *(.ramb_bss*)
+ . = ALIGN(4);
+ __bss_end_ramb__ = .;
+ } >RAMB
+
+ .heap_stack (COPY) :
+ {
+ . = ALIGN(8);
+ __end__ = .;
+ PROVIDE(end = .);
+ PROVIDE(_end = .);
+ *(.heap*)
+ . = ALIGN(8);
+ __HeapLimit = .;
+
+ __StackLimit = .;
+ *(.stack*)
+ . = ALIGN(8);
+ __StackTop = .;
+ } >RAM
+
+ /DISCARD/ :
+ {
+ libc.a (*)
+ libm.a (*)
+ libgcc.a (*)
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+
+ PROVIDE(_stack = __StackTop);
+ PROVIDE(_Min_Heap_Size = __HeapLimit - __HeapBase);
+ PROVIDE(_Min_Stack_Size = __StackTop - __StackLimit);
+
+ __RamEnd = ORIGIN(RAM) + LENGTH(RAM);
+ ASSERT(__StackTop <= __RamEnd, "region RAM overflowed with stack")
+}
diff --git a/bsp/hc32l136/board/linker_scripts/link.sct b/bsp/hc32l136/board/linker_scripts/link.sct
new file mode 100644
index 0000000000..7cc97595b0
--- /dev/null
+++ b/bsp/hc32l136/board/linker_scripts/link.sct
@@ -0,0 +1,15 @@
+; *************************************************************
+; *** Scatter-Loading Description File generated by uVision ***
+; *************************************************************
+
+LR_IROM1 0x00000000 0x10000 { ; load region size_region
+ ER_IROM1 0x00000000 0x10000 { ; load address = execution address
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ }
+ RW_IRAM1 0x20000000 0x2000 { ; RW data
+ .ANY (+RW +ZI)
+ }
+}
+
diff --git a/bsp/hc32l136/drivers/SConscript b/bsp/hc32l136/drivers/SConscript
new file mode 100644
index 0000000000..f37a9f6386
--- /dev/null
+++ b/bsp/hc32l136/drivers/SConscript
@@ -0,0 +1,22 @@
+from building import *
+
+cwd = GetCurrentDir()
+
+# add the general drivers.
+src = Split("""
+
+""")
+
+if GetDepend(['RT_USING_PIN']):
+ src += ['drv_gpio.c']
+
+if GetDepend(['RT_USING_SERIAL']):
+ src += ['drv_usart.c']
+
+if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
+ src += ['drv_soft_i2c.c']
+
+CPPPATH = [cwd]
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/hc32l136/drivers/drv_gpio.c b/bsp/hc32l136/drivers/drv_gpio.c
new file mode 100644
index 0000000000..0d1798dd03
--- /dev/null
+++ b/bsp/hc32l136/drivers/drv_gpio.c
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-08-19 pjq first version
+ */
+
+#include <rtthread.h>
+#include "rthw.h"
+
+#ifdef RT_USING_PIN
+#include "gpio.h"
+#include "drv_gpio.h"
+#include "interrupts_hc32l136.h"
+
+#define GPIO_PIN_INDEX(pin) ((uint8_t)((pin) & 0x0F))
+#define GPIO_PORT(pin) ((uint8_t)(((pin) >> 4) * 0x40u))
+#define GPIO_PIN(pin) ((uint16_t)(GPIO_PIN_INDEX(pin)))
+
+#define PIN_NUM(port, pin) (((((port) / 0x40u) << 4) | ((pin) & 0x0F)))
+#define PIN_MAX_NUM ((GpioPortD / 0x40u * 16) + (GpioPin15 + 1))
+
+struct rt_pin_irq_hdr pin_irq_hdr_tab[] =
+{
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+ {-1, 0, RT_NULL, RT_NULL},
+
+};
+
+static void pin_irq_handler(en_gpio_port_t port, en_gpio_pin_t pin)
+{
+ rt_int32_t irqindex = -1;
+
+ irqindex = PIN_NUM(port, pin);
+ if (pin_irq_hdr_tab[irqindex].hdr)
+ {
+ pin_irq_hdr_tab[irqindex].hdr(pin_irq_hdr_tab[irqindex].args);
+ }
+}
+
+void Gpio_IRQHandler(uint8_t u8Param)
+{
+ en_gpio_pin_t i;
+ en_gpio_port_t enPort;
+
+ enPort = (en_gpio_port_t)(GpioPortA + (GpioPortB - GpioPortA) * u8Param);
+ rt_interrupt_enter();
+ for (i=GpioPin0; i<=GpioPin15; i++)
+ {
+ if(TRUE == Gpio_GetIrqStatus(enPort, i))
+ {
+ Gpio_ClearIrq(enPort, i);
+ pin_irq_handler(enPort, i);
+ }
+
+ }
+ rt_interrupt_leave();
+}
+
+static void _pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
+{
+ uint8_t gpio_port;
+ uint16_t gpio_pin;
+
+ if (pin < PIN_MAX_NUM)
+ {
+ gpio_port = GPIO_PORT(pin);
+ gpio_pin = GPIO_PIN(pin);
+ if (PIN_LOW == value)
+ {
+ Gpio_WriteOutputIO((en_gpio_port_t)gpio_port, (en_gpio_pin_t)gpio_pin, FALSE);
+ }
+ else
+ {
+ Gpio_WriteOutputIO((en_gpio_port_t)gpio_port, (en_gpio_pin_t)gpio_pin, TRUE);
+ }
+ }
+}
+
+static int _pin_read(rt_device_t dev, rt_base_t pin)
+{
+ uint8_t gpio_port;
+ uint16_t gpio_pin;
+ int value = PIN_LOW;
+
+ if (pin < PIN_MAX_NUM)
+ {
+ gpio_port = GPIO_PORT(pin);
+ gpio_pin = GPIO_PIN(pin);
+ if (FALSE == Gpio_GetInputIO((en_gpio_port_t)gpio_port, (en_gpio_pin_t)gpio_pin))
+ {
+ value = PIN_LOW;
+ }
+ else
+ {
+ value = PIN_HIGH;
+ }
+ }
+
+ return value;
+}
+
+static void _pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
+{
+ uint8_t gpio_port;
+ uint16_t gpio_pin;
+ stc_gpio_config_t pstcGpioCfg;
+
+ memset(&pstcGpioCfg, 0, sizeof(pstcGpioCfg));
+ if (pin >= PIN_MAX_NUM)
+ {
+ return;
+ }
+
+ switch (mode)
+ {
+ case PIN_MODE_OUTPUT:
+ pstcGpioCfg.enDir = GpioDirOut;
+ pstcGpioCfg.enDrv = GpioDrvL;
+ pstcGpioCfg.enCtrlMode = GpioAHB;
+ break;
+ case PIN_MODE_INPUT:
+ pstcGpioCfg.enDir = GpioDirIn;
+ pstcGpioCfg.enDrv = GpioDrvL;
+ pstcGpioCfg.enPuPd = GpioPu;
+ pstcGpioCfg.enOD = GpioOdDisable;
+ pstcGpioCfg.enCtrlMode = GpioAHB;
+ break;
+ case PIN_MODE_INPUT_PULLUP:
+ pstcGpioCfg.enDir = GpioDirIn;
+ pstcGpioCfg.enDrv = GpioDrvL;
+ pstcGpioCfg.enPuPd = GpioPu;
+ pstcGpioCfg.enOD = GpioOdDisable;
+ pstcGpioCfg.enCtrlMode = GpioAHB;
+ break;
+ case PIN_MODE_INPUT_PULLDOWN:
+ pstcGpioCfg.enDir = GpioDirIn;
+ pstcGpioCfg.enDrv = GpioDrvL;
+ pstcGpioCfg.enPuPd = GpioPd;
+ pstcGpioCfg.enOD = GpioOdDisable;
+ pstcGpioCfg.enCtrlMode = GpioAHB;
+ break;
+ case PIN_MODE_OUTPUT_OD:
+ pstcGpioCfg.enDir = GpioDirOut;
+ pstcGpioCfg.enDrv = GpioDrvL;
+ pstcGpioCfg.enOD = GpioOdEnable;
+ pstcGpioCfg.enCtrlMode = GpioAHB;
+ break;
+ default:
+ break;
+ }
+ gpio_port = GPIO_PORT(pin);
+ gpio_pin = GPIO_PIN(pin);
+ Gpio_Init((en_gpio_port_t)gpio_port, (en_gpio_pin_t)gpio_pin, &pstcGpioCfg);
+}
+
+static rt_err_t _pin_attach_irq(struct rt_device *device, rt_int32_t pin,
+ rt_uint32_t mode, void (*hdr)(void *args), void *args)
+{
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ if (pin >= PIN_MAX_NUM)
+ {
+ return -RT_ENOSYS;
+ }
+
+ irqindex = pin;
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == pin &&
+ pin_irq_hdr_tab[irqindex].hdr == hdr &&
+ pin_irq_hdr_tab[irqindex].mode == mode &&
+ pin_irq_hdr_tab[irqindex].args == args)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ if (pin_irq_hdr_tab[irqindex].pin != -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EBUSY;
+ }
+ pin_irq_hdr_tab[irqindex].pin = pin;
+ pin_irq_hdr_tab[irqindex].hdr = hdr;
+ pin_irq_hdr_tab[irqindex].mode = mode;
+ pin_irq_hdr_tab[irqindex].args = args;
+ rt_hw_interrupt_enable(level);
+
+ return RT_EOK;
+}
+
+static rt_err_t _pin_detach_irq(struct rt_device *device, rt_int32_t pin)
+{
+ rt_base_t level;
+ rt_int32_t irqindex = -1;
+
+ if (pin >= PIN_MAX_NUM)
+ {
+ return -RT_ENOSYS;
+ }
+
+ irqindex = pin;
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_EOK;
+ }
+ pin_irq_hdr_tab[irqindex].pin = -1;
+ pin_irq_hdr_tab[irqindex].hdr = RT_NULL;
+ pin_irq_hdr_tab[irqindex].mode = 0;
+ pin_irq_hdr_tab[irqindex].args = RT_NULL;
+ rt_hw_interrupt_enable(level);
+
+ return RT_EOK;
+}
+
+static rt_err_t _pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
+{
+ rt_base_t level;
+ en_gpio_port_t gpio_port;
+ en_gpio_pin_t gpio_pin;
+ rt_int32_t irqindex;
+ stc_gpio_config_t pstcGpioCfg;
+
+ if ((pin >= PIN_MAX_NUM) || ((PIN_IRQ_ENABLE != enabled) && (PIN_IRQ_DISABLE != enabled)))
+ {
+ return -RT_ENOSYS;
+ }
+
+ irqindex = pin;
+ gpio_port = (en_gpio_port_t)GPIO_PORT(pin);
+ gpio_pin = (en_gpio_pin_t)GPIO_PIN(pin);
+ if (enabled == PIN_IRQ_ENABLE)
+ {
+ level = rt_hw_interrupt_disable();
+ if (pin_irq_hdr_tab[irqindex].pin == -1)
+ {
+ rt_hw_interrupt_enable(level);
+ return RT_ENOSYS;
+ }
+
+ /* Exint config */
+ pstcGpioCfg.enDir = GpioDirIn;
+ pstcGpioCfg.enDrv = GpioDrvL;
+ pstcGpioCfg.enPuPd = GpioPu;
+ pstcGpioCfg.enOD = GpioOdDisable;
+ pstcGpioCfg.enCtrlMode = GpioAHB;
+ Gpio_Init(gpio_port, gpio_pin, &pstcGpioCfg);
+ Gpio_ClearIrq(gpio_port, gpio_pin);
+
+ switch (pin_irq_hdr_tab[irqindex].mode)
+ {
+ case PIN_IRQ_MODE_RISING:
+ Gpio_EnableIrq(gpio_port, gpio_pin, GpioIrqRising);
+ break;
+ case PIN_IRQ_MODE_FALLING:
+ Gpio_EnableIrq(gpio_port, gpio_pin, GpioIrqFalling);
+ break;
+ case PIN_IRQ_MODE_HIGH_LEVEL:
+ Gpio_EnableIrq(gpio_port, gpio_pin, GpioIrqHigh);
+ break;
+ case PIN_IRQ_MODE_LOW_LEVEL:
+ Gpio_EnableIrq(gpio_port, gpio_pin, GpioIrqLow);
+ break;
+ }
+ EnableNvic((IRQn_Type)(pin / 16), IrqLevel3, TRUE);
+
+ rt_hw_interrupt_enable(level);
+ }
+ else
+ {
+ level = rt_hw_interrupt_disable();
+ switch (pin_irq_hdr_tab[irqindex].mode)
+ {
+ case PIN_IRQ_MODE_RISING:
+ Gpio_DisableIrq(gpio_port, gpio_pin, GpioIrqRising);
+ break;
+ case PIN_IRQ_MODE_FALLING:
+ Gpio_DisableIrq(gpio_port, gpio_pin, GpioIrqFalling);
+ break;
+ case PIN_IRQ_MODE_RISING_FALLING:
+
+ break;
+ case PIN_IRQ_MODE_LOW_LEVEL:
+ Gpio_DisableIrq(gpio_port, gpio_pin, GpioIrqLow);
+ break;
+ }
+ rt_hw_interrupt_enable(level);
+ }
+
+ return RT_EOK;
+}
+
+static const struct rt_pin_ops _pin_ops =
+{
+ _pin_mode,
+ _pin_write,
+ _pin_read,
+ _pin_attach_irq,
+ _pin_detach_irq,
+ _pin_irq_enable,
+};
+
+int rt_hw_pin_init(void)
+{
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE);
+
+ return rt_device_pin_register("pin", &_pin_ops, RT_NULL);
+}
+INIT_BOARD_EXPORT(rt_hw_pin_init);
+
+#endif /* RT_USING_PIN */
diff --git a/bsp/hc32l136/drivers/drv_gpio.h b/bsp/hc32l136/drivers/drv_gpio.h
new file mode 100644
index 0000000000..bc07777b90
--- /dev/null
+++ b/bsp/hc32l136/drivers/drv_gpio.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-08-19 pjq first version
+ */
+
+#ifndef __DRV_GPIO_H__
+#define __DRV_GPIO_H__
+
+#include <rtdevice.h>
+
+#ifdef RT_USING_PIN
+
+#define __HC_PORT(port) GpioPort##port
+#define GET_PIN(PORT, PIN) (((rt_uint16_t)__HC_PORT(PORT) / 0x40 * 16) + PIN)
+
+#ifndef EXINT0_IRQ_CONFIG
+#define EXINT0_IRQ_CONFIG \
+ { \
+ .irq = EXINT0_INT_IRQn, \
+ .irq_prio = EXINT0_INT_PRIO, \
+ }
+#endif /* EXINT1_IRQ_CONFIG */
+
+#ifndef EXINT1_IRQ_CONFIG
+#define EXINT1_IRQ_CONFIG \
+ { \
+ .irq = EXINT1_INT_IRQn, \
+ .irq_prio = EXINT1_INT_PRIO, \
+ }
+#endif /* EXINT1_IRQ_CONFIG */
+
+#ifndef EXINT2_IRQ_CONFIG
+#define EXINT2_IRQ_CONFIG \
+ { \
+ .irq = EXINT2_INT_IRQn, \
+ .irq_prio = EXINT2_INT_PRIO, \
+ }
+#endif /* EXINT2_IRQ_CONFIG */
+
+#ifndef EXINT3_IRQ_CONFIG
+#define EXINT3_IRQ_CONFIG \
+ { \
+ .irq = EXINT3_INT_IRQn, \
+ .irq_prio = EXINT3_INT_PRIO, \
+ }
+#endif /* EXINT3_IRQ_CONFIG */
+
+#ifndef EXINT4_IRQ_CONFIG
+#define EXINT4_IRQ_CONFIG \
+ { \
+ .irq = EXINT4_INT_IRQn, \
+ .irq_prio = EXINT4_INT_PRIO, \
+ }
+#endif /* EXINT4_IRQ_CONFIG */
+
+#ifndef EXINT5_IRQ_CONFIG
+#define EXINT5_IRQ_CONFIG \
+ { \
+ .irq = EXINT5_INT_IRQn, \
+ .irq_prio = EXINT5_INT_PRIO, \
+ }
+#endif /* EXINT5_IRQ_CONFIG */
+
+#ifndef EXINT6_IRQ_CONFIG
+#define EXINT6_IRQ_CONFIG \
+ { \
+ .irq = EXINT6_INT_IRQn, \
+ .irq_prio = EXINT6_INT_PRIO, \
+ }
+#endif /* EXINT6_IRQ_CONFIG */
+
+#ifndef EXINT7_IRQ_CONFIG
+#define EXINT7_IRQ_CONFIG \
+ { \
+ .irq = EXINT7_INT_IRQn, \
+ .irq_prio = EXINT7_INT_PRIO, \
+ }
+#endif /* EXINT7_IRQ_CONFIG */
+
+#ifndef EXINT8_IRQ_CONFIG
+#define EXINT8_IRQ_CONFIG \
+ { \
+ .irq = EXINT8_INT_IRQn, \
+ .irq_prio = EXINT8_INT_PRIO, \
+ }
+#endif /* EXINT8_IRQ_CONFIG */
+
+#ifndef EXINT9_IRQ_CONFIG
+#define EXINT9_IRQ_CONFIG \
+ { \
+ .irq = EXINT9_INT_IRQn, \
+ .irq_prio = EXINT9_INT_PRIO, \
+ }
+#endif /* EXINT9_IRQ_CONFIG */
+
+#ifndef EXINT10_IRQ_CONFIG
+#define EXINT10_IRQ_CONFIG \
+ { \
+ .irq = EXINT10_INT_IRQn, \
+ .irq_prio = EXINT10_INT_PRIO, \
+ }
+#endif /* EXINT10_IRQ_CONFIG */
+
+#ifndef EXINT11_IRQ_CONFIG
+#define EXINT11_IRQ_CONFIG \
+ { \
+ .irq = EXINT11_INT_IRQn, \
+ .irq_prio = EXINT11_INT_PRIO, \
+ }
+#endif /* EXINT11_IRQ_CONFIG */
+
+#ifndef EXINT12_IRQ_CONFIG
+#define EXINT12_IRQ_CONFIG \
+ { \
+ .irq = EXINT12_INT_IRQn, \
+ .irq_prio = EXINT12_INT_PRIO, \
+ }
+#endif /* EXINT12_IRQ_CONFIG */
+
+#ifndef EXINT13_IRQ_CONFIG
+#define EXINT13_IRQ_CONFIG \
+ { \
+ .irq = EXINT13_INT_IRQn, \
+ .irq_prio = EXINT13_INT_PRIO, \
+ }
+#endif /* EXINT13_IRQ_CONFIG */
+
+#ifndef EXINT14_IRQ_CONFIG
+#define EXINT14_IRQ_CONFIG \
+ { \
+ .irq = EXINT14_INT_IRQn, \
+ .irq_prio = EXINT14_INT_PRIO, \
+ }
+#endif /* EXINT14_IRQ_CONFIG */
+
+#ifndef EXINT15_IRQ_CONFIG
+#define EXINT15_IRQ_CONFIG \
+ { \
+ .irq = EXINT15_INT_IRQn, \
+ .irq_prio = EXINT15_INT_PRIO, \
+ }
+#endif /* EXINT15_IRQ_CONFIG */
+
+#endif
+
+#endif /* __DRV_GPIO_H__ */
diff --git a/bsp/hc32l136/drivers/drv_usart.c b/bsp/hc32l136/drivers/drv_usart.c
new file mode 100644
index 0000000000..7f81374dbb
--- /dev/null
+++ b/bsp/hc32l136/drivers/drv_usart.c
@@ -0,0 +1,622 @@
+/*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-08-19 pjq first version
+ */
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include <rtdevice.h>
+#include <rthw.h>
+#include "gpio.h"
+#include "uart.h"
+#include "drv_usart.h"
+
+#ifdef RT_USING_SERIAL
+
+#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1)
+#error "Please define at least one BSP_USING_UARTx"
+/* UART instance can be selected at menuconfig -> Hardware Drivers Config -> On-chip Peripheral Drivers -> Enable UART */
+#endif
+
+/*******************************************************************************
+ * Local type definitions ('typedef')
+ ******************************************************************************/
+/* HC32 config Rx timeout */
+struct hc32_uart_rxto
+{
+ rt_uint32_t channel;
+ rt_size_t timeout_bits;
+};
+
+/* HC32 UART index */
+struct uart_index
+{
+ rt_uint8_t index;
+ rt_uint8_t idx;
+};
+
+/* HC32 UART irq handler */
+struct uart_irq_handler
+{
+ void (*tx_irq_handler)(void);
+ void (*rxerr_irq_handler)(void);
+ void (*rx_irq_handler)(void);
+ void (*cts_irq_handler)(void);
+ void (*pei_irq_handler)(void);
+};
+
+/*******************************************************************************
+ * Local pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global variable definitions (declared in header file with 'extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Local function prototypes ('static')
+ ******************************************************************************/
+#ifdef RT_SERIAL_USING_DMA
+static void hc32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag);
+#endif
+
+/*******************************************************************************
+ * Local variable definitions ('static')
+ ******************************************************************************/
+enum
+{
+#ifdef BSP_USING_UART0
+ UART0_INDEX,
+#endif
+#ifdef BSP_USING_UART1
+ UART1_INDEX,
+#endif
+ UART_INDEX_MAX,
+};
+
+static const struct uart_index uart_map[] =
+{
+#ifdef BSP_USING_UART0
+ {UART0_INDEX, UARTCH0},
+#endif
+#ifdef BSP_USING_UART1
+ {UART1_INDEX, UARTCH1},
+#endif
+};
+
+static struct hc32_uart_config uart_config[] =
+{
+#ifdef BSP_USING_UART0
+ { \
+ .name = "uart0", \
+ .idx = UARTCH0, \
+ },
+#endif
+#ifdef BSP_USING_UART1
+ { \
+ .name = "uart1", \
+ .idx = UARTCH1, \
+ }
+#endif
+};
+
+#ifdef BSP_USING_UART0
+static int uart0_rx_flag;
+#endif
+#ifdef BSP_USING_UART1
+static int uart1_rx_flag;
+#endif
+static struct hc32_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};
+static const struct uart_irq_handler uart_irq_handlers[sizeof(uart_obj) / sizeof(uart_obj[0])];
+
+/*******************************************************************************
+ * Function implementation - global ('extern') and local ('static')
+ ******************************************************************************/
+
+//static uint32_t hc32_get_uart_index(M0P_UART_TypeDef *Instance)
+static uint32_t hc32_get_uart_index(uint8_t idx)
+{
+ uint32_t index = UART_INDEX_MAX;
+
+ for (uint8_t i = 0U; i < ARRAY_SZ(uart_map); i++)
+ {
+ if (uart_map[i].idx == idx)
+ {
+ index = uart_map[i].index;
+ RT_ASSERT(index < UART_INDEX_MAX)
+ break;
+ }
+ }
+
+ return index;
+}
+
+#if defined(BSP_USING_UART0)
+void uart0_gpioinit(void)
+{
+ stc_gpio_config_t stcGpioCfg;
+ DDL_ZERO_STRUCT(stcGpioCfg);
+ stcGpioCfg.enDir = GpioDirOut;
+ Gpio_Init(GpioPortA,GpioPin9,&stcGpioCfg);
+ Gpio_SetAfMode(GpioPortA,GpioPin9,GpioAf1);//TX
+ stcGpioCfg.enDir = GpioDirIn;
+ Gpio_Init(GpioPortA,GpioPin10,&stcGpioCfg);
+ Gpio_SetAfMode(GpioPortA,GpioPin10,GpioAf1);//RX
+}
+#endif
+
+#if defined(BSP_USING_UART1)
+void uart1_gpioinit(void)
+{
+ stc_gpio_config_t stcGpioCfg;
+
+ DDL_ZERO_STRUCT(stcGpioCfg);
+ stcGpioCfg.enDir = GpioDirOut;
+ Gpio_Init(GpioPortA,GpioPin2,&stcGpioCfg);
+ Gpio_SetAfMode(GpioPortA,GpioPin2,GpioAf1);//TX
+ stcGpioCfg.enDir = GpioDirIn;
+ Gpio_Init(GpioPortA,GpioPin3,&stcGpioCfg);
+ Gpio_SetAfMode(GpioPortA,GpioPin3,GpioAf1);//RX
+}
+#endif
+
+static rt_err_t hc32_configure(struct rt_serial_device *serial,
+ struct serial_configure *cfg)
+{
+ struct hc32_uart *uart;
+ uint16_t u16Scnt = 0;
+ stc_uart_config_t stcConfig;
+ stc_uart_irq_cb_t stcUartIrqCb;
+ stc_uart_multimode_t stcMulti;
+ stc_uart_baud_t stcBaud;
+ uint8_t index;
+ en_uart_mmdorck_t enTb8;
+
+ DDL_ZERO_STRUCT(stcConfig);
+ DDL_ZERO_STRUCT(stcUartIrqCb);
+ DDL_ZERO_STRUCT(stcMulti);
+ DDL_ZERO_STRUCT(stcBaud);
+
+ RT_ASSERT(RT_NULL != cfg);
+ RT_ASSERT(RT_NULL != serial);
+
+ uart = rt_container_of(serial, struct hc32_uart, serial);
+#if defined(BSP_USING_UART0)
+ if (uart->config->idx == UARTCH0)
+ {
+ uart0_gpioinit();
+ }
+#endif
+
+#if defined(BSP_USING_UART1)
+ if (uart->config->idx == UARTCH1)
+ {
+ uart1_gpioinit();
+ }
+#endif
+
+ /* Configure USART initialization structure */
+ index = hc32_get_uart_index(uart->config->idx);
+ stcUartIrqCb.pfnRxIrqCb = uart_irq_handlers[index].rx_irq_handler;
+ stcUartIrqCb.pfnTxIrqCb = uart_irq_handlers[index].tx_irq_handler;
+ stcUartIrqCb.pfnRxFEIrqCb = uart_irq_handlers[index].rxerr_irq_handler;
+ stcUartIrqCb.pfnPEIrqCb = uart_irq_handlers[index].pei_irq_handler;
+ stcUartIrqCb.pfnCtsIrqCb = uart_irq_handlers[index].cts_irq_handler;
+ stcConfig.pstcIrqCb = &stcUartIrqCb;
+ stcConfig.bTouchNvic = TRUE;
+
+ stcConfig.enRunMode = UartMode3;
+ stcMulti.enMulti_mode = UartNormal;
+
+ if(BIT_ORDER_LSB == cfg->bit_order)
+ {
+
+ }
+ else
+ {
+
+ }
+
+ switch(cfg->stop_bits)
+ {
+ case STOP_BITS_1:
+ stcConfig.enStopBit = Uart1bit;
+ break;
+ case STOP_BITS_2:
+ stcConfig.enStopBit = Uart2bit;
+ break;
+ default:
+ break;
+ }
+
+ switch(cfg->parity)
+ {
+ case PARITY_NONE:
+ enTb8 = UartDataOrAddr;
+ break;
+ case PARITY_EVEN:
+ enTb8 = UartEven;
+ break;
+ case PARITY_ODD:
+ enTb8 = UartOdd;
+ break;
+ default:
+ enTb8 = UartDataOrAddr;
+ break;
+ }
+
+ switch(cfg->data_bits)
+ {
+ case DATA_BITS_8:
+ break;
+ default:
+ return -RT_ERROR;
+ }
+
+ Uart_SetMMDOrCk(uart->config->idx, enTb8);
+ stcConfig.pstcMultiMode = &stcMulti;
+ Uart_Init(uart->config->idx, &stcConfig);
+
+ Uart_SetClkDiv(uart->config->idx, Uart8Or16Div);
+ stcBaud.u32Pclk = Sysctrl_GetPClkFreq();
+ stcBaud.enRunMode = UartMode3;
+ stcBaud.u32Baud = cfg->baud_rate;
+ u16Scnt = Uart_CalScnt(uart->config->idx, &stcBaud);
+ Uart_SetBaud(uart->config->idx, u16Scnt);
+
+ Uart_ClrStatus(uart->config->idx, UartTC);
+ Uart_ClrStatus(uart->config->idx, UartRC);
+ Uart_DisableIrq(uart->config->idx, UartTxIrq);
+ Uart_DisableIrq(uart->config->idx, UartRxIrq);
+ Uart_EnableFunc(uart->config->idx, UartRx);
+
+ return RT_EOK;
+}
+
+static rt_err_t hc32_control(struct rt_serial_device *serial, int cmd, void *arg)
+{
+ struct hc32_uart *uart;
+
+ RT_ASSERT(serial != RT_NULL);
+ uart = rt_container_of(serial, struct hc32_uart, serial);
+
+ switch (cmd)
+ {
+ /* disable interrupt */
+ case RT_DEVICE_CTRL_CLR_INT:
+ Uart_DisableIrq(uart->config->idx, UartRxIrq);
+ break;
+
+ /* enable interrupt */
+ case RT_DEVICE_CTRL_SET_INT:
+ /* enable rx irq */
+ Uart_ClrStatus(uart->config->idx, UartRC);
+ Uart_EnableIrq(uart->config->idx, UartRxIrq);
+ break;
+
+ case RT_DEVICE_CTRL_CLOSE:
+ break;
+ }
+
+ return RT_EOK;
+}
+
+static int hc32_putc(struct rt_serial_device *serial, char c)
+{
+ struct hc32_uart *uart;
+
+ RT_ASSERT(RT_NULL != serial);
+
+ uart = rt_container_of(serial, struct hc32_uart, serial);
+
+ if(serial->parent.open_flag & RT_DEVICE_FLAG_INT_TX)
+ {
+ if (Uart_GetStatus(uart->config->idx, UartTC) == FALSE)
+ {
+ return -1;
+ }
+ }
+ Uart_SendData(uart->config->idx, c);
+
+ return 1;
+}
+
+static int hc32_getc(struct rt_serial_device *serial)
+{
+ int ch= -1;
+ struct hc32_uart *uart;
+
+ RT_ASSERT(RT_NULL != serial);
+
+ uart = rt_container_of(serial, struct hc32_uart, serial);
+
+#if defined(BSP_USING_UART0)
+ if (uart->config->idx == UARTCH0)
+ {
+ if (serial->parent.open_flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ if (uart0_rx_flag)
+ {
+ ch = Uart_ReceiveData(uart->config->idx);
+ uart0_rx_flag = 0;
+ }
+ }
+ else
+ {
+ if(Uart_GetStatus(uart->config->idx, UartRC))
+ {
+ Uart_ClrStatus(uart->config->idx, UartRC);
+ ch = Uart_ReceiveData(uart->config->idx);
+ }
+ }
+ }
+#endif
+#if defined(BSP_USING_UART1)
+ if (uart->config->idx == UARTCH1)
+ {
+ if (serial->parent.open_flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ if (uart1_rx_flag)
+ {
+ ch = Uart_ReceiveData(uart->config->idx);
+ uart1_rx_flag = 0;
+ }
+ }
+ else
+ {
+ if(Uart_GetStatus(uart->config->idx, UartRC))
+ {
+ Uart_ClrStatus(uart->config->idx, UartRC);
+ ch = Uart_ReceiveData(uart->config->idx);
+ }
+ }
+ }
+#endif
+
+ return ch;
+}
+
+static rt_size_t hc32_dma_transmit(struct rt_serial_device *serial,
+ rt_uint8_t *buf,
+ rt_size_t size,
+ int direction)
+{
+
+ return 0;
+}
+
+static void hc32_uart_rx_irq_handler(struct hc32_uart *uart)
+{
+ RT_ASSERT(RT_NULL != uart);
+
+ rt_hw_serial_isr(&uart->serial, RT_SERIAL_EVENT_RX_IND);
+}
+
+static void hc32_uart_tx_irq_handler(struct hc32_uart *uart)
+{
+ RT_ASSERT(RT_NULL != uart);
+
+ if (uart->serial.parent.open_flag & RT_DEVICE_FLAG_INT_TX)
+ {
+ rt_hw_serial_isr(&uart->serial, RT_SERIAL_EVENT_TX_DONE);
+ }
+}
+
+static void hc32_uart_rxerr_irq_handler(struct hc32_uart *uart)
+{
+ RT_ASSERT(RT_NULL != uart);
+}
+
+static void hc32_uart_cts_irq_handler(struct hc32_uart *uart)
+{
+ RT_ASSERT(RT_NULL != uart);
+}
+
+static void hc32_uart_pei_irq_handler(struct hc32_uart *uart)
+{
+ RT_ASSERT(RT_NULL != uart);
+}
+
+#ifdef RT_SERIAL_USING_DMA
+static void hc32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
+{
+
+}
+#endif
+
+#if defined(BSP_USING_UART0)
+static void hc32_uart0_rx_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ uart0_rx_flag = 1;
+ hc32_uart_rx_irq_handler(&uart_obj[UART0_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart0_tx_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_tx_irq_handler(&uart_obj[UART0_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart0_rxerr_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_rxerr_irq_handler(&uart_obj[UART0_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart0_cts_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_cts_irq_handler(&uart_obj[UART0_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart0_pei_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_pei_irq_handler(&uart_obj[UART0_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+#endif /* BSP_USING_UART0 */
+
+#if defined(BSP_USING_UART1)
+static void hc32_uart1_tx_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_tx_irq_handler(&uart_obj[UART1_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart1_rxerr_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_rxerr_irq_handler(&uart_obj[UART1_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart1_rx_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ uart1_rx_flag = 1;
+ hc32_uart_rx_irq_handler(&uart_obj[UART1_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart1_cts_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_cts_irq_handler(&uart_obj[UART1_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+
+static void hc32_uart1_pei_irq_handler(void)
+{
+ /* enter interrupt */
+ rt_interrupt_enter();
+
+ hc32_uart_pei_irq_handler(&uart_obj[UART1_INDEX]);
+
+ /* leave interrupt */
+ rt_interrupt_leave();
+}
+#endif /* BSP_USING_UART1 */
+
+static const struct uart_irq_handler uart_irq_handlers[] =
+{
+#ifdef BSP_USING_UART0
+ { hc32_uart0_tx_irq_handler, hc32_uart0_rxerr_irq_handler, hc32_uart0_rx_irq_handler,
+ hc32_uart0_cts_irq_handler, hc32_uart0_pei_irq_handler
+ },
+#endif
+#ifdef BSP_USING_UART1
+ { hc32_uart1_tx_irq_handler, hc32_uart1_rxerr_irq_handler, hc32_uart1_rx_irq_handler,
+ hc32_uart1_cts_irq_handler, hc32_uart1_pei_irq_handler
+ },
+#endif
+};
+
+static void hc32_uart_get_dma_config(void)
+{
+
+}
+
+static const struct rt_uart_ops hc32_uart_ops =
+{
+ .configure = hc32_configure,
+ .control = hc32_control,
+ .putc = hc32_putc,
+ .getc = hc32_getc,
+ .dma_transmit = hc32_dma_transmit
+};
+
+int hc32_hw_uart_init(void)
+{
+ rt_err_t result = RT_EOK;
+ rt_size_t obj_num = sizeof(uart_obj) / sizeof(struct hc32_uart);
+ struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
+
+ hc32_uart_get_dma_config();
+
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio,TRUE);
+#ifdef BSP_USING_UART0
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralUart0,TRUE);
+#endif
+#ifdef BSP_USING_UART1
+ Sysctrl_SetPeripheralGate(SysctrlPeripheralUart1,TRUE);
+#endif
+
+ for (int i = 0; i < obj_num; i++)
+ {
+ /* init UART object */
+ uart_obj[i].serial.ops = &hc32_uart_ops;
+ uart_obj[i].serial.config = config;
+ uart_obj[i].config = &uart_config[i];
+
+ /* register UART device */
+ result = rt_hw_serial_register(&uart_obj[i].serial,
+ uart_obj[i].config->name,
+ (RT_DEVICE_FLAG_RDWR |
+ RT_DEVICE_FLAG_INT_RX |
+ RT_DEVICE_FLAG_INT_TX |
+ uart_obj[i].uart_dma_flag),
+ &uart_obj[i]);
+ RT_ASSERT(result == RT_EOK);
+ }
+
+ return result;
+}
+
+INIT_BOARD_EXPORT(hc32_hw_uart_init);
+
+#endif /* RT_USING_SERIAL */
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/drivers/drv_usart.h b/bsp/hc32l136/drivers/drv_usart.h
new file mode 100644
index 0000000000..a948bde5d3
--- /dev/null
+++ b/bsp/hc32l136/drivers/drv_usart.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021, Huada Semiconductor Co., Ltd.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-08-19 pjq first version
+ */
+
+
+#ifndef __DRV_USART_H__
+#define __DRV_USART_H__
+
+/*******************************************************************************
+ * Include files
+ ******************************************************************************/
+#include <rtthread.h>
+#include "rtdevice.h"
+
+#include "ddl.h"
+#include "uart.h"
+
+/* C binding of definitions if building with C++ compiler */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*******************************************************************************
+ * Global type definitions ('typedef')
+ ******************************************************************************/
+/* HC32 config uart class */
+struct hc32_uart_config
+{
+ const char *name;
+ rt_uint8_t idx;
+ rt_uint16_t uart_dma_flag;
+ struct rt_serial_device serial;
+};
+
+/* stm32 uart dirver class */
+struct hc32_uart
+{
+ struct hc32_uart_config *config;
+#ifdef RT_SERIAL_USING_DMA
+
+#endif
+ rt_uint16_t uart_dma_flag;
+ struct rt_serial_device serial;
+};
+
+/*******************************************************************************
+ * Global pre-processor symbols/macros ('#define')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global variable definitions ('extern')
+ ******************************************************************************/
+
+/*******************************************************************************
+ * Global function prototypes (definition in C source)
+ ******************************************************************************/
+int rt_hw_uart_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DRV_USART_H__ */
+
+/*******************************************************************************
+ * EOF (not truncated)
+ ******************************************************************************/
diff --git a/bsp/hc32l136/figures/board.png b/bsp/hc32l136/figures/board.png
new file mode 100644
index 0000000000..b5b5b368d1
--- /dev/null
+++ b/bsp/hc32l136/figures/board.png
Binary files differ
diff --git a/bsp/hc32l136/project.ewp b/bsp/hc32l136/project.ewp
new file mode 100644
index 0000000000..1ed9cb8f20
--- /dev/null
+++ b/bsp/hc32l136/project.ewp
@@ -0,0 +1,2157 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<project>
+ <fileVersion>2</fileVersion>
+ <configuration>
+ <name>Release</name>
+ <toolchain>
+ <name>ARM</name>
+ </toolchain>
+ <debug>0</debug>
+ <settings>
+ <name>General</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <version>24</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>OGChipSelectEditMenu</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>GFPUDeviceSlave</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>ExePath</name>
+ <state>build\iar\release\Exe</state>
+ </option>
+ <option>
+ <name>ObjPath</name>
+ <state>build\iar\release\Obj</state>
+ </option>
+ <option>
+ <name>ListPath</name>
+ <state>build\iar\release\List</state>
+ </option>
+ <option>
+ <name>GEndianMode</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input variant</name>
+ <version>3</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>Output variant</name>
+ <version>2</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Output description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>GOutputBinary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OGCoreOrChip</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelect</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelectSlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>RTDescription</name>
+ <state>Use the full configuration of the C/C++ runtime library. Full locale interface, C locale, file descriptor support, multibytes in printf and scanf, and hex floats in strtod.</state>
+ </option>
+ <option>
+ <name>OGProductVersion</name>
+ <state>6.50.1.4445</state>
+ </option>
+ <option>
+ <name>OGLastSavedByProductVersion</name>
+ <state>7.80.4.12487</state>
+ </option>
+ <option>
+ <name>GeneralEnableMisra</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraVerbose</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GenLowLevelInterface</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GEndianModeBE</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GenStdoutInterface</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111010110110011110101111110111111111111101111111111001101111110011110001111111011011111111111111111</state>
+ </option>
+ <option>
+ <name>RTConfigPath2</name>
+ <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Full.h</state>
+ </option>
+ <option>
+ <name>GBECoreSlave</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ <option>
+ <name>OGUseCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGUseCmsisDspLib</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibThreads</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CoreVariant</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ <option>
+ <name>FPU2</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NrRegs</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NEON</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GFPUCoreSlave2</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ICCARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>31</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>CCDefines</name>
+ <state></state>
+ <state>USE_DDL_DRIVER</state>
+ <state>HC32L136</state>
+ <state>__DEBUG</state>
+ <state>__RTTHREAD__</state>
+ </option>
+ <option>
+ <name>CCPreprocFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocComments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMnemonics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMessages</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagSuppress</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagRemark</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagWarning</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagError</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAllowList</name>
+ <version>1</version>
+ <state>11111110</state>
+ </option>
+ <option>
+ <name>CCDebugInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IEndianMode</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCLangConformance</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSignedPlainChar</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCRequirePrototypes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagWarnAreErr</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCompilerRuntimeInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>CCLibConfigHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>PreInclude</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CompilerMisraOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCIncludePath2</name>
+ <state></state>
+ <state>$PROJ_DIR$\Libraries\CMSIS\Include</state>
+ <state>$PROJ_DIR$\..\..\include</state>
+ <state>$PROJ_DIR$\Libraries\CMSIS\Device\HDSC\HC32L136\Include</state>
+ <state>$PROJ_DIR$\drivers</state>
+ <state>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\inc</state>
+ <state>$PROJ_DIR$\.</state>
+ <state>$PROJ_DIR$\applications</state>
+ <state>$PROJ_DIR$\board</state>
+ <state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m0</state>
+ <state>$PROJ_DIR$\..\..\components\drivers\include</state>
+ <state>$PROJ_DIR$\..\..\libcpu\arm\common</state>
+ <state>$PROJ_DIR$\..\..\components\finsh</state>
+ </option>
+ <option>
+ <name>CCStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCodeSection</name>
+ <state>.text</state>
+ </option>
+ <option>
+ <name>IInterwork2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IProcessorMode2</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCOptLevel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategy</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCOptLevelSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111011110110011111101111110111111111111101111111111001101111110111110001111111011111111111111111111</state>
+ </option>
+ <option>
+ <name>CCPosIndRopi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndRwpi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndNoDynInit</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccLang</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccAllowVLA</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCppDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccExceptions</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccRTTI</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccStaticDestr</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccCppInlineSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccFloatSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptimizationNoSizeConstraints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategySlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCGuardCalls</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>AARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>9</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>AObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AEndian</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ACaseSensitivity</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacroChars</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnWhat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnOne</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ADebug</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AltRegisterNames</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ADefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AListHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AListing</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Includes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacDefs</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacExps</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacExec</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OnlyAssed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MultiLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>TabSpacing</name>
+ <state>8</state>
+ </option>
+ <option>
+ <name>AXRef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDefines</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefInternal</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDual</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AOutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>AMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsEdit</name>
+ <state>100</state>
+ </option>
+ <option>
+ <name>AIgnoreStdInclude</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AUserIncludes</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AExtraOptionsCheckV2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AExtraOptionsV2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AsmNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>OBJCOPY</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>OOCOutputFormat</name>
+ <version>3</version>
+ <state>3</state>
+ </option>
+ <option>
+ <name>OCOutputOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCOutputFile</name>
+ <state>rtthread.bin</state>
+ </option>
+ <option>
+ <name>OOCCommandLineProducer</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCObjCopyEnable</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>CUSTOM</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <extensions></extensions>
+ <cmdline></cmdline>
+ <hasPrio>0</hasPrio>
+ </data>
+ </settings>
+ <settings>
+ <name>BICOMP</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ <settings>
+ <name>BUILDACTION</name>
+ <archiveVersion>1</archiveVersion>
+ <data>
+ <prebuild></prebuild>
+ <postbuild></postbuild>
+ </data>
+ </settings>
+ <settings>
+ <name>ILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>18</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IlinkLibIOConfig</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLinkMisraHandler</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkInputFileSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOutputFile</name>
+ <state>rtthread.out</state>
+ </option>
+ <option>
+ <name>IlinkDebugInfoEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkKeepSymbols</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySymbol</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySegment</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryAlign</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkConfigDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkMapFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogInitialization</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogModule</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogSection</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogVeneer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile</name>
+ <state>$PROJ_DIR$\board\linker_scripts\link.icf</state>
+ </option>
+ <option>
+ <name>IlinkIcfFileSlave</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkSuppressDiags</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsRem</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsWarn</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsErr</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkWarningsAreErrors</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkUseExtraOptions</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkLowLevelInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAutoLibEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAdditionalLibs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkOverrideProgramEntryLabel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabelSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabel</name>
+ <state>__iar_program_start</state>
+ </option>
+ <option>
+ <name>DoFill</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>FillerByte</name>
+ <state>0xFF</state>
+ </option>
+ <option>
+ <name>FillerStart</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>FillerEnd</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>CrcSize</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcAlign</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcPoly</name>
+ <state>0x11021</state>
+ </option>
+ <option>
+ <name>CrcCompl</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcBitOrder</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcInitialValue</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>DoCrc</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkBE8Slave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkStdoutInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcFullSize</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIElfToolPostProcess</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogAutoLibSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogRedirSymbols</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogUnusedFragments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcReverseByteOrder</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcUseAsInput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptInline</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsAllow</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsForce</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptMergeDuplSections</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptUseVfe</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptForceVfe</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackAnalysisEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackControlFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkStackCallGraphFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CrcAlgorithm</name>
+ <version>1</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcUnitSize</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkThreadsSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogCallGraph</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile_AltDefault</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>IARCHIVE</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IarchiveInputs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IarchiveOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IarchiveOutput</name>
+ <state>###Unitialized###</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>BILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ </configuration>
+ <configuration>
+ <name>Debug</name>
+ <toolchain>
+ <name>ARM</name>
+ </toolchain>
+ <debug>0</debug>
+ <settings>
+ <name>General</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <version>24</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>ExePath</name>
+ <state>build\iar\debug\Exe</state>
+ </option>
+ <option>
+ <name>ObjPath</name>
+ <state>build\iar\debug\Obj</state>
+ </option>
+ <option>
+ <name>ListPath</name>
+ <state>build\iar\debug\List</state>
+ </option>
+ <option>
+ <name>GEndianMode</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input variant</name>
+ <version>3</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>Output variant</name>
+ <version>2</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Output description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>GOutputBinary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OGCoreOrChip</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelect</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelectSlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>RTDescription</name>
+ <state>Use the full configuration of the C/C++ runtime library. Full locale interface, C locale, file descriptor support, multibytes in printf and scanf, and hex floats in strtod.</state>
+ </option>
+ <option>
+ <name>OGProductVersion</name>
+ <state>6.50.1.4445</state>
+ </option>
+ <option>
+ <name>OGLastSavedByProductVersion</name>
+ <state>7.70.1.11471</state>
+ </option>
+ <option>
+ <name>GeneralEnableMisra</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraVerbose</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OGChipSelectEditMenu</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>GenLowLevelInterface</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GEndianModeBE</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GenStdoutInterface</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111010110110011110101111110111111111111101111111111001101111110011110001111111011011111111111111111</state>
+ </option>
+ <option>
+ <name>RTConfigPath2</name>
+ <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Full.h</state>
+ </option>
+ <option>
+ <name>GBECoreSlave</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ <option>
+ <name>OGUseCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGUseCmsisDspLib</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibThreads</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CoreVariant</name>
+ <version>24</version>
+ <state>39</state>
+ </option>
+ <option>
+ <name>GFPUDeviceSlave</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>FPU2</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NrRegs</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NEON</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GFPUCoreSlave2</name>
+ <version>24</version>
+ <state>39</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ICCARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>31</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>CCDefines</name>
+ <state>__DEBUG</state>
+ <state>USE_DDL_DRIVER</state>
+ <state>HC32L136</state>
+ <state>__DEBUG</state>
+ <state>__RTTHREAD__</state>
+ </option>
+ <option>
+ <name>CCPreprocFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocComments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMnemonics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMessages</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagSuppress</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagRemark</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagWarning</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagError</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAllowList</name>
+ <version>1</version>
+ <state>00000000</state>
+ </option>
+ <option>
+ <name>CCDebugInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IEndianMode</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCLangConformance</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSignedPlainChar</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCRequirePrototypes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagWarnAreErr</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCompilerRuntimeInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>CCLibConfigHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>PreInclude</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CompilerMisraOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCIncludePath2</name>
+ <state></state>
+ <state>$PROJ_DIR$\Libraries\CMSIS\Include</state>
+ <state>$PROJ_DIR$\..\..\include</state>
+ <state>$PROJ_DIR$\Libraries\CMSIS\Device\HDSC\HC32L136\Include</state>
+ <state>$PROJ_DIR$\drivers</state>
+ <state>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\inc</state>
+ <state>$PROJ_DIR$\.</state>
+ <state>$PROJ_DIR$\applications</state>
+ <state>$PROJ_DIR$\board</state>
+ <state>$PROJ_DIR$\..\..\libcpu\arm\cortex-m0</state>
+ <state>$PROJ_DIR$\..\..\components\drivers\include</state>
+ <state>$PROJ_DIR$\..\..\libcpu\arm\common</state>
+ <state>$PROJ_DIR$\..\..\components\finsh</state>
+ </option>
+ <option>
+ <name>CCStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCodeSection</name>
+ <state>.text</state>
+ </option>
+ <option>
+ <name>IInterwork2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IProcessorMode2</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCOptLevel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategy</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCOptLevelSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111011110110011111101111110111111111111101111111111001101111110111110001111111011111111111111111111</state>
+ </option>
+ <option>
+ <name>CCPosIndRopi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndRwpi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndNoDynInit</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccLang</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccAllowVLA</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCppDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccExceptions</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccRTTI</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccStaticDestr</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccCppInlineSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccFloatSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptimizationNoSizeConstraints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategySlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCGuardCalls</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>AARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>9</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>AObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AEndian</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ACaseSensitivity</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacroChars</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnWhat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnOne</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ADebug</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AltRegisterNames</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ADefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AListHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AListing</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Includes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacDefs</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacExps</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacExec</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OnlyAssed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MultiLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>TabSpacing</name>
+ <state>8</state>
+ </option>
+ <option>
+ <name>AXRef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDefines</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefInternal</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDual</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AOutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>AMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsEdit</name>
+ <state>100</state>
+ </option>
+ <option>
+ <name>AIgnoreStdInclude</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AUserIncludes</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AExtraOptionsCheckV2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AExtraOptionsV2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AsmNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>OBJCOPY</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>OOCOutputFile</name>
+ <state>rtthread.bin</state>
+ </option>
+ <option>
+ <name>OOCOutputFormat</name>
+ <version>3</version>
+ <state>3</state>
+ </option>
+ <option>
+ <name>OCOutputOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCCommandLineProducer</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCObjCopyEnable</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>CUSTOM</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <extensions></extensions>
+ <cmdline></cmdline>
+ <hasPrio>0</hasPrio>
+ </data>
+ </settings>
+ <settings>
+ <name>BICOMP</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ <settings>
+ <name>BUILDACTION</name>
+ <archiveVersion>1</archiveVersion>
+ <data>
+ <prebuild></prebuild>
+ <postbuild></postbuild>
+ </data>
+ </settings>
+ <settings>
+ <name>ILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>18</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IlinkOutputFile</name>
+ <state>rtthread.out</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile</name>
+ <state>$PROJ_DIR$\board\linker_scripts\link.icf</state>
+ </option>
+ <option>
+ <name>IlinkLibIOConfig</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLinkMisraHandler</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkInputFileSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkDebugInfoEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkKeepSymbols</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySymbol</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySegment</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryAlign</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkConfigDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkMapFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogInitialization</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogModule</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogSection</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogVeneer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkIcfFileSlave</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkSuppressDiags</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsRem</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsWarn</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsErr</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkWarningsAreErrors</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkUseExtraOptions</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkLowLevelInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAutoLibEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAdditionalLibs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkOverrideProgramEntryLabel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabelSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabel</name>
+ <state>__iar_program_start</state>
+ </option>
+ <option>
+ <name>DoFill</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>FillerByte</name>
+ <state>0xFF</state>
+ </option>
+ <option>
+ <name>FillerStart</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>FillerEnd</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>CrcSize</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcAlign</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcPoly</name>
+ <state>0x11021</state>
+ </option>
+ <option>
+ <name>CrcCompl</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcBitOrder</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcInitialValue</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>DoCrc</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkBE8Slave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkStdoutInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcFullSize</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIElfToolPostProcess</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogAutoLibSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogRedirSymbols</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogUnusedFragments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcReverseByteOrder</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcUseAsInput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptInline</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsAllow</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsForce</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptMergeDuplSections</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptUseVfe</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptForceVfe</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackAnalysisEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackControlFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkStackCallGraphFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CrcAlgorithm</name>
+ <version>1</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcUnitSize</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkThreadsSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogCallGraph</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile_AltDefault</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>IARCHIVE</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IarchiveInputs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IarchiveOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IarchiveOutput</name>
+ <state>###Unitialized###</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>BILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ </configuration>
+ <group>
+ <name>Applications</name>
+ <file>
+ <name>$PROJ_DIR$\applications\main.c</name>
+ </file>
+ </group>
+ <group>
+ <name>CPU</name>
+ <file>
+ <name>$PROJ_DIR$\..\..\libcpu\arm\common\backtrace.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m0\context_iar.S</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\libcpu\arm\cortex-m0\cpuport.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\libcpu\arm\common\div0.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\libcpu\arm\common\showmem.c</name>
+ </file>
+ </group>
+ <group>
+ <name>DeviceDrivers</name>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\completion.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\dataqueue.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\misc\pin.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\pipe.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\ringblk_buf.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\ringbuffer.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\serial\serial.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\waitqueue.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\drivers\src\workqueue.c</name>
+ </file>
+ </group>
+ <group>
+ <name>Drivers</name>
+ <file>
+ <name>$PROJ_DIR$\board\board.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\drivers\drv_gpio.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\drivers\drv_usart.c</name>
+ </file>
+ </group>
+ <group>
+ <name>finsh</name>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\cmd.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_compiler.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_error.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_heap.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_init.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_node.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_ops.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_parser.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_token.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_var.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\finsh_vm.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\msh.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\components\finsh\shell.c</name>
+ </file>
+ </group>
+ <group>
+ <name>HC32_StdPeriph</name>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\adc.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\ddl.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\flash.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\gpio.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\CMSIS\Device\HDSC\HC32L136\Source\interrupts_hc32l136.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\lpuart.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\rtc.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\CMSIS\Device\HDSC\HC32L136\Source\IAR\startup_hc32l136.s</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\sysctrl.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\CMSIS\Device\HDSC\HC32L136\Source\system_hc32l13x.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\timer3.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\trim.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\Libraries\HC32L136_StdPeriph_Driver\src\uart.c</name>
+ </file>
+ </group>
+ <group>
+ <name>Kernel</name>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\clock.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\components.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\device.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\idle.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\ipc.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\irq.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\kservice.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\mem.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\mempool.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\object.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\scheduler.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\thread.c</name>
+ </file>
+ <file>
+ <name>$PROJ_DIR$\..\..\src\timer.c</name>
+ </file>
+ </group>
+</project>
+
+
diff --git a/bsp/hc32l136/project.eww b/bsp/hc32l136/project.eww
new file mode 100644
index 0000000000..c2cb02eb1e
--- /dev/null
+++ b/bsp/hc32l136/project.eww
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<workspace>
+ <project>
+ <path>$WS_DIR$\project.ewp</path>
+ </project>
+ <batchBuild/>
+</workspace>
+
+
diff --git a/bsp/hc32l136/project.uvoptx b/bsp/hc32l136/project.uvoptx
new file mode 100644
index 0000000000..27cc1f022c
--- /dev/null
+++ b/bsp/hc32l136/project.uvoptx
@@ -0,0 +1,924 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
+
+ <SchemaVersion>1.0</SchemaVersion>
+
+ <Header>### uVision Project, (C) Keil Software</Header>
+
+ <Extensions>
+ <cExt>*.c</cExt>
+ <aExt>*.s*; *.src; *.a*</aExt>
+ <oExt>*.obj; *.o</oExt>
+ <lExt>*.lib</lExt>
+ <tExt>*.txt; *.h; *.inc; *.md</tExt>
+ <pExt>*.plm</pExt>
+ <CppX>*.cpp</CppX>
+ <nMigrate>0</nMigrate>
+ </Extensions>
+
+ <DaveTm>
+ <dwLowDateTime>0</dwLowDateTime>
+ <dwHighDateTime>0</dwHighDateTime>
+ </DaveTm>
+
+ <Target>
+ <TargetName>rt-thread</TargetName>
+ <ToolsetNumber>0x4</ToolsetNumber>
+ <ToolsetName>ARM-ADS</ToolsetName>
+ <TargetOption>
+ <CLKADS>12000000</CLKADS>
+ <OPTTT>
+ <gFlags>1</gFlags>
+ <BeepAtEnd>1</BeepAtEnd>
+ <RunSim>0</RunSim>
+ <RunTarget>1</RunTarget>
+ <RunAbUc>0</RunAbUc>
+ </OPTTT>
+ <OPTHX>
+ <HexSelection>1</HexSelection>
+ <FlashByte>65535</FlashByte>
+ <HexRangeLowAddress>0</HexRangeLowAddress>
+ <HexRangeHighAddress>0</HexRangeHighAddress>
+ <HexOffset>0</HexOffset>
+ </OPTHX>
+ <OPTLEX>
+ <PageWidth>79</PageWidth>
+ <PageLength>66</PageLength>
+ <TabStop>8</TabStop>
+ <ListingPath>.\build\</ListingPath>
+ </OPTLEX>
+ <ListingPage>
+ <CreateCListing>1</CreateCListing>
+ <CreateAListing>1</CreateAListing>
+ <CreateLListing>1</CreateLListing>
+ <CreateIListing>0</CreateIListing>
+ <AsmCond>1</AsmCond>
+ <AsmSymb>1</AsmSymb>
+ <AsmXref>0</AsmXref>
+ <CCond>1</CCond>
+ <CCode>0</CCode>
+ <CListInc>0</CListInc>
+ <CSymb>0</CSymb>
+ <LinkerCodeListing>0</LinkerCodeListing>
+ </ListingPage>
+ <OPTXL>
+ <LMap>1</LMap>
+ <LComments>1</LComments>
+ <LGenerateSymbols>1</LGenerateSymbols>
+ <LLibSym>1</LLibSym>
+ <LLines>1</LLines>
+ <LLocSym>1</LLocSym>
+ <LPubSym>1</LPubSym>
+ <LXref>0</LXref>
+ <LExpSel>0</LExpSel>
+ </OPTXL>
+ <OPTFL>
+ <tvExp>1</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <IsCurrentTarget>1</IsCurrentTarget>
+ </OPTFL>
+ <CpuCode>255</CpuCode>
+ <DebugOpt>
+ <uSim>0</uSim>
+ <uTrg>1</uTrg>
+ <sLdApp>1</sLdApp>
+ <sGomain>1</sGomain>
+ <sRbreak>1</sRbreak>
+ <sRwatch>1</sRwatch>
+ <sRmem>1</sRmem>
+ <sRfunc>1</sRfunc>
+ <sRbox>1</sRbox>
+ <tLdApp>1</tLdApp>
+ <tGomain>1</tGomain>
+ <tRbreak>1</tRbreak>
+ <tRwatch>1</tRwatch>
+ <tRmem>1</tRmem>
+ <tRfunc>0</tRfunc>
+ <tRbox>1</tRbox>
+ <tRtrace>1</tRtrace>
+ <sRSysVw>1</sRSysVw>
+ <tRSysVw>1</tRSysVw>
+ <sRunDeb>0</sRunDeb>
+ <sLrtime>0</sLrtime>
+ <bEvRecOn>1</bEvRecOn>
+ <bSchkAxf>0</bSchkAxf>
+ <bTchkAxf>0</bTchkAxf>
+ <nTsel>4</nTsel>
+ <sDll></sDll>
+ <sDllPa></sDllPa>
+ <sDlgDll></sDlgDll>
+ <sDlgPa></sDlgPa>
+ <sIfile></sIfile>
+ <tDll></tDll>
+ <tDllPa></tDllPa>
+ <tDlgDll></tDlgDll>
+ <tDlgPa></tDlgPa>
+ <tIfile></tIfile>
+ <pMon>Segger\JL2CM3.dll</pMon>
+ </DebugOpt>
+ <TargetDriverDllRegistry>
+ <SetRegEntry>
+ <Number>0</Number>
+ <Key>UL2CM3</Key>
+ <Name>-U -O206 -S0 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0FlashHC32L136_64K.FLM -FS00 -FL010000 -FP0($$Device:HC32L136K8TA$Flash\FlashHC32L136_64K.FLM)</Name>
+ </SetRegEntry>
+ <SetRegEntry>
+ <Number>0</Number>
+ <Key>JL2CM3</Key>
+ <Name>-U4294967295 -O78 -S4 -ZTIFSpeedSel2000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC2000 -FN0</Name>
+ </SetRegEntry>
+ </TargetDriverDllRegistry>
+ <Breakpoint/>
+ <Tracepoint>
+ <THDelay>0</THDelay>
+ </Tracepoint>
+ <DebugFlag>
+ <trace>0</trace>
+ <periodic>0</periodic>
+ <aLwin>0</aLwin>
+ <aCover>0</aCover>
+ <aSer1>0</aSer1>
+ <aSer2>0</aSer2>
+ <aPa>0</aPa>
+ <viewmode>0</viewmode>
+ <vrSel>0</vrSel>
+ <aSym>0</aSym>
+ <aTbox>0</aTbox>
+ <AscS1>0</AscS1>
+ <AscS2>0</AscS2>
+ <AscS3>0</AscS3>
+ <aSer3>0</aSer3>
+ <eProf>0</eProf>
+ <aLa>0</aLa>
+ <aPa1>0</aPa1>
+ <AscS4>0</AscS4>
+ <aSer4>0</aSer4>
+ <StkLoc>0</StkLoc>
+ <TrcWin>0</TrcWin>
+ <newCpu>0</newCpu>
+ <uProt>0</uProt>
+ </DebugFlag>
+ <LintExecutable></LintExecutable>
+ <LintConfigFile></LintConfigFile>
+ <bLintAuto>0</bLintAuto>
+ <bAutoGenD>0</bAutoGenD>
+ <LntExFlags>0</LntExFlags>
+ <pMisraName></pMisraName>
+ <pszMrule></pszMrule>
+ <pSingCmds></pSingCmds>
+ <pMultCmds></pMultCmds>
+ <pMisraNamep></pMisraNamep>
+ <pszMrulep></pszMrulep>
+ <pSingCmdsp></pSingCmdsp>
+ <pMultCmdsp></pMultCmdsp>
+ <DebugDescription>
+ <Enable>1</Enable>
+ <EnableFlashSeq>0</EnableFlashSeq>
+ <EnableLog>0</EnableLog>
+ <Protocol>2</Protocol>
+ <DbgClock>1000000</DbgClock>
+ </DebugDescription>
+ </TargetOption>
+ </Target>
+
+ <Group>
+ <GroupName>Applications</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>1</GroupNumber>
+ <FileNumber>1</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>applications\main.c</PathWithFileName>
+ <FilenameWithoutPath>main.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>CPU</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>2</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\common\backtrace.c</PathWithFileName>
+ <FilenameWithoutPath>backtrace.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>3</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\common\div0.c</PathWithFileName>
+ <FilenameWithoutPath>div0.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>4</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\common\showmem.c</PathWithFileName>
+ <FilenameWithoutPath>showmem.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>5</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\cortex-m0\cpuport.c</PathWithFileName>
+ <FilenameWithoutPath>cpuport.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>2</GroupNumber>
+ <FileNumber>6</FileNumber>
+ <FileType>2</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\libcpu\arm\cortex-m0\context_rvds.S</PathWithFileName>
+ <FilenameWithoutPath>context_rvds.S</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>DeviceDrivers</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>7</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\misc\pin.c</PathWithFileName>
+ <FilenameWithoutPath>pin.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>8</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\serial\serial.c</PathWithFileName>
+ <FilenameWithoutPath>serial.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>9</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\dataqueue.c</PathWithFileName>
+ <FilenameWithoutPath>dataqueue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>10</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\ringblk_buf.c</PathWithFileName>
+ <FilenameWithoutPath>ringblk_buf.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>11</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\waitqueue.c</PathWithFileName>
+ <FilenameWithoutPath>waitqueue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>12</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\completion.c</PathWithFileName>
+ <FilenameWithoutPath>completion.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>13</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\pipe.c</PathWithFileName>
+ <FilenameWithoutPath>pipe.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>14</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\ringbuffer.c</PathWithFileName>
+ <FilenameWithoutPath>ringbuffer.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>3</GroupNumber>
+ <FileNumber>15</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\drivers\src\workqueue.c</PathWithFileName>
+ <FilenameWithoutPath>workqueue.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>Drivers</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>16</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>board\board.c</PathWithFileName>
+ <FilenameWithoutPath>board.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>17</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>drivers\drv_gpio.c</PathWithFileName>
+ <FilenameWithoutPath>drv_gpio.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>4</GroupNumber>
+ <FileNumber>18</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>drivers\drv_usart.c</PathWithFileName>
+ <FilenameWithoutPath>drv_usart.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>finsh</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>19</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_node.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_node.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>20</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_parser.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_parser.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>21</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\cmd.c</PathWithFileName>
+ <FilenameWithoutPath>cmd.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>22</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_vm.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_vm.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>23</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\msh.c</PathWithFileName>
+ <FilenameWithoutPath>msh.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>24</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\shell.c</PathWithFileName>
+ <FilenameWithoutPath>shell.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>25</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_var.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_var.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>26</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_compiler.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_compiler.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>27</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_heap.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_heap.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>28</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_ops.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_ops.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>29</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_error.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_error.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>30</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_token.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_token.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>5</GroupNumber>
+ <FileNumber>31</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\components\finsh\finsh_init.c</PathWithFileName>
+ <FilenameWithoutPath>finsh_init.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>HC32_StdPeriph</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>32</FileNumber>
+ <FileType>2</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\CMSIS\Device\HDSC\HC32L136\Source\ARM\startup_hc32l136.s</PathWithFileName>
+ <FilenameWithoutPath>startup_hc32l136.s</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>33</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\trim.c</PathWithFileName>
+ <FilenameWithoutPath>trim.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>34</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\CMSIS\Device\HDSC\HC32L136\Source\system_hc32l13x.c</PathWithFileName>
+ <FilenameWithoutPath>system_hc32l13x.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>35</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\CMSIS\Device\HDSC\HC32L136\Source\interrupts_hc32l136.c</PathWithFileName>
+ <FilenameWithoutPath>interrupts_hc32l136.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>36</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\uart.c</PathWithFileName>
+ <FilenameWithoutPath>uart.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>37</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\sysctrl.c</PathWithFileName>
+ <FilenameWithoutPath>sysctrl.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>38</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\gpio.c</PathWithFileName>
+ <FilenameWithoutPath>gpio.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>39</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\ddl.c</PathWithFileName>
+ <FilenameWithoutPath>ddl.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>40</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\timer3.c</PathWithFileName>
+ <FilenameWithoutPath>timer3.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>41</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\flash.c</PathWithFileName>
+ <FilenameWithoutPath>flash.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>42</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\lpuart.c</PathWithFileName>
+ <FilenameWithoutPath>lpuart.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>43</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\rtc.c</PathWithFileName>
+ <FilenameWithoutPath>rtc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>6</GroupNumber>
+ <FileNumber>44</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>Libraries\HC32L136_StdPeriph_Driver\src\adc.c</PathWithFileName>
+ <FilenameWithoutPath>adc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+ <Group>
+ <GroupName>Kernel</GroupName>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <cbSel>0</cbSel>
+ <RteFlg>0</RteFlg>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>45</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\mem.c</PathWithFileName>
+ <FilenameWithoutPath>mem.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>46</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\clock.c</PathWithFileName>
+ <FilenameWithoutPath>clock.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>47</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\ipc.c</PathWithFileName>
+ <FilenameWithoutPath>ipc.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>48</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\mempool.c</PathWithFileName>
+ <FilenameWithoutPath>mempool.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>49</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\scheduler.c</PathWithFileName>
+ <FilenameWithoutPath>scheduler.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>50</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\idle.c</PathWithFileName>
+ <FilenameWithoutPath>idle.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>51</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\kservice.c</PathWithFileName>
+ <FilenameWithoutPath>kservice.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>52</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\irq.c</PathWithFileName>
+ <FilenameWithoutPath>irq.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>53</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\timer.c</PathWithFileName>
+ <FilenameWithoutPath>timer.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>54</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\components.c</PathWithFileName>
+ <FilenameWithoutPath>components.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>55</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\object.c</PathWithFileName>
+ <FilenameWithoutPath>object.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>56</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\device.c</PathWithFileName>
+ <FilenameWithoutPath>device.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ <File>
+ <GroupNumber>7</GroupNumber>
+ <FileNumber>57</FileNumber>
+ <FileType>1</FileType>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <bDave2>0</bDave2>
+ <PathWithFileName>..\..\src\thread.c</PathWithFileName>
+ <FilenameWithoutPath>thread.c</FilenameWithoutPath>
+ <RteFlg>0</RteFlg>
+ <bShared>0</bShared>
+ </File>
+ </Group>
+
+</ProjectOpt>
diff --git a/bsp/hc32l136/project.uvprojx b/bsp/hc32l136/project.uvprojx
new file mode 100644
index 0000000000..c6f27013bd
--- /dev/null
+++ b/bsp/hc32l136/project.uvprojx
@@ -0,0 +1,713 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
+
+ <SchemaVersion>2.1</SchemaVersion>
+
+ <Header>### uVision Project, (C) Keil Software</Header>
+
+ <Targets>
+ <Target>
+ <TargetName>rt-thread</TargetName>
+ <ToolsetNumber>0x4</ToolsetNumber>
+ <ToolsetName>ARM-ADS</ToolsetName>
+ <pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
+ <uAC6>0</uAC6>
+ <TargetOption>
+ <TargetCommonOption>
+ <Device>HC32L136K8TA</Device>
+ <Vendor>HDSC</Vendor>
+ <PackID>HDSC.HC32L136.1.0.0</PackID>
+ <PackURL>https://raw.githubusercontent.com/hdscmcu/pack/master/</PackURL>
+ <Cpu>IRAM(0x20000000,0x2000) IROM(0x00000000,0x10000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE</Cpu>
+ <FlashUtilSpec></FlashUtilSpec>
+ <StartupFile></StartupFile>
+ <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0FlashHC32L136_64K -FS00 -FL010000 -FP0($$Device:HC32L136K8TA$Flash\FlashHC32L136_64K.FLM))</FlashDriverDll>
+ <DeviceId>0</DeviceId>
+ <RegisterFile>$$Device:HC32L136K8TA$Device\Include\HC32L136K8TA.h</RegisterFile>
+ <MemoryEnv></MemoryEnv>
+ <Cmp></Cmp>
+ <Asm></Asm>
+ <Linker></Linker>
+ <OHString></OHString>
+ <InfinionOptionDll></InfinionOptionDll>
+ <SLE66CMisc></SLE66CMisc>
+ <SLE66AMisc></SLE66AMisc>
+ <SLE66LinkerMisc></SLE66LinkerMisc>
+ <SFDFile>$$Device:HC32L136K8TA$SVD\HC32L136K8TA.sfr</SFDFile>
+ <bCustSvd>1</bCustSvd>
+ <UseEnv>0</UseEnv>
+ <BinPath></BinPath>
+ <IncludePath></IncludePath>
+ <LibPath></LibPath>
+ <RegisterFilePath></RegisterFilePath>
+ <DBRegisterFilePath></DBRegisterFilePath>
+ <TargetStatus>
+ <Error>0</Error>
+ <ExitCodeStop>0</ExitCodeStop>
+ <ButtonStop>0</ButtonStop>
+ <NotGenerated>0</NotGenerated>
+ <InvalidFlash>1</InvalidFlash>
+ </TargetStatus>
+ <OutputDirectory>.\build\keil\Obj\</OutputDirectory>
+ <OutputName>rtthread</OutputName>
+ <CreateExecutable>1</CreateExecutable>
+ <CreateLib>0</CreateLib>
+ <CreateHexFile>0</CreateHexFile>
+ <DebugInformation>1</DebugInformation>
+ <BrowseInformation>0</BrowseInformation>
+ <ListingPath>.\build\</ListingPath>
+ <HexFormatSelection>1</HexFormatSelection>
+ <Merge32K>0</Merge32K>
+ <CreateBatchFile>0</CreateBatchFile>
+ <BeforeCompile>
+ <RunUserProg1>0</RunUserProg1>
+ <RunUserProg2>0</RunUserProg2>
+ <UserProg1Name></UserProg1Name>
+ <UserProg2Name></UserProg2Name>
+ <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+ <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+ <nStopU1X>0</nStopU1X>
+ <nStopU2X>0</nStopU2X>
+ </BeforeCompile>
+ <BeforeMake>
+ <RunUserProg1>0</RunUserProg1>
+ <RunUserProg2>0</RunUserProg2>
+ <UserProg1Name></UserProg1Name>
+ <UserProg2Name></UserProg2Name>
+ <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+ <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+ <nStopB1X>0</nStopB1X>
+ <nStopB2X>0</nStopB2X>
+ </BeforeMake>
+ <AfterMake>
+ <RunUserProg1>1</RunUserProg1>
+ <RunUserProg2>0</RunUserProg2>
+ <UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
+ <UserProg2Name></UserProg2Name>
+ <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+ <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+ <nStopA1X>0</nStopA1X>
+ <nStopA2X>0</nStopA2X>
+ </AfterMake>
+ <SelectedForBatchBuild>0</SelectedForBatchBuild>
+ <SVCSIdString></SVCSIdString>
+ </TargetCommonOption>
+ <CommonProperty>
+ <UseCPPCompiler>0</UseCPPCompiler>
+ <RVCTCodeConst>0</RVCTCodeConst>
+ <RVCTZI>0</RVCTZI>
+ <RVCTOtherData>0</RVCTOtherData>
+ <ModuleSelection>0</ModuleSelection>
+ <IncludeInBuild>1</IncludeInBuild>
+ <AlwaysBuild>0</AlwaysBuild>
+ <GenerateAssemblyFile>0</GenerateAssemblyFile>
+ <AssembleAssemblyFile>0</AssembleAssemblyFile>
+ <PublicsOnly>0</PublicsOnly>
+ <StopOnExitCode>3</StopOnExitCode>
+ <CustomArgument></CustomArgument>
+ <IncludeLibraryModules></IncludeLibraryModules>
+ <ComprImg>1</ComprImg>
+ </CommonProperty>
+ <DllOption>
+ <SimDllName>SARMCM3.DLL</SimDllName>
+ <SimDllArguments> </SimDllArguments>
+ <SimDlgDll>DARMCM1.DLL</SimDlgDll>
+ <SimDlgDllArguments>-pCM0+</SimDlgDllArguments>
+ <TargetDllName>SARMCM3.DLL</TargetDllName>
+ <TargetDllArguments> </TargetDllArguments>
+ <TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
+ <TargetDlgDllArguments>-pCM0+</TargetDlgDllArguments>
+ </DllOption>
+ <DebugOption>
+ <OPTHX>
+ <HexSelection>1</HexSelection>
+ <HexRangeLowAddress>0</HexRangeLowAddress>
+ <HexRangeHighAddress>0</HexRangeHighAddress>
+ <HexOffset>0</HexOffset>
+ <Oh166RecLen>16</Oh166RecLen>
+ </OPTHX>
+ </DebugOption>
+ <Utilities>
+ <Flash1>
+ <UseTargetDll>1</UseTargetDll>
+ <UseExternalTool>0</UseExternalTool>
+ <RunIndependent>0</RunIndependent>
+ <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
+ <Capability>1</Capability>
+ <DriverSelection>4096</DriverSelection>
+ </Flash1>
+ <bUseTDR>1</bUseTDR>
+ <Flash2>BIN\UL2CM3.DLL</Flash2>
+ <Flash3>"" ()</Flash3>
+ <Flash4></Flash4>
+ <pFcarmOut></pFcarmOut>
+ <pFcarmGrp></pFcarmGrp>
+ <pFcArmRoot></pFcArmRoot>
+ <FcArmLst>0</FcArmLst>
+ </Utilities>
+ <TargetArmAds>
+ <ArmAdsMisc>
+ <GenerateListings>0</GenerateListings>
+ <asHll>1</asHll>
+ <asAsm>1</asAsm>
+ <asMacX>1</asMacX>
+ <asSyms>1</asSyms>
+ <asFals>1</asFals>
+ <asDbgD>1</asDbgD>
+ <asForm>1</asForm>
+ <ldLst>0</ldLst>
+ <ldmm>1</ldmm>
+ <ldXref>1</ldXref>
+ <BigEnd>0</BigEnd>
+ <AdsALst>1</AdsALst>
+ <AdsACrf>1</AdsACrf>
+ <AdsANop>0</AdsANop>
+ <AdsANot>0</AdsANot>
+ <AdsLLst>1</AdsLLst>
+ <AdsLmap>1</AdsLmap>
+ <AdsLcgr>1</AdsLcgr>
+ <AdsLsym>1</AdsLsym>
+ <AdsLszi>1</AdsLszi>
+ <AdsLtoi>1</AdsLtoi>
+ <AdsLsun>1</AdsLsun>
+ <AdsLven>1</AdsLven>
+ <AdsLsxf>1</AdsLsxf>
+ <RvctClst>0</RvctClst>
+ <GenPPlst>0</GenPPlst>
+ <AdsCpuType>"Cortex-M0+"</AdsCpuType>
+ <RvctDeviceName></RvctDeviceName>
+ <mOS>0</mOS>
+ <uocRom>0</uocRom>
+ <uocRam>0</uocRam>
+ <hadIROM>1</hadIROM>
+ <hadIRAM>1</hadIRAM>
+ <hadXRAM>0</hadXRAM>
+ <uocXRam>0</uocXRam>
+ <RvdsVP>0</RvdsVP>
+ <RvdsMve>0</RvdsMve>
+ <RvdsCdeCp>0</RvdsCdeCp>
+ <hadIRAM2>0</hadIRAM2>
+ <hadIROM2>0</hadIROM2>
+ <StupSel>8</StupSel>
+ <useUlib>0</useUlib>
+ <EndSel>0</EndSel>
+ <uLtcg>0</uLtcg>
+ <nSecure>0</nSecure>
+ <RoSelD>3</RoSelD>
+ <RwSelD>3</RwSelD>
+ <CodeSel>0</CodeSel>
+ <OptFeed>0</OptFeed>
+ <NoZi1>0</NoZi1>
+ <NoZi2>0</NoZi2>
+ <NoZi3>0</NoZi3>
+ <NoZi4>0</NoZi4>
+ <NoZi5>0</NoZi5>
+ <Ro1Chk>0</Ro1Chk>
+ <Ro2Chk>0</Ro2Chk>
+ <Ro3Chk>0</Ro3Chk>
+ <Ir1Chk>1</Ir1Chk>
+ <Ir2Chk>0</Ir2Chk>
+ <Ra1Chk>0</Ra1Chk>
+ <Ra2Chk>0</Ra2Chk>
+ <Ra3Chk>0</Ra3Chk>
+ <Im1Chk>1</Im1Chk>
+ <Im2Chk>0</Im2Chk>
+ <OnChipMemories>
+ <Ocm1>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm1>
+ <Ocm2>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm2>
+ <Ocm3>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm3>
+ <Ocm4>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm4>
+ <Ocm5>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm5>
+ <Ocm6>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm6>
+ <IRAM>
+ <Type>0</Type>
+ <StartAddress>0x20000000</StartAddress>
+ <Size>0x2000</Size>
+ </IRAM>
+ <IROM>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x10000</Size>
+ </IROM>
+ <XRAM>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </XRAM>
+ <OCR_RVCT1>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT1>
+ <OCR_RVCT2>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT2>
+ <OCR_RVCT3>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT3>
+ <OCR_RVCT4>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x10000</Size>
+ </OCR_RVCT4>
+ <OCR_RVCT5>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT5>
+ <OCR_RVCT6>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT6>
+ <OCR_RVCT7>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT7>
+ <OCR_RVCT8>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT8>
+ <OCR_RVCT9>
+ <Type>0</Type>
+ <StartAddress>0x20000000</StartAddress>
+ <Size>0x2000</Size>
+ </OCR_RVCT9>
+ <OCR_RVCT10>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT10>
+ </OnChipMemories>
+ <RvctStartVector></RvctStartVector>
+ </ArmAdsMisc>
+ <Cads>
+ <interw>1</interw>
+ <Optim>1</Optim>
+ <oTime>0</oTime>
+ <SplitLS>0</SplitLS>
+ <OneElfS>1</OneElfS>
+ <Strict>0</Strict>
+ <EnumInt>0</EnumInt>
+ <PlainCh>0</PlainCh>
+ <Ropi>0</Ropi>
+ <Rwpi>0</Rwpi>
+ <wLevel>0</wLevel>
+ <uThumb>0</uThumb>
+ <uSurpInc>0</uSurpInc>
+ <uC99>1</uC99>
+ <uGnu>0</uGnu>
+ <useXO>0</useXO>
+ <v6Lang>0</v6Lang>
+ <v6LangP>0</v6LangP>
+ <vShortEn>0</vShortEn>
+ <vShortWch>0</vShortWch>
+ <v6Lto>0</v6Lto>
+ <v6WtE>0</v6WtE>
+ <v6Rtti>0</v6Rtti>
+ <VariousControls>
+ <MiscControls>--diag_suppress=186,66</MiscControls>
+ <Define>USE_DDL_DRIVER, __DEBUG, __RTTHREAD__, HC32L136, __CLK_TCK=RT_TICK_PER_SECOND</Define>
+ <Undefine></Undefine>
+ <IncludePath>applications;.;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m0;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;board;drivers;..\..\components\finsh;Libraries\CMSIS\Include;Libraries\CMSIS\Device\HDSC\HC32L136\Include;Libraries\HC32L136_StdPeriph_Driver\inc;.;..\..\include;..\..\components\libc\compilers\common;..\..\components\libc\compilers\common\none-gcc;..\..\examples\utest\testcases\kernel</IncludePath>
+ </VariousControls>
+ </Cads>
+ <Aads>
+ <interw>1</interw>
+ <Ropi>0</Ropi>
+ <Rwpi>0</Rwpi>
+ <thumb>0</thumb>
+ <SplitLS>0</SplitLS>
+ <SwStkChk>0</SwStkChk>
+ <NoWarn>0</NoWarn>
+ <uSurpInc>0</uSurpInc>
+ <useXO>0</useXO>
+ <ClangAsOpt>1</ClangAsOpt>
+ <VariousControls>
+ <MiscControls></MiscControls>
+ <Define></Define>
+ <Undefine></Undefine>
+ <IncludePath></IncludePath>
+ </VariousControls>
+ </Aads>
+ <LDads>
+ <umfTarg>1</umfTarg>
+ <Ropi>0</Ropi>
+ <Rwpi>0</Rwpi>
+ <noStLib>0</noStLib>
+ <RepFail>1</RepFail>
+ <useFile>0</useFile>
+ <TextAddressRange>0x00000000</TextAddressRange>
+ <DataAddressRange>0x20000000</DataAddressRange>
+ <pXoBase></pXoBase>
+ <ScatterFile>.\board\linker_scripts\link.sct</ScatterFile>
+ <IncludeLibs></IncludeLibs>
+ <IncludeLibsPath></IncludeLibsPath>
+ <Misc></Misc>
+ <LinkerInputFile></LinkerInputFile>
+ <DisabledWarnings></DisabledWarnings>
+ </LDads>
+ </TargetArmAds>
+ </TargetOption>
+ <Groups>
+ <Group>
+ <GroupName>Applications</GroupName>
+ <Files>
+ <File>
+ <FileName>main.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>applications\main.c</FilePath>
+ </File>
+ </Files>
+ </Group>
+ <Group>
+ <GroupName>CPU</GroupName>
+ <Files>
+ <File>
+ <FileName>backtrace.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\libcpu\arm\common\backtrace.c</FilePath>
+ </File>
+ <File>
+ <FileName>div0.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\libcpu\arm\common\div0.c</FilePath>
+ </File>
+ <File>
+ <FileName>showmem.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\libcpu\arm\common\showmem.c</FilePath>
+ </File>
+ <File>
+ <FileName>cpuport.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\libcpu\arm\cortex-m0\cpuport.c</FilePath>
+ </File>
+ <File>
+ <FileName>context_rvds.S</FileName>
+ <FileType>2</FileType>
+ <FilePath>..\..\libcpu\arm\cortex-m0\context_rvds.S</FilePath>
+ </File>
+ </Files>
+ </Group>
+ <Group>
+ <GroupName>DeviceDrivers</GroupName>
+ <Files>
+ <File>
+ <FileName>pin.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\misc\pin.c</FilePath>
+ </File>
+ <File>
+ <FileName>serial.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\serial\serial.c</FilePath>
+ </File>
+ <File>
+ <FileName>dataqueue.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\dataqueue.c</FilePath>
+ </File>
+ <File>
+ <FileName>ringblk_buf.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\ringblk_buf.c</FilePath>
+ </File>
+ <File>
+ <FileName>waitqueue.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\waitqueue.c</FilePath>
+ </File>
+ <File>
+ <FileName>completion.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\completion.c</FilePath>
+ </File>
+ <File>
+ <FileName>pipe.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\pipe.c</FilePath>
+ </File>
+ <File>
+ <FileName>ringbuffer.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\ringbuffer.c</FilePath>
+ </File>
+ <File>
+ <FileName>workqueue.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\drivers\src\workqueue.c</FilePath>
+ </File>
+ </Files>
+ </Group>
+ <Group>
+ <GroupName>Drivers</GroupName>
+ <Files>
+ <File>
+ <FileName>board.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>board\board.c</FilePath>
+ </File>
+ <File>
+ <FileName>drv_gpio.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>drivers\drv_gpio.c</FilePath>
+ </File>
+ <File>
+ <FileName>drv_usart.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>drivers\drv_usart.c</FilePath>
+ </File>
+ </Files>
+ </Group>
+ <Group>
+ <GroupName>finsh</GroupName>
+ <Files>
+ <File>
+ <FileName>finsh_node.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_node.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_parser.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_parser.c</FilePath>
+ </File>
+ <File>
+ <FileName>cmd.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\cmd.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_vm.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_vm.c</FilePath>
+ </File>
+ <File>
+ <FileName>msh.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\msh.c</FilePath>
+ </File>
+ <File>
+ <FileName>shell.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\shell.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_var.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_var.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_compiler.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_compiler.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_heap.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_heap.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_ops.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_ops.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_error.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_error.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_token.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_token.c</FilePath>
+ </File>
+ <File>
+ <FileName>finsh_init.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\components\finsh\finsh_init.c</FilePath>
+ </File>
+ </Files>
+ </Group>
+ <Group>
+ <GroupName>HC32_StdPeriph</GroupName>
+ <Files>
+ <File>
+ <FileName>startup_hc32l136.s</FileName>
+ <FileType>2</FileType>
+ <FilePath>Libraries\CMSIS\Device\HDSC\HC32L136\Source\ARM\startup_hc32l136.s</FilePath>
+ </File>
+ <File>
+ <FileName>trim.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\trim.c</FilePath>
+ </File>
+ <File>
+ <FileName>system_hc32l13x.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\CMSIS\Device\HDSC\HC32L136\Source\system_hc32l13x.c</FilePath>
+ </File>
+ <File>
+ <FileName>interrupts_hc32l136.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\CMSIS\Device\HDSC\HC32L136\Source\interrupts_hc32l136.c</FilePath>
+ </File>
+ <File>
+ <FileName>uart.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\uart.c</FilePath>
+ </File>
+ <File>
+ <FileName>sysctrl.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\sysctrl.c</FilePath>
+ </File>
+ <File>
+ <FileName>gpio.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\gpio.c</FilePath>
+ </File>
+ <File>
+ <FileName>ddl.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\ddl.c</FilePath>
+ </File>
+ <File>
+ <FileName>timer3.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\timer3.c</FilePath>
+ </File>
+ <File>
+ <FileName>flash.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\flash.c</FilePath>
+ </File>
+ <File>
+ <FileName>lpuart.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\lpuart.c</FilePath>
+ </File>
+ <File>
+ <FileName>rtc.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\rtc.c</FilePath>
+ </File>
+ <File>
+ <FileName>adc.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>Libraries\HC32L136_StdPeriph_Driver\src\adc.c</FilePath>
+ </File>
+ </Files>
+ </Group>
+ <Group>
+ <GroupName>Kernel</GroupName>
+ <Files>
+ <File>
+ <FileName>mem.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\mem.c</FilePath>
+ </File>
+ <File>
+ <FileName>clock.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\clock.c</FilePath>
+ </File>
+ <File>
+ <FileName>ipc.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\ipc.c</FilePath>
+ </File>
+ <File>
+ <FileName>mempool.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\mempool.c</FilePath>
+ </File>
+ <File>
+ <FileName>scheduler.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\scheduler.c</FilePath>
+ </File>
+ <File>
+ <FileName>idle.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\idle.c</FilePath>
+ </File>
+ <File>
+ <FileName>kservice.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\kservice.c</FilePath>
+ </File>
+ <File>
+ <FileName>irq.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\irq.c</FilePath>
+ </File>
+ <File>
+ <FileName>timer.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\timer.c</FilePath>
+ </File>
+ <File>
+ <FileName>components.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\components.c</FilePath>
+ </File>
+ <File>
+ <FileName>object.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\object.c</FilePath>
+ </File>
+ <File>
+ <FileName>device.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\device.c</FilePath>
+ </File>
+ <File>
+ <FileName>thread.c</FileName>
+ <FileType>1</FileType>
+ <FilePath>..\..\src\thread.c</FilePath>
+ </File>
+ </Files>
+ </Group>
+ </Groups>
+ </Target>
+ </Targets>
+
+ <RTE>
+ <apis/>
+ <components/>
+ <files/>
+ </RTE>
+
+</Project>
diff --git a/bsp/hc32l136/rtconfig.h b/bsp/hc32l136/rtconfig.h
new file mode 100644
index 0000000000..68c2c571d6
--- /dev/null
+++ b/bsp/hc32l136/rtconfig.h
@@ -0,0 +1,180 @@
+#ifndef RT_CONFIG_H__
+#define RT_CONFIG_H__
+
+/* Automatically generated file; DO NOT EDIT. */
+/* RT-Thread Project Configuration */
+
+/* RT-Thread Kernel */
+
+#define RT_NAME_MAX 8
+#define RT_ALIGN_SIZE 4
+#define RT_THREAD_PRIORITY_32
+#define RT_THREAD_PRIORITY_MAX 32
+#define RT_TICK_PER_SECOND 1000
+#define RT_USING_OVERFLOW_CHECK
+#define RT_USING_HOOK
+#define RT_USING_IDLE_HOOK
+#define RT_IDLE_HOOK_LIST_SIZE 4
+#define IDLE_THREAD_STACK_SIZE 256
+//#define RT_USING_TIMER_SOFT
+//#define RT_TIMER_THREAD_PRIO 4
+//#define RT_TIMER_THREAD_STACK_SIZE 512
+
+/* kservice optimization */
+
+#define RT_DEBUG
+
+/* Inter-Thread communication */
+
+#define RT_USING_SEMAPHORE
+#define RT_USING_MUTEX
+#define RT_USING_EVENT
+#define RT_USING_MAILBOX
+#define RT_USING_MESSAGEQUEUE
+
+/* Memory Management */
+
+#define RT_USING_MEMPOOL
+#define RT_USING_SMALL_MEM
+#define RT_USING_HEAP
+
+/* Kernel Device Object */
+
+#define RT_USING_DEVICE
+#define RT_USING_CONSOLE
+#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLE_DEVICE_NAME "uart1"
+#define RT_VER_NUM 0x40003
+#define ARCH_ARM
+#define ARCH_ARM_CORTEX_M
+#define ARCH_ARM_CORTEX_M0
+
+/* RT-Thread Components */
+
+#define RT_USING_COMPONENTS_INIT
+#define RT_USING_USER_MAIN
+#define RT_MAIN_THREAD_STACK_SIZE 512
+#define RT_MAIN_THREAD_PRIORITY 10
+
+/* C++ features */
+
+
+/* Command shell */
+
+#define RT_USING_FINSH
+#define FINSH_THREAD_NAME "tshell"
+#define FINSH_USING_HISTORY
+#define FINSH_HISTORY_LINES 5
+#define FINSH_USING_SYMTAB
+#define FINSH_USING_DESCRIPTION
+#define FINSH_THREAD_PRIORITY 20
+#define FINSH_THREAD_STACK_SIZE 512
+#define FINSH_CMD_SIZE 80
+#define FINSH_USING_MSH
+#define FINSH_USING_MSH_DEFAULT
+#define FINSH_ARG_MAX 10
+
+/* Device virtual file system */
+
+
+/* Device Drivers */
+
+#define RT_USING_DEVICE_IPC
+#define RT_PIPE_BUFSZ 512
+#define RT_USING_SERIAL
+#define RT_SERIAL_RB_BUFSZ 64
+#define RT_USING_PIN
+
+/* Using USB */
+
+
+/* POSIX layer and C standard library */
+
+
+/* Network */
+
+/* Socket abstraction layer */
+
+
+/* Network interface device */
+
+
+/* light weight TCP/IP stack */
+
+
+/* AT commands */
+
+
+/* VBUS(Virtual Software BUS) */
+
+
+/* Utilities */
+
+
+/* RT-Thread online packages */
+
+/* IoT - internet of things */
+
+
+/* Wi-Fi */
+
+/* Marvell WiFi */
+
+
+/* Wiced WiFi */
+
+
+/* IoT Cloud */
+
+
+/* security packages */
+
+
+/* language packages */
+
+
+/* multimedia packages */
+
+
+/* tools packages */
+
+
+/* system packages */
+
+/* acceleration: Assembly language or algorithmic acceleration packages */
+
+
+/* Micrium: Micrium software products porting for RT-Thread */
+
+
+/* peripheral libraries and drivers */
+
+
+/* AI packages */
+
+
+/* miscellaneous packages */
+
+
+/* samples: kernel and components samples */
+
+
+/* entertainment: terminal games and other interesting software packages */
+
+
+/* Hardware Drivers Config */
+
+#define MCU_HC32L136
+
+/* Onboard Peripheral Drivers */
+
+/* On-chip Peripheral Drivers */
+
+#define BSP_USING_GPIO
+#define BSP_USING_UART
+#define BSP_USING_UART1
+
+/* Board extended module Drivers */
+
+
+#endif
diff --git a/bsp/hc32l136/rtconfig.py b/bsp/hc32l136/rtconfig.py
new file mode 100644
index 0000000000..4556c8a87e
--- /dev/null
+++ b/bsp/hc32l136/rtconfig.py
@@ -0,0 +1,132 @@
+import os
+
+# toolchains options
+ARCH='arm'
+CPU='cortex-m0'
+CROSS_TOOL='iar'
+
+print "############rtconfig##############"
+
+if os.getenv('RTT_CC'):
+ CROSS_TOOL = os.getenv('RTT_CC')
+
+print "CROSS_TOOL: " + CROSS_TOOL
+
+# cross_tool provides the cross compiler
+# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
+if CROSS_TOOL == 'gcc':
+ PLATFORM = 'gcc'
+ EXEC_PATH = r'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
+elif CROSS_TOOL == 'keil':
+ PLATFORM = 'armcc'
+ EXEC_PATH = r'D:\03_software\Program Files\Keil_v5'
+elif CROSS_TOOL == 'iar':
+ PLATFORM = 'iar'
+ EXEC_PATH = r'D:\03_software\Program Files\IAR Systems\Embedded Workbench 7.5'
+
+if os.getenv('RTT_EXEC_PATH'):
+ EXEC_PATH = os.getenv('RTT_EXEC_PATH')
+
+BUILD = 'debug'
+MCU_TYPE = 'HC32L136'
+
+if PLATFORM == 'gcc':
+ # toolchains
+ PREFIX = 'arm-none-eabi-'
+ CC = PREFIX + 'gcc'
+ AS = PREFIX + 'gcc'
+ AR = PREFIX + 'ar'
+ LINK = PREFIX + 'gcc'
+ TARGET_EXT = 'elf'
+ SIZE = PREFIX + 'size'
+ OBJDUMP = PREFIX + 'objdump'
+ OBJCPY = PREFIX + 'objcopy'
+
+ DEVICE = ' -mcpu=cortex-m0 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
+ CFLAGS = DEVICE + ' -g -Wall -DHC32F4A0 -D__DEBUG -DUSE_DDL_DRIVER -D__ASSEMBLY__ -D__FPU_USED'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
+ LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
+
+ CPATH = ''
+ LPATH = ''
+
+ if BUILD == 'debug':
+ CFLAGS += ' -O0 -gdwarf-2'
+ AFLAGS += ' -gdwarf-2'
+ else:
+ CFLAGS += ' -O2'
+
+ POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
+
+elif PLATFORM == 'armcc':
+ # toolchains
+ CC = 'armcc'
+ AS = 'armasm'
+ AR = 'armar'
+ LINK = 'armlink'
+ TARGET_EXT = 'axf'
+
+ DEVICE = ' --cpu=cortex-m0.fp'
+ CFLAGS = DEVICE + ' --apcs=interwork -DUSE_DDL_DRIVER -DHC32F4A0 -D__DEBUG'
+ AFLAGS = DEVICE
+ LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter "board/linker_scripts/link.sct"'
+
+ CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
+ LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
+
+ EXEC_PATH += '/arm/bin40/'
+
+ if BUILD == 'debug':
+ CFLAGS += ' -g -O0'
+ AFLAGS += ' -g'
+ else:
+ CFLAGS += ' -O2'
+
+ POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
+
+elif PLATFORM == 'iar':
+ # toolchains
+ CC = 'iccarm'
+ AS = 'iasmarm'
+ AR = 'iarchive'
+ LINK = 'ilinkarm'
+ TARGET_EXT = 'out'
+
+ DEVICE = ' -D __DEBUG' + ' -D USE_DDL_DRIVER' + ' -D HC32F4A0'
+
+ CFLAGS = DEVICE
+ CFLAGS += ' --diag_suppress Pa050'
+ CFLAGS += ' --no_cse'
+ CFLAGS += ' --no_unroll'
+ CFLAGS += ' --no_inline'
+ CFLAGS += ' --no_code_motion'
+ CFLAGS += ' --no_tbaa'
+ CFLAGS += ' --no_clustering'
+ CFLAGS += ' --no_scheduling'
+ CFLAGS += ' --endian=little'
+ CFLAGS += ' --cpu=Cortex-M0'
+ CFLAGS += ' -e'
+ CFLAGS += ' --fpu=None'
+ CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
+ CFLAGS += ' -Ol'
+ CFLAGS += ' --use_c++_inline'
+
+ AFLAGS = ''
+ AFLAGS += ' -s+'
+ AFLAGS += ' -w+'
+ AFLAGS += ' -r'
+ AFLAGS += ' --cpu Cortex-M0'
+ AFLAGS += ' --fpu None'
+ if BUILD == 'debug':
+ CFLAGS += ' --debug'
+ CFLAGS += ' -On'
+ else:
+ CFLAGS += ' -Oh'
+
+ LFLAGS = ' --config "board/linker_scripts/link.icf"'
+ LFLAGS += ' --redirect _Printf=_PrintfTiny'
+ LFLAGS += ' --redirect _Scanf=_ScanfSmall'
+ LFLAGS += ' --entry __iar_program_start'
+
+ EXEC_PATH = EXEC_PATH + '/arm/bin/'
+ POST_ACTION = ''
diff --git a/bsp/hc32l136/template.ewp b/bsp/hc32l136/template.ewp
new file mode 100644
index 0000000000..4e56df1965
--- /dev/null
+++ b/bsp/hc32l136/template.ewp
@@ -0,0 +1,1933 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<project>
+ <fileVersion>2</fileVersion>
+ <configuration>
+ <name>Release</name>
+ <toolchain>
+ <name>ARM</name>
+ </toolchain>
+ <debug>0</debug>
+ <settings>
+ <name>General</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <version>24</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>OGChipSelectEditMenu</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>GFPUDeviceSlave</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>ExePath</name>
+ <state>build\iar\release\Exe</state>
+ </option>
+ <option>
+ <name>ObjPath</name>
+ <state>build\iar\release\Obj</state>
+ </option>
+ <option>
+ <name>ListPath</name>
+ <state>build\iar\release\List</state>
+ </option>
+ <option>
+ <name>GEndianMode</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input variant</name>
+ <version>3</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>Output variant</name>
+ <version>2</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Output description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>GOutputBinary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OGCoreOrChip</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelect</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelectSlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>RTDescription</name>
+ <state>Use the full configuration of the C/C++ runtime library. Full locale interface, C locale, file descriptor support, multibytes in printf and scanf, and hex floats in strtod.</state>
+ </option>
+ <option>
+ <name>OGProductVersion</name>
+ <state>6.50.1.4445</state>
+ </option>
+ <option>
+ <name>OGLastSavedByProductVersion</name>
+ <state>7.80.4.12487</state>
+ </option>
+ <option>
+ <name>GeneralEnableMisra</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraVerbose</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GenLowLevelInterface</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GEndianModeBE</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GenStdoutInterface</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111010110110011110101111110111111111111101111111111001101111110011110001111111011011111111111111111</state>
+ </option>
+ <option>
+ <name>RTConfigPath2</name>
+ <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Full.h</state>
+ </option>
+ <option>
+ <name>GBECoreSlave</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ <option>
+ <name>OGUseCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGUseCmsisDspLib</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibThreads</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CoreVariant</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ <option>
+ <name>FPU2</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NrRegs</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NEON</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GFPUCoreSlave2</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ICCARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>31</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>CCDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCPreprocFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocComments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMnemonics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMessages</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagSuppress</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagRemark</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagWarning</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagError</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAllowList</name>
+ <version>1</version>
+ <state>11111110</state>
+ </option>
+ <option>
+ <name>CCDebugInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IEndianMode</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCLangConformance</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSignedPlainChar</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCRequirePrototypes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagWarnAreErr</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCompilerRuntimeInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>CCLibConfigHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>PreInclude</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CompilerMisraOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCIncludePath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCodeSection</name>
+ <state>.text</state>
+ </option>
+ <option>
+ <name>IInterwork2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IProcessorMode2</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCOptLevel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategy</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCOptLevelSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111011110110011111101111110111111111111101111111111001101111110111110001111111011111111111111111111</state>
+ </option>
+ <option>
+ <name>CCPosIndRopi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndRwpi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndNoDynInit</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccLang</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccAllowVLA</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCppDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccExceptions</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccRTTI</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccStaticDestr</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccCppInlineSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccFloatSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptimizationNoSizeConstraints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategySlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCGuardCalls</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>AARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>9</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>AObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AEndian</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ACaseSensitivity</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacroChars</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnWhat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnOne</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ADebug</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AltRegisterNames</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ADefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AListHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AListing</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Includes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacDefs</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacExps</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacExec</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OnlyAssed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MultiLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>TabSpacing</name>
+ <state>8</state>
+ </option>
+ <option>
+ <name>AXRef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDefines</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefInternal</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDual</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AOutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>AMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsEdit</name>
+ <state>100</state>
+ </option>
+ <option>
+ <name>AIgnoreStdInclude</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AUserIncludes</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AExtraOptionsCheckV2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AExtraOptionsV2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AsmNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>OBJCOPY</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>OOCOutputFormat</name>
+ <version>3</version>
+ <state>3</state>
+ </option>
+ <option>
+ <name>OCOutputOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCOutputFile</name>
+ <state>rtthread.bin</state>
+ </option>
+ <option>
+ <name>OOCCommandLineProducer</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCObjCopyEnable</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>CUSTOM</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <extensions></extensions>
+ <cmdline></cmdline>
+ <hasPrio>0</hasPrio>
+ </data>
+ </settings>
+ <settings>
+ <name>BICOMP</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ <settings>
+ <name>BUILDACTION</name>
+ <archiveVersion>1</archiveVersion>
+ <data>
+ <prebuild></prebuild>
+ <postbuild></postbuild>
+ </data>
+ </settings>
+ <settings>
+ <name>ILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>18</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IlinkLibIOConfig</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLinkMisraHandler</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkInputFileSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOutputFile</name>
+ <state>rtthread.out</state>
+ </option>
+ <option>
+ <name>IlinkDebugInfoEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkKeepSymbols</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySymbol</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySegment</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryAlign</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkConfigDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkMapFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogInitialization</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogModule</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogSection</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogVeneer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile</name>
+ <state>$PROJ_DIR$\board\linker_scripts\link.icf</state>
+ </option>
+ <option>
+ <name>IlinkIcfFileSlave</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkSuppressDiags</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsRem</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsWarn</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsErr</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkWarningsAreErrors</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkUseExtraOptions</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkLowLevelInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAutoLibEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAdditionalLibs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkOverrideProgramEntryLabel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabelSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabel</name>
+ <state>__iar_program_start</state>
+ </option>
+ <option>
+ <name>DoFill</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>FillerByte</name>
+ <state>0xFF</state>
+ </option>
+ <option>
+ <name>FillerStart</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>FillerEnd</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>CrcSize</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcAlign</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcPoly</name>
+ <state>0x11021</state>
+ </option>
+ <option>
+ <name>CrcCompl</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcBitOrder</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcInitialValue</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>DoCrc</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkBE8Slave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkStdoutInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcFullSize</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIElfToolPostProcess</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogAutoLibSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogRedirSymbols</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogUnusedFragments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcReverseByteOrder</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcUseAsInput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptInline</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsAllow</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsForce</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptMergeDuplSections</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptUseVfe</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptForceVfe</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackAnalysisEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackControlFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkStackCallGraphFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CrcAlgorithm</name>
+ <version>1</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcUnitSize</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkThreadsSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogCallGraph</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile_AltDefault</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>IARCHIVE</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IarchiveInputs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IarchiveOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IarchiveOutput</name>
+ <state>###Unitialized###</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>BILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ </configuration>
+ <configuration>
+ <name>Debug</name>
+ <toolchain>
+ <name>ARM</name>
+ </toolchain>
+ <debug>0</debug>
+ <settings>
+ <name>General</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <version>24</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>ExePath</name>
+ <state>build\iar\debug\Exe</state>
+ </option>
+ <option>
+ <name>ObjPath</name>
+ <state>build\iar\debug\Obj</state>
+ </option>
+ <option>
+ <name>ListPath</name>
+ <state>build\iar\debug\List</state>
+ </option>
+ <option>
+ <name>GEndianMode</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input variant</name>
+ <version>3</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Input description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>Output variant</name>
+ <version>2</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>Output description</name>
+ <state>Automatic choice of formatter.</state>
+ </option>
+ <option>
+ <name>GOutputBinary</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OGCoreOrChip</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelect</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>GRuntimeLibSelectSlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>RTDescription</name>
+ <state>Use the full configuration of the C/C++ runtime library. Full locale interface, C locale, file descriptor support, multibytes in printf and scanf, and hex floats in strtod.</state>
+ </option>
+ <option>
+ <name>OGProductVersion</name>
+ <state>6.50.1.4445</state>
+ </option>
+ <option>
+ <name>OGLastSavedByProductVersion</name>
+ <state>7.70.1.11471</state>
+ </option>
+ <option>
+ <name>GeneralEnableMisra</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraVerbose</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OGChipSelectEditMenu</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>GenLowLevelInterface</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GEndianModeBE</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>GenStdoutInterface</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>GeneralMisraVer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GeneralMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111010110110011110101111110111111111111101111111111001101111110011110001111111011011111111111111111</state>
+ </option>
+ <option>
+ <name>RTConfigPath2</name>
+ <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Full.h</state>
+ </option>
+ <option>
+ <name>GBECoreSlave</name>
+ <version>24</version>
+ <state>35</state>
+ </option>
+ <option>
+ <name>OGUseCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OGUseCmsisDspLib</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GRuntimeLibThreads</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CoreVariant</name>
+ <version>24</version>
+ <state>39</state>
+ </option>
+ <option>
+ <name>GFPUDeviceSlave</name>
+ <state>Default None</state>
+ </option>
+ <option>
+ <name>FPU2</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NrRegs</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>NEON</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>GFPUCoreSlave2</name>
+ <version>24</version>
+ <state>39</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ICCARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>31</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>CCDefines</name>
+ <state>__DEBUG</state>
+ </option>
+ <option>
+ <name>CCPreprocFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocComments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPreprocLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMnemonics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListCMessages</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCListAssSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagSuppress</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagRemark</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagWarning</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCDiagError</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCAllowList</name>
+ <version>1</version>
+ <state>00000000</state>
+ </option>
+ <option>
+ <name>CCDebugInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IEndianMode</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCLangConformance</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSignedPlainChar</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCRequirePrototypes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCDiagWarnAreErr</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCompilerRuntimeInfo</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>CCLibConfigHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>PreInclude</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CompilerMisraOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCIncludePath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCStdIncCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCodeSection</name>
+ <state>.text</state>
+ </option>
+ <option>
+ <name>IInterwork2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IProcessorMode2</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCOptLevel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategy</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCOptLevelSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules98</name>
+ <version>0</version>
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+ </option>
+ <option>
+ <name>CompilerMisraRules04</name>
+ <version>0</version>
+ <state>011111011111111110111111111011011101111011111011110110011111101111110111111111111101111111111001101111110111110001111111011111111111111111111</state>
+ </option>
+ <option>
+ <name>CCPosIndRopi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndRwpi</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPosIndNoDynInit</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccLang</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccAllowVLA</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCppDialect</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccExceptions</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccRTTI</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccStaticDestr</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccCppInlineSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IccCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IccFloatSemantics</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptimizationNoSizeConstraints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCOptStrategySlave</name>
+ <version>0</version>
+ <state>2</state>
+ </option>
+ <option>
+ <name>CCGuardCalls</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>AARM</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>9</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>AObjPrefix</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AEndian</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>ACaseSensitivity</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacroChars</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnWhat</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AWarnOne</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AWarnRange2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>ADebug</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AltRegisterNames</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ADefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AList</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AListHeader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AListing</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>Includes</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacDefs</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacExps</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacExec</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OnlyAssed</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MultiLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLengthCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>PageLength</name>
+ <state>80</state>
+ </option>
+ <option>
+ <name>TabSpacing</name>
+ <state>8</state>
+ </option>
+ <option>
+ <name>AXRef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDefines</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefInternal</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AXRefDual</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>AOutputFile</name>
+ <state>$FILE_BNAME$.o</state>
+ </option>
+ <option>
+ <name>AMultibyteSupport</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ALimitErrorsEdit</name>
+ <state>100</state>
+ </option>
+ <option>
+ <name>AIgnoreStdInclude</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AUserIncludes</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AExtraOptionsCheckV2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AExtraOptionsV2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>AsmNoLiteralPool</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>OBJCOPY</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>OOCOutputFile</name>
+ <state>rtthread.bin</state>
+ </option>
+ <option>
+ <name>OOCOutputFormat</name>
+ <version>3</version>
+ <state>3</state>
+ </option>
+ <option>
+ <name>OCOutputOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCCommandLineProducer</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OOCObjCopyEnable</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>CUSTOM</name>
+ <archiveVersion>3</archiveVersion>
+ <data>
+ <extensions></extensions>
+ <cmdline></cmdline>
+ <hasPrio>0</hasPrio>
+ </data>
+ </settings>
+ <settings>
+ <name>BICOMP</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ <settings>
+ <name>BUILDACTION</name>
+ <archiveVersion>1</archiveVersion>
+ <data>
+ <prebuild></prebuild>
+ <postbuild></postbuild>
+ </data>
+ </settings>
+ <settings>
+ <name>ILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>18</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IlinkOutputFile</name>
+ <state>rtthread.out</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile</name>
+ <state>$PROJ_DIR$\board\linker_scripts\link.icf</state>
+ </option>
+ <option>
+ <name>IlinkLibIOConfig</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>XLinkMisraHandler</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkInputFileSlave</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkDebugInfoEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkKeepSymbols</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySymbol</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinarySegment</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkRawBinaryAlign</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkConfigDefines</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkMapFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogFile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogInitialization</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogModule</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogSection</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogVeneer</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfOverride</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkIcfFileSlave</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkEnableRemarks</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkSuppressDiags</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsRem</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsWarn</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkTreatAsErr</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkWarningsAreErrors</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkUseExtraOptions</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkLowLevelInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAutoLibEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkAdditionalLibs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkOverrideProgramEntryLabel</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabelSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkProgramEntryLabel</name>
+ <state>__iar_program_start</state>
+ </option>
+ <option>
+ <name>DoFill</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>FillerByte</name>
+ <state>0xFF</state>
+ </option>
+ <option>
+ <name>FillerStart</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>FillerEnd</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>CrcSize</name>
+ <version>0</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcAlign</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcPoly</name>
+ <state>0x11021</state>
+ </option>
+ <option>
+ <name>CrcCompl</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcBitOrder</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CrcInitialValue</name>
+ <state>0x0</state>
+ </option>
+ <option>
+ <name>DoCrc</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkBE8Slave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkBufferedTerminalOutput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkStdoutInterfaceSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcFullSize</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIElfToolPostProcess</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogAutoLibSelect</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogRedirSymbols</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkLogUnusedFragments</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcReverseByteOrder</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCrcUseAsInput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptInline</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsAllow</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptExceptionsForce</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkCmsis</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptMergeDuplSections</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkOptUseVfe</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkOptForceVfe</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackAnalysisEnable</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkStackControlFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IlinkStackCallGraphFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CrcAlgorithm</name>
+ <version>1</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CrcUnitSize</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkThreadsSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>IlinkLogCallGraph</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IlinkIcfFile_AltDefault</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>IARCHIVE</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>0</debug>
+ <option>
+ <name>IarchiveInputs</name>
+ <state></state>
+ </option>
+ <option>
+ <name>IarchiveOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>IarchiveOutput</name>
+ <state>###Unitialized###</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>BILINK</name>
+ <archiveVersion>0</archiveVersion>
+ <data/>
+ </settings>
+ </configuration>
+</project>
+
+
diff --git a/bsp/hc32l136/template.eww b/bsp/hc32l136/template.eww
new file mode 100644
index 0000000000..bd036bb4c9
--- /dev/null
+++ b/bsp/hc32l136/template.eww
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<workspace>
+ <project>
+ <path>$WS_DIR$\template.ewp</path>
+ </project>
+ <batchBuild/>
+</workspace>
+
+
diff --git a/bsp/hc32l136/template.uvoptx b/bsp/hc32l136/template.uvoptx
new file mode 100644
index 0000000000..53cd00988b
--- /dev/null
+++ b/bsp/hc32l136/template.uvoptx
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
+
+ <SchemaVersion>1.0</SchemaVersion>
+
+ <Header>### uVision Project, (C) Keil Software</Header>
+
+ <Extensions>
+ <cExt>*.c</cExt>
+ <aExt>*.s*; *.src; *.a*</aExt>
+ <oExt>*.obj; *.o</oExt>
+ <lExt>*.lib</lExt>
+ <tExt>*.txt; *.h; *.inc; *.md</tExt>
+ <pExt>*.plm</pExt>
+ <CppX>*.cpp</CppX>
+ <nMigrate>0</nMigrate>
+ </Extensions>
+
+ <DaveTm>
+ <dwLowDateTime>0</dwLowDateTime>
+ <dwHighDateTime>0</dwHighDateTime>
+ </DaveTm>
+
+ <Target>
+ <TargetName>rt-thread</TargetName>
+ <ToolsetNumber>0x4</ToolsetNumber>
+ <ToolsetName>ARM-ADS</ToolsetName>
+ <TargetOption>
+ <CLKADS>12000000</CLKADS>
+ <OPTTT>
+ <gFlags>1</gFlags>
+ <BeepAtEnd>1</BeepAtEnd>
+ <RunSim>0</RunSim>
+ <RunTarget>1</RunTarget>
+ <RunAbUc>0</RunAbUc>
+ </OPTTT>
+ <OPTHX>
+ <HexSelection>1</HexSelection>
+ <FlashByte>65535</FlashByte>
+ <HexRangeLowAddress>0</HexRangeLowAddress>
+ <HexRangeHighAddress>0</HexRangeHighAddress>
+ <HexOffset>0</HexOffset>
+ </OPTHX>
+ <OPTLEX>
+ <PageWidth>79</PageWidth>
+ <PageLength>66</PageLength>
+ <TabStop>8</TabStop>
+ <ListingPath>.\build\</ListingPath>
+ </OPTLEX>
+ <ListingPage>
+ <CreateCListing>1</CreateCListing>
+ <CreateAListing>1</CreateAListing>
+ <CreateLListing>1</CreateLListing>
+ <CreateIListing>0</CreateIListing>
+ <AsmCond>1</AsmCond>
+ <AsmSymb>1</AsmSymb>
+ <AsmXref>0</AsmXref>
+ <CCond>1</CCond>
+ <CCode>0</CCode>
+ <CListInc>0</CListInc>
+ <CSymb>0</CSymb>
+ <LinkerCodeListing>0</LinkerCodeListing>
+ </ListingPage>
+ <OPTXL>
+ <LMap>1</LMap>
+ <LComments>1</LComments>
+ <LGenerateSymbols>1</LGenerateSymbols>
+ <LLibSym>1</LLibSym>
+ <LLines>1</LLines>
+ <LLocSym>1</LLocSym>
+ <LPubSym>1</LPubSym>
+ <LXref>0</LXref>
+ <LExpSel>0</LExpSel>
+ </OPTXL>
+ <OPTFL>
+ <tvExp>0</tvExp>
+ <tvExpOptDlg>0</tvExpOptDlg>
+ <IsCurrentTarget>1</IsCurrentTarget>
+ </OPTFL>
+ <CpuCode>255</CpuCode>
+ <DebugOpt>
+ <uSim>0</uSim>
+ <uTrg>1</uTrg>
+ <sLdApp>1</sLdApp>
+ <sGomain>1</sGomain>
+ <sRbreak>1</sRbreak>
+ <sRwatch>1</sRwatch>
+ <sRmem>1</sRmem>
+ <sRfunc>1</sRfunc>
+ <sRbox>1</sRbox>
+ <tLdApp>1</tLdApp>
+ <tGomain>1</tGomain>
+ <tRbreak>1</tRbreak>
+ <tRwatch>1</tRwatch>
+ <tRmem>1</tRmem>
+ <tRfunc>0</tRfunc>
+ <tRbox>1</tRbox>
+ <tRtrace>1</tRtrace>
+ <sRSysVw>1</sRSysVw>
+ <tRSysVw>1</tRSysVw>
+ <sRunDeb>0</sRunDeb>
+ <sLrtime>0</sLrtime>
+ <bEvRecOn>1</bEvRecOn>
+ <bSchkAxf>0</bSchkAxf>
+ <bTchkAxf>0</bTchkAxf>
+ <nTsel>4</nTsel>
+ <sDll></sDll>
+ <sDllPa></sDllPa>
+ <sDlgDll></sDlgDll>
+ <sDlgPa></sDlgPa>
+ <sIfile></sIfile>
+ <tDll></tDll>
+ <tDllPa></tDllPa>
+ <tDlgDll></tDlgDll>
+ <tDlgPa></tDlgPa>
+ <tIfile></tIfile>
+ <pMon>Segger\JL2CM3.dll</pMon>
+ </DebugOpt>
+ <TargetDriverDllRegistry>
+ <SetRegEntry>
+ <Number>0</Number>
+ <Key>UL2CM3</Key>
+ <Name>-U -O206 -S0 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0FlashHC32L136_64K.FLM -FS00 -FL010000 -FP0($$Device:HC32L136K8TA$Flash\FlashHC32L136_64K.FLM)</Name>
+ </SetRegEntry>
+ <SetRegEntry>
+ <Number>0</Number>
+ <Key>JL2CM3</Key>
+ <Name>-U4294967295 -O78 -S4 -ZTIFSpeedSel2000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC2000 -FN0</Name>
+ </SetRegEntry>
+ </TargetDriverDllRegistry>
+ <Breakpoint/>
+ <Tracepoint>
+ <THDelay>0</THDelay>
+ </Tracepoint>
+ <DebugFlag>
+ <trace>0</trace>
+ <periodic>0</periodic>
+ <aLwin>0</aLwin>
+ <aCover>0</aCover>
+ <aSer1>0</aSer1>
+ <aSer2>0</aSer2>
+ <aPa>0</aPa>
+ <viewmode>0</viewmode>
+ <vrSel>0</vrSel>
+ <aSym>0</aSym>
+ <aTbox>0</aTbox>
+ <AscS1>0</AscS1>
+ <AscS2>0</AscS2>
+ <AscS3>0</AscS3>
+ <aSer3>0</aSer3>
+ <eProf>0</eProf>
+ <aLa>0</aLa>
+ <aPa1>0</aPa1>
+ <AscS4>0</AscS4>
+ <aSer4>0</aSer4>
+ <StkLoc>0</StkLoc>
+ <TrcWin>0</TrcWin>
+ <newCpu>0</newCpu>
+ <uProt>0</uProt>
+ </DebugFlag>
+ <LintExecutable></LintExecutable>
+ <LintConfigFile></LintConfigFile>
+ <bLintAuto>0</bLintAuto>
+ <bAutoGenD>0</bAutoGenD>
+ <LntExFlags>0</LntExFlags>
+ <pMisraName></pMisraName>
+ <pszMrule></pszMrule>
+ <pSingCmds></pSingCmds>
+ <pMultCmds></pMultCmds>
+ <pMisraNamep></pMisraNamep>
+ <pszMrulep></pszMrulep>
+ <pSingCmdsp></pSingCmdsp>
+ <pMultCmdsp></pMultCmdsp>
+ <DebugDescription>
+ <Enable>1</Enable>
+ <EnableFlashSeq>0</EnableFlashSeq>
+ <EnableLog>0</EnableLog>
+ <Protocol>2</Protocol>
+ <DbgClock>1000000</DbgClock>
+ </DebugDescription>
+ </TargetOption>
+ </Target>
+
+</ProjectOpt>
diff --git a/bsp/hc32l136/template.uvprojx b/bsp/hc32l136/template.uvprojx
new file mode 100644
index 0000000000..c40f7d0bf7
--- /dev/null
+++ b/bsp/hc32l136/template.uvprojx
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
+
+ <SchemaVersion>2.1</SchemaVersion>
+
+ <Header>### uVision Project, (C) Keil Software</Header>
+
+ <Targets>
+ <Target>
+ <TargetName>rt-thread</TargetName>
+ <ToolsetNumber>0x4</ToolsetNumber>
+ <ToolsetName>ARM-ADS</ToolsetName>
+ <pCCUsed>5060020::V5.06 (build 20)::ARMCC</pCCUsed>
+ <uAC6>0</uAC6>
+ <TargetOption>
+ <TargetCommonOption>
+ <Device>HC32L136K8TA</Device>
+ <Vendor>HDSC</Vendor>
+ <PackID>HDSC.HC32L136.1.0.0</PackID>
+ <PackURL>https://raw.githubusercontent.com/hdscmcu/pack/master/</PackURL>
+ <Cpu>IRAM(0x20000000,0x2000) IROM(0x00000000,0x10000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE</Cpu>
+ <FlashUtilSpec></FlashUtilSpec>
+ <StartupFile></StartupFile>
+ <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0FlashHC32L136_64K -FS00 -FL010000 -FP0($$Device:HC32L136K8TA$Flash\FlashHC32L136_64K.FLM))</FlashDriverDll>
+ <DeviceId>0</DeviceId>
+ <RegisterFile>$$Device:HC32L136K8TA$Device\Include\HC32L136K8TA.h</RegisterFile>
+ <MemoryEnv></MemoryEnv>
+ <Cmp></Cmp>
+ <Asm></Asm>
+ <Linker></Linker>
+ <OHString></OHString>
+ <InfinionOptionDll></InfinionOptionDll>
+ <SLE66CMisc></SLE66CMisc>
+ <SLE66AMisc></SLE66AMisc>
+ <SLE66LinkerMisc></SLE66LinkerMisc>
+ <SFDFile>$$Device:HC32L136K8TA$SVD\HC32L136K8TA.sfr</SFDFile>
+ <bCustSvd>1</bCustSvd>
+ <UseEnv>0</UseEnv>
+ <BinPath></BinPath>
+ <IncludePath></IncludePath>
+ <LibPath></LibPath>
+ <RegisterFilePath></RegisterFilePath>
+ <DBRegisterFilePath></DBRegisterFilePath>
+ <TargetStatus>
+ <Error>0</Error>
+ <ExitCodeStop>0</ExitCodeStop>
+ <ButtonStop>0</ButtonStop>
+ <NotGenerated>0</NotGenerated>
+ <InvalidFlash>1</InvalidFlash>
+ </TargetStatus>
+ <OutputDirectory>.\build\keil\Obj\</OutputDirectory>
+ <OutputName>rtthread</OutputName>
+ <CreateExecutable>1</CreateExecutable>
+ <CreateLib>0</CreateLib>
+ <CreateHexFile>0</CreateHexFile>
+ <DebugInformation>1</DebugInformation>
+ <BrowseInformation>0</BrowseInformation>
+ <ListingPath>.\build\</ListingPath>
+ <HexFormatSelection>1</HexFormatSelection>
+ <Merge32K>0</Merge32K>
+ <CreateBatchFile>0</CreateBatchFile>
+ <BeforeCompile>
+ <RunUserProg1>0</RunUserProg1>
+ <RunUserProg2>0</RunUserProg2>
+ <UserProg1Name></UserProg1Name>
+ <UserProg2Name></UserProg2Name>
+ <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+ <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+ <nStopU1X>0</nStopU1X>
+ <nStopU2X>0</nStopU2X>
+ </BeforeCompile>
+ <BeforeMake>
+ <RunUserProg1>0</RunUserProg1>
+ <RunUserProg2>0</RunUserProg2>
+ <UserProg1Name></UserProg1Name>
+ <UserProg2Name></UserProg2Name>
+ <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+ <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+ <nStopB1X>0</nStopB1X>
+ <nStopB2X>0</nStopB2X>
+ </BeforeMake>
+ <AfterMake>
+ <RunUserProg1>1</RunUserProg1>
+ <RunUserProg2>0</RunUserProg2>
+ <UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
+ <UserProg2Name></UserProg2Name>
+ <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+ <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+ <nStopA1X>0</nStopA1X>
+ <nStopA2X>0</nStopA2X>
+ </AfterMake>
+ <SelectedForBatchBuild>0</SelectedForBatchBuild>
+ <SVCSIdString></SVCSIdString>
+ </TargetCommonOption>
+ <CommonProperty>
+ <UseCPPCompiler>0</UseCPPCompiler>
+ <RVCTCodeConst>0</RVCTCodeConst>
+ <RVCTZI>0</RVCTZI>
+ <RVCTOtherData>0</RVCTOtherData>
+ <ModuleSelection>0</ModuleSelection>
+ <IncludeInBuild>1</IncludeInBuild>
+ <AlwaysBuild>0</AlwaysBuild>
+ <GenerateAssemblyFile>0</GenerateAssemblyFile>
+ <AssembleAssemblyFile>0</AssembleAssemblyFile>
+ <PublicsOnly>0</PublicsOnly>
+ <StopOnExitCode>3</StopOnExitCode>
+ <CustomArgument></CustomArgument>
+ <IncludeLibraryModules></IncludeLibraryModules>
+ <ComprImg>1</ComprImg>
+ </CommonProperty>
+ <DllOption>
+ <SimDllName>SARMCM3.DLL</SimDllName>
+ <SimDllArguments> </SimDllArguments>
+ <SimDlgDll>DARMCM1.DLL</SimDlgDll>
+ <SimDlgDllArguments>-pCM0+</SimDlgDllArguments>
+ <TargetDllName>SARMCM3.DLL</TargetDllName>
+ <TargetDllArguments> </TargetDllArguments>
+ <TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
+ <TargetDlgDllArguments>-pCM0+</TargetDlgDllArguments>
+ </DllOption>
+ <DebugOption>
+ <OPTHX>
+ <HexSelection>1</HexSelection>
+ <HexRangeLowAddress>0</HexRangeLowAddress>
+ <HexRangeHighAddress>0</HexRangeHighAddress>
+ <HexOffset>0</HexOffset>
+ <Oh166RecLen>16</Oh166RecLen>
+ </OPTHX>
+ </DebugOption>
+ <Utilities>
+ <Flash1>
+ <UseTargetDll>1</UseTargetDll>
+ <UseExternalTool>0</UseExternalTool>
+ <RunIndependent>0</RunIndependent>
+ <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
+ <Capability>1</Capability>
+ <DriverSelection>4096</DriverSelection>
+ </Flash1>
+ <bUseTDR>1</bUseTDR>
+ <Flash2>BIN\UL2CM3.DLL</Flash2>
+ <Flash3>"" ()</Flash3>
+ <Flash4></Flash4>
+ <pFcarmOut></pFcarmOut>
+ <pFcarmGrp></pFcarmGrp>
+ <pFcArmRoot></pFcArmRoot>
+ <FcArmLst>0</FcArmLst>
+ </Utilities>
+ <TargetArmAds>
+ <ArmAdsMisc>
+ <GenerateListings>0</GenerateListings>
+ <asHll>1</asHll>
+ <asAsm>1</asAsm>
+ <asMacX>1</asMacX>
+ <asSyms>1</asSyms>
+ <asFals>1</asFals>
+ <asDbgD>1</asDbgD>
+ <asForm>1</asForm>
+ <ldLst>0</ldLst>
+ <ldmm>1</ldmm>
+ <ldXref>1</ldXref>
+ <BigEnd>0</BigEnd>
+ <AdsALst>1</AdsALst>
+ <AdsACrf>1</AdsACrf>
+ <AdsANop>0</AdsANop>
+ <AdsANot>0</AdsANot>
+ <AdsLLst>1</AdsLLst>
+ <AdsLmap>1</AdsLmap>
+ <AdsLcgr>1</AdsLcgr>
+ <AdsLsym>1</AdsLsym>
+ <AdsLszi>1</AdsLszi>
+ <AdsLtoi>1</AdsLtoi>
+ <AdsLsun>1</AdsLsun>
+ <AdsLven>1</AdsLven>
+ <AdsLsxf>1</AdsLsxf>
+ <RvctClst>0</RvctClst>
+ <GenPPlst>0</GenPPlst>
+ <AdsCpuType>"Cortex-M0+"</AdsCpuType>
+ <RvctDeviceName></RvctDeviceName>
+ <mOS>0</mOS>
+ <uocRom>0</uocRom>
+ <uocRam>0</uocRam>
+ <hadIROM>1</hadIROM>
+ <hadIRAM>1</hadIRAM>
+ <hadXRAM>0</hadXRAM>
+ <uocXRam>0</uocXRam>
+ <RvdsVP>0</RvdsVP>
+ <RvdsMve>0</RvdsMve>
+ <RvdsCdeCp>0</RvdsCdeCp>
+ <hadIRAM2>0</hadIRAM2>
+ <hadIROM2>0</hadIROM2>
+ <StupSel>8</StupSel>
+ <useUlib>0</useUlib>
+ <EndSel>0</EndSel>
+ <uLtcg>0</uLtcg>
+ <nSecure>0</nSecure>
+ <RoSelD>3</RoSelD>
+ <RwSelD>3</RwSelD>
+ <CodeSel>0</CodeSel>
+ <OptFeed>0</OptFeed>
+ <NoZi1>0</NoZi1>
+ <NoZi2>0</NoZi2>
+ <NoZi3>0</NoZi3>
+ <NoZi4>0</NoZi4>
+ <NoZi5>0</NoZi5>
+ <Ro1Chk>0</Ro1Chk>
+ <Ro2Chk>0</Ro2Chk>
+ <Ro3Chk>0</Ro3Chk>
+ <Ir1Chk>1</Ir1Chk>
+ <Ir2Chk>0</Ir2Chk>
+ <Ra1Chk>0</Ra1Chk>
+ <Ra2Chk>0</Ra2Chk>
+ <Ra3Chk>0</Ra3Chk>
+ <Im1Chk>1</Im1Chk>
+ <Im2Chk>0</Im2Chk>
+ <OnChipMemories>
+ <Ocm1>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm1>
+ <Ocm2>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm2>
+ <Ocm3>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm3>
+ <Ocm4>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm4>
+ <Ocm5>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm5>
+ <Ocm6>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </Ocm6>
+ <IRAM>
+ <Type>0</Type>
+ <StartAddress>0x20000000</StartAddress>
+ <Size>0x2000</Size>
+ </IRAM>
+ <IROM>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x10000</Size>
+ </IROM>
+ <XRAM>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </XRAM>
+ <OCR_RVCT1>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT1>
+ <OCR_RVCT2>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT2>
+ <OCR_RVCT3>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT3>
+ <OCR_RVCT4>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x10000</Size>
+ </OCR_RVCT4>
+ <OCR_RVCT5>
+ <Type>1</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT5>
+ <OCR_RVCT6>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT6>
+ <OCR_RVCT7>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT7>
+ <OCR_RVCT8>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT8>
+ <OCR_RVCT9>
+ <Type>0</Type>
+ <StartAddress>0x20000000</StartAddress>
+ <Size>0x2000</Size>
+ </OCR_RVCT9>
+ <OCR_RVCT10>
+ <Type>0</Type>
+ <StartAddress>0x0</StartAddress>
+ <Size>0x0</Size>
+ </OCR_RVCT10>
+ </OnChipMemories>
+ <RvctStartVector></RvctStartVector>
+ </ArmAdsMisc>
+ <Cads>
+ <interw>1</interw>
+ <Optim>1</Optim>
+ <oTime>0</oTime>
+ <SplitLS>0</SplitLS>
+ <OneElfS>1</OneElfS>
+ <Strict>0</Strict>
+ <EnumInt>0</EnumInt>
+ <PlainCh>0</PlainCh>
+ <Ropi>0</Ropi>
+ <Rwpi>0</Rwpi>
+ <wLevel>0</wLevel>
+ <uThumb>0</uThumb>
+ <uSurpInc>0</uSurpInc>
+ <uC99>1</uC99>
+ <uGnu>0</uGnu>
+ <useXO>0</useXO>
+ <v6Lang>0</v6Lang>
+ <v6LangP>0</v6LangP>
+ <vShortEn>0</vShortEn>
+ <vShortWch>0</vShortWch>
+ <v6Lto>0</v6Lto>
+ <v6WtE>0</v6WtE>
+ <v6Rtti>0</v6Rtti>
+ <VariousControls>
+ <MiscControls>--diag_suppress=186,66</MiscControls>
+ <Define>__DEBUG,HC32F4A0,USE_DDL_DRIVER</Define>
+ <Undefine></Undefine>
+ <IncludePath></IncludePath>
+ </VariousControls>
+ </Cads>
+ <Aads>
+ <interw>1</interw>
+ <Ropi>0</Ropi>
+ <Rwpi>0</Rwpi>
+ <thumb>0</thumb>
+ <SplitLS>0</SplitLS>
+ <SwStkChk>0</SwStkChk>
+ <NoWarn>0</NoWarn>
+ <uSurpInc>0</uSurpInc>
+ <useXO>0</useXO>
+ <ClangAsOpt>1</ClangAsOpt>
+ <VariousControls>
+ <MiscControls></MiscControls>
+ <Define></Define>
+ <Undefine></Undefine>
+ <IncludePath></IncludePath>
+ </VariousControls>
+ </Aads>
+ <LDads>
+ <umfTarg>1</umfTarg>
+ <Ropi>0</Ropi>
+ <Rwpi>0</Rwpi>
+ <noStLib>0</noStLib>
+ <RepFail>1</RepFail>
+ <useFile>0</useFile>
+ <TextAddressRange>0x00000000</TextAddressRange>
+ <DataAddressRange>0x20000000</DataAddressRange>
+ <pXoBase></pXoBase>
+ <ScatterFile>.\board\linker_scripts\link.sct</ScatterFile>
+ <IncludeLibs></IncludeLibs>
+ <IncludeLibsPath></IncludeLibsPath>
+ <Misc>--keep=*Handler</Misc>
+ <LinkerInputFile></LinkerInputFile>
+ <DisabledWarnings></DisabledWarnings>
+ </LDads>
+ </TargetArmAds>
+ </TargetOption>
+ </Target>
+ </Targets>
+
+ <RTE>
+ <apis/>
+ <components/>
+ <files/>
+ </RTE>
+
+</Project>